use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testSetAndGetMaxThreads.
@Test
public void testSetAndGetMaxThreads() {
Builder builder = new Builder();
assertNull(builder.getMaxThreads());
assertSame(builder, builder.setMaxThreads(16));
assertEquals(16, builder.getMaxThreads().intValue());
assertSame(builder, builder.setMaxThreads(null));
assertNull(builder.getMaxThreads());
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testParseMemberName.
@Test
public void testParseMemberName() {
Builder builder = new Builder();
assertNull(builder.getMemberName());
builder.parseMemberName((String[]) null);
assertNull(builder.getMemberName());
// empty String array
builder.parseMemberName();
assertNull(builder.getMemberName());
builder.parseMemberName(Command.START.getName(), "--opt", "-o");
assertNull(builder.getMemberName());
builder.parseMemberName("memberOne");
assertEquals("memberOne", builder.getMemberName());
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testSetServerBindAddressToLocalHost.
@Test
public void testSetServerBindAddressToLocalHost() throws Exception {
String host = InetAddress.getLocalHost().getHostName();
new Builder().setServerBindAddress(host);
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testStartCacheServer.
@Test
public void testStartCacheServer() throws IOException {
final Cache mockCache = mockContext.mock(Cache.class, "Cache");
final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getCacheServers();
will(returnValue(Collections.emptyList()));
oneOf(mockCache).addCacheServer();
will(returnValue(mockCacheServer));
oneOf(mockCacheServer).setBindAddress(with(aNull(String.class)));
oneOf(mockCacheServer).setPort(with(equal(11235)));
oneOf(mockCacheServer).start();
}
});
final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setServerBindAddress(null).setServerPort(11235).setDisableDefaultServer(false).build();
assertNotNull(serverLauncher);
assertEquals("serverOne", serverLauncher.getMemberName());
assertFalse(serverLauncher.isDisableDefaultServer());
serverLauncher.startCacheServer(mockCache);
}
use of org.apache.geode.distributed.ServerLauncher.Builder in project geode by apache.
the class ServerLauncherTest method testIsWaiting.
@Test
public void testIsWaiting() {
final Cache mockCache = mockContext.mock(Cache.class, "Cache");
final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getDistributedSystem();
will(returnValue(mockDistributedSystem));
oneOf(mockDistributedSystem).isConnected();
will(returnValue(true));
}
});
final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").build();
assertNotNull(serverLauncher);
assertEquals("serverOne", serverLauncher.getMemberName());
serverLauncher.running.set(true);
assertTrue(serverLauncher.isRunning());
assertTrue(serverLauncher.isWaiting(mockCache));
}
Aggregations