diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-11-27 15:12:27 +0200 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-11-27 15:30:22 +0200 |
commit | fcd1fc097076c19ae6d0855d73813d7ed5cea911 (patch) | |
tree | 6e11e3c28213f78f0017a95cc1bf8596a9e5fd3a /openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http | |
parent | d8906a0cc7fcc302020e983fdfade2758663ba4d (diff) |
Improved notification on item archive/restore
Addressed code review comments, added unit-tests.
Change-Id: I2a74e9969540cb636658aa012f82a81e0fd2eac2
Issue-ID: SDC-1667
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http')
-rw-r--r-- | openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http/HttpTaskProducerTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http/HttpTaskProducerTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http/HttpTaskProducerTest.java index 3c12b37e6d..4d8a1103b8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http/HttpTaskProducerTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/services/catalog/notification/http/HttpTaskProducerTest.java @@ -17,11 +17,16 @@ package org.openecomp.sdcrests.item.rest.services.catalog.notification.http; import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import java.util.HashSet; +import java.util.Set; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.openecomp.sdcrests.item.rest.services.catalog.notification.EntryNotConfiguredException; +import org.openecomp.sdcrests.item.types.ItemAction; /** * @author evitaliy @@ -33,6 +38,30 @@ public class HttpTaskProducerTest { public ExpectedException exception = ExpectedException.none(); @Test + public void uniquePathExistsForEveryAction() { + + ItemAction[] availableActions = ItemAction.values(); + Set<String> collectedPaths = new HashSet<>(availableActions.length); + for (ItemAction action : availableActions) { + String path = HttpTaskProducer.getApiPath(action); + assertFalse("Path empty for action '" + action.name() + "'", path == null || path.isEmpty()); + collectedPaths.add(path); + } + + assertEquals("Paths not unique for some actions", availableActions.length, collectedPaths.size()); + } + + @Test + public void restorePathEqualsRestored() { + assertEquals("restored", HttpTaskProducer.getApiPath(ItemAction.RESTORE)); + } + + @Test + public void archivePathEqualsArchived() { + assertEquals("archived", HttpTaskProducer.getApiPath(ItemAction.ARCHIVE)); + } + + @Test public void errorWhenProtocolNotDefined() { HttpConfiguration config = mockConfiguration(); config.setCatalogBeProtocol(null); |