From 12414fe43077e12d7ef711951b1633ad31d73573 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 22 Jan 2019 10:27:32 -0600 Subject: Public and Private Locate entries Issue-ID: AAF-723 Change-Id: I9dcd2e732ce64b39aaa57a6e9404f275f7ad540c Signed-off-by: Instrumental --- misc/env/pom.xml | 2 +- .../java/org/onap/aaf/misc/env/StaticSlot.java | 2 +- .../onap/aaf/misc/env/JU_JavaUtilLogTarget.java | 3 +- .../org/onap/aaf/misc/env/JU_NullLifeCycle.java | 4 +- .../org/onap/aaf/misc/env/JU_StoreImplTest.java | 144 -------------------- .../onap/aaf/misc/env/jaxb/JU_StoreImplTest.java | 148 +++++++++++++++++++++ misc/log4j/pom.xml | 2 +- misc/pom.xml | 2 +- misc/rosetta/pom.xml | 2 +- misc/xgen/pom.xml | 2 +- 10 files changed, 158 insertions(+), 153 deletions(-) delete mode 100644 misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java create mode 100644 misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java (limited to 'misc') diff --git a/misc/env/pom.xml b/misc/env/pom.xml index 85bcdf94..2c8d4207 100644 --- a/misc/env/pom.xml +++ b/misc/env/pom.xml @@ -24,7 +24,7 @@ org.onap.aaf.authz miscparent - 2.1.9-SNAPSHOT + 2.1.10-SNAPSHOT .. diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java b/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java index 0bff6a06..61d10ae1 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/StaticSlot.java @@ -59,7 +59,7 @@ public final class StaticSlot { * @param name * The name of the StaticSlot's key. */ - StaticSlot(int index, String name) { + public StaticSlot(int index, String name) { slot = index; key = name; } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java index 2617559d..d76d8828 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java @@ -19,7 +19,7 @@ * */ -package org.onap.aaf.misc.env.impl; +package org.onap.aaf.misc.env; import static org.junit.Assert.assertFalse; import static org.mockito.MockitoAnnotations.initMocks; @@ -31,6 +31,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; +import org.onap.aaf.misc.env.impl.JavaUtilLogTarget; public class JU_JavaUtilLogTarget { diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java index e685dfe6..d8e843b4 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java @@ -19,10 +19,10 @@ * */ -package org.onap.aaf.misc.env.impl; +package org.onap.aaf.misc.env; import org.junit.Test; -import org.onap.aaf.misc.env.APIException; +import org.onap.aaf.misc.env.impl.NullLifeCycle; public class JU_NullLifeCycle { diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java deleted file mode 100644 index db48345c..00000000 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java +++ /dev/null @@ -1,144 +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; - -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 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 retVal = bdfObj.existingStaticSlotNames(); - assertTrue(retVal.size()==1); - } -} 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..39d43066 --- /dev/null +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java @@ -0,0 +1,148 @@ +/** + * ============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.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.MockitoAnnotations.initMocks; + +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; +import org.onap.aaf.misc.env.Env; +import org.onap.aaf.misc.env.LogTarget; +import org.onap.aaf.misc.env.Slot; +import org.onap.aaf.misc.env.StaticSlot; +import org.onap.aaf.misc.env.StoreImpl; +import org.onap.aaf.misc.env.TimeTaken; + +@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 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 retVal = bdfObj.existingStaticSlotNames(); + assertTrue(retVal.size()==1); + } +} diff --git a/misc/log4j/pom.xml b/misc/log4j/pom.xml index 51073c01..0621305d 100644 --- a/misc/log4j/pom.xml +++ b/misc/log4j/pom.xml @@ -24,7 +24,7 @@ org.onap.aaf.authz miscparent - 2.1.9-SNAPSHOT + 2.1.10-SNAPSHOT .. diff --git a/misc/pom.xml b/misc/pom.xml index 13f3aa7f..89e7e2b8 100644 --- a/misc/pom.xml +++ b/misc/pom.xml @@ -25,7 +25,7 @@ org.onap.aaf.authz parent - 2.1.9-SNAPSHOT + 2.1.10-SNAPSHOT miscparent AAF Misc Parent diff --git a/misc/rosetta/pom.xml b/misc/rosetta/pom.xml index acf7c3dc..2cf38a34 100644 --- a/misc/rosetta/pom.xml +++ b/misc/rosetta/pom.xml @@ -24,7 +24,7 @@ org.onap.aaf.authz miscparent - 2.1.9-SNAPSHOT + 2.1.10-SNAPSHOT .. diff --git a/misc/xgen/pom.xml b/misc/xgen/pom.xml index 355a7128..c2042cf8 100644 --- a/misc/xgen/pom.xml +++ b/misc/xgen/pom.xml @@ -24,7 +24,7 @@ org.onap.aaf.authz miscparent - 2.1.9-SNAPSHOT + 2.1.10-SNAPSHOT .. -- cgit 1.2.3-korg