summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gathman <jonathan.gathman@att.com>2019-01-03 16:32:34 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-03 16:32:34 +0000
commita5b72a805fdf6fc88de674be886e9c170d0241bd (patch)
tree39ee1bca75f6c2ea6436167a51b6c75a7598a1c9
parent012c59918c6fb9ce8a925a82bff3877104212a27 (diff)
parent7ce6d70ff56de123b483a857a77810b78b1628de (diff)
Merge "Add more junits misc env jaxb"
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBObjectifier.java135
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBStringifier.java137
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java218
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java186
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java144
5 files changed, 548 insertions, 272 deletions
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBObjectifier.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBObjectifier.java
deleted file mode 100644
index ac0e859c..00000000
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBObjectifier.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 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.onap.aaf.misc.env.jaxb;
-
-import java.io.InputStream;
-import java.io.Reader;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.validation.Schema;
-
-import org.onap.aaf.misc.env.APIException;
-import org.onap.aaf.misc.env.Env;
-import org.onap.aaf.misc.env.TimeTaken;
-import org.onap.aaf.misc.env.old.IOObjectifier;
-
-/**
- * Allow Extended IO interface usage without muddying up the Stringifier Interface
- */
-public class JAXBObjectifier<T> implements IOObjectifier<T> {
- private JAXBumar jumar;
-
- public JAXBObjectifier(Schema schema, Class<?>... classes) throws APIException {
- try {
- jumar = new JAXBumar(schema, classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- public JAXBObjectifier(Class<?>... classes) throws APIException {
- try {
- jumar = new JAXBumar(classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- // package on purpose
- JAXBObjectifier(JAXBumar jumar) {
- this.jumar = jumar;
- }
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, String input) throws APIException {
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- tt.size(input.length());
- return (T)jumar.unmarshal(env.debug(), input);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, Reader rdr) throws APIException {
- //TODO create a Reader that Counts?
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- return (T)jumar.unmarshal(env.debug(), rdr);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, InputStream is) throws APIException {
- //TODO create a Reader that Counts?
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- return (T)jumar.unmarshal(env.debug(), is);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
-
- public void servicePrestart(Env env) throws APIException {
- }
-
- public void threadPrestart(Env env) throws APIException {
- }
-
- // // @Override
- public void refresh(Env env) throws APIException {
- }
-
- // // @Override
- public void threadDestroy(Env env) throws APIException {
- }
-
- // // @Override
- public void serviceDestroy(Env env) throws APIException {
- }
-
-
- @SuppressWarnings("unchecked")
- public T newInstance() throws APIException {
- try {
- return (T)jumar.newInstance();
- } catch (Exception e) {
- throw new APIException(e);
- }
- }
-
-}
-
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBStringifier.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBStringifier.java
deleted file mode 100644
index 9b8a2c97..00000000
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JAXBStringifier.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 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.onap.aaf.misc.env.jaxb;
-
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-
-import org.onap.aaf.misc.env.APIException;
-import org.onap.aaf.misc.env.Env;
-import org.onap.aaf.misc.env.TimeTaken;
-import org.onap.aaf.misc.env.old.IOStringifier;
-
-public class JAXBStringifier<T> implements IOStringifier<T> {
- private JAXBmar jmar;
-
- public JAXBStringifier(Class<?>... classes) throws APIException {
- try {
- jmar = new JAXBmar(classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- public JAXBStringifier(QName qname, Class<?>... classes)
- throws APIException {
- try {
- jmar = new JAXBmar(qname, classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- // package on purpose
- JAXBStringifier(JAXBmar jmar) {
- this.jmar = jmar;
- }
-
- // // @Override
- public void stringify(Env env, T input, Writer writer, boolean ... options)
- throws APIException {
- TimeTaken tt = env.start("JAXB Marshal", Env.XML);
- try {
- jmar.marshal(env.debug(), input, writer, options);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
- // @Override
- public void stringify(Env env, T input, OutputStream os, boolean ... options)
- throws APIException {
- // TODO create an OutputStream that Counts?
- TimeTaken tt = env.start("JAXB Marshal", Env.XML);
- try {
- jmar.marshal(env.debug(), input, os, options);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
- // @Override
- public String stringify(Env env, T input, boolean ... options) throws APIException {
- TimeTaken tt = env.start("JAXB Marshal", Env.XML);
- StringWriter sw = new StringWriter();
- try {
- jmar.marshal(env.debug(), input, sw, options);
- String rv = sw.toString();
- tt.size(rv.length());
- return rv;
- } catch (JAXBException e) {
- tt.size(0);
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
- // // @Override
- public void servicePrestart(Env env) throws APIException {
- }
-
- // // @Override
- public void threadPrestart(Env env) throws APIException {
- }
-
- // // @Override
- public void refresh(Env env) throws APIException {
- }
-
- // // @Override
- public void threadDestroy(Env env) throws APIException {
- }
-
- // // @Override
- public void serviceDestroy(Env env) throws APIException {
- }
-
- // @Override
- public JAXBStringifier<T> pretty(boolean pretty) {
- jmar.pretty(pretty);
- return this;
- }
-
- // @Override
- public JAXBStringifier<T> asFragment(boolean fragment) {
- jmar.asFragment(fragment);
- return this;
- }
-
-}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java
new file mode 100644
index 00000000..46feebb1
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java
@@ -0,0 +1,218 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.onap.aaf.misc.env.jaxb;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.validation.Schema;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.LogTarget;
+import org.onap.aaf.misc.env.TimeTaken;
+
+public class JU_JAXBObjectifierTest {
+
+ @Mock
+ JAXBumar jumar;
+
+ @Mock
+ Schema schema;
+
+ @Mock
+ Env env;
+
+ TimeTaken tt,ttObjectify;
+
+ LogTarget logT;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ tt=Mockito.mock(TimeTaken.class);
+ Mockito.doReturn(tt).when(env).start("JAXB Unmarshal", Env.XML);
+ Mockito.doNothing().when(tt).done();
+ logT = Mockito.mock(LogTarget.class);
+ Mockito.doReturn(logT).when(env).debug();
+ }
+
+ @Test
+ public void testObjectify() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier( schema, new Class[] {this.getClass()});
+ bdfObj = new JAXBObjectifier(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, "test");
+ bdfObj.objectify(env, "test");
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testObjectifyException() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, "test");
+ bdfObj.objectify(env, "test");
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testObjectifyRdr() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(new Class[] {this.getClass()});
+ bdfObj = new JAXBObjectifier(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(StringReader.class));
+ bdfObj.objectify(env, Mockito.mock(StringReader.class));
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testObjectifyRdrException() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ StringReader sr = Mockito.mock(StringReader.class);
+ Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr);
+ bdfObj.objectify(env, sr);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testObjectifyIs() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(InputStream.class));
+ bdfObj.objectify(env, Mockito.mock(InputStream.class));
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testObjectifyIsException() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ InputStream sr = Mockito.mock(InputStream.class);
+ Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr);
+ bdfObj.objectify(env, sr);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testEmptyMethods() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ bdfObj.servicePrestart(env);
+ bdfObj.threadPrestart(env);
+ bdfObj.threadDestroy(env);
+ bdfObj.serviceDestroy(env);
+ bdfObj.refresh(env);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ }
+
+ }
+
+ @Test
+ public void testNewInstance() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ Object retVal = bdfObj.newInstance();
+ Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).newInstance();
+
+ } catch (IllegalAccessException e) {
+ assertEquals("Test Exception", e.getLocalizedMessage());
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNewInstanceException() {
+ JAXBObjectifier<?> bdfObj = null;
+ try {
+ bdfObj = new JAXBObjectifier(jumar);
+ Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).newInstance();
+ Object retVal = bdfObj.newInstance();
+ } catch (IllegalAccessException e) {
+ assertEquals("Test Exception", e.getLocalizedMessage());
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (InstantiationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java
new file mode 100644
index 00000000..7d310ae7
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java
@@ -0,0 +1,186 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.onap.aaf.misc.env.jaxb;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.LogTarget;
+import org.onap.aaf.misc.env.TimeTaken;
+
+public class JU_JAXBStringifierTest {
+
+ @Mock
+ JAXBmar jumar;
+
+ @Mock
+ QName qname;
+
+ @Mock
+ Env env;
+
+ TimeTaken tt,ttstringify;
+
+ LogTarget logT;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ tt=Mockito.mock(TimeTaken.class);
+ Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML);
+ Mockito.doNothing().when(tt).done();
+ logT = Mockito.mock(LogTarget.class);
+ Mockito.doReturn(logT).when(env).debug();
+ }
+
+ @Test
+ public void teststringify() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>( qname, new Class[] {this.getClass()});
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true);
+ bdfObj.stringify(env, jumar, true);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void teststringifyWriter() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>(new Class[] {this.getClass()});
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true);
+ bdfObj.stringify(env, jumar, Mockito.mock(StringWriter.class), true);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void teststringifyWriterException() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ StringWriter sr = Mockito.mock(StringWriter.class);
+ Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, sr, true);
+ bdfObj.stringify(env, jumar, sr, true);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void teststringifyOs() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(OutputStream.class), true);
+ bdfObj.stringify(env, jumar, Mockito.mock(OutputStream.class), true);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void teststringifyOsException() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ OutputStream os = Mockito.mock(OutputStream.class);
+ Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, os, true);
+ bdfObj.stringify(env, jumar, os, true);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ } catch (JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Test
+ public void testEmptyMethods() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ try {
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ bdfObj.servicePrestart(env);
+ bdfObj.threadPrestart(env);
+ bdfObj.threadDestroy(env);
+ bdfObj.serviceDestroy(env);
+ bdfObj.refresh(env);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("Test Exception"));
+ }
+
+ }
+
+ @Test
+ public void testPretty() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ Mockito.doReturn(jumar).when(jumar).pretty(true);
+ Object retVal = bdfObj.pretty(true);
+ assertTrue(retVal instanceof JAXBStringifier);
+ }
+
+ @Test
+ public void testNewInstanceException() {
+ JAXBStringifier<JAXBmar> bdfObj = null;
+ bdfObj = new JAXBStringifier<JAXBmar>(jumar);
+ Mockito.doReturn(jumar).when(jumar).asFragment(true);
+ Object retVal = bdfObj.asFragment(true);
+ assertTrue(retVal instanceof JAXBStringifier);
+
+ }
+}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
new file mode 100644
index 00000000..db48345c
--- /dev/null
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
@@ -0,0 +1,144 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.onap.aaf.misc.env;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class JU_StoreImplTest {
+
+ @Mock
+ QName qname;
+
+ @Mock
+ Env env;
+
+ TimeTaken tt,ttstringify;
+
+ LogTarget logT;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ tt=Mockito.mock(TimeTaken.class);
+ Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML);
+ Mockito.doNothing().when(tt).done();
+ logT = Mockito.mock(LogTarget.class);
+ Mockito.doReturn(logT).when(env).debug();
+ }
+
+ @Test
+ public void testPropsFromArgs() {
+ StoreImpl bdfObj = new StoreImpl();
+ bdfObj = new StoreImpl("");
+ bdfObj.propsFromArgs(null, new String[] {"test"});
+ bdfObj.propsFromArgs("test", new String[] {"test","te=st","test=1"});
+
+ }
+
+ @Test
+ public void testMorePropsConstructor() {
+ Properties props = Mockito.mock(Properties.class);
+ new StoreImpl(null,props);
+ StoreImpl bdfObj = new StoreImpl("test",props);
+ }
+
+ @Test
+ public void testMorePropsFileNOtExists() {
+ Properties props = Mockito.mock(Properties.class);
+ Mockito.doReturn("test").when(props).getProperty("test");
+ StoreImpl bdfObj = new StoreImpl("test",props);
+ }
+
+ @Test
+ public void testMorePropsExists() {
+ Properties props = Mockito.mock(Properties.class);
+ Mockito.doReturn(System.getProperty("user.dir")+"/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java").when(props).getProperty("test");
+ StoreImpl bdfObj = new StoreImpl("test",props);
+ }
+
+ @Test
+ public void testNewTransState() {
+ StoreImpl bdfObj = new StoreImpl(null, new String[] {});
+ bdfObj.newTransState();
+ }
+
+ @Test
+ public void testSlot() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {});
+ Slot slot = bdfObj.slot(null);
+ assertEquals(slot.toString(),"=0");
+ slot = bdfObj.slot("test");
+ assertEquals(slot.toString(),"test=1");
+ }
+
+ @Test
+ public void testExistingSlot() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
+ Slot retVal = bdfObj.existingSlot("test");
+ assertNull(retVal);
+ }
+
+ @Test
+ public void testExistingSlotNames() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
+ List<String> retVal = bdfObj.existingSlotNames();
+ assertTrue(retVal.size()==0);
+ }
+
+ @Test
+ public void testGet() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
+ Object retVal = bdfObj.get(new StaticSlot(1,"test"),qname);
+ assertTrue(retVal instanceof QName);
+ }
+
+ @Test
+ public void testGetSlot() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
+ Object retVal = bdfObj.get(new StaticSlot(1,"test"));
+ assertNull(retVal);
+ }
+
+ @Test
+ public void testExistingStaticSlotNames() {
+ StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
+ List<String> retVal = bdfObj.existingStaticSlotNames();
+ assertTrue(retVal.size()==1);
+ }
+}