Examples of AsynchronousFacade


Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModel bm1 = new BusinessModel();

    bm1.processBusinessModel2(15);

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    AsynchronousTask asynchronousTask1 =

      asynchronousFacade.getAsynchronousTask();

    bm1.processBusinessModel2(10);

    AsynchronousTask asynchronousTask2 =

      asynchronousFacade.getAsynchronousTask();

    assertEquals(

      "Method is not succesfull !",

      OK,

      asynchronousFacade.getResponseCode(asynchronousTask1));

    assertTrue(

      "value returned is not an instance of Long",

      asynchronousFacade.getReturnValue(asynchronousTask1)

        instanceof Long);

    assertEquals(

      "Method does not return the right value !"

        + ((Long)asynchronousFacade.getReturnValue(asynchronousTask1))

          .longValue(),

      ((Long)asynchronousFacade.getReturnValue(asynchronousTask1))

        .longValue(),

      15);

    assertEquals(

      "Method is not succesfull !",

      asynchronousFacade.getResponseCode(asynchronousTask2),

      OK);

    assertTrue(

      "value returned is not an instance of Long",

      asynchronousFacade.getReturnValue(asynchronousTask2)

        instanceof Long);

    assertEquals(

      "Method does not return the right value !"

        + ((Long)asynchronousFacade.getReturnValue(asynchronousTask2))

          .longValue(),

      ((Long)asynchronousFacade.getReturnValue(asynchronousTask2))

        .longValue(),

      10);
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

  public static void test2AsynchronousCallOnSameInstance2() {

    BusinessModel bm1 = new BusinessModel();

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    asynchronousFacade.setTimeout(50);

    bm1.processBusinessModel2(1000);

    AsynchronousTask asynchronousTask1 =

      asynchronousFacade.getAsynchronousTask();

    asynchronousFacade.setTimeout(200);

    bm1.processBusinessModel2(10);

    AsynchronousTask asynchronousTask2 =

      asynchronousFacade.getAsynchronousTask();

    assertEquals(

      "Method did not timeout !",

      TIMEOUT,

      asynchronousFacade.getResponseCode(asynchronousTask1));

    assertEquals(

      "Method is not succesfull !",

      asynchronousFacade.getResponseCode(asynchronousTask2),

      OK);

    assertTrue(

      "value returned is not an instance of Long",

      asynchronousFacade.getReturnValue(asynchronousTask2)

        instanceof Long);

    assertEquals(

      "Method does not return the right value !"

        + ((Long)asynchronousFacade.getReturnValue(asynchronousTask2))

          .longValue(),

      ((Long)asynchronousFacade.getReturnValue(asynchronousTask2))

        .longValue(),

      10);
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

  public static void testTimeout() {

    BusinessModel bm1 = new BusinessModel(200);

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    asynchronousFacade.setTimeout(100);

    bm1.processBusinessModel();

    long t0 = System.currentTimeMillis();

    //System.out.println(

    //  asynchronousFacade.getAsynchronousTask().getResponse());

    assertEquals(

      "Method did not timeout !",

      TIMEOUT,

      asynchronousFacade.getResponseCode());

    long t1 = System.currentTimeMillis();

    assertTrue("Method time out in " + (t1 - t0) + " ms.", (t1 - t0) < 120);
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModel bm1 = new BusinessModel();

      bm1.processBusinessModel2(10);

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    assertEquals(

      "Method is not succesfull !",

      OK,

      asynchronousFacade.getResponseCode());

    assertTrue(

      "value returned is not an instance of Long",

      asynchronousFacade.getReturnValue() instanceof Long);

    assertEquals(

      "Method does not return the right value !"

        + ((Long)asynchronousFacade.getReturnValue()).longValue(),

      ((Long)asynchronousFacade.getReturnValue()).longValue(),

      10);

  }
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModelWithCleanup bm1 = new BusinessModelWithCleanup();

    BusinessModelWithCleanup bm2 = new BusinessModelWithCleanup();

    AsynchronousFacade asynchronousFacade1 = (AsynchronousFacade)bm1;

    AsynchronousFacade asynchronousFacade2 = (AsynchronousFacade)bm2;

    asynchronousFacade1.setTimeout(100);

    bm1.processBusinessModel2(200);

    bm2.processBusinessModel2(200);

    assertEquals(

      "Method did not timeout !",

      TIMEOUT,

      asynchronousFacade1.getResponseCode());

    assertEquals(

      "Method is not successfull !",

      OK,

      asynchronousFacade2.getResponseCode());

    assertEquals("Cleanup method not called", true, bm1.bCleanupCalled);

    assertEquals("Cleanup method called", false, bm2.bCleanupCalled);
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModel bm1 = new BusinessModel(200);

    bm1.processBusinessModel();

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    long t0 = System.currentTimeMillis();

    assertFalse("isDone returns TRUE  !", asynchronousFacade.isDone());

    long t1 = System.currentTimeMillis();

    assertTrue(

      "isDone is a blocking call " + (t1 - t0) + " ms.",

      (t1 - t0) < 20);

    assertEquals(

      "Method is not succesfull !",

      OK,

      asynchronousFacade.getResponseCode());

    assertTrue("isDone returns FALSE  !", asynchronousFacade.isDone());

  }
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModel bm1 = new BusinessModel();

    bm1.processBusinessModel2(-1);

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    assertEquals(

      "EXCEPTIONCAUGHT error not returned !",

      EXCEPTIONCAUGHT,

      asynchronousFacade.getResponseCode());

  }
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    BusinessModel bm1 = new BusinessModel(200);

    bm1.processBusinessModel();

    AsynchronousFacade asynchronousFacade = (AsynchronousFacade)bm1;

    assertEquals(

      "Pool size not full !",

      CAN_NOT_PROCESS,

      asynchronousFacade.getResponseCode());

  }
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

        + " (ms).");

    BusinessModel bm = new BusinessModel(10);

    AsynchronousFacade Fbm = (AsynchronousFacade)bm;

    long total = 0;

    int iOk = 0;

    int nb1 = 200;

    int nb2 = 5;

    AsynchronousTask[] Tbm = new AsynchronousTask[nb2];

    for (int j = 0; j < nb1; j++) {

      long t0 = System.currentTimeMillis();

      for (int i = 0; i < nb2; i++) {

        bm.processBusinessModel();

        Tbm[i] = Fbm.getAsynchronousTask();

      }

      long t1 = System.currentTimeMillis();

      total += (t1 - t0);

      for (int i = 0; i < nb2; i++) {

        int ok = Fbm.getResponseCode(Tbm[i]);

        if (ok == OK)

          iOk++;
View Full Code Here

Examples of org.jboss.aspects.asynchronous.aspects.AsynchronousFacade

    long t0 = System.currentTimeMillis();

    bm1.processBusinessModel();

    AsynchronousFacade asynchronousFacade1 = (AsynchronousFacade)bm1;

    assertEquals(

      "Method is not succesfull !",

      OK,

      asynchronousFacade1.getResponseCode());

    long t1 = System.currentTimeMillis();

    long startingTime =

      asynchronousFacade1.getThreadManagerResponse().getStartingTime();

    long endingTime =

      asynchronousFacade1.getThreadManagerResponse().getEndingTime();

    assertTrue(

      "starting time issue ? " + (startingTime - t0),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.