Search in sources :

Example 16 with Builder

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

the class ServerLauncherTest method testSetAndGetEvictionHeapPercentage.

@Test
public void testSetAndGetEvictionHeapPercentage() {
    Builder builder = new Builder();
    assertNull(builder.getEvictionHeapPercentage());
    assertSame(builder, builder.setEvictionHeapPercentage(55.55f));
    assertEquals(55.55f, builder.getEvictionHeapPercentage().floatValue(), 0.0f);
    assertSame(builder, builder.setEvictionHeapPercentage(null));
    assertNull(builder.getEvictionHeapPercentage());
}
Also used : Builder(org.apache.geode.distributed.ServerLauncher.Builder) UnitTest(org.apache.geode.test.junit.categories.UnitTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

Example 17 with Builder

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

the class ServerLauncherTest method testStartCacheServerWithExistingCacheServer.

@Test
public void testStartCacheServerWithExistingCacheServer() 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.singletonList(mockCacheServer)));
        }
    });
    final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(false).build();
    assertNotNull(serverLauncher);
    assertEquals("serverOne", serverLauncher.getMemberName());
    assertFalse(serverLauncher.isDisableDefaultServer());
    serverLauncher.startCacheServer(mockCache);
}
Also used : Expectations(org.jmock.Expectations) Builder(org.apache.geode.distributed.ServerLauncher.Builder) CacheServer(org.apache.geode.cache.server.CacheServer) Cache(org.apache.geode.cache.Cache) UnitTest(org.apache.geode.test.junit.categories.UnitTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

Example 18 with Builder

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

the class ServerLauncherTest method testSetAndGetMemberName.

@Test
public void testSetAndGetMemberName() {
    Builder builder = new Builder();
    assertNull(builder.getMemberName());
    assertSame(builder, builder.setMemberName("serverOne"));
    assertEquals("serverOne", builder.getMemberName());
}
Also used : Builder(org.apache.geode.distributed.ServerLauncher.Builder) UnitTest(org.apache.geode.test.junit.categories.UnitTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

Example 19 with Builder

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

the class ServerLauncherTest method testStartCacheServerWhenDefaultServerDisabled.

@Test
public void testStartCacheServerWhenDefaultServerDisabled() throws IOException {
    final Cache mockCache = mockContext.mock(Cache.class, "Cache");
    mockContext.checking(new Expectations() {

        {
            oneOf(mockCache).getCacheServers();
            will(returnValue(Collections.emptyList()));
        }
    });
    final ServerLauncher serverLauncher = new Builder().setMemberName("serverOne").setDisableDefaultServer(true).build();
    assertNotNull(serverLauncher);
    assertEquals("serverOne", serverLauncher.getMemberName());
    assertTrue(serverLauncher.isDisableDefaultServer());
    serverLauncher.startCacheServer(mockCache);
}
Also used : Expectations(org.jmock.Expectations) Builder(org.apache.geode.distributed.ServerLauncher.Builder) Cache(org.apache.geode.cache.Cache) UnitTest(org.apache.geode.test.junit.categories.UnitTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test)

Example 20 with Builder

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

the class ServerLauncherTest method testSetAndGetMaxMessageCount.

@Test
public void testSetAndGetMaxMessageCount() {
    Builder builder = new Builder();
    assertNull(builder.getMaxMessageCount());
    assertSame(builder, builder.setMaxMessageCount(50));
    assertEquals(50, builder.getMaxMessageCount().intValue());
    assertSame(builder, builder.setMaxMessageCount(null));
    assertNull(builder.getMaxMessageCount());
}
Also used : Builder(org.apache.geode.distributed.ServerLauncher.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.ServerLauncher.Builder)56 Test (org.junit.Test)56 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)31 UnitTest (org.apache.geode.test.junit.categories.UnitTest)29 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)27 File (java.io.File)18 Cache (org.apache.geode.cache.Cache)14 Expectations (org.jmock.Expectations)12 ServerState (org.apache.geode.distributed.ServerLauncher.ServerState)11 ArrayList (java.util.ArrayList)4 CacheServer (org.apache.geode.cache.server.CacheServer)4 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)3 FileNotFoundException (java.io.FileNotFoundException)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 BindException (java.net.BindException)2 Properties (java.util.Properties)2 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)2 RegionAttributesCreation (org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation)2 ProcessStreamReader (org.apache.geode.internal.process.ProcessStreamReader)2