Package org.exoplatform.services.rpc

Examples of org.exoplatform.services.rpc.SingleMethodCallCommand


  
   public void testSingleMethodCallCommand() throws Exception
   {
      try
      {
         new SingleMethodCallCommand(null, null);
         fail("we expect an IllegalArgumentException");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      MyService myService = new MyService();
      try
      {
         new SingleMethodCallCommand(myService, null);
         fail("we expect an IllegalArgumentException");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      try
      {
         new SingleMethodCallCommand(myService, "foo");
         fail("we expect an NoSuchMethodException");
      }
      catch (NoSuchMethodException e)
      {
         // OK
      }
      try
      {
         new SingleMethodCallCommand(myService, "getPrivateName");
         fail("we expect an IllegalArgumentException since only the public methods are allowed");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      InitParams params = new InitParams();
      ValueParam paramConf = new ValueParam();
      paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
      paramConf.setValue("jar:/conf/portal/udp.xml");     
      params.addParameter(paramConf);
      RPCServiceImpl service = null;
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         RemoteCommand getName = service.registerCommand(new SingleMethodCallCommand(myService, "getName"));
         RemoteCommand add = service.registerCommand(new SingleMethodCallCommand(myService, "add", int.class));
         RemoteCommand evaluate1 = service.registerCommand(new SingleMethodCallCommand(myService, "evaluate", int[].class));
         RemoteCommand evaluate2 = service.registerCommand(new SingleMethodCallCommand(myService, "evaluate", List.class));
         RemoteCommand total1 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int.class));
         RemoteCommand total2 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int.class, int.class));
         RemoteCommand total3 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int[].class));
         RemoteCommand total4 = service.registerCommand(new SingleMethodCallCommand(myService, "total", String.class, long.class, int[].class));
         RemoteCommand testTypes1 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", String[].class));
         RemoteCommand testTypes2 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", int[].class));
         RemoteCommand testTypes3 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", long[].class));
         RemoteCommand testTypes4 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", byte[].class));
         RemoteCommand testTypes5 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", short[].class));
         RemoteCommand testTypes6 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", char[].class));
         RemoteCommand testTypes7 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", double[].class));
         RemoteCommand testTypes8 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", float[].class));
         RemoteCommand testTypes9 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", boolean[].class));

         service.start();
         List<Object> result;
        
         assertEquals("name", service.executeCommandOnCoordinator(getName, true));
View Full Code Here


  
   public void testSingleMethodCallCommand() throws Exception
   {
      try
      {
         new SingleMethodCallCommand(null, null);
         fail("we expect an IllegalArgumentException");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      MyService myService = new MyService();
      try
      {
         new SingleMethodCallCommand(myService, null);
         fail("we expect an IllegalArgumentException");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      try
      {
         new SingleMethodCallCommand(myService, "foo");
         fail("we expect an NoSuchMethodException");
      }
      catch (NoSuchMethodException e)
      {
         // OK
      }
      try
      {
         new SingleMethodCallCommand(myService, "getPrivateName");
         fail("we expect an IllegalArgumentException since only the public methods are allowed");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      InitParams params = new InitParams();
      ValueParam paramConf = new ValueParam();
      paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
      paramConf.setValue("jar:/conf/portal/udp.xml");     
      params.addParameter(paramConf);
      RPCServiceImpl service = null;
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         RemoteCommand getName = service.registerCommand(new SingleMethodCallCommand(myService, "getName"));
         RemoteCommand add = service.registerCommand(new SingleMethodCallCommand(myService, "add", int.class));
         RemoteCommand evaluate1 = service.registerCommand(new SingleMethodCallCommand(myService, "evaluate", int[].class));
         RemoteCommand evaluate2 = service.registerCommand(new SingleMethodCallCommand(myService, "evaluate", List.class));
         RemoteCommand total1 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int.class));
         RemoteCommand total2 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int.class, int.class));
         RemoteCommand total3 = service.registerCommand(new SingleMethodCallCommand(myService, "total", int[].class));
         RemoteCommand total4 = service.registerCommand(new SingleMethodCallCommand(myService, "total", String.class, long.class, int[].class));
         RemoteCommand testTypes1 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", String[].class));
         RemoteCommand testTypes2 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", int[].class));
         RemoteCommand testTypes3 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", long[].class));
         RemoteCommand testTypes4 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", byte[].class));
         RemoteCommand testTypes5 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", short[].class));
         RemoteCommand testTypes6 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", char[].class));
         RemoteCommand testTypes7 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", double[].class));
         RemoteCommand testTypes8 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", float[].class));
         RemoteCommand testTypes9 = service.registerCommand(new SingleMethodCallCommand(myService, "testTypes", boolean[].class));

         service.start();
         List<Object> result;
        
         assertEquals("name", service.executeCommandOnCoordinator(getName, true));
View Full Code Here

TOP

Related Classes of org.exoplatform.services.rpc.SingleMethodCallCommand

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.