From 8c769bae2d6d71677ce71a299d618957029ab4ac Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Mon, 10 Apr 2006 08:46:26 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'Build_ID-1_3_1'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Build_ID-1_3_1@704 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss.test/src/testclient/LasttestClient.java | 389 --------------------------- 1 file changed, 389 deletions(-) delete mode 100644 spss.test/src/testclient/LasttestClient.java (limited to 'spss.test/src/testclient/LasttestClient.java') diff --git a/spss.test/src/testclient/LasttestClient.java b/spss.test/src/testclient/LasttestClient.java deleted file mode 100644 index 339b6609d..000000000 --- a/spss.test/src/testclient/LasttestClient.java +++ /dev/null @@ -1,389 +0,0 @@ -package testclient; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.RandomAccessFile; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.Date; - - -/** - * @author Sven - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class LasttestClient { - - - public int max_thread_count = 300; - public int thread_counter = 0; - public int error_count = 0; - public int turns = 0; - - public long max = 0; - public long min = Long.MAX_VALUE; - - public PrintStream Log = null; - - public boolean stop = false; - - private String readFile(String filename) throws Exception - { - RandomAccessFile raf = new RandomAccessFile(filename, "r"); - if (raf.length() > Integer.MAX_VALUE) - throw new IOException("file too big to fit in byte array."); - - byte[] result = new byte[(int) raf.length()]; - - raf.read(result); - - return new String(result); - - } - - - - public String buildRequest(String filename) throws Exception - { - String data = readFile(filename); - int index = data.indexOf(">"); - - String xml_head = data.substring(0,index+1); - data = data.substring(index+1); - //Log.println("Data2:\n"+data); - - data = - xml_head + - "\" "+ - "soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\"> "+ - " "+ - data + - ""+ - ""; - - if(data.indexOf("10.16.46.109")!=-1) - data = replaceString(data,"10.16.46.109","127.0.0.1"); - - System.out.println("Request:"+data); - - return data; - - } - - public String buildEndpoint(String request,String server) - { - String ep = null; - if(request.indexOf(""); - if(pos==-1) - { - return true; - } - else - { - return false; - } - } - - } - - private String replaceString( - String input, - String oldPart, - String newPart) - throws Exception { - String erg = null; - - //First Part - erg = input.substring(0, input.indexOf(oldPart)); - //Insert new Part - erg += newPart; - - //insert REST - erg - += input.substring( - input.indexOf(oldPart) + oldPart.length(), - input.length()); - - return erg; - } - - public static void main(String[] args) throws Exception - { - int sek = 0; - int turns = 0; - - if(args.length!=4) - { - System.out.println("Parameteranzahl falsch. Bitte verwenden Sie die Syntax "); - return; - } - - try { - sek = Integer.parseInt(args[2]); - if(args[3].equals("INF")) - { - turns = 0; - } - else - turns = Integer.parseInt(args[3]); - } - catch(NumberFormatException e) - { - System.out.println("Einer der Parameter (Requestanzahl oder Testanzahl) ist keine Zahl !"); - return; - } - - System.out.println("Starte Lastest mit folgenden Parametern ..."); - System.out.println("Requestdatei: "+args[0]); - System.out.println("ServerURL: "+args[1]); - System.out.println("Requests pro Sekunde: "+sek); - System.out.println("Durchläufe: "+(turns==0?"INF":turns+"")); - - - LasttestClient lc = new LasttestClient(); - //lc.startTest("data/CX0/TestGeneratorCX0.001.Req.xml","http://161.106.2.255:8080/",10,1000); - lc.startTest(args[0],args[1],sek,turns); - } -} - -class Dispatcher extends Thread -{ - private String request = null; - private String endpoint = null; - private LasttestClient parent = null; - private int max; - private int turns; - public Dispatcher(LasttestClient parent,String request,String endpoint,int max,int turns) - { - this.request = request; - this.endpoint = endpoint; - this.parent = parent; - this.max = max; - this.turns = turns; - } - - public void run() - { - this.setPriority(Thread.NORM_PRIORITY+1); - System.out.println("Dispatcher wird gestartet..."); - TestThread[] old_reqs = buildRequests(); - for(int turn_counter=0;turns==0?true:(turn_counter"); - if(pos==-1) - { - long diff = end-start; - if(parent.maxdiff) - { - parent.min=diff; - } - return true; - - } - else - { - return false; - } - } - - } - -} \ No newline at end of file -- cgit v1.2.3