Examples of InitParams


Examples of org.exoplatform.container.xml.InitParams

      }
      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"));
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }
   }
  
   public void testExecOnCoordinator() throws Exception
   {
      InitParams params = new InitParams();
      ValueParam paramConf = new ValueParam();
      paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
      paramConf.setValue("jar:/conf/portal/udp.xml");
      params.addParameter(paramConf);

      final List<Boolean> calledCommands = Collections.synchronizedList(new ArrayList<Boolean>());

      RPCServiceImpl service1 = null;
      RPCServiceImpl service2 = null;
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      assertEquals(172.5D, p.size_b);
   }

   private void assertPropertyParam(String expectedValue, Component component, String paramName, String propertyName)
   {
      InitParams initParams = component.getInitParams();
      assertNotNull(initParams);
      PropertiesParam propertiesParam = initParams.getPropertiesParam(paramName);
      assertNotNull(paramName);
      assertEquals(expectedValue, propertiesParam.getProperty(propertyName));
   }
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      assertEquals(expectedValue, propertiesParam.getProperty(propertyName));
   }

   private void assertValueParam(String expectedValue, Component component, String paramName)
   {
      InitParams initParams = component.getInitParams();
      assertNotNull(initParams);
      ValueParam valueParam = initParams.getValueParam(paramName);
      assertNotNull(paramName);
      assertEquals(expectedValue, valueParam.getValue());
   }
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      configManager = (ConfigurationManager)container.getComponentInstanceOfType(ConfigurationManager.class);
   }
  
   public void testParameters()
   {
      InitParams params = null;
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a IllegalArgumentException since the jgroups config cannot be found");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      params = new InitParams();
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a IllegalArgumentException since the jgroups config cannot be found");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      ValueParam paramConf = new ValueParam();
      paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
      params.addParameter(paramConf);
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a IllegalArgumentException since the jgroups config cannot be found");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      paramConf.setValue("fakePath");
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a IllegalArgumentException since the jgroups config cannot be found");
      }
      catch (IllegalArgumentException e)
      {
         // OK
      }
      paramConf.setValue("jar:/conf/portal/udp.xml");
      RPCServiceImpl service = null;
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(RPCServiceImpl.DEFAULT_TIMEOUT, service.getDefaultTimeout());
         assertEquals(RPCServiceImpl.DEFAULT_RETRY_TIMEOUT, service.getRetryTimeout());
         assertEquals(true, service.isAllowFailover());
         assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getContext().getName(), service.getClusterName());
      }
      finally
      {
         if (service != null)
         {
            service.stop();           
         }
      }
      ValueParam paramTimeout = new ValueParam();
      paramTimeout.setName(RPCServiceImpl.PARAM_DEFAULT_TIMEOUT);
      paramTimeout.setValue("fakeValue");
      params.addParameter(paramTimeout);
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a NumberFormatException since the timeout is not properly set");
      }
      catch (NumberFormatException e)
      {
         // OK
      }
      paramTimeout.setValue("60");
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(60, service.getDefaultTimeout());
         assertEquals(RPCServiceImpl.DEFAULT_RETRY_TIMEOUT, service.getRetryTimeout());
         assertEquals(true, service.isAllowFailover());
         assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getContext().getName(), service.getClusterName());
      }
      finally
      {
         if (service != null)
         {
            service.stop();           
         }
      }
      ValueParam paramRetryTimeout = new ValueParam();
      paramRetryTimeout.setName(RPCServiceImpl.PARAM_RETRY_TIMEOUT);
      paramRetryTimeout.setValue("fakeValue");
      params.addParameter(paramRetryTimeout);
      try
      {
         new RPCServiceImpl(container.getContext(), params, configManager);
         fail("We expect a NumberFormatException since the retry timeout is not properly set");
      }
      catch (NumberFormatException e)
      {
         // OK
      }     
      paramRetryTimeout.setValue("60");
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(60, service.getDefaultTimeout());
         assertEquals(60, service.getRetryTimeout());
         assertEquals(true, service.isAllowFailover());
         assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getContext().getName(), service.getClusterName());
      }
      finally
      {
         if (service != null)
         {
            service.stop();           
         }
      }
      ValueParam paramAllowFailover = new ValueParam();
      paramAllowFailover.setName(RPCServiceImpl.PARAM_ALLOW_FAILOVER);
      paramAllowFailover.setValue("fakeValue");
      params.addParameter(paramAllowFailover);
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(60, service.getDefaultTimeout());
         assertEquals(60, service.getRetryTimeout());
         assertEquals(false, service.isAllowFailover());
         assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getContext().getName(), service.getClusterName());
      }
      finally
      {
         if (service != null)
         {
            service.stop();           
         }
      }
      paramAllowFailover.setValue("TRUE");
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(60, service.getDefaultTimeout());
         assertEquals(60, service.getRetryTimeout());
         assertEquals(true, service.isAllowFailover());
         assertEquals(RPCServiceImpl.CLUSTER_NAME + "-" + container.getContext().getName(), service.getClusterName());
      }
      finally
      {
         if (service != null)
         {
            service.stop();           
         }
      }
     
      ValueParam paramClusterName = new ValueParam();     
      paramClusterName.setName(RPCServiceImpl.PARAM_CLUSTER_NAME);
      paramClusterName.setValue("MyName");
      params.addParameter(paramClusterName);
      try
      {
         service = new RPCServiceImpl(container.getContext(), params, configManager);
         assertEquals(60, service.getDefaultTimeout());
         assertEquals(paramClusterName.getValue() + "-" + container.getContext().getName(), service.getClusterName());
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }
   }
  
   public void testStates() throws Exception
   {
      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;
      RemoteCommand foo  = new RemoteCommand()
      {
        
         public String getId()
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }     
   }
  
   public void testCommands() throws Exception
   {
      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 fake = new RemoteCommand()
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }       
   }

   public void testSeveralNodes() throws Exception
   {
      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 service1 = null, service2 = null;     
      try
      {
         service1 = new RPCServiceImpl(container.getContext(), params, configManager);
         service2 = new RPCServiceImpl(container.getContext(), params, configManager);
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }
      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"));
View Full Code Here

Examples of org.exoplatform.container.xml.InitParams

      }
   }
  
   public void testExecOnCoordinator() throws Exception
   {
      InitParams params = new InitParams();
      ValueParam paramConf = new ValueParam();
      paramConf.setName(RPCServiceImpl.PARAM_JGROUPS_CONFIG);
      paramConf.setValue("jar:/conf/portal/udp.xml");
      params.addParameter(paramConf);

      final List<Boolean> calledCommands = Collections.synchronizedList(new ArrayList<Boolean>());

      RPCServiceImpl service1 = null;
      RPCServiceImpl service2 = null;
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.