geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateAndDestroyGatewaySenderCommandsDUnitTest.java
@Test
  public void testCreateDestroyGatewaySenderWithGatewayTransportFilters() {
    Integer dsIdPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
    propsSetUp(dsIdPort);

    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
    vm3.invoke(() -> createCache(dsIdPort));
    vm4.invoke(() -> createCache(dsIdPort));
    vm5.invoke(() -> createCache(dsIdPort));

    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000;
    String command = CliStrings.CREATE_GATEWAYSENDER + " --" + CliStrings.CREATE_GATEWAYSENDER__ID
        + "=ln" + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER
        + "=org.apache.geode.cache30.MyGatewayTransportFilter1";
    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
    if (cmdResult != null) {
      String strCmdResult = commandResultToString(cmdResult);
      getLogWriter()
          .info("testCreateDestroyGatewaySenderWithGatewayTransportFilters stringResult : "
              + strCmdResult + ">>>>");
      assertEquals(Result.Status.OK, cmdResult.getStatus());
      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
      List<String> status = resultData.retrieveAllValues("Status");
      assertEquals(5, status.size());
      for (String stat : status) {
        assertTrue("GatewaySender creation failed with: " + stat, !stat.contains("ERROR:"));
      }
    } else {
      fail(
          "testCreateDestroyGatewaySenderWithGatewayTransportFilters failed as did not get CommandResult");
    }
    vm3.invoke(() -> verifySenderState("ln", false, false));
    vm4.invoke(() -> verifySenderState("ln", false, false));
    vm5.invoke(() -> verifySenderState("ln", false, false));
    List<String> transportFilters = new ArrayList<String>();
    transportFilters.add("org.apache.geode.cache30.MyGatewayTransportFilter1");
    vm3.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    vm4.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    vm5.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    doDestroyAndVerifyGatewaySender("ln", null, null,
        "testCreateDestroyGatewaySenderWithGatewayTransportFilters", Arrays.asList(vm3, vm4, vm5),
        5, false);
  }
/**
   * GatewaySender with given attribute values and transport filters.
   */
GatewaySender with given attribute values and transport filters.
GatewaySender with given attribute values and transport filters .
@Test
  public void testCreateDestroyGatewaySenderWithGatewayTransportFilters() {
    Integer dsIdPort = vm1.invoke(() -> createFirstLocatorWithDSId(1));
    propsSetUp(dsIdPort);
    vm2.invoke(() -> createFirstRemoteLocator(2, dsIdPort));
    vm3.invoke(() -> createCache(dsIdPort));
    vm4.invoke(() -> createCache(dsIdPort));
    vm5.invoke(() -> createCache(dsIdPort));
    int socketReadTimeout = GatewaySender.MINIMUM_SOCKET_READ_TIMEOUT + 1000;
    String command = CliStrings.CREATE_GATEWAYSENDER + " --" + CliStrings.CREATE_GATEWAYSENDER__ID
        + "=ln" + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__PARALLEL + "=false" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__BATCHSIZE + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD" + " --"
        + CliStrings.CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER
        + "=org.apache.geode.cache30.MyGatewayTransportFilter1";
    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
    if (cmdResult != null) {
      String strCmdResult = commandResultToString(cmdResult);
      getLogWriter()
          .info("testCreateDestroyGatewaySenderWithGatewayTransportFilters stringResult : "
              + strCmdResult + ">>>>");
      assertEquals(Result.Status.OK, cmdResult.getStatus());
      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
      List<String> status = resultData.retrieveAllValues("Status");
      assertEquals(5, status.size());
      for (String stat : status) {
        assertTrue("GatewaySender creation failed with: " + stat, !stat.contains("ERROR:"));
      }
    } else {
      fail(
          "testCreateDestroyGatewaySenderWithGatewayTransportFilters failed as did not get CommandResult");
    }
    vm3.invoke(() -> verifySenderState("ln", false, false));
    vm4.invoke(() -> verifySenderState("ln", false, false));
    vm5.invoke(() -> verifySenderState("ln", false, false));
    List<String> transportFilters = new ArrayList<String>();
    transportFilters.add("org.apache.geode.cache30.MyGatewayTransportFilter1");
    vm3.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    vm4.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    vm5.invoke(() -> verifySenderAttributes("ln", 2, false, true, 1000, socketReadTimeout, true,
        1000, 5000, true, false, 1000, 100, 2, OrderPolicy.THREAD, null, transportFilters));
    doDestroyAndVerifyGatewaySender("ln", null, null,
        "testCreateDestroyGatewaySenderWithGatewayTransportFilters", Arrays.asList(vm3, vm4, vm5),
        5, false);
  }
