use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testSetAndGetCommand.
@Test
public void testSetAndGetCommand() {
Builder builder = new Builder();
assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
assertSame(builder, builder.setCommand(Command.STATUS));
assertEquals(Command.STATUS, builder.getCommand());
assertSame(builder, builder.setCommand(null));
assertEquals(Builder.DEFAULT_COMMAND, builder.getCommand());
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testSetAndGetSocketBufferSize.
@Test
public void testSetAndGetSocketBufferSize() {
Builder builder = new Builder();
assertNull(builder.getSocketBufferSize());
assertSame(builder, builder.setSocketBufferSize(32768));
assertEquals(32768, builder.getSocketBufferSize().intValue());
assertSame(builder, builder.setSocketBufferSize(null));
assertNull(builder.getSocketBufferSize());
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherIntegrationTest method testBuildWithNoMemberNameOnStart.
@Test
public void testBuildWithNoMemberNameOnStart() throws Exception {
// given: gemfire.properties with no name
useGemFirePropertiesFileInTemporaryFolder(DistributionConfig.GEMFIRE_PREFIX + "properties", new Properties());
// when: no MemberName is specified
when(new Builder().setCommand(Command.START)).build();
// then: throw IllegalStateException
then(caughtException()).isExactlyInstanceOf(IllegalStateException.class).hasMessage(LocalizedStrings.Launcher_Builder_MEMBER_NAME_VALIDATION_ERROR_MESSAGE.toLocalizedString("Server"));
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherIntegrationTest method testBuilderSetWorkingDirectoryToNonExistingDirectory.
@Test
public void testBuilderSetWorkingDirectoryToNonExistingDirectory() {
// when: setting WorkingDirectory to non-existing directory
when(new Builder()).setWorkingDirectory("/path/to/non_existing/directory");
// then: throw IllegalArgumentException
then(caughtException()).hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_NOT_FOUND_ERROR_MESSAGE.toLocalizedString("Server")).hasCause(new FileNotFoundException("/path/to/non_existing/directory"));
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherIntegrationTest method testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart.
@Test
public void testBuildSetWorkingDirectoryToNonCurrentDirectoryOnStart() throws Exception {
// given: using ServerLauncher in-process
// when: setting WorkingDirectory to non-current directory
when(new Builder().setCommand(Command.START).setMemberName("serverOne").setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath())).build();
// then: throw IllegalStateException
then(caughtException()).isExactlyInstanceOf(IllegalStateException.class).hasMessage(LocalizedStrings.Launcher_Builder_WORKING_DIRECTORY_OPTION_NOT_VALID_ERROR_MESSAGE.toLocalizedString("Server"));
}
Aggregations