Bonjour je souhaite utiliser jmeter pour faire des test des charges. J'ai seulement deux classes java. Savez vous comment l'ajouter à mon plan de travail, c'est une assertion, une configuration?
voici le code des 2 classes
Citation :
public class testUpload { public static void main(String [] args){ String devis = "devis"; String nomFichier = "kldjklzejf" + "sdkfgdlmfjgomdfijgfd" + "gdfgikpdofigpodfigopidfg" + "gpdfgpofdkpgoidfpogifd" + "mdfgjkdpfoigoidfgoçuero"; byte[] buf =new byte[1024]; InputStream stream = new ByteArrayInputStream(nomFichier.getBytes()); try { FileHttp.put("http://pluton/recette/", stream, devis); } catch (IOException e) { throw new RuntimeException(e); }
} }
public class FileHttp { public final static String EXT_XML = ".xml"; public final static String EXT_PDF = ".pdf";
public static void put(String repDefaut, InputStream is, String nomFichier) throws IOException { URL url = new URL(repDefaut + nomFichier); HttpURLConnection connect =(HttpURLConnection)url.openConnection(); connect.setRequestMethod("PUT" ); connect.setDoOutput(true); connect.setRequestProperty("ContentType", "text/xml" );
OutputStream os = connect.getOutputStream(); byte[] buf =new byte[1024]; int c; while((c = is.read(buf)) > -1) os.write(buf, 0, c);
LogManager.getInstance().log("Connecting to " + url.toString(),LogManager.INFORMATION); connect.connect();
BufferedReader bis = new BufferedReader(new InputStreamReader(connect.getInputStream())); String line; while((line = bis.readLine()) !=null) LogManager.getInstance().log(line,LogManager.INFORMATION);
Marsh Posté le 15-06-2009 à 14:58:59
Bonjour je souhaite utiliser jmeter pour faire des test des charges.
J'ai seulement deux classes java. Savez vous comment l'ajouter à mon plan de travail, c'est une assertion, une configuration?
voici le code des 2 classes
public class testUpload
{
public static void main(String [] args){
String devis = "devis";
String nomFichier = "kldjklzejf" +
"sdkfgdlmfjgomdfijgfd" +
"gdfgikpdofigpodfigopidfg" +
"gpdfgpofdkpgoidfpogifd" +
"mdfgjkdpfoigoidfgoçuero";
byte[] buf =new byte[1024];
InputStream stream = new ByteArrayInputStream(nomFichier.getBytes());
try
{
FileHttp.put("http://pluton/recette/", stream, devis);
} catch (IOException e)
{
throw new RuntimeException(e);
}
}
}
public class FileHttp
{
public final static String EXT_XML = ".xml";
public final static String EXT_PDF = ".pdf";
public static void put(String repDefaut, InputStream is, String nomFichier) throws IOException {
URL url = new URL(repDefaut + nomFichier);
HttpURLConnection connect =(HttpURLConnection)url.openConnection();
connect.setRequestMethod("PUT" );
connect.setDoOutput(true);
connect.setRequestProperty("ContentType", "text/xml" );
OutputStream os = connect.getOutputStream();
byte[] buf =new byte[1024];
int c;
while((c = is.read(buf)) > -1)
os.write(buf, 0, c);
LogManager.getInstance().log("Connecting to " + url.toString(),LogManager.INFORMATION);
connect.connect();
BufferedReader bis = new BufferedReader(new InputStreamReader(connect.getInputStream()));
String line;
while((line = bis.readLine()) !=null)
LogManager.getInstance().log(line,LogManager.INFORMATION);
os.close();
bis.close();
connect.disconnect();
}
}