Search in sources :

Example 6 with ApiConfigList

use of com.cloudera.api.swagger.model.ApiConfigList in project knox by apache.

the class AbstractCMDiscoveryTest method createApiConfigListMock.

protected static ApiConfigList createApiConfigListMock(final Map<String, String> configProps) {
    ApiConfigList configList = EasyMock.createNiceMock(ApiConfigList.class);
    EasyMock.expect(configList.getItems()).andReturn(createMockApiConfigs(configProps)).anyTimes();
    EasyMock.replay(configList);
    return configList;
}
Also used : ApiConfigList(com.cloudera.api.swagger.model.ApiConfigList)

Example 7 with ApiConfigList

use of com.cloudera.api.swagger.model.ApiConfigList in project knox by apache.

the class ClouderaManagerServiceDiscoveryRepositoryTest method testAddRoleConfig.

@Test
public void testAddRoleConfig() throws Exception {
    final String serviceName = "HDFS-1";
    final String roleName = "NAMENODE-1";
    final String roleConfigName = "myRoleConfig";
    final String roleConfigValue = "myRoleConfigValue";
    repository.registerCluster(serviceDiscoveryConfig);
    final ApiService service = EasyMock.createNiceMock(ApiService.class);
    EasyMock.expect(service.getName()).andReturn(serviceName).anyTimes();
    final ApiRole role = EasyMock.createNiceMock(ApiRole.class);
    EasyMock.expect(role.getName()).andReturn(roleName).anyTimes();
    final ApiRoleList roles = EasyMock.createNiceMock(ApiRoleList.class);
    EasyMock.expect(roles.getItems()).andReturn(Collections.singletonList(role)).anyTimes();
    final ApiConfig roleConfig = EasyMock.createNiceMock(ApiConfig.class);
    EasyMock.expect(roleConfig.getName()).andReturn(roleConfigName).anyTimes();
    EasyMock.expect(roleConfig.getValue()).andReturn(roleConfigValue).anyTimes();
    final ApiConfigList roleConfigs = EasyMock.createNiceMock(ApiConfigList.class);
    EasyMock.expect(roleConfigs.getItems()).andReturn(Collections.singletonList(roleConfig)).anyTimes();
    EasyMock.replay(service, role, roles, roleConfig, roleConfigs);
    assertFalse(containsRoleConfig(service, role, roleConfigName, roleConfigValue));
    repository.addService(serviceDiscoveryConfig, service);
    repository.addRoles(serviceDiscoveryConfig, service, roles);
    repository.addRoleConfigs(serviceDiscoveryConfig, service, role, roleConfigs);
    assertTrue(containsRoleConfig(service, role, roleConfigName, roleConfigValue));
}
Also used : ApiRole(com.cloudera.api.swagger.model.ApiRole) ApiConfigList(com.cloudera.api.swagger.model.ApiConfigList) ApiService(com.cloudera.api.swagger.model.ApiService) ApiRoleList(com.cloudera.api.swagger.model.ApiRoleList) ApiConfig(com.cloudera.api.swagger.model.ApiConfig) Test(org.junit.Test)

Aggregations

ApiConfigList (com.cloudera.api.swagger.model.ApiConfigList)7 ApiRole (com.cloudera.api.swagger.model.ApiRole)4 ApiRoleList (com.cloudera.api.swagger.model.ApiRoleList)4 ApiService (com.cloudera.api.swagger.model.ApiService)3 ApiServiceConfig (com.cloudera.api.swagger.model.ApiServiceConfig)3 RolesResourceApi (com.cloudera.api.swagger.RolesResourceApi)2 ServicesResourceApi (com.cloudera.api.swagger.ServicesResourceApi)2 ApiException (com.cloudera.api.swagger.client.ApiException)2 ApiConfig (com.cloudera.api.swagger.model.ApiConfig)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ApiClient (com.cloudera.api.swagger.client.ApiClient)1 ApiServiceList (com.cloudera.api.swagger.model.ApiServiceList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 GatewayConfig (org.apache.knox.gateway.config.GatewayConfig)1 ServiceDiscovery (org.apache.knox.gateway.topology.discovery.ServiceDiscovery)1 ServiceDiscoveryConfig (org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig)1 DiscoveryApiClient (org.apache.knox.gateway.topology.discovery.cm.DiscoveryApiClient)1