diff options
author | 2017-09-08 09:34:19 -0400 | |
---|---|---|
committer | 2017-09-08 15:43:41 -0400 | |
commit | f94c995d4d2b5ffd7f7fa7cf6ec10cdcbf4932a7 (patch) | |
tree | b55fd1ba04576abec768823c4dad9f4a800909e2 /aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java | |
parent | 6042ff29f5f1f00b537f4b92e7aeeded13810545 (diff) |
EdgeRules throws descriptive error on invalid rule
Also added test coverage, including refactoring of test resources to
simplify test suites.
Issue-ID: AAI-277
Change-Id: Ibfdc81342a139d121740f10bccc66a7420b61945
Signed-off-by: Threefoot, Jane (jt6620) <jt6620@att.com>
Diffstat (limited to 'aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java')
-rw-r--r-- | aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java index 0d40f89f..8e37fe05 100644 --- a/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/introspection/sideeffect/DataCopyTest.java @@ -20,17 +20,8 @@ package org.openecomp.aai.introspection.sideeffect; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; - +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; import org.apache.commons.io.IOUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -43,11 +34,7 @@ import org.mockito.MockitoAnnotations; import org.openecomp.aai.db.props.AAIProperties; import org.openecomp.aai.dbmap.DBConnectionType; import org.openecomp.aai.exceptions.AAIException; -import org.openecomp.aai.introspection.Introspector; -import org.openecomp.aai.introspection.Loader; -import org.openecomp.aai.introspection.LoaderFactory; -import org.openecomp.aai.introspection.ModelType; -import org.openecomp.aai.introspection.Version; +import org.openecomp.aai.introspection.*; import org.openecomp.aai.introspection.sideeffect.exceptions.AAIMissingRequiredPropertyException; import org.openecomp.aai.parsers.query.QueryParser; import org.openecomp.aai.serialization.db.DBSerializer; @@ -55,17 +42,22 @@ import org.openecomp.aai.serialization.db.EdgeProperty; import org.openecomp.aai.serialization.engines.QueryStyle; import org.openecomp.aai.serialization.engines.TitanDBEngine; import org.openecomp.aai.serialization.engines.TransactionalGraphEngine; -import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; -import org.openecomp.aai.util.AAIConstants; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; -@Ignore public class DataCopyTest { private static TitanGraph graph; - private final static Version version = Version.v10; + private final static Version version = Version.getLatest(); private final static ModelType introspectorFactoryType = ModelType.MOXY; private final static QueryStyle queryStyle = QueryStyle.TRAVERSAL; private final static DBConnectionType type = DBConnectionType.REALTIME; @@ -83,7 +75,6 @@ public class DataCopyTest { graph = TitanFactory.build().set("storage.backend","inmemory").open(); System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); - QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "src/test/resources/org/openecomp/aai/introspection/"); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); dbEngine = new TitanDBEngine( queryStyle, @@ -112,7 +103,7 @@ public class DataCopyTest { @Test public void runPopulatePersonaModelVer() throws URISyntaxException, AAIException, UnsupportedEncodingException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, MalformedURLException { - final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); final Introspector obj = loader.introspectorFromName("test-object"); obj.setValue("vnf-id", "myId"); obj.setValue("model-invariant-id", "key1"); @@ -168,7 +159,7 @@ public class DataCopyTest { @Test public void verifyNestedSideEffect() throws URISyntaxException, AAIException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, InstantiationException, NoSuchMethodException, IOException { - final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); final Introspector obj = loader.unmarshal("customer", this.getJsonString("nested-case.json")); System.out.println(obj.marshal(true)); TransactionalGraphEngine spy = spy(dbEngine); @@ -194,7 +185,7 @@ public class DataCopyTest { @Test public void expectedMissingPropertyExceptionInURI() throws AAIException, UnsupportedEncodingException { - final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); final Introspector obj = loader.introspectorFromName("test-object"); obj.setValue("vnf-id", "myId"); obj.setValue("model-invariant-id", "key1"); @@ -217,7 +208,7 @@ public class DataCopyTest { @Test public void expectedMissingPropertyExceptionForResultingObject() throws AAIException, UnsupportedEncodingException { - final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); final Introspector obj = loader.introspectorFromName("test-object"); obj.setValue("vnf-id", "myId"); obj.setValue("model-invariant-id", "key3"); @@ -241,7 +232,7 @@ public class DataCopyTest { @Test public void expectNoProcessingWithNoProperties() throws AAIException, UnsupportedEncodingException { - final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v10); + final Loader loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest()); final Introspector obj = loader.introspectorFromName("test-object"); obj.setValue("vnf-id", "myId"); @@ -267,7 +258,7 @@ public class DataCopyTest { private String getJsonString(String filename) throws IOException { - FileInputStream is = new FileInputStream("src/test/resources/org/openecomp/aai/introspection/sideeffect/" + filename); + FileInputStream is = new FileInputStream("src/test/resources/bundleconfig-local/etc/oxm/sideeffect/" + filename); String s = IOUtils.toString(is, "UTF-8"); IOUtils.closeQuietly(is); |