diff options
author | sebdet <sd378r@intl.att.com> | 2018-09-21 17:46:12 +0200 |
---|---|---|
committer | sebdet <sd378r@intl.att.com> | 2018-09-21 17:46:12 +0200 |
commit | ac3eeb30f40a225372c67cb33fe3396cf44770e4 (patch) | |
tree | 56ada2506f9e38776e476b9aab923d30b1e8c151 /src/test/java/org/onap | |
parent | 4aea6da2620cf887fac4cd1158374174f6fc9152 (diff) |
Add delete test
Add a test and fix the delete model code that was not working
Issue-ID: CLAMP-217
Change-Id: I235200ee0e7dc25ed759b88568333882bfb90c50
Signed-off-by: sebdet <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java index 9cca936c8..7a37a9dc2 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import com.att.aft.dme2.internal.apache.commons.lang.RandomStringUtils; @@ -39,6 +40,7 @@ import java.util.List; import java.util.Properties; import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.NotFoundException; import javax.xml.transform.TransformerException; import org.apache.commons.codec.DecoderException; @@ -214,6 +216,27 @@ public class CldsServiceItCase { assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus())); assertTrue(CldsModel.STATUS_ACTIVE.equals(cldsService.getModel(randomNameModel).getStatus())); + responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_STOP, + randomNameModel, "false", cldsService.getModel(randomNameModel)); + assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); + assertNotNull(responseEntity.getBody()); + assertTrue(CldsModel.STATUS_STOPPED.equals(((CldsModel) responseEntity.getBody()).getStatus())); + assertTrue(CldsModel.STATUS_STOPPED.equals(cldsService.getModel(randomNameModel).getStatus())); + + responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_RESTART, + randomNameModel, "false", cldsService.getModel(randomNameModel)); + assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); + assertNotNull(responseEntity.getBody()); + assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus())); + assertTrue(CldsModel.STATUS_ACTIVE.equals(cldsService.getModel(randomNameModel).getStatus())); + + responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_UPDATE, + randomNameModel, "false", cldsService.getModel(randomNameModel)); + assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); + assertNotNull(responseEntity.getBody()); + assertTrue(CldsModel.STATUS_ACTIVE.equals(((CldsModel) responseEntity.getBody()).getStatus())); + assertTrue(CldsModel.STATUS_ACTIVE.equals(cldsService.getModel(randomNameModel).getStatus())); + responseEntity = cldsService.unDeployModel(randomNameModel, cldsService.getModel(randomNameModel)); assertNotNull(responseEntity); assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); @@ -221,6 +244,22 @@ public class CldsServiceItCase { assertTrue(CldsModel.STATUS_DISTRIBUTED.equals(((CldsModel) responseEntity.getBody()).getStatus())); assertTrue(CldsModel.STATUS_DISTRIBUTED.equals(cldsService.getModel(randomNameModel).getStatus())); + responseEntity = cldsService.putModelAndProcessAction(CldsEvent.ACTION_DELETE, + randomNameModel, "false", cldsService.getModel(randomNameModel)); + assertNotNull(responseEntity); + assertTrue(responseEntity.getStatusCode().equals(HttpStatus.OK)); + assertNotNull(responseEntity.getBody()); + try { + cldsService.getModel(randomNameModel); + fail("Should have raised an NotFoundException exception"); + } catch(NotFoundException ne) { + + } + + } + + @Test + public void testDcaePost() { DcaeEvent dcaeEvent = new DcaeEvent(); dcaeEvent.setArtifactName("ClosedLoop_with-enough-characters_TestArtifact.yml"); dcaeEvent.setEvent(DcaeEvent.EVENT_CREATED); |