summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-08-12 09:14:21 +0100
committerAnderson Ribeiro <anderson.ribeiro@est.tech>2021-08-13 18:53:24 +0000
commit276117aaa383b16a0b62e2666a612e669b8f27c8 (patch)
tree6e34078c50b768569bf97ebb8ae578c8ac9d5e0a /catalog-be/src/test
parentb8bfef3a009922db72c1a618211ce03c07683e58 (diff)
Support models extending models
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3668 Change-Id: Iad4d2a28c1c982e55e8835d4f30a9a212aefb6be
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java15
2 files changed, 16 insertions, 1 deletions
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 {