use of org.onap.so.db.catalog.beans.NetworkRecipe in project so by onap.
the class NetworkRestHandler method findNetworkRecipe.
public Recipe findNetworkRecipe(String action) throws NoRecipeException {
String modelName = "GR-API-DEFAULT";
NetworkRecipe recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action);
if (recipe == null) {
throw new NoRecipeException(String.format("Unable to locate default recipe for, Action: %s, Model Name: %s", action, modelName));
}
return recipe;
}
use of org.onap.so.db.catalog.beans.NetworkRecipe in project so by onap.
the class QueryResourceRecipeTest method convertToJsonEmptyRecipe.
@Test
public void convertToJsonEmptyRecipe() {
QueryResourceRecipe vnfQueryRR = new QueryResourceRecipe(new VnfRecipe());
QueryResourceRecipe networkQueryRR = new QueryResourceRecipe(new NetworkRecipe());
QueryResourceRecipe arQueryRR = new QueryResourceRecipe(new ArRecipe());
String expected = "{\"orchestrationUri\":\"\",\"action\":\"\",\"description\":\"\",\"id\":\"\",\"recipeTimeout\":\"\",\"paramXSD\":\"\"}";
assertEquals(expected, vnfQueryRR.JSON2(false, false));
assertEquals(expected, networkQueryRR.JSON2(false, false));
assertEquals(expected, arQueryRR.JSON2(false, false));
}
use of org.onap.so.db.catalog.beans.NetworkRecipe in project so by onap.
the class CatalogDbClient method postNetworkRecipe.
public void postNetworkRecipe(NetworkRecipe recipe) {
try {
HttpHeaders headers = getHttpHeaders();
HttpEntity<NetworkRecipe> entity = new HttpEntity<>(recipe, headers);
restTemplate.exchange(UriComponentsBuilder.fromUriString(endpoint + "/networkRecipe").build().encode().toString(), HttpMethod.POST, entity, NetworkRecipe.class).getBody();
} catch (HttpClientErrorException e) {
if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
throw new EntityNotFoundException("Unable to find NetworkRecipe with Id: " + recipe.getId());
}
throw e;
}
}
Aggregations