use of org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig in project knox by apache.
the class AmbariServiceDiscoveryTest method testSingleClusterDiscovery.
@Test
public void testSingleClusterDiscovery() throws Exception {
final String discoveryAddress = "http://ambarihost:8080";
final String clusterName = "testCluster";
ServiceDiscovery sd = new TestAmbariServiceDiscovery(clusterName);
GatewayConfig gc = EasyMock.createNiceMock(GatewayConfig.class);
EasyMock.replay(gc);
ServiceDiscoveryConfig sdc = EasyMock.createNiceMock(ServiceDiscoveryConfig.class);
EasyMock.expect(sdc.getAddress()).andReturn(discoveryAddress).anyTimes();
EasyMock.expect(sdc.getUser()).andReturn(null).anyTimes();
EasyMock.replay(sdc);
ServiceDiscovery.Cluster cluster = sd.discover(gc, sdc, clusterName);
assertNotNull(cluster);
assertEquals(clusterName, cluster.getName());
assertTrue(AmbariCluster.class.isAssignableFrom(cluster.getClass()));
assertEquals(6, ((AmbariCluster) cluster).getComponents().size());
// printServiceURLs(cluster);
}
Aggregations