From 7a8dd82a9d97c36cdf2491b41a41a8fef794be63 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Fri, 4 Oct 2019 16:29:52 -0400 Subject: Fix issue where user cannot create a recipe via Fix issue where user cannot create a recipe via rest Issue-ID: SO-2394 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ia21131a1179cbba2652aae30451a25a90ac00e51 --- .../catalogdb/catalogrest/CatalogDBRestTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'adapters') diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index e1cca8901e..347bce5b17 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -37,6 +37,7 @@ import org.json.JSONException; import org.junit.Test; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; +import org.onap.so.db.catalog.beans.ServiceRecipe; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -52,6 +53,8 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules"; + private static final String SERVICE_RECIPE = "serviceRecipe"; + private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES = "ecomp/mso/catalog/v2/serviceAllottedResources"; @@ -839,6 +842,25 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { } } + @Test + public void testCreateServiceRecipe() throws JSONException { + ServiceRecipe recipe = new ServiceRecipe(); + recipe.setAction("action"); + recipe.setDescription("description"); + recipe.setOrchestrationUri("http://test"); + recipe.setRecipeTimeout(120); + recipe.setServiceModelUUID(serviceUUID); + HttpEntity entity = new HttpEntity(recipe, headers); + headers.set("Accept", MediaType.APPLICATION_JSON); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(SERVICE_RECIPE)); + + ResponseEntity response = + restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class); + + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value()); + } + private String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } -- cgit 1.2.3-korg