use of io.cdap.common.http.ObjectResponse in project cdap by caskdata.
the class DatasetTypeHandlerTest method verifyAll.
private void verifyAll(Set<DatasetModuleMeta> expectedModules, Map<String, List<String>> typeDependencies) throws IOException {
Set<DatasetModuleMeta> actualModules = new HashSet<>(getModules().getResponseObject());
Assert.assertEquals(expectedModules, actualModules);
for (DatasetModuleMeta expectedModule : expectedModules) {
ObjectResponse<DatasetModuleMeta> response = getModule(expectedModule.getName());
Assert.assertEquals(HttpStatus.SC_OK, response.getResponseCode());
Assert.assertEquals(expectedModule, response.getResponseObject());
for (String type : expectedModule.getTypes()) {
ObjectResponse<DatasetTypeMeta> typeResponse = getType(type);
Assert.assertEquals(HttpStatus.SC_OK, typeResponse.getResponseCode());
verify(typeResponse.getResponseObject(), type, typeDependencies.get(type));
}
}
List<DatasetTypeMeta> actualTypes = getTypes().getResponseObject();
Assert.assertEquals(actualTypes.size(), typeDependencies.size());
Assert.assertTrue(Iterables.elementsEqual(typeDependencies.keySet(), actualTypes.stream().map(input -> input == null ? null : input.getName()).collect(Collectors.toList())));
for (DatasetTypeMeta typeMeta : actualTypes) {
verify(typeMeta, typeMeta.getName(), typeDependencies.get(typeMeta.getName()));
}
}
Aggregations