use of org.apache.knox.gateway.ha.provider.HaDescriptor in project knox by apache.
the class HaDescriptorManagerTest method testDescriptorDefaults.
@Test
public void testDescriptorDefaults() throws IOException {
String xml = "<ha><service name='foo'/></ha>";
ByteArrayInputStream inputStream = new ByteArrayInputStream(xml.getBytes());
HaDescriptor descriptor = HaDescriptorManager.load(inputStream);
assertNotNull(descriptor);
assertEquals(1, descriptor.getEnabledServiceNames().size());
HaServiceConfig config = descriptor.getServiceConfig("foo");
assertNotNull(config);
assertEquals("foo", config.getServiceName());
assertEquals(HaServiceConfigConstants.DEFAULT_MAX_FAILOVER_ATTEMPTS, config.getMaxFailoverAttempts());
assertEquals(HaServiceConfigConstants.DEFAULT_FAILOVER_SLEEP, config.getFailoverSleep());
assertEquals(HaServiceConfigConstants.DEFAULT_MAX_RETRY_ATTEMPTS, config.getMaxRetryAttempts());
assertEquals(HaServiceConfigConstants.DEFAULT_RETRY_SLEEP, config.getRetrySleep());
assertEquals(HaServiceConfigConstants.DEFAULT_ENABLED, config.isEnabled());
}
Aggregations