From 276117aaa383b16a0b62e2666a612e669b8f27c8 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Thu, 12 Aug 2021 09:14:21 +0100 Subject: Support models extending models Signed-off-by: MichaelMorris Issue-ID: SDC-3668 Change-Id: Iad4d2a28c1c982e55e8835d4f30a9a212aefb6be --- .../openecomp/sdc/be/servlets/ArchiveEndpointTest.java | 2 +- .../org/openecomp/sdc/be/servlets/ModelServletTest.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'catalog-be/src') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java index faede3d9c5..8a15f473c9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java @@ -264,7 +264,7 @@ class ArchiveEndpointTest extends JerseyTest { @Bean ModelOperation modelOperation() { - return new ModelOperation(null, null, null); + return new ModelOperation(null, null, null, null); } private void initGraphForTest() { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java index e40124fff4..4e1c0e7945 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java @@ -199,6 +199,21 @@ class ModelServletTest extends JerseyTest { .post(Entity.entity(formDataMultiPart, MediaType.MULTIPART_FORM_DATA)); assertEquals(Status.OK.getStatusCode(), response.getStatus()); } + + @Test + void createModelWithDerivedFromSuccessTest() throws JsonProcessingException { + when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200); + when(componentsUtils.getResponseFormat(ActionStatus.CREATED)).thenReturn(responseFormat); + when(modelBusinessLogic.createModel(any(Model.class))).thenReturn(model); + ModelCreateRequest derviedModelCreateRequest = new ModelCreateRequest(); + derviedModelCreateRequest.setName("derivedModel"); + derviedModelCreateRequest.setDerivedFrom(model.getName()); + final FormDataMultiPart formDataMultiPart = buildCreateFormDataMultiPart(new byte[0], parseToJsonString(derviedModelCreateRequest)); + final var response = target(rootPath.toString()).request(MediaType.APPLICATION_JSON) + .header(Constants.USER_ID_HEADER, USER_ID) + .post(Entity.entity(formDataMultiPart, MediaType.MULTIPART_FORM_DATA)); + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + } @Test void createModelFailTest() throws JsonProcessingException { -- cgit 1.2.3-korg