diff options
author | Patrick Brady <pb071s@att.com> | 2017-05-16 19:56:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-05-16 19:56:46 +0000 |
commit | 0b5c94513448866c614d098b5603fcda94d00c0d (patch) | |
tree | 7927a893d1e1723b3a2b6c071296e3c70368f66b /appc-common/src | |
parent | ccf361a446c19d1c67ed1adf4db191be67c3cf58 (diff) | |
parent | 802a6d56da75982fef0f65a30d245ef98fce1220 (diff) |
Merge "Remove unused class StreamHelper"
Diffstat (limited to 'appc-common/src')
-rw-r--r-- | appc-common/src/main/java/org/openecomp/appc/util/StreamHelper.java | 60 | ||||
-rw-r--r-- | appc-common/src/test/java/org/openecomp/appc/util/TestStreamHelper.java | 78 |
2 files changed, 0 insertions, 138 deletions
diff --git a/appc-common/src/main/java/org/openecomp/appc/util/StreamHelper.java b/appc-common/src/main/java/org/openecomp/appc/util/StreamHelper.java deleted file mode 100644 index 8f80b8117..000000000 --- a/appc-common/src/main/java/org/openecomp/appc/util/StreamHelper.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : APP-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - - -package org.openecomp.appc.util; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; - -public class StreamHelper { - - /** - * private default constructor prevents instantiation - */ - private StreamHelper() { - } - - /** - * @param inputStream - * @return Input stream converted to string - */ - public static String getStringFromInputStream(InputStream inputStream) { - StringBuffer buffer = new StringBuffer(); - byte[] array = new byte[4096]; - - if (inputStream != null) { - try { - int len = inputStream.read(array); - while (len != -1) { - buffer.append(new String(array, 0, len, Charset.forName("UTF-8"))); - len = inputStream.read(array); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - return buffer.toString(); - } - -} diff --git a/appc-common/src/test/java/org/openecomp/appc/util/TestStreamHelper.java b/appc-common/src/test/java/org/openecomp/appc/util/TestStreamHelper.java deleted file mode 100644 index d0b93a3c1..000000000 --- a/appc-common/src/test/java/org/openecomp/appc/util/TestStreamHelper.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * openECOMP : APP-C - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.appc.util; - -import static org.junit.Assert.*; - -import java.io.ByteArrayInputStream; - -import org.junit.Test; -import org.openecomp.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)); - } - -} |