Examples of Addable


Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testCalculatorServiceControl() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {1, 2, 3};

      // Get the result from the service
      int result = calc.add(args);

      // Calculate the expected result
      int expected = this.add(args);

      // Test
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testCalculatorServiceInChain() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {1, 2, 3};

      // Define the chain
      Interceptor[] interceptorChain = new Interceptor[]
      {new AddOneInterceptor()};

      // Make the handler
      InterceptorChainInvocationHandler handler = new InterceptorChainInvocationHandler(interceptorChain, calc);

      // Apply the chain
      Addable newCalc = (Addable) ProxyUtils.mixinProxy(calc, handler);

      // Get the result from the service
      int result = newCalc.add(args);

      // Calculate the expected result (adding all, plus 1)
      int expected = this.add(args) + 1;

      // Test
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testChainInvokableMoreThanOnce() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {1, 2, 3};

      // Define the chain
      Interceptor[] interceptorChain = new Interceptor[]
      {new AddOneInterceptor()};

      // Make the handler
      InterceptorChainInvocationHandler handler = new InterceptorChainInvocationHandler(interceptorChain, calc);

      // Apply the chain
      Addable newCalc = (Addable) ProxyUtils.mixinProxy(calc, handler);

      // Get the result from the service
      int result1 = newCalc.add(args);
      // Invoke again
      int result2 = newCalc.add(args);

      // Calculate the expected result (adding all, plus 1)
      int expected = this.add(args) + 1;

      // Test
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testCalculatorServiceInMultiHandlerChain() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {1, 2, 3};
      int[] overrideArgs =
      {5, 10};

      // Define the chain
      Interceptor[] interceptorChain = new Interceptor[]
      {new ChangeInputInterceptor(overrideArgs), new AddOneInterceptor()};

      // Make the handler
      InterceptorChainInvocationHandler handler = new InterceptorChainInvocationHandler(interceptorChain, calc);

      // Mix it up
      Addable newCalc = (Addable) ProxyUtils.mixinProxy(calc, handler);

      // Get the result from the service
      int result = newCalc.add(args);

      // Calculate the expected result (overriden arguments sum, plus 1)
      int expected = this.add(overrideArgs) + 1;

      // Test
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testCalculatorServiceAddingMixin() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {4, 7, 2};

      // Define the chain
      Interceptor[] interceptorChain = new Interceptor[]
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

    */
   @Test
   public void testAsync() throws Exception
   {
      // Initialize
      Addable calc = new CalculatorServiceBean();
      int[] args =
      {1, 2, 3};
      int expectedSum = 0;
      for (int arg : args)
      {
         expectedSum += arg;
      }

      // Make async
      Addable asyncCalc = AsyncUtils.mixinAsync(calc);

      // Make the async call
      asyncCalc.add(args);

      // Get the future result
      Future<?> futureResult = AsyncUtils.getFutureResult(asyncCalc);

      // Block until the call returns
View Full Code Here

Examples of org.jboss.ejb3.test.common.proxy.Addable

   }

   @Test
   public void testException() throws Exception
   {
      Addable failingBean = new Addable() {
         public int add(int... args)
         {
            throw new RuntimeException("Failed predictably");
         }
      };
     
      Addable asyncFailingBean = AsyncUtils.mixinAsync(failingBean);
     
      asyncFailingBean.add(1, 2, 3);
     
      Future<?> futureResult = AsyncUtils.getFutureResult(asyncFailingBean);
     
      try
      {
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.