aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
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 {