aboutsummaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/test/java
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-05-12 17:36:59 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-05-12 17:37:13 -0400
commitb5b99b72733ca5c064b46fdf4527ace28b8b545b (patch)
treeb1606e7d824e5d56b3530f724bf7bf326f9a7833 /aai-traversal/src/test/java
parentb6a2b26886ac329dd0836270127c1b9d283c3659 (diff)
Add all of the traversal source files
Change-Id: Id31f4bdda9c86f782f86829f8b86dada959a9729 Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
Diffstat (limited to 'aai-traversal/src/test/java')
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/DbEdgeGroupTest.java104
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessingTest.java86
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/dbgraphmap/SearchGraphEdgeRuleTest.java59
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/QueryTest.java85
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/util/ValidateEncodingTest.java101
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/transforms/JoltTestUtil.java61
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/transforms/LowerHyphenToLowerCamelConverterTest.java73
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/transforms/MapTraverserTest.java56
8 files changed, 625 insertions, 0 deletions
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/DbEdgeGroupTest.java b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/DbEdgeGroupTest.java
new file mode 100644
index 0000000..e0ad9fc
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/DbEdgeGroupTest.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.dbgraphgen;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+
+public class DbEdgeGroupTest {
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleMany2Many() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertTrue(!(Boolean)method.invoke(new DbEdgeGroup(), "l-interface", "logical-link"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleMany2ManyRev() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertTrue(!(Boolean)method.invoke(new DbEdgeGroup(), "logical-link", "l-interface"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleOne2One() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertFalse((Boolean)method.invoke(new DbEdgeGroup(), "l-interface", "sriov-vf"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleOne2OneRev() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertFalse((Boolean)method.invoke(new DbEdgeGroup(), "sriov-vf", "l-interface"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleMany2One() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertTrue((Boolean)method.invoke(new DbEdgeGroup(), "cloud-region", "complex"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleMany2OneRev() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertTrue(!(Boolean)method.invoke(new DbEdgeGroup(), "complex", "cloud-region"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleOne2Many() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertTrue(!(Boolean)method.invoke(new DbEdgeGroup(), "cloud-region", "tenant"));
+ }
+
+ @Test
+ public void additionalEdgeWouldBreakMultEdgeRuleOne2ManyRev() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+
+ Method method = DbEdgeGroup.class.getDeclaredMethod("additionalEdgeWouldBreakMultEdgeRule", String.class, String.class);
+ method.setAccessible(true);
+
+ assertFalse((Boolean)method.invoke(new DbEdgeGroup(), "tenant", "cloud-region"));
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessingTest.java b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessingTest.java
new file mode 100644
index 0000000..30aa812
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessingTest.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.dbgraphgen;
+//package org.openecomp.aai.dbgen;
+//
+//import java.util.ArrayList;
+//
+//import org.junit.BeforeClass;
+//import org.junit.Rule;
+//import org.junit.Test;
+//import org.junit.rules.ExpectedException;
+//
+//import org.openecomp.aai.exceptions.AAIException;
+//import org.openecomp.aai.ingestModel.DbMaps;
+//import org.openecomp.aai.ingestModel.IngestModelMoxyOxm;
+//import org.openecomp.aai.util.AAIConstants;
+//
+//public class ModelBasedProcessingTest {
+//
+// private static DbMaps dbMaps = null;
+// private static ModelBasedProcessing processor;
+// @BeforeClass
+// public static void configure() throws Exception {
+// System.setProperty("AJSC_HOME", ".");
+// System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
+// ArrayList<String> apiVersions = new ArrayList<String>();
+// apiVersions.add("v9");
+// apiVersions.add("v8");
+// apiVersions.add("v7");
+// apiVersions.add("v2");
+// IngestModelMoxyOxm m = new IngestModelMoxyOxm();
+// m.init(apiVersions);
+//
+// dbMaps = m.dbMapsContainer.get(AAIConstants.AAI_DEFAULT_API_VERSION);
+// processor = new ModelBasedProcessing();
+//
+// }
+//
+// @Rule
+// public ExpectedException expectedEx = ExpectedException.none();
+//
+// @Test
+// public void check4EdgeRuleThrowsExceptionWhenNodeTypeADoesNotExist() throws Exception {
+// String nodeTypeA = "cccomplex";
+// String nodeTypeB = "pserver";
+// expectedEx.expect(AAIException.class);
+// expectedEx.expectMessage("AAI_6115");
+// processor.check4EdgeRule(nodeTypeA, nodeTypeB, dbMaps);
+// }
+//
+// @Test
+// public void check4EdgeRuleThrowsExceptionWhenNodeTypeBDoesNotExist() throws Exception {
+// String nodeTypeA = "complex";
+// String nodeTypeB = "ppppserver";
+// expectedEx.expect(AAIException.class);
+// expectedEx.expectMessage("AAI_6115");
+// processor.check4EdgeRule(nodeTypeA, nodeTypeB, dbMaps);
+// }
+//
+// @Test
+// public void check4EdgeRuleThrowsExceptionWhenNoRuleExists() throws Exception {
+// String nodeTypeA = "complex";
+// String nodeTypeB = "service";
+// expectedEx.expect(AAIException.class);
+// expectedEx.expectMessage("AAI_6120");
+// processor.check4EdgeRule(nodeTypeA, nodeTypeB, dbMaps);
+// }
+//}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/dbgraphmap/SearchGraphEdgeRuleTest.java b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphmap/SearchGraphEdgeRuleTest.java
new file mode 100644
index 0000000..7484353
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/dbgraphmap/SearchGraphEdgeRuleTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.dbgraphmap;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import org.openecomp.aai.exceptions.AAIException;
+
+public class SearchGraphEdgeRuleTest {
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
+ @Test
+ public void getEdgeLabelTest() throws AAIException {
+ String[] label = SearchGraph.getEdgeLabel("customer", "service-subscription");
+
+ assertEquals("subscribesTo", label[0]);
+ }
+
+ @Test
+ public void getEdgeLabelThrowsExceptionWhenNoRuleExists() throws Exception {
+ String nodeTypeA = "complex";
+ String nodeTypeB = "service";
+ expectedEx.expect(AAIException.class);
+ expectedEx.expectMessage("No EdgeRule found for passed nodeTypes: complex, service.");
+ SearchGraph.getEdgeLabel(nodeTypeA, nodeTypeB);
+ }
+
+ @Test
+ public void getEdgeLabelThrowsExceptionWhenNodeTypesDoNotExist() throws Exception {
+ String nodeTypeA = "A";
+ String nodeTypeB = "B";
+ expectedEx.expect(AAIException.class);
+ expectedEx.expectMessage("No EdgeRule found for passed nodeTypes: A, B.");
+ SearchGraph.getEdgeLabel(nodeTypeA, nodeTypeB);
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/QueryTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/QueryTest.java
new file mode 100644
index 0000000..0df8ee3
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/QueryTest.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.rest.search;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.serialization.db.EdgeRules;
+import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+public abstract class QueryTest {
+
+ protected Graph graph;
+ private GremlinServerSingleton gremlinServerSingleton;
+ private GremlinGroovyShellSingleton shell;
+
+ protected final List<Vertex> expectedResult = new ArrayList<>();
+ protected final EdgeRules rules = EdgeRules.getInstance();
+
+
+ public QueryTest() throws AAIException, NoEdgeRuleFoundException {
+ setUp();
+ }
+ public void setUp() throws AAIException, NoEdgeRuleFoundException {
+ System.setProperty("AJSC_HOME", ".");
+ System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
+ graph = TinkerGraph.open();
+ createGraph();
+ gremlinServerSingleton = GremlinServerSingleton.getInstance();
+ shell = GremlinGroovyShellSingleton.getInstance();
+ }
+
+ public void run() {
+
+ String query = "g." + gremlinServerSingleton.getStoredQuery(getQueryName());
+
+ Map<String, Object> params = new HashMap<>();
+
+ GraphTraversal<Vertex, Vertex> g = graph.traversal().V();
+ addStartNode(g);
+ params.put("g", g);
+ addParam(params);
+ GraphTraversal<Vertex, Vertex> result = (GraphTraversal<Vertex, Vertex>)shell.executeTraversal(query, params);
+
+ List<Vertex> vertices = result.toList();
+ assertTrue("all vertices found", vertices.containsAll(expectedResult) && expectedResult.containsAll(vertices));
+
+ }
+
+ protected abstract void createGraph() throws AAIException, NoEdgeRuleFoundException;
+
+ protected abstract String getQueryName();
+
+ protected abstract void addStartNode(GraphTraversal<Vertex, Vertex> g);
+
+ protected abstract void addParam(Map<String, Object> params);
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/util/ValidateEncodingTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/util/ValidateEncodingTest.java
new file mode 100644
index 0000000..8c6450d
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/util/ValidateEncodingTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.rest.util;
+
+import static org.junit.Assert.*;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class ValidateEncodingTest {
+
+
+ @Test
+ public void badPath() throws UnsupportedEncodingException {
+ String badPath = "/aai/v6/network/vces/vce/blahh::blach/others/other/jklfea{}";
+ UriInfo mockUriInfo = getMockUriInfo(badPath, new MultivaluedHashMap<String, String>());
+ ValidateEncoding validator = ValidateEncoding.getInstance();
+
+ assertEquals(false, validator.validate(mockUriInfo));
+ }
+
+ @Test
+ public void goodPath() throws UnsupportedEncodingException {
+ String goodPath = "/aai/v6/network/vces/vce/blahh%3A%3Ablach/others/other/jklfea%7B%7D";
+ UriInfo mockUriInfo = getMockUriInfo(goodPath, new MultivaluedHashMap<String, String>());
+ ValidateEncoding validator = ValidateEncoding.getInstance();
+
+ assertEquals(true, validator.validate(mockUriInfo));
+ }
+
+ @Test
+ public void badQueryParamsKey() throws UnsupportedEncodingException {
+ MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
+ map.putSingle("blahblah", "test");
+ map.putSingle("blahblah", "test2");
+ map.putSingle("bad::bad", "test3");
+ UriInfo mockUriInfo = getMockUriInfo("", map);
+
+ ValidateEncoding validator = ValidateEncoding.getInstance();
+
+ assertEquals(false, validator.validate(mockUriInfo));
+
+ }
+ @Test
+ public void badQueryParamsValue() throws UnsupportedEncodingException {
+ MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
+ map.putSingle("blahblah", "test");
+ map.putSingle("blahblah", "test//:2");
+ map.putSingle("badbad", "test3");
+ UriInfo mockUriInfo = getMockUriInfo("", map);
+
+ ValidateEncoding validator = ValidateEncoding.getInstance();
+
+ assertEquals(false, validator.validate(mockUriInfo));
+ }
+ @Test
+ public void goodQueryParams() throws UnsupportedEncodingException {
+ MultivaluedHashMap<String, String> map = new MultivaluedHashMap<String, String>();
+ map.putSingle("blahblah", "test");
+ map.putSingle("blahblah", "test2");
+ map.putSingle("badbad", "~test%2F%2F%3A3");
+ UriInfo mockUriInfo = getMockUriInfo("", map);
+
+ ValidateEncoding validator = ValidateEncoding.getInstance();
+
+ assertEquals(true, validator.validate(mockUriInfo));
+ }
+
+ private UriInfo getMockUriInfo(String path, MultivaluedMap<String, String> map) {
+ UriInfo mockUriInfo = Mockito.mock(UriInfo.class);
+ Mockito.when(mockUriInfo.getPath(false)).thenReturn(path);
+ Mockito.when(mockUriInfo.getQueryParameters(false)).thenReturn(map);
+
+ return mockUriInfo;
+ }
+
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/transforms/JoltTestUtil.java b/aai-traversal/src/test/java/org/openecomp/aai/transforms/JoltTestUtil.java
new file mode 100644
index 0000000..7df2790
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/transforms/JoltTestUtil.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.transforms;
+
+
+import java.io.IOException;
+
+import org.junit.Assert;
+
+import com.bazaarvoice.jolt.ArrayOrderObliviousDiffy;
+import com.bazaarvoice.jolt.Diffy;
+import com.bazaarvoice.jolt.JsonUtils;
+
+public class JoltTestUtil {
+
+ private static final Diffy diffy = new Diffy();
+ private static final Diffy arrayOrderObliviousDiffy = new ArrayOrderObliviousDiffy();
+
+ public static void runDiffy( String failureMessage, Object expected, Object actual ) throws IOException {
+ runDiffy( diffy, failureMessage, expected, actual );
+ }
+
+ public static void runDiffy( Object expected, Object actual ) throws IOException {
+ runDiffy( diffy, "Failed", expected, actual );
+ }
+
+ public static void runArrayOrderObliviousDiffy( String failureMessage, Object expected, Object actual ) throws IOException {
+ runDiffy( arrayOrderObliviousDiffy, failureMessage, expected, actual );
+ }
+
+ public static void runArrayOrderObliviousDiffy( Object expected, Object actual ) throws IOException {
+ runDiffy( arrayOrderObliviousDiffy, "Failed", expected, actual );
+ }
+
+
+ private static void runDiffy( Diffy diffy, String failureMessage, Object expected, Object actual ) {
+ String actualObject = JsonUtils.toPrettyJsonString( actual );
+ Diffy.Result result = diffy.diff( expected, actual );
+ if (!result.isEmpty()) {
+ Assert.fail( "\nActual object\n" + actualObject + "\n" + failureMessage + "\nDiffy output\n" + result.toString());
+ }
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/transforms/LowerHyphenToLowerCamelConverterTest.java b/aai-traversal/src/test/java/org/openecomp/aai/transforms/LowerHyphenToLowerCamelConverterTest.java
new file mode 100644
index 0000000..3dc5299
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/transforms/LowerHyphenToLowerCamelConverterTest.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.transforms;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import static org.junit.Assert.*;
+
+@RunWith(Parameterized.class)
+public class LowerHyphenToLowerCamelConverterTest {
+
+ private Converter converter = new LowerHyphenToLowerCamelConverter();
+
+ private String input;
+ private String expected;
+
+ public LowerHyphenToLowerCamelConverterTest(String input, String expected){
+ this.input = input;
+ this.expected = expected;
+ }
+
+ /**
+ * Data Provider for the Lower Hyphen to Camel Converter Tests
+ * Make sure the capitalization is not lost during the conversion
+ * @return
+ */
+ @Parameters
+ public static Collection<Object[]> data(){
+
+ return Arrays.asList(new Object[][]{
+ {null, null},
+ {"test-name", "testName"},
+ {"test---name", "testName"}, // Case multiple
+ {"testName", "testName"}, // Case where upper case word shouldn't be lowercased
+ {"test-name-cool", "testNameCool"},
+ {"test-name-Cool", "testNameCool"},
+ {"test-name-Cool-Name-wow----Rest", "testNameCoolNameWowRest"},
+ {"test-name#fast#", "testName#fast#"},
+ {"test-name---", "testName"},
+ {"----test-name", "TestName"},
+ });
+ }
+
+ @Test
+ public void testIfInputSuccessfullyModified(){
+ String actual = converter.convert(input);
+ assertEquals(expected, actual);
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/transforms/MapTraverserTest.java b/aai-traversal/src/test/java/org/openecomp/aai/transforms/MapTraverserTest.java
new file mode 100644
index 0000000..e3b7760
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/transforms/MapTraverserTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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=========================================================
+ */
+
+package org.openecomp.aai.transforms;
+
+import org.openecomp.aai.transforms.LowerCamelToLowerHyphenConverter;
+import org.openecomp.aai.transforms.MapTraverser;
+import com.bazaarvoice.jolt.JsonUtils;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Map;
+
+public class MapTraverserTest {
+
+ private final String testResources = "src/test/resources/maputils/testcases/";
+
+ private String[] testCases = { "TestCase1.json", "TestCase2.json" };
+ private MapTraverser traverser = new MapTraverser(new LowerCamelToLowerHyphenConverter());
+
+ @Test(expected = NullPointerException.class)
+ public void testIfMapIsNullThrowNullPointerException(){
+ Map<String, Object> map = null;
+ traverser.convertKeys(map);
+ }
+
+ @Test
+ public void runTestCases() throws IOException {
+
+ for(String testCase : testCases){
+ Map<String, Object> values = JsonUtils.filepathToMap(testResources + testCase);
+
+ Object input = values.get("input");
+ Object actual = traverser.convertKeys((Map<String, Object>)input);
+ Object output = values.get("output");
+ JoltTestUtil.runArrayOrderObliviousDiffy( "failed case " + testCase, output, actual );
+ }
+ }
+}