summaryrefslogtreecommitdiffstats
path: root/appc-common/src/test/java/org/openecomp
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-12-13 11:19:06 -0800
committerPatrick Brady <pb071s@att.com>2017-12-13 11:19:17 -0800
commit781b1a6df324419c846c84ea983c18fc8362bfd3 (patch)
tree580008010dd50ca32db2ef6dc2e36628cf8c2b5b /appc-common/src/test/java/org/openecomp
parent161df8a94bb3b0c34ed16fd4fdba078bd1eeef9a (diff)
Third part of onap rename
This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady <pb071s@att.com> Issue-ID: APPC-13
Diffstat (limited to 'appc-common/src/test/java/org/openecomp')
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/cache/CacheStrategiesTest.java48
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/cache/impl/LRUCacheTest.java61
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheFactoryTest.java69
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheImplTest.java64
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/concurrent/TestSignal.java135
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/configuration/DefaultConfigurationTest.java337
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/encryption/TestEncryption.java46
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/exceptions/APPCExceptionTest.java89
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidInputExceptionTest.java39
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidStateExceptionTest.java39
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/exceptions/UnknownProviderExceptionTest.java93
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/i18n/MsgTest.java771
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/logging/LoggingConstantsTest.java60
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/metadata/TestMetadataService.java54
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifierTest.java105
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/pool/CachedElementTest.java276
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/pool/Element.java78
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/pool/PoolTest.java323
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/pool/Testable.java35
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/util/TestJsonUtil.java74
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/util/TestStringHelper.java107
-rw-r--r--appc-common/src/test/java/org/openecomp/appc/util/TestStructuredPropertyHelper.java236
22 files changed, 0 insertions, 3139 deletions
diff --git a/appc-common/src/test/java/org/openecomp/appc/cache/CacheStrategiesTest.java b/appc-common/src/test/java/org/openecomp/appc/cache/CacheStrategiesTest.java
deleted file mode 100644
index 41ceb4303..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/cache/CacheStrategiesTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.cache;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CacheStrategiesTest {
- private CacheStrategies cacheStrategies = CacheStrategies.LRU;
-
- @Test
- public void testName() throws Exception {
- Assert.assertEquals("Should have name LRU", "LRU", cacheStrategies.name());
- }
-
- @Test
- public void testToString() throws Exception {
- Assert.assertEquals("Should return String LRU", "LRU", cacheStrategies.toString());
- }
-
- @Test
- public void testEquals() throws Exception {
- Assert.assertTrue(cacheStrategies.equals(CacheStrategies.LRU));
- Assert.assertFalse(cacheStrategies.equals(null));
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/cache/impl/LRUCacheTest.java b/appc-common/src/test/java/org/openecomp/appc/cache/impl/LRUCacheTest.java
deleted file mode 100644
index 3f4233d86..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/cache/impl/LRUCacheTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.cache.impl;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-import java.util.Map;
-
-public class LRUCacheTest {
-
- @Test
- public void testConstructor() throws Exception {
- LRUCache cache = new LRUCache(20);
- Map internalMap = Whitebox.getInternalState(cache, "map");
- Assert.assertTrue(internalMap != null);
- Assert.assertTrue(internalMap.size() == 0);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetAndPutObject() throws Exception {
- LRUCache cache = new LRUCache(20);
-
- String key = "testing key";
- Assert.assertTrue(cache.getObject(key) == null);
-
- String value = "testing value";
- cache.putObject(key, value);
- Map internalMap = Whitebox.getInternalState(cache, "map");
- Assert.assertTrue(internalMap.containsKey(key));
- Assert.assertTrue(internalMap.containsValue(value));
- Assert.assertTrue(internalMap.size() == 1);
-
- Assert.assertEquals(value, cache.getObject(key));
- }
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheFactoryTest.java b/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheFactoryTest.java
deleted file mode 100644
index 386118025..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheFactoryTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.cache.impl;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.appc.cache.CacheStrategies;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.reflect.Whitebox;
-
-import static org.mockito.Mockito.mock;
-
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({MetadataCacheFactory.class, MetadataCacheImpl.class})
-public class MetadataCacheFactoryTest {
- @Test
- public void testConstructor() throws Exception {
- Whitebox.invokeConstructor(MetadataCacheFactory.class);
- }
-
- @Test
- public void testGetInstance() throws Exception {
- Assert.assertTrue("Should not return null", MetadataCacheFactory.getInstance() != null);
- Assert.assertEquals("Should always return the same object",
- MetadataCacheFactory.getInstance(), MetadataCacheFactory.getInstance());
- }
-
- @Test
- public void testGetMetadataCacheWithNoArgument() throws Exception {
- MetadataCacheImpl mockImpl = mock(MetadataCacheImpl.class);
- PowerMockito.whenNew(MetadataCacheImpl.class).withNoArguments().thenReturn(mockImpl);
- Assert.assertEquals(mockImpl, MetadataCacheFactory.getInstance().getMetadataCache());
- }
-
- @Test
- public void testGetMetadataCacheWithArgument() throws Exception {
- CacheStrategies cacheStrategies = CacheStrategies.LRU;
- MetadataCacheImpl mockImpl = mock(MetadataCacheImpl.class);
- PowerMockito.whenNew(MetadataCacheImpl.class).withArguments(cacheStrategies).thenReturn(mockImpl);
- Assert.assertEquals(mockImpl, MetadataCacheFactory.getInstance().getMetadataCache(cacheStrategies));
- }
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheImplTest.java b/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheImplTest.java
deleted file mode 100644
index c68fb48dc..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/cache/impl/MetadataCacheImplTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.cache.impl;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.appc.cache.CacheStrategies;
-import org.powermock.reflect.Whitebox;
-
-import static org.mockito.Mockito.spy;
-
-public class MetadataCacheImplTest {
- @Test
- public void testConstructor() throws Exception {
- // test without parameter
- MetadataCacheImpl impl = new MetadataCacheImpl<>();
- Assert.assertTrue("Should have initialized strategy",
- Whitebox.getInternalState(impl, "strategy") != null);
-
- // test with parameter
- impl = new MetadataCacheImpl<>(CacheStrategies.LRU);
- Assert.assertTrue("Should have initialized strategy",
- Whitebox.getInternalState(impl, "strategy") != null);
-
- impl = new MetadataCacheImpl<>(null);
- Assert.assertTrue("Should not initialized strategy",
- Whitebox.getInternalState(impl, "strategy") == null);
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetAndPutObject() throws Exception {
- MetadataCacheImpl impl = spy(new MetadataCacheImpl<>());
-
- String key = "testing key";
- Assert.assertTrue(impl.getObject(key) == null);
-
- String value = "testing value";
- impl.putObject(key, value);
- Assert.assertEquals(value, impl.getObject(key));
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/concurrent/TestSignal.java b/appc-common/src/test/java/org/openecomp/appc/concurrent/TestSignal.java
deleted file mode 100644
index e86fe54a1..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/concurrent/TestSignal.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.concurrent;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.concurrent.TimeoutException;
-
-import org.junit.Test;
-import org.onap.appc.concurrent.Signal;
-
-public class TestSignal {
-
- private static final DateFormat formatter = new SimpleDateFormat("HH:mm:ss.SSS");
- public static final String SIGNAL_READY = "READY";
- public static final String SIGNAL_SHUTDOWN = "SHUTDOWN";
-
- @Test
- public void TestSimpleSignal() throws TimeoutException {
-
- Signal mySignal = new Signal(Thread.currentThread());
- mySignal.setTimeout(5000L);
- Fred fred = new Fred(mySignal);
- Thread t1 = new Thread(fred);
-
- /*
- * Verify that fred is dead, then start him and wait for him to signal us he is ready to proceed
- */
- assertFalse(t1.isAlive());
- t1.start();
- System.out.println(formatter.format(new Date()) + " MAIN: Waiting for Ready...");
- mySignal.waitFor(SIGNAL_READY);
- System.out.println(formatter.format(new Date()) + " MAIN: Signal Ready received");
-
- /*
- * Verify that fred is still alive and we will sleep for a while (simulate doing things)
- */
- assertTrue(t1.isAlive());
- try {
- Thread.sleep(250L);
- } catch (InterruptedException e) {
- // ignored
- }
-
- /*
- * Verify that fred is still alive and signal him to shutdown
- */
- assertTrue(t1.isAlive());
- System.out.println(formatter.format(new Date()) + " MAIN: Signaling shutdown");
- fred.getSignal().signal(SIGNAL_SHUTDOWN);
-
- /*
- * Wait a little bit
- */
- try {
- Thread.sleep(250L);
- } catch (InterruptedException e) {
- // ignored
- }
-
- /*
- * Verify that fred is dead now and that he completed normally
- */
- System.out.println(formatter.format(new Date()) + " MAIN: Shutting down...");
- assertFalse(t1.isAlive());
- assertTrue(fred.isCompleted());
- }
-
- public class Fred implements Runnable {
- private Signal signal;
- private Signal parentSignal;
- private boolean completed = false;
-
- public Fred(Signal parentSignal) {
- this.parentSignal = parentSignal;
- }
-
- @Override
- public void run() {
- signal = new Signal(Thread.currentThread());
- signal.setTimeout(5000L);
- try {
- Thread.sleep(250L);
- } catch (InterruptedException e) {
- // Ignore
- }
-
- System.out.println(formatter.format(new Date()) + " FRED: Signaling ready...");
- parentSignal.signal(SIGNAL_READY);
-
- try {
- System.out.println(formatter.format(new Date()) + " FRED: Waiting for shutdown...");
- signal.waitFor(SIGNAL_SHUTDOWN);
- System.out.println(formatter.format(new Date()) + " FRED: Received shutdown");
- completed = true;
- } catch (TimeoutException e) {
- e.printStackTrace();
- }
- }
-
- public boolean isCompleted() {
- return completed;
- }
-
- public Signal getSignal() {
- return signal;
- }
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/configuration/DefaultConfigurationTest.java b/appc-common/src/test/java/org/openecomp/appc/configuration/DefaultConfigurationTest.java
deleted file mode 100644
index a423eae81..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/configuration/DefaultConfigurationTest.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.configuration;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.powermock.reflect.Whitebox;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import static org.mockito.Mockito.mock;
-
-public class DefaultConfigurationTest {
- private static final String propKey1 = "testKey1";
- private static final String propKey2 = "testKey2";
- private static final String propValue1 = "testValue1";
- private static final String propValue2 = "testValue2";
-
- private Properties prop = new Properties();
- private DefaultConfiguration defaultConfiguration;
-
- @Before
- public void setUp() throws Exception {
- prop.setProperty(propKey1, propValue1);
- prop.setProperty(propKey2, propValue2);
-
- defaultConfiguration = new DefaultConfiguration();
- }
-
- @Test
- public void testClear() throws Exception {
- Whitebox.setInternalState(defaultConfiguration, "properties", prop);
- defaultConfiguration.clear();
- Properties internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
- Assert.assertTrue("internal properties should be cleared", internalProp.isEmpty());
- }
-
- @Test
- public void testClone() throws Exception {
- Object clonedObject = defaultConfiguration.clone();
- Assert.assertTrue("Should be DefaultConfiguration", clonedObject instanceof DefaultConfiguration);
- Properties internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
- Properties clonedInternalProp = Whitebox.getInternalState(clonedObject, "properties");
- Assert.assertEquals(internalProp, clonedInternalProp);
- }
-
- @Test
- public void testEquals() throws Exception {
- // test compare with null
- Assert.assertFalse(defaultConfiguration.equals(null));
- // test with non-DefaultConfiguration object
- Assert.assertFalse(defaultConfiguration.equals("abc"));
-
- // test with not match DefaultConfiguration object
- defaultConfiguration.setProperties(prop);
- DefaultConfiguration newConfig = new DefaultConfiguration();
- Assert.assertFalse(defaultConfiguration.equals(newConfig));
-
- // test with matching DefaultConfiguration object
- newConfig.setProperties(prop);
- Assert.assertTrue(defaultConfiguration.equals(newConfig));
- }
-
- @Test
- public void testSetPropAndGetBooleanProperty() throws Exception {
- String booleanKey = "booleanKey";
- // test default value
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey));
- // test match value true
- defaultConfiguration.setProperty(booleanKey, "true");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey));
- defaultConfiguration.setProperty(booleanKey, "True");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey));
- defaultConfiguration.setProperty(booleanKey, "TrUe");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey));
- // test not matching true values
- defaultConfiguration.setProperty(booleanKey, "false");
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey));
- defaultConfiguration.setProperty(booleanKey, "abc");
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey));
- }
-
- @Test
- public void testSetPropAndGetBooleanPropertyWithDefaultValue() throws Exception {
- String booleanKey = "booleanKey";
- // test default value
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey, false));
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey, true));
- // test match value true
- defaultConfiguration.setProperty(booleanKey, "true");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey, false));
- defaultConfiguration.setProperty(booleanKey, "True");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey, false));
- defaultConfiguration.setProperty(booleanKey, "TrUe");
- Assert.assertTrue(defaultConfiguration.getBooleanProperty(booleanKey, false));
- // test not matching true values
- defaultConfiguration.setProperty(booleanKey, "false");
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey, true));
- defaultConfiguration.setProperty(booleanKey, "abc");
- Assert.assertFalse(defaultConfiguration.getBooleanProperty(booleanKey, true));
- }
-
- @Test
- public void testSetPropAndGetDoubleProperty() throws Exception {
- String doubleKey = "doubleKey";
- // test default value
- Assert.assertTrue(0.0 == defaultConfiguration.getDoubleProperty(doubleKey));
- // test NumberFormatException
- defaultConfiguration.setProperty(doubleKey, "abc");
- Assert.assertTrue(0.0 == defaultConfiguration.getDoubleProperty(doubleKey));
- // test normal
- defaultConfiguration.setProperty(doubleKey, "1.1");
- Assert.assertTrue(1.1 == defaultConfiguration.getDoubleProperty(doubleKey));
- }
-
- @Test
- public void testSetPropAndGetDoublePropertyWithDefaultValue() throws Exception {
- String doubleKey = "doubleKey";
- // test default value
- Assert.assertTrue(2.2 == defaultConfiguration.getDoubleProperty(doubleKey, 2.2));
- // test NumberFormatException
- defaultConfiguration.setProperty(doubleKey, "abc");
- Assert.assertTrue(0.0 == defaultConfiguration.getDoubleProperty(doubleKey, 2.2));
- // test normal
- defaultConfiguration.setProperty(doubleKey, "1.1");
- Assert.assertTrue(1.1 == defaultConfiguration.getDoubleProperty(doubleKey, 2.2));
- }
-
- @Test
- public void testSetPropAndGetIntegerProperty() throws Exception {
- String integerKey = "integerKey";
- // test default value
- Assert.assertTrue(0 == defaultConfiguration.getIntegerProperty(integerKey));
- // test NumberFormatException
- defaultConfiguration.setProperty(integerKey, "abc");
- Assert.assertTrue(0 == defaultConfiguration.getIntegerProperty(integerKey));
- // test normal
- defaultConfiguration.setProperty(integerKey, "100");
- Assert.assertTrue(100 == defaultConfiguration.getIntegerProperty(integerKey));
- }
-
- @Test
- public void testSetPropAndGetIntegerPropertyWithDefaultValue() throws Exception {
- String integerKey = "integerKey";
- // test default value
- Assert.assertTrue(100 == defaultConfiguration.getIntegerProperty(integerKey, 100));
- // test NumberFormatException
- defaultConfiguration.setProperty(integerKey, "abc");
- Assert.assertTrue(0 == defaultConfiguration.getIntegerProperty(integerKey, 100));
- // test normal
- defaultConfiguration.setProperty(integerKey, "100");
- Assert.assertTrue(100 == defaultConfiguration.getIntegerProperty(integerKey, 10));
- }
-
- @Test
- public void testSetPropAndGetLongProperty() throws Exception {
- String longKey = "longKey";
- // test default value
- Assert.assertTrue(0 == defaultConfiguration.getLongProperty(longKey));
- // test NumberFormatException
- defaultConfiguration.setProperty(longKey, "abc");
- Assert.assertTrue(0 == defaultConfiguration.getLongProperty(longKey));
- // test normal
- defaultConfiguration.setProperty(longKey, "100");
- Assert.assertTrue(100 == defaultConfiguration.getLongProperty(longKey));
- }
-
- @Test
- public void testSetPropAndGetLongPropertyWithDefaultVaue() throws Exception {
- String longKey = "longKey";
- // test default value
- Assert.assertTrue(10 == defaultConfiguration.getLongProperty(longKey, 10));
- // test NumberFormatException
- defaultConfiguration.setProperty(longKey, "abc");
- Assert.assertTrue(0 == defaultConfiguration.getLongProperty(longKey, 10));
- // test normal
- defaultConfiguration.setProperty(longKey, "100");
- Assert.assertTrue(100 == defaultConfiguration.getLongProperty(longKey, 10));
- }
-
- @Test
- public void testSetAndGetProperties() throws Exception {
- Properties internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
- Assert.assertEquals(internalProp, defaultConfiguration.getProperties());
-
- defaultConfiguration.setProperties(prop);
- internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
- Assert.assertEquals(internalProp, defaultConfiguration.getProperties());
- }
-
- @Test
- public void testSetAndGetProperty() throws Exception {
- String key = "key";
- // test default value
- Assert.assertTrue(null == defaultConfiguration.getProperty(key));
- // test normal
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertEquals("abc", defaultConfiguration.getProperty(key));
- }
-
- @Test
- public void testSetPropAndGetPropertyWithDefaultValue() throws Exception {
- String key = "key";
- // test default value
- Assert.assertTrue(null == defaultConfiguration.getProperty(key, null));
- Assert.assertEquals("abc", defaultConfiguration.getProperty(key, "abc"));
- // test normal
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertEquals("abc", defaultConfiguration.getProperty(key, "abcd"));
- }
-
- @Test
- public void testHashCode() throws Exception {
- Properties properties = null;
- Whitebox.setInternalState(defaultConfiguration, "properties", properties);
- Assert.assertEquals(0, defaultConfiguration.hashCode());
-
-
- Whitebox.setInternalState(defaultConfiguration, "properties", prop);
- Assert.assertEquals(prop.hashCode(), defaultConfiguration.hashCode());
- }
-
- @Test
- public void testIsPropertyDefined() throws Exception {
- String key = "key";
- // test not exist
- Assert.assertFalse(defaultConfiguration.isPropertyDefined(key));
- // test exist
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertTrue(defaultConfiguration.isPropertyDefined(key));
- }
-
- @Test
- public void testIsValidBoolean() throws Exception {
- String key = "key";
- // test not exist
- Assert.assertFalse(defaultConfiguration.isValidBoolean(key));
- // test exist with invalid
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertFalse(defaultConfiguration.isValidBoolean(key));
- // test exist with valid
- defaultConfiguration.setProperty(key, "True");
- Assert.assertTrue(defaultConfiguration.isPropertyDefined(key));
- defaultConfiguration.setProperty(key, "FaLse");
- Assert.assertTrue(defaultConfiguration.isPropertyDefined(key));
- }
-
- @Test
- public void testIsValidDouble() throws Exception {
- String key = "key";
- // test not exist
- Assert.assertFalse(defaultConfiguration.isValidDouble(key));
- // test exist with invalid
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertFalse(defaultConfiguration.isValidDouble(key));
- // test exist with valid
- defaultConfiguration.setProperty(key, "2");
- Assert.assertTrue(defaultConfiguration.isValidDouble(key));
- defaultConfiguration.setProperty(key, "3.45");
- Assert.assertTrue(defaultConfiguration.isValidDouble(key));
- }
-
- @Test
- public void testIsValidInteger() throws Exception {
- String key = "key";
- // test not exist
- Assert.assertFalse(defaultConfiguration.isValidInteger(key));
- // test exist with invalid
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertFalse(defaultConfiguration.isValidInteger(key));
- defaultConfiguration.setProperty(key, "3.45");
- Assert.assertFalse(defaultConfiguration.isValidInteger(key));
- // test exist with valid
- defaultConfiguration.setProperty(key, "2");
- Assert.assertTrue(defaultConfiguration.isValidInteger(key));
- }
-
- @Test
- public void testIsValidLong() throws Exception {
- String key = "key";
- // test not exist
- Assert.assertFalse(defaultConfiguration.isValidLong(key));
- // test exist with invalid
- defaultConfiguration.setProperty(key, "abc");
- Assert.assertFalse(defaultConfiguration.isValidLong(key));
- defaultConfiguration.setProperty(key, "3.45");
- Assert.assertFalse(defaultConfiguration.isValidLong(key));
- // test exist with valid
- defaultConfiguration.setProperty(key, "2");
- Assert.assertTrue(defaultConfiguration.isValidLong(key));
- }
-
- @Test
- public void testSetPropertiesWithInputStream() throws Exception {
- InputStream mockIS = mock(InputStream.class);
- defaultConfiguration.setProperties(mockIS);
-
- Properties mockProp = mock(Properties.class);
- Mockito.doThrow(new IOException("testing exception")).when(mockProp).load(mockIS);
- Whitebox.setInternalState(defaultConfiguration, "properties", mockProp);
- defaultConfiguration.setProperties(mockIS);
- // Should come here without exception
- }
-
- @Test
- public void testToString() throws Exception {
- Properties internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
- Assert.assertEquals(String.format("Configuration: %d properties, keys:[%s]",
- internalProp.size(), internalProp.keySet().toString()), defaultConfiguration.toString());
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/encryption/TestEncryption.java b/appc-common/src/test/java/org/openecomp/appc/encryption/TestEncryption.java
deleted file mode 100644
index aa9664d2e..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/encryption/TestEncryption.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.encryption;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import org.junit.Test;
-import org.onap.appc.encryption.EncryptionTool;
-
-public class TestEncryption {
-
- @Test
- public void testEncryptionDecryption() {
- String plain = "AppC";
- String enc = EncryptionTool.getInstance().encrypt(plain);
- assertNotEquals(plain, enc);
- String dec = EncryptionTool.getInstance().decrypt(enc);
- assertNotEquals(enc, dec);
- assertEquals(plain, dec);
- System.out.println(String.format("%s = [%s]", plain, enc));
- }
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/exceptions/APPCExceptionTest.java b/appc-common/src/test/java/org/openecomp/appc/exceptions/APPCExceptionTest.java
deleted file mode 100644
index a9611a2df..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/exceptions/APPCExceptionTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.exceptions;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-
-public class APPCExceptionTest {
-
- @Test
- public void testConstructorNoArgument() throws Exception {
- APPCException appcException = new APPCException();
- Assert.assertTrue(appcException.getCause() == null);
- Assert.assertTrue(appcException.getLocalizedMessage() == null);
- Assert.assertTrue(appcException.getMessage() == null);
- }
-
- @Test
- public void testConstructorWithMessaqge() throws Exception {
- String message = "testing message";
- APPCException appcException = new APPCException(message);
- Assert.assertTrue(appcException.getCause() == null);
- Assert.assertEquals(message, appcException.getLocalizedMessage());
- Assert.assertEquals(message, appcException.getMessage());
- }
-
- @Test
- public void testConstructorWithThrowable() throws Exception {
- String message = "testing message";
- Throwable throwable = new Throwable(message);
- APPCException appcException = new APPCException(throwable);
- Assert.assertEquals(throwable, appcException.getCause());
- Assert.assertTrue(appcException.getLocalizedMessage().contains(message));
- Assert.assertTrue(appcException.getMessage().contains(message));
- }
-
- @Test
- public void testConstructorWithMessageAndThrowable() throws Exception {
- String message = "testing message";
- String tMessage = "throwable message";
- Throwable throwable = new Throwable(tMessage);
- APPCException appcException = new APPCException(message, throwable);
- Assert.assertEquals(throwable, appcException.getCause());
- Assert.assertTrue(appcException.getLocalizedMessage().contains(message));
- Assert.assertTrue(appcException.getMessage().contains(message));
- }
-
- @Test
- public void testConstructorWithFourArguments() throws Exception {
- String message = "testing message";
- String tMessage = "throwable message";
- Throwable throwable = new Throwable(tMessage);
- APPCException appcException = new APPCException(message, throwable, true, true);
- Assert.assertEquals(throwable, appcException.getCause());
- Assert.assertTrue(appcException.getLocalizedMessage().contains(message));
- Assert.assertTrue(appcException.getMessage().contains(message));
-
- Assert.assertTrue(Whitebox.getInternalState(appcException, "stackTrace") != null);
- Assert.assertTrue(Whitebox.getInternalState(appcException, "suppressedExceptions") != null);
-
- appcException = new APPCException(message, throwable, false, false);
- Assert.assertTrue(Whitebox.getInternalState(appcException, "stackTrace") == null);
- Assert.assertTrue(Whitebox.getInternalState(appcException, "suppressedExceptions") == null);
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidInputExceptionTest.java b/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidInputExceptionTest.java
deleted file mode 100644
index 9822ff7ee..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidInputExceptionTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.exceptions;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class InvalidInputExceptionTest {
- @Test
- public void testConstructor() throws Exception {
- String message = "testing message";
- InvalidInputException invalidInputException = new InvalidInputException(message);
- Assert.assertTrue(invalidInputException.getCause() == null);
- Assert.assertEquals(message, invalidInputException.getLocalizedMessage());
- Assert.assertEquals(message, invalidInputException.getMessage());
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidStateExceptionTest.java b/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidStateExceptionTest.java
deleted file mode 100644
index c008131f1..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/exceptions/InvalidStateExceptionTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.exceptions;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class InvalidStateExceptionTest {
- @Test
- public void testConstructor() throws Exception {
- String message = "testing message";
- InvalidStateException invalidStateException = new InvalidStateException(message);
- Assert.assertTrue(invalidStateException.getCause() == null);
- Assert.assertEquals(message, invalidStateException.getLocalizedMessage());
- Assert.assertEquals(message, invalidStateException.getMessage());
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/exceptions/UnknownProviderExceptionTest.java b/appc-common/src/test/java/org/openecomp/appc/exceptions/UnknownProviderExceptionTest.java
deleted file mode 100644
index d3c7ab5ef..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/exceptions/UnknownProviderExceptionTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.exceptions;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-public class UnknownProviderExceptionTest {
-
- @Test
- public void testConstructorNoArgument() throws Exception {
- UnknownProviderException unknownProviderException = new UnknownProviderException();
- Assert.assertTrue(unknownProviderException.getCause() == null);
- Assert.assertTrue(unknownProviderException.getLocalizedMessage() == null);
- Assert.assertTrue(unknownProviderException.getMessage() == null);
- }
-
- @Test
- public void testConstructorWithMessaqge() throws Exception {
- String message = "testing message";
- UnknownProviderException unknownProviderException = new UnknownProviderException(message);
- Assert.assertTrue(unknownProviderException.getCause() == null);
- Assert.assertEquals(message, unknownProviderException.getLocalizedMessage());
- Assert.assertEquals(message, unknownProviderException.getMessage());
- }
-
- @Test
- public void testConstructorWithThrowable() throws Exception {
- String message = "testing message";
- Throwable throwable = new Throwable(message);
- UnknownProviderException unknownProviderException = new UnknownProviderException(throwable);
- Assert.assertEquals(throwable, unknownProviderException.getCause());
- Assert.assertTrue(unknownProviderException.getLocalizedMessage().contains(message));
- Assert.assertTrue(unknownProviderException.getMessage().contains(message));
- }
-
- @Test
- public void testConstructorWithMessageAndThrowable() throws Exception {
- String message = "testing message";
- String tMessage = "throwable message";
- Throwable throwable = new Throwable(tMessage);
- UnknownProviderException unknownProviderException = new UnknownProviderException(message, throwable);
- Assert.assertEquals(throwable, unknownProviderException.getCause());
- Assert.assertTrue(unknownProviderException.getLocalizedMessage().contains(message));
- Assert.assertTrue(unknownProviderException.getMessage().contains(message));
- }
-
- @Test
- public void testConstructorWithFourArguements() throws Exception {
- String message = "testing message";
- String tMessage = "throwable message";
- Throwable throwable = new Throwable(tMessage);
- UnknownProviderException unknownProviderException =
- new UnknownProviderException(message, throwable, true, true);
- Assert.assertEquals(throwable, unknownProviderException.getCause());
- Assert.assertTrue(unknownProviderException.getLocalizedMessage().contains(message));
- Assert.assertTrue(unknownProviderException.getMessage().contains(message));
-
- Assert.assertTrue(Whitebox.getInternalState(unknownProviderException, "stackTrace") != null);
- Assert.assertTrue(Whitebox.getInternalState(unknownProviderException,
- "suppressedExceptions") != null);
-
- unknownProviderException = new UnknownProviderException(message, throwable, false, false);
- Assert.assertTrue(Whitebox.getInternalState(unknownProviderException,
- "stackTrace") == null);
- Assert.assertTrue(Whitebox.getInternalState(unknownProviderException,
- "suppressedExceptions") == null);
- }
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/i18n/MsgTest.java b/appc-common/src/test/java/org/openecomp/appc/i18n/MsgTest.java
deleted file mode 100644
index 1a541a5d4..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/i18n/MsgTest.java
+++ /dev/null
@@ -1,771 +0,0 @@
-package org.onap.appc.i18n;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class MsgTest {
-
- @Test
- public void testNameAndToString() throws Exception {
- for (Msg msg : Msg.values()) {
- Assert.assertEquals(msg.name(), msg.toString());
- }
- }
-
- @Test
- public void testCONFIGURATION_STARTED() {
- assertNotNull(Msg.valueOf("CONFIGURATION_STARTED"));
- }
-
- @Test
- public void testCONFIGURATION_CLEARED() {
- assertNotNull(Msg.valueOf("CONFIGURATION_CLEARED"));
- }
-
- @Test
- public void testLOADING_CONFIGURATION_OVERRIDES() {
- assertNotNull(Msg.valueOf("LOADING_CONFIGURATION_OVERRIDES"));
- }
-
-
- @Test
- public void testLOADING_DEFAULTS() {
- assertNotNull(Msg.valueOf("LOADING_DEFAULTS"));
- }
-
-
- @Test
- public void testNO_DEFAULTS_FOUND() {
- assertNotNull(Msg.valueOf("NO_DEFAULTS_FOUND"));
- }
-
- @Test
- public void testPROPERTY_VALUE() {
- assertNotNull(Msg.valueOf("PROPERTY_VALUE"));
- }
-
- @Test
- public void testNO_OVERRIDE_PROPERTY_FILE_LOADED() {
- assertNotNull(Msg.valueOf("NO_OVERRIDE_PROPERTY_FILE_LOADED"));
- }
-
- @Test
- public void testSEARCHING_CONFIGURATION_OVERRIDES() {
- assertNotNull(Msg.valueOf("SEARCHING_CONFIGURATION_OVERRIDES"));
- }
-
- @Test
- public void testLOADING_APPLICATION_OVERRIDES() {
- assertNotNull(Msg.valueOf("LOADING_APPLICATION_OVERRIDES"));
- }
-
- @Test
- public void testNO_APPLICATION_OVERRIDES() {
- assertNotNull(Msg.valueOf("NO_APPLICATION_OVERRIDES"));
- }
-
- @Test
- public void testMERGING_SYSTEM_PROPERTIES() {
- assertNotNull(Msg.valueOf("MERGING_SYSTEM_PROPERTIES"));
- }
-
- @Test
- public void testSETTING_SPECIAL_PROPERTY() {
- assertNotNull(Msg.valueOf("SETTING_SPECIAL_PROPERTY"));
- }
-
- @Test
- public void testLOADING_RESOURCE_BUNDLE() {
- assertNotNull(Msg.valueOf("LOADING_RESOURCE_BUNDLE"));
- }
-
- @Test
- public void testLOGGING_ALREADY_INITIALIZED() { assertNotNull(Msg.valueOf("LOGGING_ALREADY_INITIALIZED")); }
-
- @Test
- public void testSEARCHING_LOG_CONFIGURATION() {
- assertNotNull(Msg.valueOf("SEARCHING_LOG_CONFIGURATION"));
- }
-
- @Test
- public void testLOADING_DEFAULT_LOG_CONFIGURATION() {
- assertNotNull(Msg.valueOf("LOADING_DEFAULT_LOG_CONFIGURATION"));
- }
-
- @Test
- public void testNO_LOG_CONFIGURATION() {
- assertNotNull(Msg.valueOf("NO_LOG_CONFIGURATION"));
- }
-
- @Test
- public void testUNSUPPORTED_LOGGING_FRAMEWORK() {
- assertNotNull(Msg.valueOf("UNSUPPORTED_LOGGING_FRAMEWORK"));
- }
-
- @Test
- public void testLOADING_LOG_CONFIGURATION() {
- assertNotNull(Msg.valueOf("LOADING_LOG_CONFIGURATION"));
- }
-
- @Test
- public void testUNKNOWN_PROVIDER() {
- assertNotNull(Msg.valueOf("UNKNOWN_PROVIDER"));
- }
-
- @Test
- public void testSERVER_STATE_CHANGE_TIMEOUT() {
- assertNotNull(Msg.valueOf("SERVER_STATE_CHANGE_TIMEOUT"));
- }
-
- @Test
- public void testSERVER_DELETED() {
- assertNotNull(Msg.valueOf("SERVER_DELETED"));
- }
-
- @Test
- public void testUNKNOWN_SERVER_STATE() {
- assertNotNull(Msg.valueOf("UNKNOWN_SERVER_STATE"));
- }
-
- @Test
- public void testCOMPONENT_INITIALIZING() {
- assertNotNull(Msg.valueOf("COMPONENT_INITIALIZING"));
- }
-
- @Test
- public void testCOMPONENT_INITIALIZED() {
- assertNotNull(Msg.valueOf("COMPONENT_INITIALIZED"));
- }
-
- @Test
- public void testCOMPONENT_TERMINATING() {
- assertNotNull(Msg.valueOf("COMPONENT_TERMINATING"));
- }
-
- @Test
- public void testCOMPONENT_TERMINATED() {
- assertNotNull(Msg.valueOf("COMPONENT_TERMINATED"));
- }
-
- @Test
- public void testIAAS_ADAPTER_UNSUPPORTED_OPERATION() {
- assertNotNull(Msg.valueOf("IAAS_ADAPTER_UNSUPPORTED_OPERATION"));
- }
-
- @Test
- public void testIAAS_ADAPTER_RPC_CALLED() {
- assertNotNull(Msg.valueOf("IAAS_ADAPTER_RPC_CALLED"));
- }
-
- @Test
- public void testNO_SERVICE_FOUND() {
- assertNotNull(Msg.valueOf("NO_SERVICE_FOUND"));
- }
-
- @Test
- public void testCONTEXT_PARAMETERS_DISPLAY() {
- assertNotNull(Msg.valueOf("CONTEXT_PARAMETERS_DISPLAY"));
- }
-
- @Test
- public void testRESPONSE_PARAMETERS_DISPLAY() {
- assertNotNull(Msg.valueOf("RESPONSE_PARAMETERS_DISPLAY"));
- }
-
- @Test
- public void testNULL_OR_INVALID_ARGUMENT() {
- assertNotNull(Msg.valueOf("NULL_OR_INVALID_ARGUMENT"));
- }
-
- @Test
- public void testPROCESSING_REQUEST() {
- assertNotNull(Msg.valueOf("PROCESSING_REQUEST"));
- }
-
- @Test
- public void testINVALID_SERVICE_REQUEST() {
- assertNotNull(Msg.valueOf("INVALID_SERVICE_REQUEST"));
- }
-
- @Test
- public void testREGISTERING_SERVICE() {
- assertNotNull(Msg.valueOf("REGISTERING_SERVICE"));
- }
-
- @Test
- public void testUNREGISTERING_SERVICE() {
- assertNotNull(Msg.valueOf("UNREGISTERING_SERVICE"));
- }
-
- @Test
- public void testLOADING_PROVIDER_DEFINITIONS() {
- assertNotNull(Msg.valueOf("LOADING_PROVIDER_DEFINITIONS"));
- }
-
- @Test
- public void testRESTARTING_SERVER() {
- assertNotNull(Msg.valueOf("RESTARTING_SERVER"));
- }
-
- @Test
- public void testREBUILDING_SERVER() {
- assertNotNull(Msg.valueOf("REBUILDING_SERVER"));
- }
-
- @Test
- public void testMIGRATING_SERVER() {
- assertNotNull(Msg.valueOf("MIGRATING_SERVER"));
- }
-
- @Test
- public void testEVACUATING_SERVER() {
- assertNotNull(Msg.valueOf("EVACUATING_SERVER"));
- }
-
- @Test
- public void testSNAPSHOTING_SERVER() {
- assertNotNull(Msg.valueOf("SNAPSHOTING_SERVER"));
- }
-
- @Test
- public void testLOOKING_SERVER_UP() {
- assertNotNull(Msg.valueOf("LOOKING_SERVER_UP"));
- }
-
- @Test
- public void testINVALID_SELF_LINK_URL() {
- assertNotNull(Msg.valueOf("INVALID_SELF_LINK_URL"));
- }
-
- @Test
- public void testSERVER_FOUND() {
- assertNotNull(Msg.valueOf("SERVER_FOUND"));
- }
-
- @Test
- public void testSERVER_NOT_FOUND() {
- assertNotNull(Msg.valueOf("SERVER_NOT_FOUND"));
- }
-
- @Test
- public void testSERVER_OPERATION_EXCEPTION() {
- assertNotNull(Msg.valueOf("SERVER_OPERATION_EXCEPTION"));
- }
-
- @Test
- public void testMISSING_REQUIRED_PROPERTIES() {
- assertNotNull(Msg.valueOf("MISSING_REQUIRED_PROPERTIES"));
- }
-
- @Test
- public void testSERVER_ERROR_STATE() {
- assertNotNull(Msg.valueOf("SERVER_ERROR_STATE"));
- }
-
- @Test
- public void testIMAGE_NOT_FOUND() {
- assertNotNull(Msg.valueOf("IMAGE_NOT_FOUND"));
- }
-
- @Test
- public void testSTATE_CHANGE_TIMEOUT() {
- assertNotNull(Msg.valueOf("STATE_CHANGE_TIMEOUT"));
- }
-
- @Test
- public void testSTATE_CHANGE_EXCEPTION() {
- assertNotNull(Msg.valueOf("STATE_CHANGE_EXCEPTION"));
- }
-
- @Test
- public void testSTOP_SERVER() {
- assertNotNull(Msg.valueOf("STOP_SERVER"));
- }
-
- @Test
- public void testSTART_SERVER() {
- assertNotNull(Msg.valueOf("START_SERVER"));
- }
-
- @Test
- public void testRESUME_SERVER() {
- assertNotNull(Msg.valueOf("RESUME_SERVER"));
- }
-
- @Test
- public void testUNPAUSE_SERVER() {
- assertNotNull(Msg.valueOf("UNPAUSE_SERVER"));
- }
-
- @Test
- public void testREBUILD_SERVER() {
- assertNotNull(Msg.valueOf("REBUILD_SERVER"));
- }
-
- @Test
- public void testCONNECTION_FAILED_RETRY() {
- assertNotNull(Msg.valueOf("CONNECTION_FAILED_RETRY"));
- }
-
- @Test
- public void testCONNECTION_FAILED() {
- assertNotNull(Msg.valueOf("CONNECTION_FAILED"));
- }
-
- @Test
- public void testSTOPPING_SERVER() {
- assertNotNull(Msg.valueOf("STOPPING_SERVER"));
- }
-
- @Test
- public void testSTARTING_SERVER() {
- assertNotNull(Msg.valueOf("STARTING_SERVER"));
- }
-
- @Test
- public void testREBUILD_SERVER_FAILED() {
- assertNotNull(Msg.valueOf("REBUILD_SERVER_FAILED"));
- }
-
- @Test
- public void testPARAMETER_IS_MISSING() {
- assertNotNull(Msg.valueOf("PARAMETER_IS_MISSING"));
- }
-
- @Test
- public void testPARAMETER_NOT_NUMERIC() {
- assertNotNull(Msg.valueOf("PARAMETER_NOT_NUMERIC"));
- }
-
- @Test
- public void testDG_FAILED_RESPONSE() {
- assertNotNull(Msg.valueOf("DG_FAILED_RESPONSE"));
- }
-
- @Test
- public void testEXCEPTION_CALLING_DG() {
- assertNotNull(Msg.valueOf("EXCEPTION_CALLING_DG"));
- }
-
- @Test
- public void testGRAPH_NOT_FOUND() {
- assertNotNull(Msg.valueOf("GRAPH_NOT_FOUND"));
- }
-
- @Test
- public void testDEBUG_GRAPH_RESPONSE_HEADER() {
- assertNotNull(Msg.valueOf("DEBUG_GRAPH_RESPONSE_HEADER"));
- }
-
- @Test
- public void testDEBUG_GRAPH_RESPONSE_DETAIL() {
- assertNotNull(Msg.valueOf("DEBUG_GRAPH_RESPONSE_DETAIL"));
- }
-
- @Test
- public void testINVALID_REQUIRED_PROPERTY() {
- assertNotNull(Msg.valueOf("INVALID_REQUIRED_PROPERTY"));
- }
-
- @Test
- public void testMIGRATE_SERVER_FAILED() {
- assertNotNull(Msg.valueOf("MIGRATE_SERVER_FAILED"));
- }
-
- @Test
- public void testEVACUATE_SERVER_FAILED() {
- assertNotNull(Msg.valueOf("EVACUATE_SERVER_FAILED"));
- }
-
- @Test
- public void testEVACUATE_SERVER_REBUILD_FAILED() {
- assertNotNull(Msg.valueOf("EVACUATE_SERVER_REBUILD_FAILED"));
- }
-
- @Test
- public void testAPPC_TOO_BUSY() {
- assertNotNull(Msg.valueOf("APPC_TOO_BUSY"));
- }
-
- @Test
- public void testVF_SERVER_BUSY() {
- assertNotNull(Msg.valueOf("VF_SERVER_BUSY"));
- }
-
- @Test
- public void testVF_ILLEGAL_COMMAND() {
- assertNotNull(Msg.valueOf("VF_ILLEGAL_COMMAND"));
- }
-
- @Test
- public void testVF_UNDEFINED_STATE() {
- assertNotNull(Msg.valueOf("VF_UNDEFINED_STATE"));
- }
-
- @Test
- public void testAPPC_NO_RESOURCE_FOUND() {
- assertNotNull(Msg.valueOf("APPC_NO_RESOURCE_FOUND"));
- }
-
- @Test
- public void testAPPC_EXPIRED_REQUEST() {
- assertNotNull(Msg.valueOf("APPC_EXPIRED_REQUEST"));
- }
-
- @Test
- public void testAPPC_WORKFLOW_NOT_FOUND() {
- assertNotNull(Msg.valueOf("APPC_WORKFLOW_NOT_FOUND"));
- }
-
- @Test
- public void testAPPC_INVALID_INPUT() {
- assertNotNull(Msg.valueOf("APPC_INVALID_INPUT"));
- }
-
- @Test
- public void testAPPC_AUDIT_MSG() {
- assertNotNull(Msg.valueOf("APPC_AUDIT_MSG"));
- }
-
- @Test
- public void testAAI_CONNECTION_FAILED() {
- assertNotNull(Msg.valueOf("AAI_CONNECTION_FAILED"));
- }
-
- @Test
- public void testAAI_UPDATE_FAILED() {
- assertNotNull(Msg.valueOf("AAI_UPDATE_FAILED"));
- }
-
- @Test
- public void testAAI_GET_DATA_FAILED() {
- assertNotNull(Msg.valueOf("AAI_GET_DATA_FAILED"));
- }
-
- @Test
- public void testAAI_CONNECTION_FAILED_RETRY() {
- assertNotNull(Msg.valueOf("AAI_CONNECTION_FAILED_RETRY"));
- }
-
- @Test
- public void testAAI_DELETE_FAILED() {
- assertNotNull(Msg.valueOf("AAI_DELETE_FAILED"));
- }
-
- @Test
- public void testAAI_QUERY_FAILED() {
- assertNotNull(Msg.valueOf("AAI_QUERY_FAILED"));
- }
-
- @Test
- public void testVNF_CONFIGURED() {
- assertNotNull(Msg.valueOf("VNF_CONFIGURED"));
- }
-
- @Test
- public void testVNF_CONFIGURATION_STARTED() {
- assertNotNull(Msg.valueOf("VNF_CONFIGURATION_STARTED"));
- }
-
- @Test
- public void testVNF_CONFIGURATION_FAILED() {
- assertNotNull(Msg.valueOf("VNF_CONFIGURATION_FAILED"));
- }
-
- @Test
- public void testVNF_TEST_STARTED() {
- assertNotNull(Msg.valueOf("VNF_TEST_STARTED"));
- }
-
- @Test
- public void testVNF_TESTED() {
- assertNotNull(Msg.valueOf("VNF_TESTED"));
- }
-
- @Test
- public void testVNF_TEST_FAILED() {
- assertNotNull(Msg.valueOf("VNF_TEST_FAILED"));
- }
-
- @Test
- public void testVNF_NOT_FOUND() {
- assertNotNull(Msg.valueOf("VNF_NOT_FOUND"));
- }
-
- @Test
- public void testVNF_HEALTHCECK_FAILED() {
- assertNotNull(Msg.valueOf("VNF_HEALTHCECK_FAILED"));
- }
-
- @Test
- public void testVM_HEALTHCECK_FAILED() {
- assertNotNull(Msg.valueOf("VM_HEALTHCECK_FAILED"));
- }
-
- @Test
- public void testSTOP_SERVER_FAILED() {
- assertNotNull(Msg.valueOf("STOP_SERVER_FAILED"));
- }
-
- @Test
- public void testTERMINATE_SERVER_FAILED() {
- assertNotNull(Msg.valueOf("TERMINATE_SERVER_FAILED"));
- }
-
- @Test
- public void testTERMINATING_SERVER() {
- assertNotNull(Msg.valueOf("TERMINATING_SERVER"));
- }
-
- @Test
- public void testTERMINATE_SERVER() {
- assertNotNull(Msg.valueOf("TERMINATE_SERVER"));
- }
-
- @Test
- public void testMIGRATE_COMPLETE() {
- assertNotNull(Msg.valueOf("MIGRATE_COMPLETE"));
- }
-
- @Test
- public void testRESTART_COMPLETE() {
- assertNotNull(Msg.valueOf("RESTART_COMPLETE"));
- }
-
- @Test
- public void testREBUILD_COMPLETE() {
- assertNotNull(Msg.valueOf("REBUILD_COMPLETE"));
- }
-
- @Test
- public void testSTACK_FOUND() {
- assertNotNull(Msg.valueOf("STACK_FOUND"));
- }
-
- @Test
- public void testTERMINATING_STACK() {
- assertNotNull(Msg.valueOf("TERMINATING_STACK"));
- }
-
- @Test
- public void testTERMINATE_STACK() {
- assertNotNull(Msg.valueOf("TERMINATE_STACK"));
- }
-
- @Test
- public void testSTACK_NOT_FOUND() {
- assertNotNull(Msg.valueOf("STACK_NOT_FOUND"));
- }
-
- @Test
- public void testSTACK_OPERATION_EXCEPTION() {
- assertNotNull(Msg.valueOf("STACK_OPERATION_EXCEPTION"));
- }
-
- @Test
- public void testTERMINATE_STACK_FAILED() {
- assertNotNull(Msg.valueOf("TERMINATE_STACK_FAILED"));
- }
-
- @Test
- public void testCLOSE_CONTEXT_FAILED() {
- assertNotNull(Msg.valueOf("CLOSE_CONTEXT_FAILED"));
- }
-
- @Test
- public void testSNAPSHOTING_STACK() {
- assertNotNull(Msg.valueOf("SNAPSHOTING_STACK"));
- }
-
- @Test
- public void testSTACK_SNAPSHOTED() {
- assertNotNull(Msg.valueOf("STACK_SNAPSHOTED"));
- }
-
- @Test
- public void testRESTORING_STACK() {
- assertNotNull(Msg.valueOf("RESTORING_STACK"));
- }
-
- @Test
- public void testSTACK_RESTORED() {
- assertNotNull(Msg.valueOf("STACK_RESTORED"));
- }
-
- @Test
- public void testCHECKING_SERVER() {
- assertNotNull(Msg.valueOf("CHECKING_SERVER"));
- }
-
- @Test
- public void testMISSING_PARAMETER_IN_REQUEST() {
- assertNotNull(Msg.valueOf("MISSING_PARAMETER_IN_REQUEST"));
- }
-
- @Test
- public void testCANNOT_ESTABLISH_CONNECTION() {
- assertNotNull(Msg.valueOf("CANNOT_ESTABLISH_CONNECTION"));
- }
-
- @Test
- public void testAPPC_METRIC_MSG() {
- assertNotNull(Msg.valueOf("APPC_METRIC_MSG"));
- }
-
- @Test
- public void testINPUT_PAYLOAD_PARSING_FAILED() {
- assertNotNull(Msg.valueOf("INPUT_PAYLOAD_PARSING_FAILED"));
- }
-
- @Test
- public void testAPPC_EXCEPTION() {
- assertNotNull(Msg.valueOf("APPC_EXCEPTION"));
- }
-
- @Test
- public void testSSH_DATA_EXCEPTION() {
- assertNotNull(Msg.valueOf("SSH_DATA_EXCEPTION"));
- }
-
- @Test
- public void testJSON_PROCESSING_EXCEPTION() {
- assertNotNull(Msg.valueOf("JSON_PROCESSING_EXCEPTION"));
- }
-
- @Test
- public void testSUCCESS_EVENT_MESSAGE() {
- assertNotNull(Msg.valueOf("SUCCESS_EVENT_MESSAGE"));
- }
-
- @Test
- public void testDEPENDENCY_MODEL_NOT_FOUND() {
- assertNotNull(Msg.valueOf("DEPENDENCY_MODEL_NOT_FOUND"));
- }
-
- @Test
- public void testINVALID_DEPENDENCY_MODEL() {
- assertNotNull(Msg.valueOf("INVALID_DEPENDENCY_MODEL"));
- }
-
- @Test
- public void testFAILURE_RETRIEVE_VNFC_DG() {
- assertNotNull(Msg.valueOf("FAILURE_RETRIEVE_VNFC_DG"));
- }
-
- @Test
- public void testSERVER_NETWORK_ERROR() {
- assertNotNull(Msg.valueOf("SERVER_NETWORK_ERROR"));
- }
-
- @Test
- public void testHYPERVISOR_DOWN_ERROR() {
- assertNotNull(Msg.valueOf("HYPERVISOR_DOWN_ERROR"));
- }
-
- @Test
- public void testHYPERVISOR_STATUS_UKNOWN() {
- assertNotNull(Msg.valueOf("HYPERVISOR_STATUS_UKNOWN"));
- }
-
- @Test
- public void testHYPERVISOR_NETWORK_ERROR() {
- assertNotNull(Msg.valueOf("HYPERVISOR_NETWORK_ERROR"));
- }
-
- @Test
- public void testAPPLICATION_RESTART_FAILED() {
- assertNotNull(Msg.valueOf("APPLICATION_RESTART_FAILED"));
- }
-
- @Test
- public void testAPPLICATION_START_FAILED() {
- assertNotNull(Msg.valueOf("APPLICATION_START_FAILED"));
- }
-
- @Test
- public void testAPPLICATION_STOP_FAILED() {
- assertNotNull(Msg.valueOf("APPLICATION_STOP_FAILED"));
- }
-
- @Test
- public void testRESTART_APPLICATION() {
- assertNotNull(Msg.valueOf("RESTART_APPLICATION"));
- }
-
- @Test
- public void testSTART_APPLICATION() {
- assertNotNull(Msg.valueOf("START_APPLICATION"));
- }
-
- @Test
- public void testSTOP_APPLICATION() {
- assertNotNull(Msg.valueOf("STOP_APPLICATION"));
- }
-
- @Test
- public void testLCM_OPERATIONS_DISABLED() {
- assertNotNull(Msg.valueOf("LCM_OPERATIONS_DISABLED"));
- }
-
- @Test
- public void testOAM_OPERATION_EXCEPTION() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_EXCEPTION"));
- }
-
- @Test
- public void testOAM_OPERATION_ENTERING_MAINTENANCE_MODE() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_ENTERING_MAINTENANCE_MODE"));
- }
-
- @Test
- public void testOAM_OPERATION_MAINTENANCE_MODE() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_MAINTENANCE_MODE"));
- }
-
- @Test
- public void testOAM_OPERATION_STARTING() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_STARTING"));
- }
-
- @Test
- public void testOAM_OPERATION_STARTED() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_STARTED"));
- }
-
- @Test
- public void testOAM_OPERATION_STOPPING() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_STOPPING"));
- }
-
- @Test
- public void testOAM_OPERATION_STOPPED() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_STOPPED"));
- }
-
- @Test
- public void testINVALID_STATE_TRANSITION() {
- assertNotNull(Msg.valueOf("INVALID_STATE_TRANSITION"));
- }
-
- @Test
- public void testREQUEST_HANDLER_UNAVAILABLE() {
- assertNotNull(Msg.valueOf("REQUEST_HANDLER_UNAVAILABLE"));
- }
-
- @Test
- public void testOAM_OPERATION_RESTARTING() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_RESTARTING"));
- }
-
- @Test
- public void testOAM_OPERATION_RESTARTED() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_RESTARTED"));
- }
-
- @Test
- public void testOAM_OPERATION_INVALID_INPUT() {
- assertNotNull(Msg.valueOf("OAM_OPERATION_INVALID_INPUT"));
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/logging/LoggingConstantsTest.java b/appc-common/src/test/java/org/openecomp/appc/logging/LoggingConstantsTest.java
deleted file mode 100644
index 1238b494b..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/logging/LoggingConstantsTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.logging;
-
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-public class LoggingConstantsTest {
- @Test (expected = IllegalAccessError.class)
- public void testConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.class);
- }
-
- @Test (expected = IllegalAccessError.class)
- public void testMdcKeysConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.MDCKeys.class);
- }
-
- @Test (expected = IllegalAccessError.class)
- public void testStatusCodesConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.StatusCodes.class);
- }
-
- @Test (expected = IllegalAccessError.class)
- public void testTargetNamesConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.TargetNames.class);
- }
-
- @Test (expected = IllegalAccessError.class)
- public void testTargetServiceNamesConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.TargetServiceNames.class);
- }
-
- @Test (expected = IllegalAccessError.class)
- public void testAAIServiceNamesConstructor() throws Exception {
- Whitebox.invokeConstructor(LoggingConstants.TargetServiceNames.AAIServiceNames.class);
- }
-} \ No newline at end of file
diff --git a/appc-common/src/test/java/org/openecomp/appc/metadata/TestMetadataService.java b/appc-common/src/test/java/org/openecomp/appc/metadata/TestMetadataService.java
deleted file mode 100644
index 7316fe8a6..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/metadata/TestMetadataService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.metadata;
-
-import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import com.sun.rowset.CachedRowSetImpl;
-import org.mockito.Mockito;
-import org.onap.appc.metadata.impl.MetadataServiceImpl;
-
-import javax.sql.rowset.CachedRowSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import static org.mockito.Matchers.anyCollection;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-
-
-
-public class TestMetadataService {
-
- MetadataServiceImpl metadataService = new MetadataServiceImpl();
-
- TestMetadataService() throws SQLException {
- DbLibService dbLibService = mock(DbLibService.class);
- metadataService.setDbLibService(dbLibService);
- CachedRowSet mockRS = new CachedRowSetImpl();
- Mockito.when(dbLibService.getData(anyString(), (ArrayList<String>)anyCollection(), anyString())).thenReturn(mockRS);
- }
-
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifierTest.java b/appc-common/src/test/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifierTest.java
deleted file mode 100644
index 95f3312cb..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/metadata/objects/DependencyModelIdentifierTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.metadata.objects;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-import static org.onap.appc.metadata.objects.DependencyModelIdentifier.prime;
-
-public class DependencyModelIdentifierTest {
- private static final String vnfType = "vnfType";
- private static final String vnfType2 = "vnfType2";
- private static final String cVersion = "catalogVersion";
- private DependencyModelIdentifier identifier;
- private DependencyModelIdentifier identifier1;
- private DependencyModelIdentifier identifier2;
- private DependencyModelIdentifier identifier3;
-
- @Before
- public void setUp() throws Exception {
- identifier = new DependencyModelIdentifier(vnfType, cVersion);
- identifier1 = new DependencyModelIdentifier(null, null);
- identifier2 = new DependencyModelIdentifier(vnfType, null);
- identifier3 = new DependencyModelIdentifier(null, cVersion);
- }
-
- @Test
- public void testConstructorAndGetterAndToString() throws Exception {
- Assert.assertEquals(vnfType, Whitebox.getInternalState(identifier, "vnfType"));
- Assert.assertEquals(cVersion, Whitebox.getInternalState(identifier, "catalogVersion"));
-
- Assert.assertEquals(vnfType, identifier.getVnfType());
- Assert.assertEquals(cVersion, identifier.getCatalogVersion());
-
- Assert.assertEquals(String.format(DependencyModelIdentifier.TO_STRING_FORMAT, vnfType, cVersion),
- identifier.toString());
- }
-
- @Test
- public void testHashCode() throws Exception {
- Assert.assertEquals((prime + vnfType.hashCode()) * prime + cVersion.hashCode(), identifier.hashCode());
- Assert.assertEquals(prime * prime, identifier1.hashCode());
- Assert.assertEquals((prime + vnfType.hashCode()) * prime , identifier2.hashCode());
- Assert.assertEquals(prime* prime + cVersion.hashCode(), identifier3.hashCode());
- }
-
- @Test
- public void testEquals() throws Exception {
- // other object is null
- Assert.assertFalse(identifier.equals(null));
- // other object is wrong data type
- Assert.assertFalse(identifier.equals("abc"));
-
- // my vnfType is null
- Assert.assertFalse(identifier1.equals(identifier));
- // different vnfType
- DependencyModelIdentifier identifier4 = new DependencyModelIdentifier(vnfType2, cVersion);
- Assert.assertFalse(identifier.equals(identifier4));
- // same vnfType, my catalogVerson is null
- Assert.assertFalse(identifier2.equals(identifier));
- // same vnfType and both catalogVersion are null
- identifier4 = new DependencyModelIdentifier(vnfType, null);
- Assert.assertTrue(identifier2.equals(identifier4));
-
- Assert.assertFalse(identifier.equals(identifier1));
- Assert.assertFalse(identifier.equals(identifier2));
- Assert.assertFalse(identifier.equals(identifier3));
-
- Assert.assertFalse(identifier2.equals(identifier1));
- Assert.assertFalse(identifier2.equals(identifier3));
-
-
- Assert.assertFalse(identifier3.equals(identifier));
- Assert.assertFalse(identifier3.equals(identifier1));
- Assert.assertFalse(identifier3.equals(identifier2));
-
- identifier4 = new DependencyModelIdentifier(vnfType, cVersion);
- Assert.assertTrue(identifier.equals(identifier4));
- }
-
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/pool/CachedElementTest.java b/appc-common/src/test/java/org/openecomp/appc/pool/CachedElementTest.java
deleted file mode 100644
index 30e592430..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/pool/CachedElementTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-
-
-package org.onap.appc.pool;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.appc.pool.Allocator;
-import org.onap.appc.pool.CachedElement;
-import org.onap.appc.pool.Destructor;
-import org.onap.appc.pool.Pool;
-import org.onap.appc.pool.PoolDrainedException;
-import org.onap.appc.pool.PoolExtensionException;
-import org.onap.appc.pool.PoolSpecificationException;
-import org.onap.appc.pool.*;
-
-
-public class CachedElementTest implements Allocator<Testable>, Destructor<Testable> {
- private static final int MIN = 10;
- private static final int MAX = 100;
- private Pool<Testable> pool;
- private int index = 0;
- private int destroyCount = 0;
-
- /**
- * setup
- *
- * @throws PoolSpecificationException
- * If the minimum size is less than 0, or if the max size is non-zero and less than the min size.
- */
- @Before
- public void setup() throws PoolSpecificationException {
- pool = new Pool<>(MIN, MAX);
- }
-
- /**
- * Test state
- */
- @Test
- public void testAllocator() {
- assertNull(pool.getAllocator());
- pool.setAllocator(this);
- assertNotNull(pool.getAllocator());
- }
-
- /**
- * Test state
- */
- @Test
- public void testDestructor() {
- assertNull(pool.getDestructor());
- pool.setDestructor(this);
- assertNotNull(pool.getDestructor());
- }
-
- /**
- * Test that we can allocate and release elements and that the pool maintains them in MRU order
- *
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws PoolDrainedException
- * If the caller is trying to reserve an element from a drained pool
- */
- @Test
- public void testAllocateAndRelease() throws PoolExtensionException, PoolDrainedException {
- pool.setAllocator(this);
-
- assertFalse(pool.isDrained());
-
- /*
- * Allocate three elements
- */
- Testable value1 = pool.reserve();
- assertNotNull(value1);
- assertEquals(Integer.valueOf(MIN - 1), Integer.valueOf(value1.getId()));
- assertEquals(1, pool.getAllocatedSize());
- assertEquals(MIN - 1, pool.getFreeSize());
- assertEquals(1, pool.getAllocatedSize());
-
- Testable value2 = pool.reserve();
- assertNotNull(value2);
- assertEquals(Integer.valueOf(MIN - 2), Integer.valueOf(value2.getId()));
- assertEquals(2, pool.getAllocatedSize());
- assertEquals(MIN - 2, pool.getFreeSize());
- assertEquals(2, pool.getAllocatedSize());
-
- Testable value3 = pool.reserve();
- assertNotNull(value3);
- assertEquals(Integer.valueOf(MIN - 3), Integer.valueOf(value3.getId()));
- assertEquals(3, pool.getAllocatedSize());
- assertEquals(MIN - 3, pool.getFreeSize());
- assertEquals(3, pool.getAllocatedSize());
-
- /*
- * Now, release them in the order obtained
- */
- pool.release(value1);
- pool.release(value2);
- pool.release(value3);
-
- assertEquals(0, pool.getAllocatedSize());
- assertEquals(MIN, pool.getFreeSize());
-
- /*
- * Now, allocate them again, but their values should be reversed (3, 2, 1) representing the most recently used
- * to the least recently used.
- */
- value1 = pool.reserve();
- assertNotNull(value1);
- assertEquals(Integer.valueOf(MIN - 3), Integer.valueOf(value1.getId()));
-
- value2 = pool.reserve();
- assertNotNull(value2);
- assertEquals(Integer.valueOf(MIN - 2), Integer.valueOf(value2.getId()));
-
- value3 = pool.reserve();
- assertNotNull(value3);
- assertEquals(Integer.valueOf(MIN - 1), Integer.valueOf(value3.getId()));
- }
-
- /**
- * Test that we can trim the pool to a desired size
- *
- * @throws PoolDrainedException
- * If the caller is trying to release or reserve an element from a drained pool
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws IllegalAccessException
- * if this Method object is enforcing Java language access control and the underlying method is
- * inaccessible.
- * @throws IllegalArgumentException
- * if the method is an instance method and the specified object argument is not an instance of the class
- * or interface declaring the underlying method (or of a subclass or implementor thereof); if the number
- * of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or
- * if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal
- * parameter type by a method invocation conversion.
- * @throws InvocationTargetException
- * if the underlying method throws an exception.
- * @throws SecurityException
- * If a security manager, s, is present and any of the following conditions is met:
- * <ul>
- * <li>invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the declared method</li>
- * <li>the caller's class loader is not the same as or an ancestor of the class loader for the current
- * class and invocation of s.checkPackageAccess() denies access to the package of this class</li>
- * </ul>
- * @throws NoSuchMethodException
- * if a matching method is not found.
- */
- @SuppressWarnings("nls")
- @Test
- public void testTrim() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
- PoolDrainedException, PoolExtensionException, NoSuchMethodException, SecurityException {
-
- pool.setAllocator(this);
- int SIZE = 50;
- Testable[] array = new Testable[SIZE];
-
- assertEquals(0, pool.getAllocatedSize());
- for (int i = 0; i < SIZE; i++) {
- array[i] = pool.reserve();
- }
- assertEquals(SIZE, pool.getAllocatedSize());
-
- for (int i = 0; i < SIZE; i++) {
- pool.release(array[i]);
- }
- assertEquals(0, pool.getAllocatedSize());
-
- assertEquals(SIZE, pool.getFreeSize());
-
- Method trimMethod = Pool.class.getDeclaredMethod("trim", new Class[] {
- Integer.TYPE
- });
- trimMethod.setAccessible(true);
- trimMethod.invoke(pool, new Object[] {
- SIZE - MIN
- });
-
- assertEquals(MIN, pool.getFreeSize());
- }
-
- /**
- * Test that we can drain a pool containing a mix of free and allocated elements
- *
- * @throws PoolDrainedException
- * If the caller is trying to release or reserve an element from a drained pool
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws IOException
- * if an I/O error occurs
- */
- @Test
- public void testDrain() throws PoolExtensionException, PoolDrainedException, IOException {
- int SIZE = 50;
- int FREE = 20;
- int ALLOC = SIZE - FREE;
-
- Testable[] array = new Testable[SIZE];
- pool.setAllocator(this);
- pool.setDestructor(this);
-
- assertFalse(pool.isDrained());
-
- assertEquals(0, pool.getAllocatedSize());
- for (int i = 0; i < SIZE; i++) {
- array[i] = pool.reserve();
- }
- assertEquals(SIZE, pool.getAllocatedSize());
-
- for (int i = 0; i < FREE; i++) {
- array[i].close();
- }
- assertEquals(ALLOC, pool.getAllocatedSize());
- assertEquals(FREE, pool.getFreeSize());
-
- pool.drain();
- assertEquals(0, pool.getFreeSize());
- assertEquals(0, pool.getAllocatedSize());
- assertTrue(pool.isDrained());
-
- assertEquals(SIZE, destroyCount);
- }
-
- /**
- * @see org.onap.appc.pool.Allocator#allocate(org.onap.appc.pool.Pool)
- */
- @Override
- public Testable allocate(Pool<Testable> pool) {
- Testable element = new Element(index++);
- Testable ce = CachedElement.newInstance(pool, element, new Class[] {
- Testable.class
- });
- return ce;
- }
-
- /**
- * @see org.onap.appc.pool.Destructor#destroy(java.io.Closeable, org.onap.appc.pool.Pool)
- */
- @Override
- public void destroy(Testable obj, Pool<Testable> pool) {
- destroyCount++;
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/pool/Element.java b/appc-common/src/test/java/org/openecomp/appc/pool/Element.java
deleted file mode 100644
index 877fab2aa..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/pool/Element.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-
-
-package org.onap.appc.pool;
-
-import java.io.IOException;
-
-public class Element implements Testable {
- private boolean closed;
- private Integer id;
-
- public Element(int id) {
- this.id = Integer.valueOf(id);
- closed = false;
- }
-
- @Override
- public boolean equals(Object obj) {
- boolean result = false;
- if (obj instanceof Element) {
- Element other = (Element) obj;
- result = this.id.equals(other.id);
- }
-
- return result;
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- /**
- * @see java.io.Closeable#close()
- */
- @Override
- public void close() throws IOException {
- closed = true;
- }
-
- @Override
- public Boolean isClosed() {
- return Boolean.valueOf(closed);
- }
-
- @Override
- public String toString() {
- return Integer.toString(id);
- }
-
- @Override
- public Integer getId() {
- return id;
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/pool/PoolTest.java b/appc-common/src/test/java/org/openecomp/appc/pool/PoolTest.java
deleted file mode 100644
index db9a2e615..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/pool/PoolTest.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-
-
-package org.onap.appc.pool;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.appc.pool.Allocator;
-import org.onap.appc.pool.Destructor;
-import org.onap.appc.pool.Pool;
-import org.onap.appc.pool.PoolDrainedException;
-import org.onap.appc.pool.PoolExtensionException;
-import org.onap.appc.pool.PoolSpecificationException;
-import org.onap.appc.pool.*;
-
-
-public class PoolTest implements Allocator<Testable>, Destructor<Testable> {
-
- private Pool<Testable> pool;
- private static final int MIN = 10;
- private static final int MAX = 100;
- private int index = 0;
- private int destroyCount = 0;
-
- /**
- * Set up the test by allocating a pool with MIN-MAX size (bounded pool)
- *
- * @throws PoolSpecificationException
- * If the minimum size is less than 0, or if the max size is non-zero and less than the min size.
- */
- @Before
- public void setup() throws PoolSpecificationException {
- pool = new Pool<>(MIN, MAX);
- index = 0;
- destroyCount = 0;
- }
-
- /**
- * Test that trying to construct a pool with a bad minimum throws an exception
- *
- * @throws PoolSpecificationException
- * If the minimum size is less than 0, or if the max size is non-zero and less than the min size.
- */
- @Test(expected = PoolSpecificationException.class)
- public void testInvalidMinSize() throws PoolSpecificationException {
- pool = new Pool<>(-1, MAX);
- }
-
- /**
- * Test that trying to construct a pool with a bad maximum throws an exception
- *
- * @throws PoolSpecificationException
- * If the minimum size is less than 0, or if the max size is non-zero and less than the min size.
- */
- @Test(expected = PoolSpecificationException.class)
- public void testInvalidMaxSize() throws PoolSpecificationException {
- pool = new Pool<>(MIN, -1);
- }
-
- /**
- * Test creation of a pool where max is less than min fails
- *
- * @throws PoolSpecificationException
- * If the minimum size is less than 0, or if the max size is non-zero and less than the min size.
- */
- @Test(expected = PoolSpecificationException.class)
- public void testInvalidSizeRange() throws PoolSpecificationException {
- pool = new Pool<>(MAX, MIN);
- }
-
- /**
- * Test state
- */
- @Test
- public void testMinPool() {
- assertEquals(MIN, pool.getMinPool());
- }
-
- /**
- * Test state
- */
- @Test
- public void testMaxPool() {
- assertEquals(MAX, pool.getMaxPool());
- }
-
- /**
- * Test state
- */
- @Test
- public void testAllocator() {
- assertNull(pool.getAllocator());
- pool.setAllocator(this);
- assertNotNull(pool.getAllocator());
- }
-
- /**
- * Test state
- */
- @Test
- public void testDestructor() {
- assertNull(pool.getDestructor());
- pool.setDestructor(this);
- assertNotNull(pool.getDestructor());
- }
-
- /**
- * Test that we can allocate and release elements and that the pool maintains them in MRU order
- *
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws PoolDrainedException
- * If the caller is trying to reserve an element from a drained pool
- */
- @Test
- public void testAllocateAndRelease() throws PoolExtensionException, PoolDrainedException {
- pool.setAllocator(this);
-
- assertFalse(pool.isDrained());
-
- /*
- * Allocate three elements
- */
- Testable value1 = pool.reserve();
- assertNotNull(value1);
- assertEquals(Integer.valueOf(MIN - 1), value1.getId());
- assertEquals(1, pool.getAllocatedSize());
- assertEquals(MIN - 1, pool.getFreeSize());
- assertEquals(1, pool.getAllocatedSize());
-
- Testable value2 = pool.reserve();
- assertNotNull(value2);
- assertEquals(Integer.valueOf(MIN - 2), value2.getId());
- assertEquals(2, pool.getAllocatedSize());
- assertEquals(MIN - 2, pool.getFreeSize());
- assertEquals(2, pool.getAllocatedSize());
-
- Testable value3 = pool.reserve();
- assertNotNull(value3);
- assertEquals(Integer.valueOf(MIN - 3), value3.getId());
- assertEquals(3, pool.getAllocatedSize());
- assertEquals(MIN - 3, pool.getFreeSize());
- assertEquals(3, pool.getAllocatedSize());
-
- /*
- * Now, release them in the order obtained
- */
- pool.release(value1);
- pool.release(value2);
- pool.release(value3);
-
- assertEquals(0, pool.getAllocatedSize());
- assertEquals(MIN, pool.getFreeSize());
-
- /*
- * Now, allocate them again, but their values should be reversed (3, 2, 1) representing the most recently used
- * to the least recently used.
- */
- value1 = pool.reserve();
- assertNotNull(value1);
- assertEquals(Integer.valueOf(MIN - 3), value1.getId());
-
- value2 = pool.reserve();
- assertNotNull(value2);
- assertEquals(Integer.valueOf(MIN - 2), value2.getId());
-
- value3 = pool.reserve();
- assertNotNull(value3);
- assertEquals(Integer.valueOf(MIN - 1), value3.getId());
- }
-
- /**
- * Test that we can trim the pool to a desired size
- *
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws NoSuchMethodException
- * if a matching method is not found.
- * @throws SecurityException
- * if the request is denied.
- * @throws IllegalAccessException
- * if this Method object is enforcing Java language access control and the underlying method is
- * inaccessible.
- * @throws IllegalArgumentException
- * if the method is an instance method and the specified object argument is not an instance of the class
- * or interface declaring the underlying method (or of a subclass or implementor thereof); if the number
- * of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or
- * if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal
- * parameter type by a method invocation conversion.
- * @throws InvocationTargetException
- * if the underlying method throws an exception.
- * @throws PoolDrainedException
- * If the caller is trying to reserve an element from a drained pool
- */
- @SuppressWarnings("nls")
- @Test
- public void testTrim() throws PoolExtensionException, NoSuchMethodException, SecurityException,
- IllegalAccessException, IllegalArgumentException, InvocationTargetException, PoolDrainedException {
- pool.setAllocator(this);
- int SIZE = 50;
- Proxy[] array = new Proxy[SIZE];
-
- assertEquals(0, pool.getAllocatedSize());
- for (int i = 0; i < SIZE; i++) {
- array[i] = (Proxy) pool.reserve();
- }
- assertEquals(SIZE, pool.getAllocatedSize());
-
- for (int i = 0; i < SIZE; i++) {
- pool.release((Testable) array[i]);
- }
- assertEquals(0, pool.getAllocatedSize());
-
- assertEquals(SIZE, pool.getFreeSize());
-
- Method trimMethod = Pool.class.getDeclaredMethod("trim", new Class[] {
- Integer.TYPE
- });
- trimMethod.setAccessible(true);
- trimMethod.invoke(pool, new Object[] {
- SIZE - MIN
- });
-
- assertEquals(MIN, pool.getFreeSize());
- }
-
- /**
- * Test that we can drain a pool containing a mix of free and allocated elements
- *
- * @throws PoolExtensionException
- * If the pool cannot be extended
- * @throws PoolDrainedException
- * If the caller is trying to reserve an element from a drained pool
- */
- @Test
- public void testDrain() throws PoolExtensionException, PoolDrainedException {
- int SIZE = 50;
- int FREE = 20;
- int ALLOC = SIZE - FREE;
-
- Proxy[] array = new Proxy[SIZE];
- pool.setAllocator(this);
- pool.setDestructor(this);
-
- assertFalse(pool.isDrained());
-
- assertEquals(0, pool.getAllocatedSize());
- for (int i = 0; i < SIZE; i++) {
- array[i] = (Proxy) pool.reserve();
- }
- assertEquals(SIZE, pool.getAllocatedSize());
-
- for (int i = 0; i < FREE; i++) {
- pool.release((Testable) array[i]);
- }
- assertEquals(ALLOC, pool.getAllocatedSize());
- assertEquals(FREE, pool.getFreeSize());
-
- pool.drain();
- assertEquals(0, pool.getFreeSize());
- assertEquals(0, pool.getAllocatedSize());
- assertTrue(pool.isDrained());
-
- assertEquals(SIZE, destroyCount);
- }
-
- /**
- * @see org.onap.appc.pool.Destructor#destroy(java.io.Closeable, org.onap.appc.pool.Pool)
- */
- @Override
- public void destroy(Testable obj, Pool<Testable> pool) {
- destroyCount++;
- try {
- obj.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see org.onap.appc.pool.Allocator#allocate(org.onap.appc.pool.Pool)
- */
- @Override
- public Testable allocate(Pool<Testable> pool) {
- Testable e = new Element(index++);
-
- return e;
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/pool/Testable.java b/appc-common/src/test/java/org/openecomp/appc/pool/Testable.java
deleted file mode 100644
index fb2fa75ef..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/pool/Testable.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.pool;
-
-import java.io.Closeable;
-
-public interface Testable extends Closeable {
-
- Integer getId();
-
- Boolean isClosed();
-}
-
diff --git a/appc-common/src/test/java/org/openecomp/appc/util/TestJsonUtil.java b/appc-common/src/test/java/org/openecomp/appc/util/TestJsonUtil.java
deleted file mode 100644
index 270f90f05..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/util/TestJsonUtil.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.util;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.appc.util.JsonUtil;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.junit.Assert.*;
-
-
-
-public class TestJsonUtil {
-
- @Test
- public void testConvertJsonStringToFlatMap() {
- try {
- String jsonString = "{\"A\":\"A-value\",\"B\":{\"C\":\"B.C-value\",\"D\":\"B.D-value\"}}";
- Map<String, String> flatMap = JsonUtil.convertJsonStringToFlatMap(jsonString);
- assertNotNull(flatMap);
- Map<String, String> expectedMap = new HashMap<>();
- expectedMap.put("A","A-value");
- expectedMap.put("B.C","B.C-value");
- expectedMap.put("B.D","B.D-value");
- assertEquals(expectedMap,flatMap);
- } catch (IOException e) {
- e.printStackTrace();
- Assert.fail(e.toString());
- }
- }
-
- @Test
- public void testConvertJsonStringToFlatMapWithInnerJson() {
- try {
- String jsonString = "{\"A\":\"A-value\",\"B\":\"{\\\"C\\\":\\\"C-value\\\",\\\"D\\\":\\\"D-value\\\"}\"}";
- Map<String, String> flatMap = JsonUtil.convertJsonStringToFlatMap(jsonString);
- assertNotNull(flatMap);
- Map<String, String> expectedMap = new HashMap<>();
- expectedMap.put("A","A-value");
- expectedMap.put("B","{\"C\":\"C-value\",\"D\":\"D-value\"}");
- assertEquals(expectedMap,flatMap);
- } catch (IOException e) {
- e.printStackTrace();
- Assert.fail(e.toString());
- }
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/util/TestStringHelper.java b/appc-common/src/test/java/org/openecomp/appc/util/TestStringHelper.java
deleted file mode 100644
index 06957cf2d..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/util/TestStringHelper.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-
-
-package org.onap.appc.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Properties;
-
-import org.junit.Test;
-import org.onap.appc.util.StringHelper;
-
-
-public class TestStringHelper {
-
- @Test
- public void testAsListWithNullList() {
- String value = StringHelper.asList((String[]) null);
- assertNotNull(value);
- assertEquals("[]", value);
- }
-
- @Test
- public void testAsListWithEmptyList() {
- String value = StringHelper.asList(new String[] {});
- assertNotNull(value);
- assertEquals("[]", value);
- }
-
- @Test
- public void testAsListWithSingleValue() {
- String value = StringHelper.asList("one");
- assertNotNull(value);
- assertEquals("[one]", value);
- }
-
- @Test
- public void testAsListWithTwoValues() {
- String value = StringHelper.asList("one", "two");
- assertNotNull(value);
- assertEquals("[one,two]", value);
- }
-
- @Test
- public void testAsListWithFiveValues() {
- String value = StringHelper.asList("one", "two", "three", "four", "five");
- assertNotNull(value);
- assertEquals("[one,two,three,four,five]", value);
- }
-
- @Test
- public void testPropertiesToString() {
- String key1 = "key1";
- String val1 = "val1";
- String key2 = "key2";
- String val2 = "val2";
-
- assertEquals(null, StringHelper.propertiesToString(null));
-
- Properties props = new Properties();
-
- String result = StringHelper.propertiesToString(props);
- assertNotNull(result);
- assertEquals("[ ]", result);
-
- props.setProperty(key1, val1);
- result = StringHelper.propertiesToString(props);
- assertNotNull(result);
- assertTrue(result.contains(key1));
- assertTrue(result.contains(val1));
- assertTrue(result.lastIndexOf(",") < result.length() - 3); // No trailing comma
-
- props.setProperty(key2, val2);
- result = StringHelper.propertiesToString(props);
- assertNotNull(result);
- assertTrue(result.contains(key1));
- assertTrue(result.contains(val1));
- assertTrue(result.contains(key2));
- assertTrue(result.contains(val2));
- assertTrue(result.lastIndexOf(",") < result.length() - 3); // No trailing comma
- }
-}
diff --git a/appc-common/src/test/java/org/openecomp/appc/util/TestStructuredPropertyHelper.java b/appc-common/src/test/java/org/openecomp/appc/util/TestStructuredPropertyHelper.java
deleted file mode 100644
index 06c27d0dd..000000000
--- a/appc-common/src/test/java/org/openecomp/appc/util/TestStructuredPropertyHelper.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.util;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.appc.util.StructuredPropertyHelper;
-import org.onap.appc.util.StructuredPropertyHelper.Node;
-
-/**
- * This class is used to test the structured property helper class.
- * <p>
- * A structured property is one where the name is constructed from a compound set of elements, concatenated by a period,
- * and optionally being enumerated using a sequence number suffix. A java package name is an example of a structured
- * name, where each element of the name represents a directory or name in the namespace hierarchy. Property names may
- * also be structured. This class constructs a graph of the structured properties and this test case is used to verify
- * its operation.
- * </p>
- *
- */
-public class TestStructuredPropertyHelper {
-
- /**
- * The properties to be parsed
- */
- private Properties properties;
-
- /**
- * The result of parsing the properties
- */
- private List<Node> nodes = new ArrayList<>();
-
- /**
- * Initialize the test environment
- */
- @SuppressWarnings("nls")
- @Before
- public void setup() {
- nodes.clear();
-
- properties = new Properties();
-
- properties.setProperty("provider1.name", "provider1Name");
- properties.setProperty("provider1.type", "provider1type");
- properties.setProperty("provider1.URL", "provider1URL");
- properties.setProperty("provider2.name", "provider2Name");
- properties.setProperty("provider2.type", "provider2type");
- properties.setProperty("provider2.URL", "provider2URL");
- properties.setProperty("provider003.name", "provider3Name");
- properties.setProperty("provider003.type", "provider3type");
- properties.setProperty("provider003.URL", "provider3URL");
-
- properties.setProperty("node1.level1.value1.key", "1.1.1");
- properties.setProperty("node1.level1.value2.key", "1.1.2");
- properties.setProperty("node1.level1.value3.key", "1.1.3");
- properties.setProperty("node1.level2.value1.key", "1.2.1");
- properties.setProperty("node1.level2.value2.key", "1.2.2");
- properties.setProperty("node1.level2.value3.key", "1.2.3");
- properties.setProperty("node1.level3.value1.key", "1.3.1");
- properties.setProperty("node1.level3.value2.key", "1.3.2");
- properties.setProperty("node1.level3.value3.key", "1.3.3");
- properties.setProperty("node2.level1.value1.key", "2.1.1");
- properties.setProperty("node2.level1.value2.key", "2.1.2");
- properties.setProperty("node2.level1.value3.key", "2.1.3");
- properties.setProperty("node2.level2.value1.key", "2.2.1");
- properties.setProperty("node2.level2.value2.key", "2.2.2");
- properties.setProperty("node2.level2.value3.key", "2.2.3");
- properties.setProperty("node2.level3.value1.key", "2.3.1");
- properties.setProperty("node2.level3.value2.key", "2.3.2");
- properties.setProperty("node2.level3.value3.key", "2.3.3");
- properties.setProperty("node3.level1.value1.key", "3.1.1");
- properties.setProperty("node3.level1.value2.key", "3.1.2");
- properties.setProperty("node3.level1.value3.key", "3.1.3");
- properties.setProperty("node3.level2.value1.key", "3.2.1");
- properties.setProperty("node3.level2.value2.key", "3.2.2");
- properties.setProperty("node3.level2.value3.key", "3.2.3");
- properties.setProperty("node3.level3.value1.key", "3.3.1");
- properties.setProperty("node3.level3.value2.key", "3.3.2");
- properties.setProperty("node3.level3.value3.key", "3.3.3");
-
- properties.setProperty("other.property", "bogus");
- properties.setProperty("yet.another.property", "bogus");
- properties.setProperty("simpleProperty", "bogus");
-
- }
-
- /**
- * Test that a simple namespace works
- */
- @SuppressWarnings("nls")
- @Test
- public void testSimpleNamespace() {
- nodes = StructuredPropertyHelper.getStructuredProperties(properties, "provider");
-
- assertNotNull(nodes);
- assertFalse(nodes.isEmpty());
-
- assertEquals(3, nodes.size());
-
- List<Node> children;
- for (Node node : nodes) {
- switch (node.getName()) {
- case "provider1":
- assertNull(node.getValue());
- children = node.getChildren();
- assertNotNull(children);
- assertEquals(3, children.size());
- for (Node child : children) {
- switch (child.getName()) {
- case "URL":
- assertEquals("provider1URL", child.getValue());
- break;
- case "type":
- assertEquals("provider1type", child.getValue());
- break;
- case "name":
- assertEquals("provider1Name", child.getValue());
- break;
- default:
- fail("Unknown child of " + node.getName() + " with value " + child.toString());
- }
- }
- break;
- case "provider2":
- assertNull(node.getValue());
- children = node.getChildren();
- assertNotNull(children);
- assertEquals(3, children.size());
- for (Node child : children) {
- switch (child.getName()) {
- case "URL":
- assertEquals("provider2URL", child.getValue());
- break;
- case "type":
- assertEquals("provider2type", child.getValue());
- break;
- case "name":
- assertEquals("provider2Name", child.getValue());
- break;
- default:
- fail("Unknown child of " + node.getName() + " with value " + child.toString());
- }
- }
- break;
- case "provider3":
- /*
- * Note that the helper normalizes any ordinal suffixes (003 became 3)
- */
- assertNull(node.getValue());
- children = node.getChildren();
- assertNotNull(children);
- assertEquals(3, children.size());
- for (Node child : children) {
- switch (child.getName()) {
- case "URL":
- assertEquals("provider3URL", child.getValue());
- break;
- case "type":
- assertEquals("provider3type", child.getValue());
- break;
- case "name":
- assertEquals("provider3Name", child.getValue());
- break;
- default:
- fail("Unknown child of " + node.getName() + " with value " + child.toString());
- }
- }
- break;
- default:
- fail("Unknown provider " + node.toString());
- }
- }
- // System.out.println(nodes);
- }
-
- /**
- * Test a multi-dimensional namespace (3X3X3)
- */
- @SuppressWarnings("nls")
- @Test
- public void testMultiLevelNamespace() {
- nodes = StructuredPropertyHelper.getStructuredProperties(properties, "node");
-
- assertNotNull(nodes);
- assertFalse(nodes.isEmpty());
-
- assertEquals(3, nodes.size());
- for (Node node : nodes) {
- assertNull(node.getValue());
- List<Node> children = node.getChildren();
- assertNotNull(children);
- assertEquals(3, children.size());
- for (Node child : children) {
- assertNull(child.getValue());
- List<Node> grandChildren = child.getChildren();
- assertNotNull(grandChildren);
- assertEquals(3, grandChildren.size());
- for (Node greatGrandChild : grandChildren) {
- assertNull(greatGrandChild.getValue());
- List<Node> greatGrandChildren = greatGrandChild.getChildren();
- assertNotNull(greatGrandChildren);
- assertEquals(1, greatGrandChildren.size());
- }
- }
- }
- // System.out.println(nodes);
- }
-}