summaryrefslogtreecommitdiffstats
path: root/appc-common/src/test
diff options
context:
space:
mode:
authorSkip Wonnell <skip@att.com>2017-12-16 18:48:27 -0600
committerPatrick Brady <pb071s@att.com>2017-12-19 04:39:25 +0000
commit17c2c59a3301cdc969fe53a9de8e0d84d4163b9e (patch)
treeee21556245fa45e9cab78b5ef52e7655b33e45d1 /appc-common/src/test
parent3d77400558365d716f567248d189a474d0bc8fae (diff)
Platform hardening for common bundle
General code clean up code Additional test cases Support for APPC-348, APPC-349 Issue-ID: APPC-305 Change-Id: I341c960bb33794c681aea86f2bd1b415294ec03f Signed-off-by: Skip Wonnell <skip@att.com>
Diffstat (limited to 'appc-common/src/test')
-rw-r--r--appc-common/src/test/java/org/onap/appc/ConstantsTest.java34
-rw-r--r--appc-common/src/test/java/org/onap/appc/cache/CacheStrategiesTest.java6
-rw-r--r--appc-common/src/test/java/org/onap/appc/cache/impl/LRUCacheTest.java1
-rw-r--r--appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java10
-rw-r--r--appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheImplTest.java4
-rw-r--r--appc-common/src/test/java/org/onap/appc/configuration/DefaultConfigurationTest.java16
-rw-r--r--appc-common/src/test/java/org/onap/appc/exceptions/UnknownProviderExceptionTest.java16
-rw-r--r--appc-common/src/test/java/org/onap/appc/i18n/MsgTest.java781
-rw-r--r--appc-common/src/test/java/org/onap/appc/logging/LoggingConstantsTest.java8
-rw-r--r--appc-common/src/test/java/org/onap/appc/metadata/TestMetadataService.java22
-rw-r--r--appc-common/src/test/java/org/onap/appc/metadata/objects/DependencyModelIdentifierTest.java19
-rw-r--r--appc-common/src/test/java/org/onap/appc/util/TestJsonUtil.java9
-rw-r--r--appc-common/src/test/java/org/onap/appc/util/TestStreamHelper.java81
13 files changed, 199 insertions, 808 deletions
diff --git a/appc-common/src/test/java/org/onap/appc/ConstantsTest.java b/appc-common/src/test/java/org/onap/appc/ConstantsTest.java
new file mode 100644
index 000000000..6afdb9e67
--- /dev/null
+++ b/appc-common/src/test/java/org/onap/appc/ConstantsTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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;
+
+import org.junit.Test;
+
+public class ConstantsTest {
+ @Test (expected = IllegalAccessError.class)
+ public void testConstructor() throws Exception {
+ Constants constants = new Constants();
+ }
+}
diff --git a/appc-common/src/test/java/org/onap/appc/cache/CacheStrategiesTest.java b/appc-common/src/test/java/org/onap/appc/cache/CacheStrategiesTest.java
index 41ceb4303..fe3c88306 100644
--- a/appc-common/src/test/java/org/onap/appc/cache/CacheStrategiesTest.java
+++ b/appc-common/src/test/java/org/onap/appc/cache/CacheStrategiesTest.java
@@ -9,15 +9,15 @@
* 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=========================================================
*/
diff --git a/appc-common/src/test/java/org/onap/appc/cache/impl/LRUCacheTest.java b/appc-common/src/test/java/org/onap/appc/cache/impl/LRUCacheTest.java
index 3f4233d86..0cf9e0b23 100644
--- a/appc-common/src/test/java/org/onap/appc/cache/impl/LRUCacheTest.java
+++ b/appc-common/src/test/java/org/onap/appc/cache/impl/LRUCacheTest.java
@@ -40,7 +40,6 @@ public class LRUCacheTest {
Assert.assertTrue(internalMap.size() == 0);
}
- @SuppressWarnings("unchecked")
@Test
public void testGetAndPutObject() throws Exception {
LRUCache cache = new LRUCache(20);
diff --git a/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java b/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
index 386118025..91d147f83 100644
--- a/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
+++ b/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheFactoryTest.java
@@ -24,6 +24,7 @@
package org.onap.appc.cache.impl;
+import static org.mockito.Mockito.mock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,9 +34,6 @@ 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 {
@@ -62,8 +60,10 @@ public class MetadataCacheFactoryTest {
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));
+ PowerMockito.whenNew(MetadataCacheImpl.class).withArguments(cacheStrategies)
+ .thenReturn(mockImpl);
+ Assert.assertEquals(mockImpl,
+ MetadataCacheFactory.getInstance().getMetadataCache(cacheStrategies));
}
}
diff --git a/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheImplTest.java b/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheImplTest.java
index c68fb48dc..63b6626da 100644
--- a/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheImplTest.java
+++ b/appc-common/src/test/java/org/onap/appc/cache/impl/MetadataCacheImplTest.java
@@ -24,13 +24,12 @@
package org.onap.appc.cache.impl;
+import static org.mockito.Mockito.spy;
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 {
@@ -49,7 +48,6 @@ public class MetadataCacheImplTest {
Whitebox.getInternalState(impl, "strategy") == null);
}
- @SuppressWarnings("unchecked")
@Test
public void testGetAndPutObject() throws Exception {
MetadataCacheImpl impl = spy(new MetadataCacheImpl<>());
diff --git a/appc-common/src/test/java/org/onap/appc/configuration/DefaultConfigurationTest.java b/appc-common/src/test/java/org/onap/appc/configuration/DefaultConfigurationTest.java
index a423eae81..f56f6cb3e 100644
--- a/appc-common/src/test/java/org/onap/appc/configuration/DefaultConfigurationTest.java
+++ b/appc-common/src/test/java/org/onap/appc/configuration/DefaultConfigurationTest.java
@@ -24,18 +24,16 @@
package org.onap.appc.configuration;
+import static org.mockito.Mockito.mock;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
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";
@@ -64,7 +62,8 @@ public class DefaultConfigurationTest {
@Test
public void testClone() throws Exception {
Object clonedObject = defaultConfiguration.clone();
- Assert.assertTrue("Should be DefaultConfiguration", clonedObject instanceof DefaultConfiguration);
+ Assert.assertTrue("Should be DefaultConfiguration",
+ clonedObject instanceof DefaultConfiguration);
Properties internalProp = Whitebox.getInternalState(defaultConfiguration, "properties");
Properties clonedInternalProp = Whitebox.getInternalState(clonedObject, "properties");
Assert.assertEquals(internalProp, clonedInternalProp);
@@ -332,6 +331,7 @@ public class DefaultConfigurationTest {
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());
+ internalProp.size(), internalProp.keySet().toString()),
+ defaultConfiguration.toString());
}
}
diff --git a/appc-common/src/test/java/org/onap/appc/exceptions/UnknownProviderExceptionTest.java b/appc-common/src/test/java/org/onap/appc/exceptions/UnknownProviderExceptionTest.java
index d3c7ab5ef..1db5c6009 100644
--- a/appc-common/src/test/java/org/onap/appc/exceptions/UnknownProviderExceptionTest.java
+++ b/appc-common/src/test/java/org/onap/appc/exceptions/UnknownProviderExceptionTest.java
@@ -9,15 +9,15 @@
* 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=========================================================
*/
@@ -62,7 +62,8 @@ public class UnknownProviderExceptionTest {
String message = "testing message";
String tMessage = "throwable message";
Throwable throwable = new Throwable(tMessage);
- UnknownProviderException unknownProviderException = new UnknownProviderException(message, throwable);
+ UnknownProviderException unknownProviderException =
+ new UnknownProviderException(message, throwable);
Assert.assertEquals(throwable, unknownProviderException.getCause());
Assert.assertTrue(unknownProviderException.getLocalizedMessage().contains(message));
Assert.assertTrue(unknownProviderException.getMessage().contains(message));
@@ -79,13 +80,14 @@ public class UnknownProviderExceptionTest {
Assert.assertTrue(unknownProviderException.getLocalizedMessage().contains(message));
Assert.assertTrue(unknownProviderException.getMessage().contains(message));
- Assert.assertTrue(Whitebox.getInternalState(unknownProviderException, "stackTrace") != null);
+ 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, "stackTrace") == null);
Assert.assertTrue(Whitebox.getInternalState(unknownProviderException,
"suppressedExceptions") == null);
}
diff --git a/appc-common/src/test/java/org/onap/appc/i18n/MsgTest.java b/appc-common/src/test/java/org/onap/appc/i18n/MsgTest.java
index 1a541a5d4..f3021cf73 100644
--- a/appc-common/src/test/java/org/onap/appc/i18n/MsgTest.java
+++ b/appc-common/src/test/java/org/onap/appc/i18n/MsgTest.java
@@ -1,12 +1,33 @@
-package org.onap.appc.i18n;
+/*-
+ * ============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=========================================================
+ */
-import static org.junit.Assert.assertNotNull;
+package org.onap.appc.i18n;
import org.junit.Assert;
import org.junit.Test;
public class MsgTest {
-
@Test
public void testNameAndToString() throws Exception {
for (Msg msg : Msg.values()) {
@@ -14,758 +35,4 @@ public class MsgTest {
}
}
- @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/onap/appc/logging/LoggingConstantsTest.java b/appc-common/src/test/java/org/onap/appc/logging/LoggingConstantsTest.java
index 1238b494b..e57001f17 100644
--- a/appc-common/src/test/java/org/onap/appc/logging/LoggingConstantsTest.java
+++ b/appc-common/src/test/java/org/onap/appc/logging/LoggingConstantsTest.java
@@ -9,15 +9,15 @@
* 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=========================================================
*/
@@ -57,4 +57,4 @@ public class LoggingConstantsTest {
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/onap/appc/metadata/TestMetadataService.java b/appc-common/src/test/java/org/onap/appc/metadata/TestMetadataService.java
index 7316fe8a6..dd66a2d39 100644
--- a/appc-common/src/test/java/org/onap/appc/metadata/TestMetadataService.java
+++ b/appc-common/src/test/java/org/onap/appc/metadata/TestMetadataService.java
@@ -24,18 +24,16 @@
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;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import javax.sql.rowset.CachedRowSet;
+import org.mockito.Mockito;
+import org.onap.appc.metadata.impl.MetadataServiceImpl;
+import org.onap.ccsdk.sli.core.dblib.DbLibService;
+import com.sun.rowset.CachedRowSetImpl;
@@ -46,8 +44,10 @@ public class TestMetadataService {
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);
+ CachedRowSet mockRS = new CachedRowSetImpl();
+ Mockito.when(
+ dbLibService.getData(anyString(), (ArrayList<String>) anyCollection(), anyString()))
+ .thenReturn(mockRS);
}
diff --git a/appc-common/src/test/java/org/onap/appc/metadata/objects/DependencyModelIdentifierTest.java b/appc-common/src/test/java/org/onap/appc/metadata/objects/DependencyModelIdentifierTest.java
index 95f3312cb..c7eed3d28 100644
--- a/appc-common/src/test/java/org/onap/appc/metadata/objects/DependencyModelIdentifierTest.java
+++ b/appc-common/src/test/java/org/onap/appc/metadata/objects/DependencyModelIdentifierTest.java
@@ -9,28 +9,27 @@
* 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 static org.onap.appc.metadata.objects.DependencyModelIdentifier.prime;
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";
@@ -56,16 +55,18 @@ public class DependencyModelIdentifierTest {
Assert.assertEquals(vnfType, identifier.getVnfType());
Assert.assertEquals(cVersion, identifier.getCatalogVersion());
- Assert.assertEquals(String.format(DependencyModelIdentifier.TO_STRING_FORMAT, vnfType, cVersion),
+ 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 + 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());
+ Assert.assertEquals((prime + vnfType.hashCode()) * prime, identifier2.hashCode());
+ Assert.assertEquals(prime * prime + cVersion.hashCode(), identifier3.hashCode());
}
@Test
diff --git a/appc-common/src/test/java/org/onap/appc/util/TestJsonUtil.java b/appc-common/src/test/java/org/onap/appc/util/TestJsonUtil.java
index 270f90f05..5963c6795 100644
--- a/appc-common/src/test/java/org/onap/appc/util/TestJsonUtil.java
+++ b/appc-common/src/test/java/org/onap/appc/util/TestJsonUtil.java
@@ -71,4 +71,13 @@ public class TestJsonUtil {
Assert.fail(e.toString());
}
}
+
+ @Test
+ public void testEscapeDollarInMessgeFormatter(){
+ String msg="${SYNC_NEW201}";
+ Map<String,Object> respMsg=new HashMap<String,Object>();
+ respMsg.put("vnfid",msg);
+ String formatedMsg=MessageFormatter.format(msg,respMsg);
+ Assert.assertEquals(msg,formatedMsg);
+ }
}
diff --git a/appc-common/src/test/java/org/onap/appc/util/TestStreamHelper.java b/appc-common/src/test/java/org/onap/appc/util/TestStreamHelper.java
new file mode 100644
index 000000000..70ac8a087
--- /dev/null
+++ b/appc-common/src/test/java/org/onap/appc/util/TestStreamHelper.java
@@ -0,0 +1,81 @@
+/*-
+ * ============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.io.ByteArrayInputStream;
+
+import org.junit.Test;
+import org.onap.appc.util.StreamHelper;
+
+public class TestStreamHelper {
+
+ private static final String text = "Filler text (also placeholder text or dummy text) is text that shares "
+ + "some characteristics of a real written text, but is random or otherwise generated. It may be used "
+ + "to display a sample of fonts, generate text for testing, or to spoof an e-mail spam filter. The "
+ + "process of using filler text is sometimes called greeking, although the text itself may be nonsense, "
+ + "or largely Latin, as in Lorem ipsum.\nASDF is the sequence of letters that appear on the first four "
+ + "keys on the home row of a QWERTY or QWERTZ keyboard. They are often used as a sample or test case "
+ + "or as random, meaningless nonsense. It is also a common learning tool for keyboard classes, since "
+ + "all four keys are located on Home row.\nETAOIN SHRDLU is the approximate order of frequency of the "
+ + "twelve most commonly used letters in the English language, best known as a nonsense phrase that "
+ + "sometimes appeared in print in the days of \"hot type\" publishing due to a custom of Linotype "
+ + "machine operators.\nLorem ipsum... is one of the most common filler texts, popular with "
+ + "typesetters and graphic designers. \"Li Europan lingues...\" is another similar example.\n"
+ + "Now is the time for all good men to come to the aid of the party\" is a phrase first proposed "
+ + "as a typing drill by instructor Charles E. Weller; its use is recounted in his book The Early "
+ + "History of the Typewriter, p. 21 (1918).[1] Frank E. McGurrin, an expert on the early Remington "
+ + "typewriter, used it in demonstrating his touch typing abilities in January 1889.[2] It has "
+ + "appeared in a number of typing books, often in the form \"Now is the time for all good men to "
+ + "come to the aid of their country.\"\nThe quick brown fox jumps over the lazy dog - A coherent, "
+ + "short phrase that uses every letter of the alphabet. See pangram for more examples.\nNew Petitions"
+ + " and Building Code - Many B movies of the 1940s, 50s, and 60s utilized the \"spinning newspaper\" "
+ + "effect to narrate important plot points that occurred offscreen. The effect necessitated the "
+ + "appearance of a realistic front page, which consisted of a main headline relevant to the plot, "
+ + "and several smaller headlines used as filler. A large number of these spinning newspapers "
+ + "included stories titled \"New Petitions Against Tax\" and \"Building Code Under Fire.\" These "
+ + "phrases have become running jokes among B movie fans, and particularly fans of Mystery "
+ + "Science Theater 3000. \nCharacter Generator Protocol - The Character Generator Protocol "
+ + "(CHARGEN) service is an Internet protocol intended for testing, debugging, and measurement "
+ + "purposes.\n!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefgh\n\""
+ + "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghi\n"
+ + "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghij\n"
+ + "$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijk\n";
+
+ @Test
+ public void testStreamHelperNullStream() {
+ assertNotNull(StreamHelper.getStringFromInputStream(null));
+ assertEquals("", StreamHelper.getStringFromInputStream(null));
+ }
+
+ @Test
+ public void testStreamHelperByteArrayStream() {
+ ByteArrayInputStream in = new ByteArrayInputStream(text.getBytes());
+
+ assertEquals(text, StreamHelper.getStringFromInputStream(in));
+ }
+
+}