Index: tests/axis2_app/src/LabStatServiceSkeleton.java =================================================================== --- tests/axis2_app/src/LabStatServiceSkeleton.java (revision 0) +++ tests/axis2_app/src/LabStatServiceSkeleton.java (revision 0) @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * LabStatServiceSkeleton.java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: 1.1.1 Jan 09, 2007 (06:20:51 LKT) + */ + +package org.apache.harmony.test.lab_stat_app; + +import org.apache.harmony.test.lab_stat_app.xsd.ServerStat; +import org.apache.harmony.test.lab_stat_app.xsd.StatResponse; +import org.apache.harmony.test.lab_stat_app.xsd.StatId; +import org.apache.harmony.test.lab_stat_app.xsd.StatData; +import org.apache.harmony.test.lab_stat_app.xsd.StatItem; + +import java.util.Date; +import java.util.HashMap; +import java.util.TreeMap; + +/** + * LabStatServiceSkeleton java skeleton for the axisService + */ +public class LabStatServiceSkeleton implements LabStatServiceSkeletonInterface{ + + private TreeMap storageServers = new TreeMap(); + private TreeMap storageDates = new TreeMap(); + + void put(TreeMap storage, Object prim_key, Object sec_key, Object data) { + HashMap hm = (HashMap)storage.get(prim_key); + boolean newHM = hm == null; + if (newHM) + hm = new HashMap(); + hm.put(sec_key, data); + + if (newHM) + storage.put(prim_key, hm); + } + + public void update (ServerStat stat) { + String server = stat.getServer_name(); + StatItem[] si_list = stat.getStatItem(); + //Date curDate = Date(); + + for(int i=0; i0)||(args.length>4)) + { + printUsage(); + return; + } + + Map optionsMap = optionsParser.getAllOptions(); + + CommandLineOption repoOption = (CommandLineOption) optionsMap + .get("repo"); + CommandLineOption confOption = (CommandLineOption) optionsMap + .get("conf"); + + log.info("[SimpleAxisServer] Starting"); + if (repoOption != null) { + repoLocation = repoOption.getOptionValue(); + log.info("[SimpleAxisServer] Using the Axis2 Repository" + + new File(repoLocation).getAbsolutePath()); + } + if (confOption != null) { + confLocation = confOption.getOptionValue(); + System.out + .println("[SimpleAxisServer] Using the Axis2 Configuration File" + + new File(confLocation).getAbsolutePath()); + } + + ListenerManager listenerManager = null; + try { + ConfigurationContext configctx = ConfigurationContextFactory + .createConfigurationContextFromFileSystem(repoLocation, + confLocation); + listenerManager = new ListenerManager(); + listenerManager.init(configctx); + listenerManager.start(); + Thread.sleep(2000); + } catch (Throwable t) { + log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t); + System.exit(10); + } + log.info("[SimpleAxisServer] Started"); + + boolean run = true; + while (run) { + Thread.sleep(2000); + //final String sep = File.separator; confLocation +sep+ ".." +sep+ + File stop = new File("stopServer"); + if (stop.exists()) { + log.info("[SimpleAxisServer] Shutting down..."); + listenerManager.stop(); + run = false; + } + } + } + + public static void printUsage() { + System.out.println("Usage: SimpleAxisServer -repo -conf "); + System.out.println(); + System.exit(1); + } +} Index: tests/axis2_app/src/LabStatClient.java =================================================================== --- tests/axis2_app/src/LabStatClient.java (revision 0) +++ tests/axis2_app/src/LabStatClient.java (revision 0) @@ -0,0 +1,247 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.test.lab_stat_app; + +import java.util.Calendar; +import java.util.Date; + +public class LabStatClient extends LabStatServiceStub { + + final static int ERROR_CREATE = 31; + final static int ERROR_PREPARE = 41; + final static int ERROR_UPLOAD = 51; + final static int ERROR_GETSTAT = 61; + final static int ERROR_CHECK = 91; + + final static int MAX_SHIFT = 3; + final static int LAST_PDAY = 5; + + Calendar base_date = Calendar.getInstance(); + boolean verbose = false; + int step; // in the range 1..MAX_SHIFT +//-------------------------------------------------------------- + + public LabStatClient() throws org.apache.axis2.AxisFault { + super(); + } + + public static void main(String[] args) { + LabStatClient client = null; + try { + + client = new LabStatClient(); + + } catch(Exception e) { + e.printStackTrace(); + System.err.println("\n\n"); + System.exit(ERROR_CREATE); + } + + client.step = Integer.parseInt(args[0]); + if (System.getenv("AXIS2_APP_VERBOSE") != null) { + client.verbose = true; + } + + client.upLoad(1); + client.upLoad(2); + client.check(2); + + client.upLoad(MAX_SHIFT); + client.check(MAX_SHIFT); + } +//-------------------------------------------------------------- + + public Date genDate(int day) { + base_date.clear(); + base_date.set(2007, Calendar.MARCH, 10+day); + return base_date.getTime(); + } + + public int firstDay(int step, int shift) { + return (step-1)*5+shift; + } + + public String serverName(int step, int shift) { + return "nst-"+ (step*10 + shift); + } + + public String serverName(int shift) { + return serverName(step, shift); + } +//-------------------------------------------------------------- + + public void upLoad(int shift) { + ServerStat sst = new ServerStat(); + StatItem[] sia = new StatItem[6]; + + try { + for (int d=LAST_PDAY; d>=0; d--) { + StatData s_data = new StatData(); + int m = shift*10 + d; + + s_data.setCPU_load(m + step/100f); + s_data.setRAM_load(step + m/100f); + s_data.setActive_users(step*100 + m); + + StatItem s_item = new StatItem(); + s_item.setDate(genDate( firstDay(step, shift)+d )); + s_item.setStat(s_data); + + sia[d] = s_item; + } + + sst.setServer_name(serverName(shift)); + sst.setStatItem(sia); + } catch(Exception e) { + e.printStackTrace(); + System.err.println("\n\n"); + System.exit(ERROR_PREPARE); + } + + try { + update(sst); + //System.err.println("done"); + } catch(Exception e) { + e.printStackTrace(); + System.err.println("\n\n"); + System.exit(ERROR_UPLOAD); + } + } +//-------------------------------------------------------------- + + public void check(int shift) { + StatResponse resp = null; + StatId req = new StatId(); + int last_day = firstDay(step, shift)+LAST_PDAY; + + System.out.println("\n========= Check step "+ step +", shift "+ shift); + for (int day=1; day<=last_day; day++) { + VerboseLines v = new VerboseLines(); + int bound = MAX_SHIFT; + String sname = null; + + for (int s=1; s<=step; s++) { + if (s == step) + bound = shift; + for (int b=1; b<=bound; b++) { //==================== + try { + sname = serverName(s, b); + req.setDate(genDate(day)); + req.setServer_name(sname); + + resp = getStat(req); // call in synchro mode + + } catch(Exception e) { + e.printStackTrace(); + System.err.println("\n\n"); + System.exit(ERROR_GETSTAT); + } + try { + if (resp.getEmpty()) { + v.addEmpty(sname); + if (! isEmpty(s, b, day)) + throw new Exception("Got empty stat for "+ sname + + " on "+ genDate(day)); + } else { + StatData s_data = resp.getStatData(); + v.add(sname, s_data); + + checkNonEmpty(s_data, s, b, day); + } + } catch(Exception e) { + e.printStackTrace(); + System.err.println("\n\n"); + System.exit(ERROR_CHECK); + } + } // b<=bound ========================================== + } + v.print(day); + } + } +//-------------------------------------------------------------- + + public boolean isEmpty(int step, int shift, int day) { + int r_day = day - firstDay(step, shift); + return (r_day < 0) || (r_day > LAST_PDAY); + } + + public void checkNonEmpty(StatData s_data, int step, int shift, int day) + throws Exception { + if (isEmpty(step, shift, day)) + throw new Exception("Got non-empty stat for "+ serverName(step, shift) + + " on "+ genDate(day) + + "\n- "+ toString(s_data)); + + int m = shift*10 + (day - firstDay(step, shift)); + +// s_data.setCPU_load(m + step/100f); +// s_data.setRAM_load(step + m/100f); +// s_data.setActive_users(step*100 + m); + + String wrong = ""; + if (Math.abs(s_data.getCPU_load() - (m + step/100f)) > Float.MIN_VALUE*8) + wrong += "CPU"; + if (Math.abs(s_data.getRAM_load() - (step + m/100f)) > Float.MIN_VALUE*8) + wrong += " RAM"; + if ( s_data.getActive_users() != (step*100 + m) ) + wrong += " Users"; + if (wrong.length() > 0) + throw new Exception("Got wrong "+ wrong +" for "+ serverName(step, shift) + + " on "+ genDate(day) + + "\n- "+ toString(s_data)); + } + + public String toString(StatData s_data) { + return "CPU: "+ s_data.getCPU_load() + + " RAM: "+ s_data.getRAM_load() + + " Users: "+ s_data.getActive_users(); + } +//-------------------------------------------------------------- +//-------------------------------------------------------------- + + class VerboseLines { + String names = "Server"; + String CPU = "CPU"; + String RAM = "RAM"; + String users = "Users"; + + void addEmpty(String sname) { + names += "\t"+ sname; + CPU += "\t -"; + RAM += "\t -"; + users += "\t -"; + } + + void add(String sname, StatData s_data) { + names += "\t"+ sname; + CPU += "\t"+ s_data.getCPU_load(); + RAM += "\t"+ s_data.getRAM_load(); + users += "\t"+ s_data.getActive_users(); + } + + void print(int day) { + if (! verbose) + return; + System.out.println("===== Date "+ genDate(day)); + System.out.println(names); + System.out.println(CPU); + System.out.println(RAM); + System.out.println(users); + } + } +} Index: tests/axis2_app/resources/lab_stat.wsdl =================================================================== --- tests/axis2_app/resources/lab_stat.wsdl (revision 0) +++ tests/axis2_app/resources/lab_stat.wsdl (revision 0) @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: tests/axis2_app/resources/axis2server.R.bat =================================================================== --- tests/axis2_app/resources/axis2server.R.bat (revision 0) +++ tests/axis2_app/resources/axis2server.R.bat (revision 0) @@ -0,0 +1 @@ +@ "%AXIS2_HOME%\bin\axis2server.bat" >>%1 2>&1 Index: tests/axis2_app/resources/services.xml =================================================================== --- tests/axis2_app/resources/services.xml (revision 0) +++ tests/axis2_app/resources/services.xml (revision 0) @@ -0,0 +1,43 @@ + + + + + + + + + + + + +org.apache.harmony.test.lab_stat_app.LabStatServiceSkeleton + + +urn:update + + + +urn:getStat +http://harmony.apache.org/test/lab_stat_app/LabStatServicePortType/getStatResponse + + + + Index: tests/axis2_app/resources/axis2server.R.sh =================================================================== --- tests/axis2_app/resources/axis2server.R.sh (revision 0) +++ tests/axis2_app/resources/axis2server.R.sh (revision 0) @@ -0,0 +1,40 @@ +#!/bin/sh + +# Copyright 2001,2004-2006 The Apache Software Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ---------------------------------------------------------------------------- +# SimpleAxis2Server Script +# +# Environment Variable Prequisites +# +# AXIS2_HOME Home of Axis2 installation. If not set I will try +# to figure it out. +# +# JAVA_HOME Must point at your Java Development Kit installation. +# +# JAVA_OPTS (Optional) Java runtime options. +# +# ----------------------------------------------------------------------------- + +# Get the context and from that find the location of setenv.sh +. `dirname $0`/setenv.sh + +echo JAVA_HOME=$JAVA_HOME >>$1 +echo JAVA_OPTS=$JAVA_OPTS >>$1 +echo AXIS2_HOME=$AXIS2_HOME >>$1 + +$JAVA_HOME/bin/java $JAVA_OPTS -classpath $AXIS2_HOME:$AXIS2_CLASSPATH \ +org.apache.axis2.transport.SimpleAxis2Server \ +-repo $AXIS2_HOME/repository -conf $AXIS2_HOME/conf/axis2.xml >>$1 2>&1 Index: tests/axis2_app/build.xml =================================================================== --- tests/axis2_app/build.xml (revision 0) +++ tests/axis2_app/build.xml (revision 0) @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +============== Starting ${start.server.cmd} in the next test run ===== + + + + + +Run ${start.server.cmd} +Args: ${server.log} +in ${AXIS2_HOME} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ==== Server Java : ${axis.java.home} + + + + + ========================================================= +==== Client Java : ${client.java.home} + + + + + ========================================================= + + + + + + + + + + + + + + + + + + + + + + + + + Index: adaptors/axis2_app/parameters.xml =================================================================== --- adaptors/axis2_app/parameters.xml (revision 0) +++ adaptors/axis2_app/parameters.xml (revision 0) @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: adaptors/axis2_app/adaptor.xml =================================================================== --- adaptors/axis2_app/adaptor.xml (revision 0) +++ adaptors/axis2_app/adaptor.xml (revision 0) @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +