aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/clamp/clds
diff options
context:
space:
mode:
authorVidyashree-Huawei <vidyashree.rama@huawei.com>2020-01-22 17:25:46 +0530
committerVidyashree-Huawei <vidyashree.rama@huawei.com>2020-01-29 14:40:39 +0530
commit4593656e1f168c067e2a37389aeaa67889c1c173 (patch)
tree3f78537a494fb32b3aed1e32e74c79887839219b /src/test/java/org/onap/clamp/clds
parent33fc823baeda6d4e872614b146ab865823a3ca0f (diff)
Create a camel route that would retrieve all the DCAE blueprints
Retreive all the DCAE blueprints and update DcaeInventoryCache Change-Id: Ia03a89c1871119a208094c014e5cb8aa8b4f71d3 Issue-ID: CLAMP-573 Signed-off-by: Vidyashree-Huawei <vidyashree.rama@huawei.com>
Diffstat (limited to 'src/test/java/org/onap/clamp/clds')
-rw-r--r--src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java (renamed from src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTest.java)47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTest.java b/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java
index 26cc831e..50da4004 100644
--- a/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponseCacheTestItCase.java
@@ -24,14 +24,31 @@
package org.onap.clamp.clds.model.dcae;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.ExchangeBuilder;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.clamp.clds.Application;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
-public class DcaeInventoryResponseCacheTest {
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class DcaeInventoryResponseCacheTestItCase {
public static DcaeInventoryCache inventoryCache = new DcaeInventoryCache();
+ @Autowired
+ CamelContext camelContext;
+
/**
* Initialize the responses.
*/
@@ -78,4 +95,32 @@ public class DcaeInventoryResponseCacheTest {
}
}
+ @Test
+ public void testDcaeInventoryResponse() {
+ Exchange exchange = ExchangeBuilder.anExchange(camelContext).build();
+ Exchange exchangeResponse = camelContext.createProducerTemplate()
+ .send("direct:get-all-dcae-blueprint-inventory", exchange);
+ assertThat(exchangeResponse.getIn().getHeader("CamelHttpResponseCode")).isEqualTo(200);
+ Set<DcaeInventoryResponse> blueprint = inventoryCache.getAllBlueprintsPerLoopId("testAsdcServiceId");
+ assertThat(blueprint.size()).isEqualTo(2);
+
+ DcaeInventoryResponse response1 = new DcaeInventoryResponse();
+ response1.setAsdcResourceId("0");
+ response1.setTypeName("testTypeName");
+ response1.setAsdcServiceId("testAsdcServiceId");
+ response1.setBlueprintTemplate("testBlueprintTemplate");
+ response1.setTypeId("testtypeId");
+ DcaeInventoryResponse response2 = new DcaeInventoryResponse();
+ response2.setAsdcResourceId("1");
+ response2.setTypeName("testTypeName2");
+ response2.setAsdcServiceId("testAsdcServiceId");
+ response2.setBlueprintTemplate("testBlueprintTemplate2");
+ response2.setTypeId("testtypeId2");
+
+ Set<DcaeInventoryResponse> expectedBlueprint = new HashSet<>();
+ expectedBlueprint.add(response1);
+ expectedBlueprint.add(response2);
+
+ assertEquals(blueprint, expectedBlueprint);
+ }
}