Package org.jboss.ha.core.channelfactory

Examples of org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo


         factory.start();
      }
     
      Map<String, ProtocolStackConfigInfo> origMap = factory.getProtocolStackConfigurations();
      Set<String> origKeys = new HashSet<String>(origMap.keySet());
      ProtocolStackConfigInfo unshared1 = origMap.get("unshared1");
      assertNotNull(unshared1);
      ProtocolData[] origConfig = unshared1.getConfiguration();
      assertNotNull(origConfig);
      // Copy it off so we know it's unchanged for later assertion comparisons
      origConfig = origConfig.clone();
      ProtocolData origTransport = origConfig[0];
      assertNotNull(origTransport);
      ProtocolParameter[] origParams = origTransport.getParametersAsArray();
      ProtocolParameter[] newParams = origParams.clone();     
      ProtocolData newTransport = new ProtocolData(origTransport.getProtocolName(), origTransport.getClassName(), newParams);
      ProtocolParameter overrideParam = new ProtocolParameter("max_bundle_size", "50000");
      newTransport.override(new ProtocolParameter[]{overrideParam});
      ProtocolData[] newConfig = origConfig.clone();
      newConfig[0] = newTransport;
     
      ProtocolStackConfigInfo updated = new ProtocolStackConfigInfo(unshared1.getName(), unshared1.getDescription(), newConfig);
     
      Map<String, ProtocolStackConfigInfo> newMap = new HashMap<String, ProtocolStackConfigInfo>(origMap);
      newMap.put("unshared1", updated);
   
      ProtocolData[] addedConfig = origConfig.clone();
      ProtocolStackConfigInfo added = new ProtocolStackConfigInfo("added", "added", addedConfig);
      newMap.put("added", added);
     
      assertTrue(newMap.containsKey("shared2"));
      newMap.remove("shared2");
     
      factory.setProtocolStackConfigurations(newMap);
     
      if (startBeforeOverride == false)
      {
         factory.create();
         factory.start();
      }
     
      Map<String, ProtocolStackConfigInfo> reread = factory.getProtocolStackConfigurations();
      origKeys.remove("shared2");
      origKeys.add("added");
      assertEquals(origKeys, reread.keySet());
     
      ProtocolStackConfigInfo addedInfo = reread.get("added");
      assertEquals("added", addedInfo.getName());
      assertEquals("added", addedInfo.getDescription());
      ProtocolData[] readAdded = addedInfo.getConfiguration();
      assertEquals(addedConfig.length, readAdded.length);
      for (int i = 0; i < readAdded.length; i++)
      {
         assertEquals(addedConfig[i], readAdded[i]);
         ProtocolParameter[] inputParams = addedConfig[i].getParametersAsArray();
         ProtocolParameter[] outputParams = readAdded[i].getParametersAsArray();
         assertEquals(inputParams.length, outputParams.length);
         @SuppressWarnings("unchecked")
         Map<String, ProtocolParameter> paramMap = readAdded[i].getParameters();
         for (int j = 0; j < inputParams.length; j++)
         {
            ProtocolParameter param = paramMap.get(inputParams[j].getName());
            assertNotNull(param);
            assertEquals(inputParams[j].getValue(), param.getValue());
         }
      }
     
      ProtocolStackConfigInfo updatedInfo = reread.get("unshared1");
      assertEquals("unshared1", updatedInfo.getName());
      ProtocolData[] readUpdated = updatedInfo.getConfiguration();
      assertEquals(origConfig.length, readUpdated.length);
      for (int i = 0; i < readUpdated.length; i++)
      {
         assertEquals(origConfig[i], readUpdated[i]);
         ProtocolParameter[] inputParams = origConfig[i].getParametersAsArray();
View Full Code Here


   public MetaValue createMetaValue(MetaType metaType, Map<String, ProtocolStackConfigInfo> object)
   {
      Map<String, MetaValue> result = new HashMap<String, MetaValue>();
      for (Map.Entry<String, ProtocolStackConfigInfo> entry : object.entrySet())
      {
         ProtocolStackConfigInfo info = entry.getValue();
         Map<String, MetaValue> stackValue = new HashMap<String, MetaValue>();
         stackValue.put("name", SimpleValueSupport.wrap(info.getName()));
         stackValue.put("description", SimpleValueSupport.wrap(info.getDescription()));
        
         ProtocolData[] data = info.getConfiguration();        
         stackValue.put("configuration", CONFIG_MAPPER.createMetaValue(CONFIG_MAPPER.getMetaType(), data));
        
         result.put(entry.getKey(), new CompositeValueSupport(TYPE, stackValue));
      }
     
View Full Code Here

         CollectionValue protocolsValue = (CollectionValue) stackValue.get("configuration");
         ProtocolData[] protocolData = CONFIG_MAPPER.unwrapMetaValue(protocolsValue)
         // fixes http://jira.jboss.com/jira/browse/JGRP-290
         ProtocolStackUtil.substituteVariables(protocolData); // replace vars with system props
        
         result.put(stack, new ProtocolStackConfigInfo(name, description, protocolData));
      }
     
      return result;
   }
View Full Code Here

TOP

Related Classes of org.jboss.ha.core.channelfactory.ProtocolStackConfigInfo

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.