/**
  * {@inheritDoc}
  *
  * @see org.jboss.msc.value.Value#getValue()
  */
 @Override
 public ProtocolDefaults getValue() {
   ProtocolStackConfigurator configurator = load(ProtocolDefaultsBuilder.this.resource);
   for (org.jgroups.conf.ProtocolConfiguration config : configurator.getProtocolStack()) {
     this.map.put(config.getProtocolName(), Collections.unmodifiableMap(config.getProperties()));
   }
   return this;
 }
  public static String getTcpConfig(String fullTestName, TransportFlags flags) {
    // With the XML already parsed, make a safe copy of the
    // protocol stack configurator and use that accordingly.
    JGroupsProtocolCfg jgroupsCfg = getJGroupsProtocolCfg(tcpConfigurator.getProtocolStack());

    if (!flags.withFD()) removeFailureDetectionTcp(jgroupsCfg);

    if (!flags.isSiteIndexSpecified()) {
      removeRela2(jgroupsCfg);
    } else {
      ProtocolConfiguration protocol = jgroupsCfg.getProtocol(RELAY2);
      protocol.getProperties().put("site", flags.siteName());
      if (flags.relayConfig() != null) // if not specified, use default
      protocol.getProperties().put("config", flags.relayConfig());
    }

    if (!flags.withMerge()) removeMerge(jgroupsCfg);

    if (jgroupsCfg.containsProtocol(TEST_PING)) {
      replaceTcpStartPort(jgroupsCfg, flags);
      if (fullTestName == null) return jgroupsCfg.toString(); // IDE run of test
      else return getTestPingDiscovery(fullTestName, jgroupsCfg); // Cmd line test run
    } else {
      return replaceMCastAddressAndPort(jgroupsCfg);
    }
  }
Beispiel #3
0
  protected final void init(ProtocolStackConfigurator configurator) throws Exception {
    List<ProtocolConfiguration> configs = configurator.getProtocolStack();
    // replace vars with system props
    configs.forEach(ProtocolConfiguration::substituteVariables);

    prot_stack = new ProtocolStack(this);
    prot_stack.setup(configs); // Setup protocol stack (creates protocol, calls init() on them)
  }
  public static String getUdpConfig(String fullTestName, TransportFlags flags) {
    JGroupsProtocolCfg jgroupsCfg = getJGroupsProtocolCfg(udpConfigurator.getProtocolStack());

    if (!flags.withFD()) removeFailureDetectionUdp(jgroupsCfg);

    if (!flags.withMerge()) removeMerge(jgroupsCfg);

    if (!flags.isSiteIndexSpecified()) {
      removeRela2(jgroupsCfg);
    }

    if (jgroupsCfg.containsProtocol(TEST_PING)) {
      if (fullTestName != null)
        return getTestPingDiscovery(fullTestName, jgroupsCfg); // Cmd line test run
    }

    return replaceMCastAddressAndPort(jgroupsCfg);
  }
 @Override
 public String toString() {
   return configurator.getProtocolStackString();
 }
 JGroupsProtocolCfg replaceProtocol(ProtocolType type, ProtocolConfiguration newCfg) {
   ProtocolConfiguration oldCfg = protoMap.get(type);
   int position = configurator.getProtocolStack().indexOf(oldCfg);
   // Remove protocol and put new configuration in same position
   return removeProtocol(type).addProtocol(type, newCfg, position);
 }
 JGroupsProtocolCfg removeProtocol(ProtocolType type) {
   // Update the stack and map
   configurator.getProtocolStack().remove(protoMap.remove(type));
   return this;
 }
 JGroupsProtocolCfg addProtocol(ProtocolType type, ProtocolConfiguration cfg, int position) {
   protoMap.put(type, cfg);
   configurator.getProtocolStack().add(position, cfg);
   return this;
 }