Esempio n. 1
0
  protected void createConfigs() throws Exception {
    nodeManager = new InVMNodeManager();

    backupConfig = super.createDefaultConfig();
    backupConfig.getAcceptorConfigurations().clear();
    backupConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
    backupConfig.setSharedStore(true);
    backupConfig.setBackup(true);
    backupConfig.setClustered(true);
    TransportConfiguration liveConnector = getConnectorTransportConfiguration(true);
    TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
    backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
    backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
    ReplicatedBackupUtils.createClusterConnectionConf(
        backupConfig, backupConnector.getName(), liveConnector.getName());
    backupServer = createTestableServer(backupConfig);

    liveConfig = super.createDefaultConfig();
    liveConfig.getAcceptorConfigurations().clear();
    liveConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
    liveConfig.setSharedStore(true);
    liveConfig.setClustered(true);
    ReplicatedBackupUtils.createClusterConnectionConf(liveConfig, liveConnector.getName());
    liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
    liveServer = createTestableServer(liveConfig);
  }
Esempio n. 2
0
  protected static Configuration createClusteredDefaultConfig(
      final int index, final Map<String, Object> params, final String... acceptors) {
    Configuration config = createDefaultConfig(index, params, acceptors);

    config.setClustered(true);

    return config;
  }
  /**
   * @param toOtherServerPair
   * @throws Exception
   */
  private void setupServer1() throws Exception {
    List<String> toOtherServerPair = new ArrayList<String>();
    toOtherServerPair.add("toServer2");

    Configuration conf1 =
        createDefaultConfig(0, generateInVMParams(0), InVMAcceptorFactory.class.getCanonicalName());

    conf1.setSecurityEnabled(false);
    conf1.setJMXManagementEnabled(true);
    conf1.setPersistenceEnabled(false);

    conf1
        .getConnectorConfigurations()
        .put(
            "toServer2",
            new TransportConfiguration(
                InVMConnectorFactory.class.getName(), generateInVMParams(1)));
    conf1
        .getConnectorConfigurations()
        .put(
            "server1",
            new TransportConfiguration(
                InVMConnectorFactory.class.getName(), generateInVMParams(0)));

    conf1.setClustered(true);

    conf1
        .getClusterConfigurations()
        .add(
            new ClusterConnectionConfiguration(
                "to-server2",
                "jms",
                "server1",
                1000,
                true,
                true,
                MAX_HOPS,
                1024,
                toOtherServerPair,
                false));

    JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
    // jmsconfig.getTopicConfigurations().add(new TopicConfigurationImpl("t1", "topic/t1"));

    server1 = HornetQServers.newHornetQServer(conf1, false);
    jmsServer1 = new JMSServerManagerImpl(server1, jmsconfig);
    context1 = new InVMContext();
    jmsServer1.setContext(context1);
  }
Esempio n. 4
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    Map<String, Object> acceptorParams = new HashMap<String, Object>();
    acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
    TransportConfiguration acceptorConfig =
        new TransportConfiguration(
            InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString());

    TransportConfiguration connectorConfig =
        new TransportConfiguration(
            InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString());

    CoreQueueConfiguration sourceQueueConfig =
        new CoreQueueConfiguration(
            RandomUtil.randomString(), RandomUtil.randomString(), null, false);
    CoreQueueConfiguration targetQueueConfig =
        new CoreQueueConfiguration(
            RandomUtil.randomString(), RandomUtil.randomString(), null, false);
    List<String> connectors = new ArrayList<String>();
    connectors.add(connectorConfig.getName());
    bridgeConfig =
        new BridgeConfiguration(
            RandomUtil.randomString(),
            sourceQueueConfig.getName(),
            targetQueueConfig.getAddress(),
            null,
            null,
            HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
            HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
            HornetQClient.DEFAULT_CONNECTION_TTL,
            RandomUtil.randomPositiveLong(),
            HornetQClient.DEFAULT_MAX_RETRY_INTERVAL,
            RandomUtil.randomDouble(),
            RandomUtil.randomPositiveInt(),
            RandomUtil.randomBoolean(),
            RandomUtil.randomPositiveInt(),
            connectors,
            false,
            ConfigurationImpl.DEFAULT_CLUSTER_USER,
            ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);

    Configuration conf_1 = createBasicConfig();
    conf_1.setSecurityEnabled(false);
    conf_1.setJMXManagementEnabled(true);
    conf_1.setClustered(true);
    conf_1.getAcceptorConfigurations().add(acceptorConfig);
    conf_1.getQueueConfigurations().add(targetQueueConfig);

    Configuration conf_0 = createBasicConfig();
    conf_0.setSecurityEnabled(false);
    conf_0.setJMXManagementEnabled(true);
    conf_0.setClustered(true);
    conf_0
        .getAcceptorConfigurations()
        .add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
    conf_0.getQueueConfigurations().add(sourceQueueConfig);
    conf_0.getBridgeConfigurations().add(bridgeConfig);

    server_1 =
        HornetQServers.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false);
    addServer(server_1);
    server_1.start();

    server_0 = HornetQServers.newHornetQServer(conf_0, mbeanServer, false);
    addServer(server_0);
    server_0.start();
  }