Search in sources :

Example 6 with ServiceDiscoveryConfig

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);
}
Also used : ServiceDiscoveryConfig(org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig) ServiceDiscovery(org.apache.knox.gateway.topology.discovery.ServiceDiscovery) GatewayConfig(org.apache.knox.gateway.config.GatewayConfig) Test(org.junit.Test)

Aggregations

ServiceDiscoveryConfig (org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig)6 GatewayConfig (org.apache.knox.gateway.config.GatewayConfig)3 ServiceDiscovery (org.apache.knox.gateway.topology.discovery.ServiceDiscovery)3 Test (org.junit.Test)3 File (java.io.File)2 Properties (java.util.Properties)2 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1