Package org.racsor.jmeter.flex.messaging.io.amf

Examples of org.racsor.jmeter.flex.messaging.io.amf.AmfTrace


    /**
     * Test creating an AMF message and then sending it through an AMFEndpoint
     */
    public void testDeserializeMessage() {
  AmfTrace trace = new AmfTrace();
  try {

      /**
       * GENERATE SAMPLE AMF REQUEST FROM DATA FILE
       */

//      File doc = new File(Thread.currentThread().getContextClassLoader().getResource("serialize/collectArcade_1h.binary").getFile());
//      File doc = new File(Thread.currentThread().getContextClassLoader().getResource("serialize/depositBank10000.binary").getFile());
      File doc = new File("C:\\TIC_LOCAL\\EclipseProjects\\OpenSourceRacsor\\cc_request\\jmeter\\bosses_attack.binary");
      byte[] theFile = FileUtils.readFileToByteArray(doc);
      ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
      DataInputStream din = new DataInputStream(bais);

      /**
       * CREATE A DESERIALIZER FOR SAMPLE AMF REQUEST
       */
      ActionMessage message = new ActionMessage();
      trace.startRequest("----------Deserializing AMF/HTTP request-----");

      AmfMessageDeserializer deserializer = new AmfMessageDeserializer();
      deserializer.initialize(din, trace);

      /**
       * RECORD TIME TO DESERIALIZE THE SAMPLE MESSAGE AS OUR TEST
       * METRIC...
       */
      long start = System.currentTimeMillis();

      deserializer.readMessage(message);
     
      long finish = System.currentTimeMillis();
      trace.endMessage();
      long duration = finish - start;

      /**
       * PRINT TRACE OUTPUT
       */
      System.out.print(trace.toString());

      System.out.print("AMF Deserialization Time: " + duration + "ms");

  } catch (Exception e) {
      System.out.println(trace.toString());
      e.printStackTrace();
      fail();
  }
    }
View Full Code Here


      File dir = new File(doc.getParent());
//      File dir = doc;
      System.out.println(dir.getPath());
      String[] files = dir.list(new SuffixFileFilter(".binary"));
      for (int i = 0; i < files.length; i++) {
    AmfTrace trace = new AmfTrace();
    System.out.println("===================================================");
    System.out.println(files[i]);
    System.out.println(dir.getPath()+File.separatorChar+files[i]);

    byte[] theFile = FileUtils.readFileToByteArray(new File(dir.getPath()+File.separatorChar+files[i]));
    ByteArrayInputStream bais = new ByteArrayInputStream(theFile);
    DataInputStream din = new DataInputStream(bais);

    /**
     * CREATE A DESERIALIZER FOR SAMPLE AMF REQUEST
     */
    ActionMessage message = new ActionMessage();
    trace.startRequest("----------Deserializing AMF/HTTP request-----");

    AmfMessageDeserializer deserializer = new AmfMessageDeserializer();
    deserializer.initialize(din, trace);

    /**
     * RECORD TIME TO DESERIALIZE THE SAMPLE MESSAGE AS OUR TEST
     * METRIC...
     */
    long start = System.currentTimeMillis();

    deserializer.readMessage(message);

    long finish = System.currentTimeMillis();
    trace.endMessage();
    long duration = finish - start;

    /**
     * PRINT TRACE OUTPUT
     */
    System.out.print(trace.toString());

    System.out.print("AMF Deserialization Time: " + duration + "ms");
    System.out.println("===================================================");
      }

View Full Code Here

TOP

Related Classes of org.racsor.jmeter.flex.messaging.io.amf.AmfTrace

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.