@ Test public void testCreateDestroyGatewaySenderWithGatewayTransportFilters ( ) { Integer dsIdPort = vm1 . invoke ( ( ) -> createFirstLocatorWithDSId ( 1 ) ) ; propsSetUp ( dsIdPort ) ; vm2 . invoke ( ( ) -> createFirstRemoteLocator ( 2 , dsIdPort ) ) ; vm3 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; vm4 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; vm5 . invoke ( ( ) -> createCache ( dsIdPort ) ) ; int socketReadTimeout = GatewaySender . MINIMUM_SOCKET_READ_TIMEOUT + 1000 ; String command = CliStrings . CREATE_GATEWAYSENDER + " --" + CliStrings . CREATE_GATEWAYSENDER__ID + "=ln" + " --" + CliStrings . CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2" + " --" + CliStrings . CREATE_GATEWAYSENDER__PARALLEL + "=false" + " --" + CliStrings . CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --" + CliStrings . CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --" + CliStrings . CREATE_GATEWAYSENDER__SOCKETREADTIMEOUT + "=" + socketReadTimeout + " --" + CliStrings . CREATE_GATEWAYSENDER__ENABLEBATCHCONFLATION + "=true" + " --" + CliStrings . CREATE_GATEWAYSENDER__BATCHSIZE + "=1000" + " --" + CliStrings . CREATE_GATEWAYSENDER__BATCHTIMEINTERVAL + "=5000" + " --" + CliStrings . CREATE_GATEWAYSENDER__ENABLEPERSISTENCE + "=true" + " --" + CliStrings . CREATE_GATEWAYSENDER__DISKSYNCHRONOUS + "=false" + " --" + CliStrings . CREATE_GATEWAYSENDER__MAXQUEUEMEMORY + "=1000" + " --" + CliStrings . CREATE_GATEWAYSENDER__ALERTTHRESHOLD + "=100" + " --" + CliStrings . CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=2" + " --" + CliStrings . CREATE_GATEWAYSENDER__ORDERPOLICY + "=THREAD" + " --" + CliStrings . CREATE_GATEWAYSENDER__GATEWAYTRANSPORTFILTER + "=org.apache.geode.cache30.MyGatewayTransportFilter1" ; CommandResult cmdResult = executeCommandWithIgnoredExceptions ( command ) ; if ( cmdResult != null ) { String strCmdResult = commandResultToString ( cmdResult ) ; getLogWriter ( ) . info ( "testCreateDestroyGatewaySenderWithGatewayTransportFilters stringResult : " + strCmdResult + ">>>>" ) ; assertEquals ( Result . Status . OK , cmdResult . getStatus ( ) ) ; TabularResultData resultData = ( TabularResultData ) cmdResult . getResultData ( ) ; List < String > status = resultData . retrieveAllValues ( "Status" ) ; assertEquals ( 5 , status . size ( ) ) ; for ( String stat : status ) { assertTrue ( "GatewaySender creation failed with: " + stat , ! stat . contains ( "ERROR:" ) ) ; } } else { fail ( "testCreateDestroyGatewaySenderWithGatewayTransportFilters failed as did not get CommandResult" ) ; } vm3 . invoke ( ( ) -> verifySenderState ( "ln" , false , false ) ) ; vm4 . invoke ( ( ) -> verifySenderState ( "ln" , false , false ) ) ; vm5 . invoke ( ( ) -> verifySenderState ( "ln" , false , false ) ) ; List < String > transportFilters = new ArrayList < String > ( ) ; transportFilters . add ( "org.apache.geode.cache30.MyGatewayTransportFilter1" ) ; vm3 . invoke ( ( ) -> verifySenderAttributes ( "ln" , 2 , false , true , 1000 , socketReadTimeout , true , 1000 , 5000 , true , false , 1000 , 100 , 2 , OrderPolicy . THREAD , null , transportFilters ) ) ; vm4 . invoke ( ( ) -> verifySenderAttributes ( "ln" , 2 , false , true , 1000 , socketReadTimeout , true , 1000 , 5000 , true , false , 1000 , 100 , 2 , OrderPolicy . THREAD , null , transportFilters ) ) ; vm5 . invoke ( ( ) -> verifySenderAttributes ( "ln" , 2 , false , true , 1000 , socketReadTimeout , true , 1000 , 5000 , true , false , 1000 , 100 , 2 , OrderPolicy . THREAD , null , transportFilters ) ) ; doDestroyAndVerifyGatewaySender ( "ln" , null , null , "testCreateDestroyGatewaySenderWithGatewayTransportFilters" , Arrays . asList ( vm3 , vm4 , vm5 ) , 5 , false ) ; }
GatewaySender with given attribute values and transport filters.
GatewaySender with given attribute values and transport filters .