Package org.racsor.jmeter.flex.messaging.util

Examples of org.racsor.jmeter.flex.messaging.util.UtilsFlexMessage


  //Get Response 
  InputStream is = connection.getInputStream();
//  FileUtils.writeByteArrayToFile(new File("\\responseFairview.binary"), IOUtils.toByteArray(is));

  UtilsFlexMessage utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(is);

  //Get pickupItem
  String content = utilsFlex.messageToXML();
  System.out.println(content);
  String pickupItem = "pickup_item:" + StringUtils.substringBetween(content, "<string>pickup_item:", "</string>");
  System.out.println(pickupItem);
  String oldPickupItem = "pickup_item:276698290864898721:917:dn34ppe0ireh";

  //Get template pickupItemMoney and update with new item get above
  theFile = FileUtils.readFileToByteArray(docSerializeMoney);
  ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
  DataInputStream din = new DataInputStream(bais);
  utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(din);
  String update = utilsFlex.updateFlexMessage(oldPickupItem, pickupItem);
  byte[] newdataPickupItem = utilsFlex.serializeMessage(update);

  //new Connection to pickup Money
  connection = (HttpURLConnection) url.openConnection();
  connection.setRequestMethod("POST");
  connection.setRequestProperty("Connection", "keep-alive");
  connection.setRequestProperty("Content-Type", contentType);
  //      connection.setRequestProperty("Content-Length", "" + xurro.length);

  //      connection.setUseCaches(false);
  connection.setDoInput(true);
  connection.setDoOutput(true);

  //Send request
  wr = new DataOutputStream(connection.getOutputStream());
  wr.write(newdataPickupItem);
  wr.flush();
  wr.close();

  System.out.println("responsecode:" + connection.getResponseCode());

  //Get template pickupItemCollection and update with new item get above
  int temp = StringUtils.indexOf(content, "<string>collection_loot_item_id</string>\n                  <null/>");
  System.out.println(temp);
  if (temp != -1) {
      theFile = FileUtils.readFileToByteArray(docSerializeCollection);
      bais = new ByteArrayInputStream(theFile);
      din = new DataInputStream(bais);
      utilsFlex = new UtilsFlexMessage();
      utilsFlex.parseInputStream(din);
      update = utilsFlex.updateFlexMessage(oldPickupItem, pickupItem);
      newdataPickupItem = utilsFlex.serializeMessage(update);
      //new Connection to pickup ItemCollection
      connection = (HttpURLConnection) url.openConnection();
      connection.setRequestMethod("POST");
      connection.setRequestProperty("Connection", "keep-alive");
      connection.setRequestProperty("Content-Type", contentType);
View Full Code Here


  //Get Response 
  InputStream is = connection.getInputStream();
  //  FileUtils.writeByteArrayToFile(new File("\\responseFairview.binary"), IOUtils.toByteArray( is ));

  UtilsFlexMessage deserializer = new UtilsFlexMessage();
  deserializer.parseInputStream(is);

  //  BufferedReader rd = new BufferedReader(new InputStreamReader(is));
  //  String line;
  //  StringBuffer response = new StringBuffer();
  //  while ((line = rd.readLine()) != null) {
View Full Code Here

  //    .getResource("serialize/collectHouse1_24h.binary").getFile());
  File doc = new File("\\responseFairview.binary");
  byte[] theFile = FileUtils.readFileToByteArray(doc);
  ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
  DataInputStream din = new DataInputStream(bais);
  UtilsFlexMessage utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(din);
  String content=utilsFlex.messageToXML();
  System.out.println(content);
  String pickupItem="pickup_item:"+StringUtils.substringBetween(content, "<string>pickup_item:", "</string>");
  System.out.println(pickupItem);
  String temp=""+StringUtils.indexOf(content, "<string>collection_loot_item_id</string>\n                  <null/>");
  System.out.println(temp);
 
  String oldPickupItem="pickup_item:276698290864898721:917:rflinzqcft68";
 
  doc = new File("C:\\TIC_LOCAL\\EclipseProjects\\OpenSourceRacsor\\cc_request\\jmeter\\pickupItemMoney.binary");
  theFile = FileUtils.readFileToByteArray(doc);
  bais = new ByteArrayInputStream(theFile);
  din = new DataInputStream(bais);
  utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(din);
  String update=utilsFlex.updateFlexMessage(oldPickupItem, pickupItem);
  utilsFlex.serializeMessage("\\serialize.binary",update);
 
  DataInputStream dini = new DataInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(new File("\\serialize.binary"))));
  utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(dini);
 
 
 
 
//  String content=utilsFlex.updateFlexMessage("arhacea4c4", "6xgekrsjv6");
View Full Code Here

  //    .getResource("serialize/collectHouse1_24h.binary").getFile());
  // File doc = new File(Thread.currentThread().getContextClassLoader().getResource("POST43415.binary").getFile());
  byte[] theFile = FileUtils.readFileToByteArray(doc);
  ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
  DataInputStream din = new DataInputStream(bais);
  UtilsFlexMessage utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(din);
  String content=utilsFlex.updateFlexMessage("arhacea4c4", "6xgekrsjv6");
  utilsFlex.serializeMessage("\\serialize.binary",content);
 
  DataInputStream dini = new DataInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(new File("\\serialize.binary"))));
  utilsFlex = new UtilsFlexMessage();
  utilsFlex.parseInputStream(dini);
    }
View Full Code Here

      System.out.println(filename);

      byte[] theFile = FileUtils.readFileToByteArray(new File(filename));
      ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
      DataInputStream din = new DataInputStream(bais);
      UtilsFlexMessage utilsFlex = new UtilsFlexMessage();
      utilsFlex.parseInputStream(din);
      String content=utilsFlex.updateFlexMessage("2288iduzo6", "65cbmmj34v");
      utilsFlex.serializeMessage(filename,content);
  }

    }
View Full Code Here

TOP

Related Classes of org.racsor.jmeter.flex.messaging.util.UtilsFlexMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.