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;
}
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));
}
Aggregations