SGF-322 - Add support for the newly added, retro 'max-connections' attribute on the <gfe:gateway-hub> element in the SDG XML namespace (XSD).

This commit is contained in:
John Blum
2015-02-25 18:32:52 -08:00
parent 4e3e8aa177
commit 17c9358547
7 changed files with 30 additions and 40 deletions

View File

@@ -94,6 +94,7 @@ public class GatewayHubNamespaceTest {
assertEquals("localhost", gatewayHub.getBindAddress());
assertEquals("TestGatewayHub", gatewayHub.getId());
assertTrue(gatewayHub.getManualStart());
assertEquals(125, gatewayHub.getMaxConnections());
assertEquals(5000, gatewayHub.getMaximumTimeBetweenPings());
assertEquals(45123, gatewayHub.getPort());
assertEquals(16384, gatewayHub.getSocketBufferSize());

View File

@@ -51,7 +51,7 @@ public class MockGatewayHubFactory extends AbstractMockerySupport {
private Boolean manualStart = GatewayHub.DEFAULT_MANUAL_START;
//private Integer maximumConnections = GatewayHub.DEFAULT_MAXIMUM_CONNECTIONS;
private Integer maximumConnections = GatewayHub.DEFAULT_MAX_CONNECTIONS;
private Integer maximumTimeBetweenPings = GatewayHub.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS;
private Integer socketBufferSize = GatewayHub.DEFAULT_SOCKET_BUFFER_SIZE;
@@ -94,20 +94,18 @@ public class MockGatewayHubFactory extends AbstractMockerySupport {
}
});
/*
doAnswer(new Answer<Void>() {
@Override public Void answer(final InvocationOnMock invocation) throws Throwable {
maximumConnections = invocation.getArgumentAt(0, Integer.class);
return null;
}
}).when(mockGatewayHub).setMaximumConnections(anyInt());
}).when(mockGatewayHub).setMaxConnections(anyInt());
when(mockGatewayHub.getMaximumConnections()).thenAnswer(new Answer<Integer>() {
when(mockGatewayHub.getMaxConnections()).thenAnswer(new Answer<Integer>() {
@Override public Integer answer(final InvocationOnMock invocation) throws Throwable {
return maximumConnections;
}
});
*/
doAnswer(new Answer<Void>() {
@Override public Void answer(final InvocationOnMock invocation) throws Throwable {

View File

@@ -97,7 +97,6 @@ public class GatewayHubFactoryBeanTest {
assertEquals(GatewayHub.DEFAULT_MANUAL_START, factoryBean.isManualStart(GatewayHub.DEFAULT_MANUAL_START));
}
/*
@Test
public void testSetAndGetMaxConnections() {
assertEquals(GatewayHub.DEFAULT_MAX_CONNECTIONS, factoryBean.getMaxConnections().intValue());
@@ -106,7 +105,6 @@ public class GatewayHubFactoryBeanTest {
factoryBean.setMaxConnections(null);
assertEquals(GatewayHub.DEFAULT_MAX_CONNECTIONS, factoryBean.getMaxConnections().intValue());
}
*/
@Test
public void testSetAndGetMaximumTimeBetweenPings() {
@@ -225,7 +223,7 @@ public class GatewayHubFactoryBeanTest {
factoryBean.setBindAddress("10.124.210.42");
factoryBean.setGateways(Arrays.asList(gatewayProxy));
factoryBean.setManualStart(false);
//factoryBean.setMaxConnections(50);
factoryBean.setMaxConnections(50);
factoryBean.setMaximumTimeBetweenPings(20480);
factoryBean.setName(gatewayHubName);
factoryBean.setPort(8484);
@@ -235,7 +233,7 @@ public class GatewayHubFactoryBeanTest {
verify(mockGatewayHub, times(1)).setBindAddress(eq("10.124.210.42"));
verify(mockGatewayHub, times(1)).setManualStart(eq(false));
//verify(mockGatewayHub, times(1)).setMaxConnections(eq(50));
verify(mockGatewayHub, times(1)).setMaxConnections(eq(50));
verify(mockGatewayHub, times(1)).setMaximumTimeBetweenPings(eq(20480));
verify(mockGatewayHub, times(1)).setSocketBufferSize(eq(4096));
verify(mockGatewayHub, times(1)).setStartupPolicy(eq(StartupPolicyType.PRIMARY.getName()));
@@ -305,6 +303,7 @@ public class GatewayHubFactoryBeanTest {
verify(mockGatewayHub, times(1)).setBindAddress(eq(GatewayHub.DEFAULT_BIND_ADDRESS));
verify(mockGatewayHub, times(1)).setManualStart(eq(GatewayHub.DEFAULT_MANUAL_START));
verify(mockGatewayHub, times(1)).setMaxConnections(GatewayHub.DEFAULT_MAX_CONNECTIONS);
verify(mockGatewayHub, times(1)).setMaximumTimeBetweenPings(eq(GatewayHub.DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS));
verify(mockGatewayHub, times(1)).setSocketBufferSize(eq(GatewayHub.DEFAULT_SOCKET_BUFFER_SIZE));
verify(mockGatewayHub, times(1)).setStartupPolicy(eq(GatewayHub.DEFAULT_STARTUP_POLICY));