summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-params/provider/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'appc-config/appc-config-params/provider/src/test/java')
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java89
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java38
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java159
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java67
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java108
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java92
6 files changed, 290 insertions, 263 deletions
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
index be11384c4..25ab29ed9 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
@@ -22,49 +22,44 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.parser;
+package org.onap.sdnc.config.params.parser;
+
-import static org.junit.Assert.assertEquals;
-import java.io.File;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.apache.commons.lang.StringUtils;
import org.junit.Ignore;
-import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
-import org.openecomp.sdnc.config.params.transformer.ArtificatTransformer;
-
+import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.sdnc.config.params.ParamsHandlerConstant;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.ArtificatTransformer;
public class TestPropertyDefinitionNode {
- @Ignore
+ @Ignore
public void testProcessMissingParamKeys() throws Exception {
PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
- String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
- String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
SvcLogicContext ctx = new SvcLogicContext();
propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
- assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+ ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
}
@@ -74,18 +69,29 @@ public class TestPropertyDefinitionNode {
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
- String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
- String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "SOURCE");
SvcLogicContext ctx = new SvcLogicContext();
propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
- assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
-}
+
+ for (Object key : ctx.getAttributeKeySet()) {
+ String parmName = (String) key;
+ String parmValue = ctx.getAttribute(parmName);
+ if (StringUtils.contains(parmName, "keys")) {
+ System.out.println("Key: " + parmName + ", Value: " + parmValue);
+ }
+ }
+ assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+ ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ }
@Test
public void mergeJsonData() throws Exception {
@@ -93,24 +99,47 @@ public class TestPropertyDefinitionNode {
Map<String, String> inParams = new HashMap<String, String>();
inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
- String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
- String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
+ String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
SvcLogicContext ctx = new SvcLogicContext();
propertyDefinitionNode.mergeJsonData(inParams, ctx);
- assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ String mergedParams = ctx
+ .getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER);
+ assertNotNull(mergedParams);
+ assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+ ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
}
@Test
public void testArtificatTransformer() throws Exception {
ArtificatTransformer transformer = new ArtificatTransformer();
- String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
String yaml = transformer.convertPDToYaml(propertyDefinition);
}
-
+
+
+ @Test
+ public void testValidationPd() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+ .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, jsonData);
+ inParams.put(ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, mergeJsonData);
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
+ propertyDefinitionNode.validateParams(inParams, ctx);
+ }
+
}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
index 33845ddca..19651fcc3 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
@@ -22,17 +22,24 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-public class TestArtifactProcessor{
+public class TestArtifactProcessor {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -42,37 +49,38 @@ public class TestArtifactProcessor{
ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
- OutputStream outstream=null;
+ OutputStream outstream = null;
File tempFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(tempFile);
- arp.generateArtifact(pdString,outstream);
+ arp.generateArtifact(pdString, outstream);
outstream.flush();
outstream.close();
String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
String toscaString = getFileContent(tempFile);
- Assert.assertEquals(expectedTosca,toscaString);
+ Assert.assertEquals(expectedTosca, toscaString);
}
@Test
- public void testArtifactProcessorWithStringOutput() throws IOException, ArtifactProcessorException {
+ public void testArtifactProcessorWithStringOutput()
+ throws IOException, ArtifactProcessorException {
ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
- OutputStream outstream=null;
+ OutputStream outstream = null;
outstream = new ByteArrayOutputStream();
- arp.generateArtifact(pdString,outstream);
+ arp.generateArtifact(pdString, outstream);
outstream.flush();
outstream.close();
String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
- String toscaString = outstream.toString();
+ String toscaString = outstream.toString();
}
- private String getFileContent(String fileName) throws IOException{
+ private String getFileContent(String fileName) throws IOException {
ClassLoader classLoader = new TestArtifactProcessor().getClass().getClassLoader();
InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -88,7 +96,7 @@ public class TestArtifactProcessor{
return fileString;
}
- private String getFileContent(File file) throws IOException{
+ private String getFileContent(File file) throws IOException {
InputStream is = new FileInputStream(file);
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
index 950180262..7477d748d 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
@@ -22,104 +22,92 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-
-public class TestGenerateArtifactObject
-{
+public class TestGenerateArtifactObject {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void testObjectArtifactProcessor() throws IOException, ArtifactProcessorException {
- String expectedTosca="node_types:\n" +
- " VNF:\n" +
- " derived_from: org.openecomp.genericvnf\n" +
- " version: V1\n" +
- " description: ''\n" +
- " properties:\n" +
- " LOCAL_ACCESS_IP_ADDR:\n" +
- " type: string\n" +
- " required: false\n" +
- " default: 0.0.0.0\n" +
- " status: SUPPORTED\n" +
- " LOCAL_CORE_ALT_IP_ADDR:\n" +
- " type: String\n" +
- " required: false\n" +
- " default: value\n" +
- " status: SUPPORTED\n" +
- "topology_template:\n" +
- " node_templates:\n" +
- " VNF_Template:\n" +
- " type: VNF\n" +
- " properties:\n" +
- " LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n" +
- " LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
- //Create object
+ String expectedTosca = "node_types:\n" + " VNF:\n"
+ + " derived_from: org.openecomp.genericvnf\n" + " version: V1\n"
+ + " description: ''\n" + " properties:\n" + " LOCAL_ACCESS_IP_ADDR:\n"
+ + " type: string\n" + " required: false\n"
+ + " default: 0.0.0.0\n" + " status: SUPPORTED\n"
+ + " LOCAL_CORE_ALT_IP_ADDR:\n" + " type: String\n"
+ + " required: false\n" + " default: value\n"
+ + " status: SUPPORTED\n" + "topology_template:\n" + " node_templates:\n"
+ + " VNF_Template:\n" + " type: VNF\n" + " properties:\n"
+ + " LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n"
+ + " LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
+ // Create object
PropertyDefinition pd = new PropertyDefinition();
pd.setKind("VNF");
pd.setVersion("V1");
pd.setParameters(createParameters());
- //Call ArtifactProcessor
- OutputStream outstream=null;
+ // Call ArtifactProcessor
+ OutputStream outstream = null;
- File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ File toscaFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(toscaFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- arp.generateArtifact(pd,outstream);
+ arp.generateArtifact(pd, outstream);
outstream.flush();
outstream.close();
String toscaString = getFileContent(toscaFile);
- Assert.assertEquals(expectedTosca,toscaString);
+ Assert.assertEquals(expectedTosca, toscaString);
}
@Test
public void testPDpropertiesSetNull() throws IOException, ArtifactProcessorException {
- String expectedTosca = "node_types:\n" +
- " PropertyDefinition:\n" +
- " derived_from: org.openecomp.genericvnf\n" +
- " version: V1\n" +
- " description: ''\n" +
- "topology_template:\n" +
- " node_templates:\n" +
- " PropertyDefinition_Template:\n" +
- " type: PropertyDefinition\n";
- //Create object
+ String expectedTosca = "node_types:\n" + " PropertyDefinition:\n"
+ + " derived_from: org.openecomp.genericvnf\n" + " version: V1\n"
+ + " description: ''\n" + "topology_template:\n" + " node_templates:\n"
+ + " PropertyDefinition_Template:\n" + " type: PropertyDefinition\n";
+ // Create object
PropertyDefinition pd = new PropertyDefinition();
pd.setKind("PropertyDefinition");
pd.setVersion("V1");
- OutputStream outstream=null;
+ OutputStream outstream = null;
- File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ File toscaFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(toscaFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- arp.generateArtifact(pd,outstream);
+ arp.generateArtifact(pd, outstream);
outstream.flush();
outstream.close();
String toscaString = getFileContent(toscaFile);
- Assert.assertEquals(expectedTosca,toscaString);
+ Assert.assertEquals(expectedTosca, toscaString);
}
- @Test
+ @Test
public void testArtifactGeneratorInvalidStream() throws IOException {
String expectedMsg = "java.io.IOException: Stream Closed";
PropertyDefinition pd = new PropertyDefinition();
@@ -127,25 +115,22 @@ public class TestGenerateArtifactObject
pd.setVersion("V1");
pd.setParameters(createParameters());
- //Call ArtifactProcessor
- OutputStream outstream=null;
+ // Call ArtifactProcessor
+ OutputStream outstream = null;
try {
- File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ File toscaFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(toscaFile);
outstream.close();
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- arp.generateArtifact(pd,outstream);
+ arp.generateArtifact(pd, outstream);
Assert.fail();
- }
- catch (ArtifactProcessorException e)
- {
- Assert.assertEquals(expectedMsg,e.getMessage());
+ } catch (ArtifactProcessorException e) {
+ Assert.assertEquals(expectedMsg, e.getMessage());
}
}
- private List<Parameter> createParameters()
- {
- //Create single Parameter object 1
+ private List<Parameter> createParameters() {
+ // Create single Parameter object 1
Parameter singleParameter1 = new Parameter();
singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
singleParameter1.setRequired(false);
@@ -154,7 +139,7 @@ public class TestGenerateArtifactObject
singleParameter1.setRuleType("myRule1");
singleParameter1.setRequestKeys(createRequestKeys());
- //Create single Parameter object 2
+ // Create single Parameter object 2
Parameter singleParameter2 = new Parameter();
singleParameter2.setName("LOCAL_CORE_ALT_IP_ADDR");
singleParameter2.setType("String");
@@ -164,56 +149,53 @@ public class TestGenerateArtifactObject
singleParameter2.setRuleType("myRule2");
singleParameter2.setResponseKeys(createResponseKeys());
- //Add the Parameter objects to the List
+ // Add the Parameter objects to the List
List<Parameter> parameterList = new ArrayList<Parameter>();
parameterList.add(singleParameter1);
parameterList.add(singleParameter2);
return parameterList;
}
- private List<RequestKey> createRequestKeys()
- {
- //Create RequestKey object 1
+ private List<RequestKey> createRequestKeys() {
+ // Create RequestKey object 1
RequestKey requestKey1 = new RequestKey();
requestKey1.setKeyName("class-type");
requestKey1.setKeyValue("interface-ip-address");
- //Create RequestKey object 2
+ // Create RequestKey object 2
RequestKey requestKey2 = new RequestKey();
requestKey2.setKeyName("address_fqdn");
requestKey2.setKeyValue("someVal");
- //Create RequestKey object 3
+ // Create RequestKey object 3
RequestKey requestKey3 = new RequestKey();
requestKey3.setKeyName("address_type");
requestKey3.setKeyValue("v4");
- //Add the RequestKey Objects to the List
+ // Add the RequestKey Objects to the List
List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
requestKeyList.add(requestKey1);
requestKeyList.add(requestKey2);
requestKeyList.add(requestKey3);
- return requestKeyList;
+ return requestKeyList;
}
- private List<ResponseKey> createResponseKeys()
- {
- //Create RequestKey object 1
+ private List<ResponseKey> createResponseKeys() {
+ // Create RequestKey object 1
ResponseKey responseKey1 = new ResponseKey();
responseKey1.setUniqueKeyName("name1");
responseKey1.setUniqueKeyValue("value1");
responseKey1.setFieldKeyName("field1");
- //Add the RequestKey Objects to the List
+ // Add the RequestKey Objects to the List
List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
responseKeyList.add(responseKey1);
- return responseKeyList;
+ return responseKeyList;
}
- private Parameter createParameter()
- {
+ private Parameter createParameter() {
Parameter singleParameter1 = new Parameter();
singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
singleParameter1.setRequired(false);
@@ -224,20 +206,19 @@ public class TestGenerateArtifactObject
return singleParameter1;
}
- @Test(expected =Exception.class)
+ @Test(expected = Exception.class)
public void testPDnull() throws IOException, ArtifactProcessorException {
PropertyDefinition pd = null;
- OutputStream outstream=null;
+ OutputStream outstream = null;
outstream = new FileOutputStream(".\\TestTosca.yml");
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- arp.generateArtifact(pd,outstream);
+ arp.generateArtifact(pd, outstream);
outstream.flush();
outstream.close();
}
- private String getFileContent(File file) throws IOException
- {
+ private String getFileContent(File file) throws IOException {
InputStream is = new FileInputStream(file);
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
index 4ffbe5298..fb5e934ad 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
@@ -22,18 +22,23 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
-import java.net.URL;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-public class TestGenerateArtifactString{
+public class TestGenerateArtifactString {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -42,58 +47,56 @@ public class TestGenerateArtifactString{
public void testStringArtifactGenerator() throws IOException, ArtifactProcessorException {
String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
- OutputStream outstream=null;
+ OutputStream outstream = null;
File tempFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(tempFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- arp.generateArtifact(pdString,outstream);
+ arp.generateArtifact(pdString, outstream);
outstream.flush();
outstream.close();
String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
String toscaString = getFileContent(tempFile);
- Assert.assertEquals(expectedTosca,toscaString);
+ Assert.assertEquals(expectedTosca, toscaString);
}
@Test
- public void testArtifactGeneratorWithParameterNameBlank() throws IOException, ArtifactProcessorException {
+ public void testArtifactGeneratorWithParameterNameBlank()
+ throws IOException, ArtifactProcessorException {
String pdString = getFileContent("tosca/ExamplePropertyDefinition2.yml");
- OutputStream outstream=null;
- String expectedMsg ="Parameter name is empty,null or contains whitespace";
+ OutputStream outstream = null;
+ String expectedMsg = "Parameter name is empty,null or contains whitespace";
File tempFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(tempFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
try {
arp.generateArtifact(pdString, outstream);
- }
- catch (ArtifactProcessorException e)
- {
- Assert.assertEquals(expectedMsg,e.getMessage());
+ } catch (ArtifactProcessorException e) {
+ Assert.assertEquals(expectedMsg, e.getMessage());
}
outstream.flush();
outstream.close();
}
@Test
- public void testArtifactGeneratorWithParameterNameNull() throws IOException, ArtifactProcessorException {
+ public void testArtifactGeneratorWithParameterNameNull()
+ throws IOException, ArtifactProcessorException {
String pdString = getFileContent("tosca/ExamplePropertyDefinition3.yml");
- OutputStream outstream=null;
- String expectedMsg ="Parameter name is empty,null or contains whitespace";
+ OutputStream outstream = null;
+ String expectedMsg = "Parameter name is empty,null or contains whitespace";
File tempFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(tempFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
try {
arp.generateArtifact(pdString, outstream);
- }
- catch (ArtifactProcessorException e)
- {
- Assert.assertEquals(expectedMsg,e.getMessage());
+ } catch (ArtifactProcessorException e) {
+ Assert.assertEquals(expectedMsg, e.getMessage());
}
outstream.flush();
outstream.close();
@@ -103,25 +106,22 @@ public class TestGenerateArtifactString{
public void testArtifactGeneratorWithKindNull() throws IOException, ArtifactProcessorException {
String pdString = getFileContent("tosca/ExamplePropertyDefinition4.yml");
- OutputStream outstream=null;
- String expectedMsg ="Kind in PropertyDefinition is blank or null";
+ OutputStream outstream = null;
+ String expectedMsg = "Kind in PropertyDefinition is blank or null";
File tempFile = temporaryFolder.newFile("TestTosca.yml");
outstream = new FileOutputStream(tempFile);
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
try {
arp.generateArtifact(pdString, outstream);
- }
- catch (ArtifactProcessorException e)
- {
- Assert.assertEquals(expectedMsg,e.getMessage());
+ } catch (ArtifactProcessorException e) {
+ Assert.assertEquals(expectedMsg, e.getMessage());
}
outstream.flush();
outstream.close();
}
- private String getFileContent(String fileName) throws IOException
- {
+ private String getFileContent(String fileName) throws IOException {
ClassLoader classLoader = new TestGenerateArtifactString().getClass().getClassLoader();
InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -137,8 +137,7 @@ public class TestGenerateArtifactString{
return fileString;
}
- private String getFileContent(File file) throws IOException
- {
+ private String getFileContent(File file) throws IOException {
InputStream is = new FileInputStream(file);
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
index 3eb231ae9..d4de5b579 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
@@ -22,134 +22,126 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
+package org.onap.sdnc.config.params.transformer.tosca;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
-public class TestPropertyQueryString
-{
- @Test
- public void testBuildResponseKeys()
- {
+public class TestPropertyQueryString {
+ @Test
+ public void testBuildResponseKeys() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- String properties= arp.buildResponseKeyExpression(createResponseKeys());
- Assert.assertEquals("<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",properties);
+ String properties = arp.buildResponseKeyExpression(createResponseKeys());
+ Assert.assertEquals(
+ "<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",
+ properties);
}
- @Test
- public void testBuildRequestKeys()
- {
+ @Test
+ public void testBuildRequestKeys() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- String properties= arp.buildRequestKeyExpression(createRequestKeys());
- Assert.assertEquals("<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",properties);
+ String properties = arp.buildRequestKeyExpression(createRequestKeys());
+ Assert.assertEquals(
+ "<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",
+ properties);
}
@Test
- public void testEncoding()
- {
+ public void testEncoding() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
String expected1 = "&lt;class-type&gt;";
String encoded1 = arp.encode("<class-type>");
- Assert.assertEquals(expected1,encoded1);
+ Assert.assertEquals(expected1, encoded1);
String expected2 = "&lt;&lt;&lt;metallica&lt;&gt;iron_maiden&gt;&gt;&gt;";
String encoded2 = arp.encode("<<<metallica<>iron_maiden>>>");
- Assert.assertEquals(expected2,encoded2);
+ Assert.assertEquals(expected2, encoded2);
String expected3 = "band-list&colon;metallica&comma;ironmaiden";
String encoded3 = arp.encode("band-list:metallica,ironmaiden");
- Assert.assertEquals(expected3,encoded3);
+ Assert.assertEquals(expected3, encoded3);
String expected4 = "motorhead&equals;lemmy";
String encoded4 = arp.encode("motorhead=lemmy");
- Assert.assertEquals(expected4,encoded4);
+ Assert.assertEquals(expected4, encoded4);
String expected5 = "DreamTheater";
String encoded5 = arp.encode(" DreamTheater ");
- Assert.assertEquals(expected5,encoded5);
+ Assert.assertEquals(expected5, encoded5);
}
@Test
- public void testBuildRuleType()
- {
+ public void testBuildRuleType() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
String input = "IPV4";
String expected = "<rule-type = IPV4>";
- Assert.assertEquals(expected,arp.buildRuleType(input));
+ Assert.assertEquals(expected, arp.buildRuleType(input));
}
@Test
- public void testRuleTypeSetNull()
- {
+ public void testRuleTypeSetNull() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
String expected = "<rule-type = >";
- Assert.assertEquals(expected,arp.buildRuleType(null));
+ Assert.assertEquals(expected, arp.buildRuleType(null));
}
@Test
- public void testBuildRequestKeysWithKeyNull()
- {
+ public void testBuildRequestKeysWithKeyNull() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
requestKeyList.add(null);
- String properties= arp.buildRequestKeyExpression(requestKeyList);
- Assert.assertEquals("<request-keys = >",properties);
+ String properties = arp.buildRequestKeyExpression(requestKeyList);
+ Assert.assertEquals("<request-keys = >", properties);
}
@Test
- public void testBuildResponseKeysWithKeyNull()
- {
+ public void testBuildResponseKeysWithKeyNull() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
responseKeyList.add(null);
- String properties= arp.buildResponseKeyExpression(responseKeyList);
- Assert.assertEquals("<response-keys = >",properties);
+ String properties = arp.buildResponseKeyExpression(responseKeyList);
+ Assert.assertEquals("<response-keys = >", properties);
}
@Test
- public void testBuildSourceSystem()
- {
+ public void testBuildSourceSystem() {
ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
- Assert.assertEquals("<source-system = source>",arp.buildSourceSystem("source"));
+ Assert.assertEquals("<source-system = source>", arp.buildSourceSystem("source"));
}
-
- //@Test
- private List<RequestKey> createRequestKeys()
- {
- //Create RequestKey object 1
+
+ // @Test
+ private List<RequestKey> createRequestKeys() {
+ // Create RequestKey object 1
RequestKey requestKey1 = new RequestKey();
requestKey1.setKeyName("class-type");
requestKey1.setKeyValue("interface-ip-address");
- //Create RequestKey object 2
+ // Create RequestKey object 2
RequestKey requestKey2 = new RequestKey();
requestKey2.setKeyName("address_fqdn");
requestKey2.setKeyValue("00000000000000");
- //Create RequestKey object 3
+ // Create RequestKey object 3
RequestKey requestKey3 = new RequestKey();
requestKey3.setKeyName("address_type");
requestKey3.setKeyValue("v4");
- //Add the RequestKey Objects to the List
+ // Add the RequestKey Objects to the List
List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
requestKeyList.add(requestKey1);
requestKeyList.add(requestKey2);
requestKeyList.add(requestKey3);
- return requestKeyList;
+ return requestKeyList;
}
-
- //@Test
- private List<ResponseKey> createResponseKeys()
- {
- //Create RequestKey object 1
+
+ // @Test
+ private List<ResponseKey> createResponseKeys() {
+ // Create RequestKey object 1
ResponseKey responseKey1 = new ResponseKey();
responseKey1.setUniqueKeyName("address-fqdn");
@@ -161,11 +153,11 @@ public class TestPropertyQueryString
responseKey2.setUniqueKeyValue("value2");
responseKey2.setFieldKeyName("field2");
- //Add the RequestKey Objects to the List
+ // Add the RequestKey Objects to the List
List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
responseKeyList.add(responseKey1);
responseKeyList.add(responseKey2);
- return responseKeyList;
+ return responseKeyList;
}
}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
index 1b65a21f6..407293624 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
@@ -22,14 +22,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import org.junit.Assert;
import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
public class TestReadArtifact {
@Test
@@ -38,38 +41,53 @@ public class TestReadArtifact {
String toscaArtifact = getFileContent("tosca/ReadArtifactPositiveInputTosca.yml");
ArtifactProcessorImpl artifact = new ArtifactProcessorImpl();
PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
- Assert.assertEquals(ouptPD.getKind(),"Property Definition");
- Assert.assertEquals(ouptPD.getVersion(),"V1");
+ Assert.assertEquals(ouptPD.getKind(), "Property Definition");
+ Assert.assertEquals(ouptPD.getVersion(), "V1");
- Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(),"0.0.0.0");
- Assert.assertEquals(ouptPD.getParameters().get(0).getName(),"abc");
- Assert.assertEquals(ouptPD.getParameters().get(0).getSource(),"source");
- Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(),"interface-ip-address");
- Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(),"param_desc");
- Assert.assertEquals(ouptPD.getParameters().get(0).getType(),"param1_type");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
- Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
- Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(),"0");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(), "0.0.0.0");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getName(), "abc");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getSource(), "source");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(), "interface-ip-address");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(), "param_desc");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getType(), "param1_type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+ "address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+ "0");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+ "address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+ "0");
+ Assert.assertEquals(
+ ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),
+ "address-0");
+ Assert.assertEquals(
+ ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(), "0");
- Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(),"value");
- Assert.assertEquals(ouptPD.getParameters().get(1).getName(),"param 2");
- Assert.assertEquals(ouptPD.getParameters().get(1).getSource(),"source");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(),"interface-ip-address");
- Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(),"param2");
- Assert.assertEquals(ouptPD.getParameters().get(1).getType(),"param2 type");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),"address_type");
- Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),"v4");
- Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
- Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(),"0");
- Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(),"0");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(), "value");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getName(), "param 2");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getSource(), "source");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(), "interface-ip-address");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(), "param2");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getType(), "param2 type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+ "address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+ "0");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),
+ "address_type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),
+ "v4");
+ Assert.assertEquals(
+ ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),
+ "address-0");
+ Assert.assertEquals(
+ ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(), "0");
+ Assert.assertEquals(
+ ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(), "0");
}
-
+
@Test
public void testReadArtifactNegetive() throws IOException {
@@ -79,13 +97,13 @@ public class TestReadArtifact {
PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
} catch (ArtifactProcessorException e) {
Assert.assertNotNull(e);
- Assert.assertEquals(e.getMessage(),"Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
+ Assert.assertEquals(e.getMessage(),
+ "Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
}
}
- private String getFileContent(String fileName) throws IOException
- {
- ClassLoader classLoader = new TestReadArtifact().getClass().getClassLoader();
+ private String getFileContent(String fileName) throws IOException {
+ ClassLoader classLoader = new TestReadArtifact().getClass().getClassLoader();
InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();