summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-service/src/test
diff options
context:
space:
mode:
authorda490c <dave.adams@amdocs.com>2018-08-25 02:19:05 -0400
committerda490c <dave.adams@amdocs.com>2018-08-25 02:19:12 -0400
commitb889beb825c82c38d96b74bed2d6c98cb4e0cb53 (patch)
treea26d6148e5d894e81b5e4257af2281fbbacc7d8d /sparkybe-onap-service/src/test
parent70bc6523efb4736362497ee32d37fa29f0aa50f7 (diff)
implemented sparky graph extensibility
Add additional interface abstraction points to make it easier to extend and customize the graph logic, and made it easier to interwork with resources and gizmo via spring-bean wiring changes only. Issue-ID: AAI-1503 Change-Id: I5a3dcc81ecc49db89d71f0db27cffbb04c89fbd1 Signed-off-by: da490c <dave.adams@amdocs.com>
Diffstat (limited to 'sparkybe-onap-service/src/test')
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java292
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java53
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/SchemaVisualizationProcessorTest.java3
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/config/VisualizationConfigTest.java2
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/D3VisualizationOutputTest.java9
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/GraphMetaTest.java7
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/InlineMessageTest.java55
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContextTest.java1
-rw-r--r--sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContextTest.java1
9 files changed, 319 insertions, 104 deletions
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java
index 5c027da..d58bf42 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationContextTest.java
@@ -1,5 +1,295 @@
package org.onap.aai.sparky.viewandinspect;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.InputStream;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+
+import javax.inject.Inject;
+
+import org.eclipse.persistence.jaxb.JAXBContextProperties;
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
+import org.onap.aai.cl.mdc.MdcContext;
+import org.onap.aai.restclient.client.OperationResult;
+import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
+import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
+import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
+import org.onap.aai.sparky.sync.entity.SearchableEntity;
+import org.onap.aai.sparky.util.NodeUtils;
+import org.onap.aai.sparky.util.StringCollectionContainsMatcher;
+import org.onap.aai.sparky.util.TestResourceLoader;
+import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
+import org.onap.aai.sparky.viewandinspect.context.BaseVisualizationContext;
+import org.onap.aai.sparky.viewandinspect.entity.ActiveInventoryNode;
+import org.onap.aai.sparky.viewandinspect.entity.QueryParams;
+import org.onap.aai.sparky.viewandinspect.enumeration.NodeProcessingState;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@TestPropertySource(properties = {
+"schemaIngestPropLoc = src/test/resources/oxm-reader/schema-ingest-single-oxm.properties" })
+@ContextConfiguration(locations = { "classpath:oxm-reader/oxm-reader-bean.xml" })
+
+
public class BaseVisualizationContextTest {
-}
+ private static SecureRandom secureRandom = new SecureRandom();
+ private static Logger LOG =
+ LoggerFactory.getInstance().getLogger(BaseVisualizationContextTest.class);
+
+ private BaseVisualizationContext baseVisualizationContext;
+ private ExecutorService aaiExecutorService;
+ private VisualizationConfigs visualizationConfig;
+
+ private ActiveInventoryAdapter aaiAdapter;
+ private RestEndpointConfig aaiRestEndPointConfig;
+
+ @Inject
+ private OxmEntityLookup oxmEntityLookup;
+
+ @Before
+ public void init() throws Exception {
+
+ aaiExecutorService = NodeUtils.createNamedExecutor("SLNC-WORKER", 5, LOG);
+ visualizationConfig = new VisualizationConfigs();
+
+ ArrayList<String> shallowEntities = new ArrayList<String>();
+ shallowEntities.add("cloud-region");
+
+ visualizationConfig.setShallowEntities(shallowEntities);
+ visualizationConfig.setMaxSelfLinkTraversalDepth(2);
+
+
+ aaiAdapter = Mockito.mock(ActiveInventoryAdapter.class);
+
+ aaiRestEndPointConfig = new RestEndpointConfig();
+ aaiRestEndPointConfig.setNumRequestRetries(5);
+
+ Mockito.when(aaiAdapter.getEndpointConfig()).thenReturn(aaiRestEndPointConfig);
+
+ MdcContext.initialize("" + secureRandom.nextLong(), "AAI-UI", "", "partner-name",
+ "localhost:4242");
+
+ // all our resources are prefixed already, so the repairSelfLink shouldn't do anything to the link
+ Mockito.when(aaiAdapter.repairSelfLink(Matchers.contains(""))).thenReturn("");
+
+
+ }
+
+ private Matcher<List<String>> listContainsValue(String expectedValue) {
+ return new StringCollectionContainsMatcher(expectedValue);
+ }
+
+
+ @Test
+ public void validateBasicConstruction() throws Exception {
+
+ long contextId = secureRandom.nextLong();
+
+ baseVisualizationContext = new BaseVisualizationContext(contextId, aaiAdapter,
+ aaiExecutorService, visualizationConfig, oxmEntityLookup);
+
+ assertEquals(contextId, baseVisualizationContext.getContextId());
+
+ }
+
+ @Test
+ public void validateSmallGraphAssembly() throws Exception {
+
+ /**
+ * We have a tiny graph that we will validate assembly of:
+ *
+ * <li>customer -> tenant
+ * <li>customer -> service-subscription
+ * <li>service-subscription -> service-instance-1
+ * <li>service-subscription -> service-instance-2
+ *
+ * At the end of this success path, we should have 5 nodes in the node cache. Once we have this
+ * flow we can experiment with error paths involving resource download failures to ensure graph
+ * nodes are in the correct state and that expected nodes are successfully represented in the
+ * cache.
+ */
+
+ long contextId = secureRandom.nextLong();
+
+ baseVisualizationContext = new BaseVisualizationContext(contextId, aaiAdapter,
+ aaiExecutorService, visualizationConfig, oxmEntityLookup);
+
+ SearchableEntity searchableEntity = new SearchableEntity();
+ String customerSelfLink =
+ "https://server.proxy:8443/aai/v11/business/customers/customer/customer-4";
+ String customerNodeId = NodeUtils.generateUniqueShaDigest(customerSelfLink);
+
+ searchableEntity.setId(customerNodeId);
+ searchableEntity.setEntityType("customer");
+ searchableEntity.setEntityPrimaryKeyValue("customer-4");
+ searchableEntity.setLink(customerSelfLink);
+
+ QueryParams queryParams = new QueryParams();
+ queryParams.setSearchTargetNodeId(customerNodeId);
+ queryParams.setSearchTargetPrimaryKeyValues("customer-4");
+
+ // aai customer resource dip
+
+ Mockito
+ .when(aaiAdapter.queryActiveInventoryWithRetries(Matchers.contains("customer-4"),
+ Mockito.anyString(), Mockito.anyInt()))
+ .thenReturn(new OperationResult(200, TestResourceLoader
+ .getTestResourceDataJson("/sync/aai/aai-resources/customer/customer-4.json")));
+
+ // aai tenant resource dip
+
+ Mockito
+ .when(aaiAdapter.queryActiveInventoryWithRetries(Matchers.contains("tenant/tenant-1"),
+ Mockito.anyString(), Mockito.anyInt()))
+ .thenReturn(new OperationResult(200, TestResourceLoader
+ .getTestResourceDataJson("/sync/aai/aai-resources/tenant/tenant-1.json")));
+
+ // generic-queries for service-subscription
+
+ Mockito
+ .when(aaiAdapter.getGenericQueryForSelfLink(Matchers.contains("service-subscription"),
+ Matchers.argThat(
+ listContainsValue("service-subscription.service-type:service-subscription-2"))))
+ .thenReturn(
+ "https://server.proxy:8443/aai/v11/search/generic-query/service-subscription-2");
+
+ Mockito
+ .when(aaiAdapter.queryActiveInventoryWithRetries(
+ Matchers.contains("generic-query/service-subscription-2"), Mockito.anyString(),
+ Mockito.anyInt()))
+ .thenReturn(new OperationResult(200, TestResourceLoader.getTestResourceDataJson(
+ "/sync/aai/aai-traversal/generic-query/service-subscription/service-subscription-2.json")));
+
+ // generic-queries for service-instance-1
+
+ Mockito
+ .when(aaiAdapter.getGenericQueryForSelfLink(Matchers.contains("service-instance"),
+ Matchers.argThat(listContainsValue("service-instance-id:service-instance-54"))))
+ .thenReturn(
+ "https://server.proxy:8443/aai/v11/search/generic-query/service-instance-id/service-instance-54");
+
+ Mockito
+ .when(aaiAdapter.queryActiveInventoryWithRetries(
+ Matchers.contains("generic-query/service-instance-id/service-instance-54"),
+ Mockito.anyString(), Mockito.anyInt()))
+ .thenReturn(new OperationResult(200, TestResourceLoader.getTestResourceDataJson(
+ "/sync/aai/aai-traversal/generic-query/service-instance/service-instance-54.json")));
+
+ // generic-queries for service-instance-2
+
+ Mockito
+ .when(aaiAdapter.getGenericQueryForSelfLink(Matchers.contains("service-instance"),
+ Matchers.argThat(listContainsValue("service-instance-id:service-instance-55"))))
+ .thenReturn(
+ "https://server.proxy:8443/aai/v11/search/generic-query/service-instance-id/service-instance-55");
+
+ Mockito
+ .when(aaiAdapter.queryActiveInventoryWithRetries(
+ Matchers.contains("generic-query/service-instance-id/service-instance-55"),
+ Mockito.anyString(), Mockito.anyInt()))
+ .thenReturn(new OperationResult(200, TestResourceLoader.getTestResourceDataJson(
+ "/sync/aai/aai-traversal/generic-query/service-instance/service-instance-55.json")));
+
+
+
+ // start the test
+
+ baseVisualizationContext.processSelfLinks(searchableEntity, queryParams);
+
+ /*
+ * validation can be in the form of validating nodes + relationships from the node cache
+ * baseVisualizationContext.getNodeCache();
+ */
+
+ Map<String, ActiveInventoryNode> nodeCache = baseVisualizationContext.getNodeCache();
+
+ assertEquals(5, nodeCache.size());
+ assertNotNull(nodeCache.get(customerNodeId));
+ assertEquals("customer", nodeCache.get(customerNodeId).getEntityType());
+
+ // verify node collection nodes
+
+ ActiveInventoryNode customerNode =
+ nodeCache.get("da4101ad19b3c380a1c12ffeda8ab390e1489fb4a22a392c9a1939db63c3dec5");
+ ActiveInventoryNode ssNode =
+ nodeCache.get("f4ceaf19459993c4fc9438a7579dd20d786109f4455e38682c579045b7ae615e");
+ ActiveInventoryNode tenantNode =
+ nodeCache.get("4735439b29e446b339535668238076e4b392eaa3eec218936e12f735179bc55e");
+ ActiveInventoryNode s1 =
+ nodeCache.get("f975ab453b142197af5d0173e0a9cf2aa22d10502f8ad655c8d17de81b066e8f");
+ ActiveInventoryNode s2 =
+ nodeCache.get("de77ef8f76dd6f19662b163527ff839891b9596cac655e3143fdd7ad39e2e4e3");
+
+ assertNotNull(customerNode);
+ assertNotNull(ssNode);
+ assertNotNull(tenantNode);
+ assertNotNull(s1);
+ assertNotNull(s2);
+
+ // verify node depths
+
+ assertEquals(0, customerNode.getNodeDepth());
+ assertEquals(1, ssNode.getNodeDepth());
+
+ /*
+ * I think there is a bug in the way the node depth is represented due to the enforcement of
+ * bidirectional links being disabled. We may have to circle back to this behavior at some point
+ * and re-verify that the behavior works properly.
+ */
+
+ assertEquals(2, tenantNode.getNodeDepth());
+ assertEquals(2, s1.getNodeDepth());
+ assertEquals(2, s2.getNodeDepth());
+
+ // verify node states
+
+ assertEquals(NodeProcessingState.READY, customerNode.getState());
+ assertEquals(NodeProcessingState.READY, ssNode.getState());
+
+ /*
+ * these nodes have a NEIGHBORS_UNPROCESSED state because the max traversal depth was hit before
+ * processing all the nested relationships. I think what we should look at is advancing the
+ * state to READY if in fact there are no relationships to process, which I think could be the
+ * case sometimes.
+ */
+ assertEquals(NodeProcessingState.NEIGHBORS_UNPROCESSED, tenantNode.getState());
+ assertEquals(NodeProcessingState.NEIGHBORS_UNPROCESSED, s1.getState());
+ assertEquals(NodeProcessingState.NEIGHBORS_UNPROCESSED, s2.getState());
+
+ }
+
+ protected DynamicJAXBContext createVersionedOxm() {
+ Map<String, Object> properties = new HashMap<>();
+ ClassLoader classLoader = null;
+ InputStream iStream = classLoader.getResourceAsStream("example/resources/eclipselink/eclipselink-oxm.xml");
+
+ properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, iStream);
+ try{
+ return DynamicJAXBContextFactory.createContextFromOXM(this.getClass().getClassLoader(), properties);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
index eeacde1..9be0fe2 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
@@ -5,15 +5,11 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
-import org.onap.aai.sparky.config.oxm.OxmModelLoader;
import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
-import org.onap.aai.sparky.dal.GizmoAdapter;
import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
import org.onap.aai.sparky.search.SearchServiceAdapter;
import org.onap.aai.sparky.subscription.config.SubscriptionConfig;
import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
-import org.onap.aai.sparky.util.OxmModelAndProcessorHelper;
import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
import org.onap.aai.sparky.viewandinspect.entity.QueryRequest;
import org.onap.aai.sparky.viewandinspect.services.BaseVisualizationService;
@@ -26,50 +22,49 @@ public class BaseVisualizationServiceTest {
private SubscriptionConfig subConfig;
private RestEndpointConfig endpointEConfig;
private ElasticSearchSchemaConfig schemaEConfig;
- private OxmEntityLookup oxmEntityLookup;
- private GizmoAdapter mockGizmoAdapter;
-
+ private VisualizationContextBuilder contextBuilder;
+
private BaseVisualizationService baseVisService;
-
+
@Before
public void init() throws Exception {
this.mockAaiAdapter = Mockito.mock(ActiveInventoryAdapter.class);
- this.mockAaiAdapter = Mockito.mock(ActiveInventoryAdapter.class);
this.mocksearchServiceAdapter = Mockito.mock(SearchServiceAdapter.class);
- this.mockGizmoAdapter = Mockito.mock(GizmoAdapter.class);
this.visualizationConfigs = new VisualizationConfigs();
this.subConfig = new SubscriptionConfig();
this.endpointEConfig = new RestEndpointConfig();
this.schemaEConfig = new ElasticSearchSchemaConfig();
- this.oxmEntityLookup = OxmModelAndProcessorHelper.getInstance().getOxmEntityLookup();
-
- OxmModelLoader modelLoader = OxmModelAndProcessorHelper.getInstance().getModelLoader();
-
- this.baseVisService = new BaseVisualizationService(modelLoader, visualizationConfigs,
- mockAaiAdapter, mockGizmoAdapter, mocksearchServiceAdapter, endpointEConfig, schemaEConfig, 1,
- oxmEntityLookup, subConfig);
+
+ this.contextBuilder = Mockito.mock(VisualizationContextBuilder.class);
+
+ this.baseVisService = new BaseVisualizationService(contextBuilder, visualizationConfigs,
+ mocksearchServiceAdapter, endpointEConfig, schemaEConfig, subConfig);
}
-
+
@Test
public void testAnalyzeQueryRequestBody() {
- QueryRequest validResquest = baseVisService.analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest());
+ QueryRequest validResquest = baseVisService
+ .analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest());
assertEquals(SchemaVisualizationTestDataBuilder.ROOT_NODE_HASH_ID, validResquest.getHashId());
-
- QueryRequest nullRequest = baseVisService.analyzeQueryRequestBody("This String should make the request return null eh!");
+
+ QueryRequest nullRequest = baseVisService
+ .analyzeQueryRequestBody("This String should make the request return null eh!");
assertEquals(null, nullRequest);
}
-
+
@Test
public void testBuildVisualizationUsingGenericQuery() {
-
+
initializeMocksForBuildVisualizationUsingGenericQueryTest();
-
- QueryRequest rootNodeQuery = baseVisService.analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest());
-
+
+ QueryRequest rootNodeQuery = baseVisService
+ .analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest());
+
}
-
+
private void initializeMocksForBuildVisualizationUsingGenericQueryTest() {
- Mockito.when(mockAaiAdapter.queryActiveInventoryWithRetries(Mockito.anyString(), Mockito.anyString(), Mockito.anyInt())).thenReturn(null);
+ Mockito.when(mockAaiAdapter.queryActiveInventoryWithRetries(Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyInt())).thenReturn(null);
}
-
+
}
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/SchemaVisualizationProcessorTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/SchemaVisualizationProcessorTest.java
index 83e3ee0..edb6d4c 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/SchemaVisualizationProcessorTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/SchemaVisualizationProcessorTest.java
@@ -16,7 +16,6 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.aai.sparky.util.HttpServletHelper;
import org.onap.aai.sparky.viewandinspect.entity.QueryRequest;
-import org.onap.aai.sparky.viewandinspect.services.VisualizationService;
import org.onap.aai.sparky.viewandinspect.util.SchemaVisualizationTestDataBuilder;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -65,7 +64,7 @@ public class SchemaVisualizationProcessorTest {
QueryRequest queryBody = nonEmptyMapper.readValue(queryRequest, QueryRequest.class);
Mockito.when(mockVisualizationService.analyzeQueryRequestBody(Mockito.anyString())).thenReturn(queryBody);
- Mockito.when(mockVisualizationService.buildVisualizationUsingGenericQuery(Mockito.anyObject())).thenReturn(SchemaVisualizationTestDataBuilder.getSchemaVisResult());
+ Mockito.when(mockVisualizationService.buildVisualization(Mockito.anyObject())).thenReturn(SchemaVisualizationTestDataBuilder.getSchemaVisResult());
schemaVisProcessor.setVisualizationService(mockVisualizationService);
schemaVisProcessor.processVisualizationRequest(exchange);
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/config/VisualizationConfigTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/config/VisualizationConfigTest.java
index dfa4b27..dbbd38d 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/config/VisualizationConfigTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/config/VisualizationConfigTest.java
@@ -29,8 +29,6 @@ public class VisualizationConfigTest {
visualConfig.setShallowEntities(shallowEntities);
assertNotNull(visualConfig.getShallowEntities());
- visualConfig.setGizmoEnabled(true);
- assertTrue(visualConfig.isGizmoEnabled());
visualConfig.setMakeAllNeighborsBidirectional(true);
assertTrue(visualConfig.makeAllNeighborsBidirectional());
visualConfig.setSelectedSearchedNodeClassName("selectedsearchedNodeClass");
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/D3VisualizationOutputTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/D3VisualizationOutputTest.java
index e1b9931..4afdc7d 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/D3VisualizationOutputTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/D3VisualizationOutputTest.java
@@ -1,20 +1,15 @@
package org.onap.aai.sparky.viewandinspect.entity;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
public class D3VisualizationOutputTest {
private D3VisualizationOutput d3visualization;
- private InlineMessage inlineMessage;
private GraphMeta graphMeta;
private ArrayList<SparkyGraphNode> nodes;
private ArrayList<SparkyGraphLink> links;
@@ -26,15 +21,13 @@ public class D3VisualizationOutputTest {
nodes = new ArrayList<SparkyGraphNode>();
links = new ArrayList<SparkyGraphLink>();
graphMeta = new GraphMeta();
- inlineMessage = new InlineMessage("level-1","Violation");
+
}
@Test
public void updateValues() {
- d3visualization.setInlineMessage(inlineMessage);
- assertNotNull(d3visualization.getInlineMessage());
d3visualization.addLinks(links);
d3visualization.addNodes(nodes);
d3visualization.setGraphMeta(graphMeta);
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/GraphMetaTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/GraphMetaTest.java
index bd4e454..e60f634 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/GraphMetaTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/GraphMetaTest.java
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.sparky.viewandinspect.EntityTypeAggregation;
@@ -36,12 +35,6 @@ public class GraphMetaTest {
graphMeta.setAaiEntityNodeDescriptors(aaiEntityNodeDescriptors);
assertNotNull(graphMeta.getAaiEntityNodeDescriptors());
- graphMeta.setNumLinksResolvedSuccessfullyFromCache(3);
- assertEquals(3,graphMeta.getNumLinksResolvedSuccessfullyFromCache());
- graphMeta.setNumLinksResolvedSuccessfullyFromServer(25);
- assertEquals(25,graphMeta.getNumLinksResolvedSuccessfullyFromServer());
- graphMeta.setNumLinkResolveFailed(3);
- assertEquals(3,graphMeta.getNumLinkResolveFailed());
graphMeta.setNumNodes(25);
assertEquals(25,graphMeta.getNumNodes());
graphMeta.setNumLinks(3);
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/InlineMessageTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/InlineMessageTest.java
deleted file mode 100644
index eebc821..0000000
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/entity/InlineMessageTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * ============LICENSE_START===================================================
- * SPARKY (AAI UI service)
- * ============================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
- * ============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=====================================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- */
-
-package org.onap.aai.sparky.viewandinspect.entity;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.aai.sparky.viewandinspect.entity.InlineMessage;
-
-public class InlineMessageTest {
-
- private InlineMessage inlineMsg;
-
- @Before
- public void init() throws Exception {
- inlineMsg = new InlineMessage("InlineMessage1","InlineMessage2");
-
- }
-
- @Test
- public void successfulInitializationAndUpdate() {
-
- inlineMsg.setLevel("Level-1");
- assertNotNull(inlineMsg.getLevel());
- inlineMsg.setMessage("InlineMessage3");
- assertNotNull(inlineMsg.getMessage());
- assertNotNull(inlineMsg.toString());
- }
-
-
-}
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContextTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContextTest.java
index 94050be..79b71bc 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContextTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseGizmoVisualizationContextTest.java
@@ -20,6 +20,7 @@ import org.onap.aai.sparky.dal.GizmoAdapter;
import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
import org.onap.aai.sparky.util.NodeUtils;
import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
+import org.onap.aai.sparky.viewandinspect.context.BaseGizmoVisualizationContext;
public class BaseGizmoVisualizationContextTest {
diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContextTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContextTest.java
index 1934207..394bfe4 100644
--- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContextTest.java
+++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/services/BaseVisualizationContextTest.java
@@ -34,6 +34,7 @@ import org.onap.aai.sparky.util.NodeUtils;
import org.onap.aai.sparky.util.StringCollectionContainsMatcher;
import org.onap.aai.sparky.util.TestResourceLoader;
import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs;
+import org.onap.aai.sparky.viewandinspect.context.BaseVisualizationContext;
import org.onap.aai.sparky.viewandinspect.entity.ActiveInventoryNode;
import org.onap.aai.sparky.viewandinspect.entity.QueryParams;
import org.onap.aai.sparky.viewandinspect.enumeration.NodeProcessingState;