Exemplo n.º 1
0
  private void setupServer(boolean backup, String... interceptors) throws Exception {

    final TransportConfiguration liveConnector = TransportConfigurationUtils.getInVMConnector(true);
    final TransportConfiguration backupConnector =
        TransportConfigurationUtils.getInVMConnector(false);
    final TransportConfiguration backupAcceptor =
        TransportConfigurationUtils.getInVMAcceptor(false);

    Configuration backupConfig = createDefaultConfig();
    Configuration liveConfig = createDefaultConfig();

    backupConfig.setBackup(backup);

    final String suffix = "_backup";
    backupConfig.setBindingsDirectory(backupConfig.getBindingsDirectory() + suffix);
    backupConfig.setJournalDirectory(backupConfig.getJournalDirectory() + suffix);
    backupConfig.setPagingDirectory(backupConfig.getPagingDirectory() + suffix);
    backupConfig.setLargeMessagesDirectory(backupConfig.getLargeMessagesDirectory() + suffix);

    if (interceptors.length > 0) {
      List<String> interceptorsList = Arrays.asList(interceptors);
      backupConfig.setIncomingInterceptorClassNames(interceptorsList);
    }

    ReplicatedBackupUtils.configureReplicationPair(
        backupConfig, backupConnector, backupAcceptor, liveConfig, liveConnector);
    if (backup) {
      liveServer = createServer(liveConfig);
      liveServer.start();
      waitForComponent(liveServer);
    }

    backupServer = createServer(backupConfig);
    locator = createInVMNonHALocator();
    backupServer.start();
    if (backup) {
      ServiceTestBase.waitForRemoteBackup(null, 5, true, backupServer);
    }
    int count = 0;
    waitForReplication(count);
  }
Exemplo n.º 2
0
 @Override
 protected TransportConfiguration getConnectorTransportConfiguration(final boolean live) {
   return TransportConfigurationUtils.getInVMConnector(live);
 }