diff options
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/HttpTaskProducerTest.java')
-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); |