Search in sources :

Example 41 with Builder

use of org.apache.geode.distributed.LocatorLauncher.Builder in project geode by apache.

the class LocatorLauncherIntegrationTest method testBuilderParseArgumentsWithValuesSeparatedWithCommas.

@Test
public void testBuilderParseArgumentsWithValuesSeparatedWithCommas() throws Exception {
    // given: a new builder and working directory
    String expectedWorkingDirectory = this.temporaryFolder.getRoot().getCanonicalPath();
    Builder builder = new Builder();
    // when: parsing many arguments
    builder.parseArguments("start", "memberOne", "--bind-address", InetAddress.getLocalHost().getHostAddress(), "--dir", expectedWorkingDirectory, "--hostname-for-clients", "Tucows", "--pid", "1234", "--port", "11235", "--redirect-output", "--force", "--debug");
    // then: the getters should return properly parsed values
    assertThat(builder.getCommand()).isEqualTo(Command.START);
    assertThat(builder.getBindAddress()).isEqualTo(InetAddress.getLocalHost());
    assertThat(builder.getWorkingDirectory()).isEqualTo(expectedWorkingDirectory);
    assertThat(builder.getHostnameForClients()).isEqualTo("Tucows");
    assertThat(builder.getPid().intValue()).isEqualTo(1234);
    assertThat(builder.getPort().intValue()).isEqualTo(11235);
    assertThat(builder.getRedirectOutput()).isTrue();
    assertThat(builder.getForce()).isTrue();
    assertThat(builder.getDebug()).isTrue();
}
Also used : Builder(org.apache.geode.distributed.LocatorLauncher.Builder) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 42 with Builder

use of org.apache.geode.distributed.LocatorLauncher.Builder in project geode by apache.

the class LocatorLauncherTest method testBuildWithMemberNameSetInApiPropertiesOnStart.

@Test
public void testBuildWithMemberNameSetInApiPropertiesOnStart() {
    LocatorLauncher launcher = new Builder().setCommand(LocatorLauncher.Command.START).set(NAME, "locatorABC").build();
    assertThat(launcher).isNotNull();
    assertEquals(LocatorLauncher.Command.START, launcher.getCommand());
    assertNull(launcher.getMemberName());
    assertEquals("locatorABC", launcher.getProperties().getProperty(NAME));
}
Also used : Builder(org.apache.geode.distributed.LocatorLauncher.Builder) UnitTest(org.apache.geode.test.junit.categories.UnitTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

Aggregations

Builder (org.apache.geode.distributed.LocatorLauncher.Builder)42 Test (org.junit.Test)40 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)26 File (java.io.File)21 LocatorState (org.apache.geode.distributed.LocatorLauncher.LocatorState)13 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)13 UnitTest (org.apache.geode.test.junit.categories.UnitTest)10 ArrayList (java.util.ArrayList)5 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)4 LocatorLauncher (org.apache.geode.distributed.LocatorLauncher)3 FileNotFoundException (java.io.FileNotFoundException)2 BindException (java.net.BindException)2 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Properties (java.util.Properties)2 Set (java.util.Set)2 DistributionManager (org.apache.geode.distributed.internal.DistributionManager)2 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)2 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)2