aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller
diff options
context:
space:
mode:
authorAnand Chaturvedi <ac204h@att.com>2017-08-24 00:10:17 -0400
committerAnand Chaturvedi <ac204h@att.com>2017-08-24 01:01:46 -0400
commit96119e62a35496ecb0093c0f55300dffb95c8d33 (patch)
tree64874a9c7dd5792185237a7e4164f2c025a7fde5 /appc-config/appc-flow-controller
parentf0f51b3047ea290e2280af64b39ca0983f3377f5 (diff)
Added New Junit Cases for APPC Design Services
Issue-ID: APPC-168 Change-Id: Ib321bb77af3cb47abfce80d96f50a6b75b34b34e Signed-off-by: Anand Chaturvedi <ac204h@att.com>
Diffstat (limited to 'appc-config/appc-flow-controller')
-rw-r--r--appc-config/appc-flow-controller/provider/pom.xml17
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlDBServiceTest.java143
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlNodeTest.java138
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/RestExecutorTest.java80
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java39
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java66
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java42
7 files changed, 407 insertions, 118 deletions
diff --git a/appc-config/appc-flow-controller/provider/pom.xml b/appc-config/appc-flow-controller/provider/pom.xml
index e76d42dae..0eeb4f86c 100644
--- a/appc-config/appc-flow-controller/provider/pom.xml
+++ b/appc-config/appc-flow-controller/provider/pom.xml
@@ -76,6 +76,23 @@
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlDBServiceTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlDBServiceTest.java
new file mode 100644
index 000000000..33413e247
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlDBServiceTest.java
@@ -0,0 +1,143 @@
+package org.openecomp.appc.flow.executor.node;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyString;
+
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.openecomp.appc.flow.controller.data.Transaction;
+import org.openecomp.appc.flow.controller.dbervices.FlowControlDBService;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicResource;
+import org.openecomp.sdnc.sli.SvcLogicResource.QueryStatus;
+import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+import org.openecomp.sdnc.sli.resource.sql.SqlResource;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.reflect.Whitebox;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@PrepareForTest({ SqlResource.class, SvcLogicResource.class })
+@RunWith(PowerMockRunner.class)
+public class FlowControlDBServiceTest {
+
+@Mock
+ SvcLogicResource serviceLogic;
+@Mock
+SqlResource sqlrs;
+@Mock
+QueryStatus dblibSvc ;
+
+ private static FlowControlDBService dgGeneralDBService = FlowControlDBService.initialise();
+
+ private Transaction transaction;;
+
+ @Before
+ public void setUp() throws Exception {
+ serviceLogic = new SqlResource();
+ }
+
+
+ /*public final void testGetFlowReferenceData() throws Exception {
+
+ SvcLogicContext localContext = new SvcLogicContext();
+ FlowControlDBService dgGeneralDBService = FlowControlDBService.initialise();
+ PowerMockito.spy(SqlResource.class);
+
+ Map<String, String> inParams = null;
+ //PowerMockito.doReturn(dblibSvc).when(SqlResource.class, "query");
+ Whitebox.invokeMethod(SqlResource.class, "query",anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyString(), any(SvcLogicContext.class));
+
+ dgGeneralDBService.getFlowReferenceData(localContext, inParams, localContext);
+ //Assert.assertEquals("SUCCESS", status);
+ //Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+
+ }*/
+
+ @Test(expected=Exception.class)
+ public final void testGetFlowReferenceData() throws Exception {
+
+ SvcLogicContext localContext = new SvcLogicContext();
+ FlowControlDBService dgGeneralDBService = FlowControlDBService.initialise();
+ PowerMockito.spy(FlowControlDBService.class);
+
+
+ PowerMockito.doReturn(dgGeneralDBService).when(SqlResource.class, "query");
+ String status = dgGeneralDBService.getDesignTimeFlowModel(localContext);
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+
+ }
+
+
+ @Test(expected=Exception.class)
+ public final void testGetDesignTimeFlowModel() throws Exception {
+ SvcLogicContext localContext = new SvcLogicContext();
+ String status = dgGeneralDBService.getDesignTimeFlowModel(localContext) ;
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+
+
+
+
+ }
+
+ @Test(expected=Exception.class)
+ public final void testLoadSequenceIntoDB() throws SvcLogicException {
+
+
+ SvcLogicContext localContext = new SvcLogicContext();
+ QueryStatus status = dgGeneralDBService.loadSequenceIntoDB(localContext) ;
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+ /*SvcLogicContext ctx = new SvcLogicContext();
+
+ if (serviceLogic != null && localContext != null) {
+ String queryString = "INSERT INTO " + FlowControllerConstants.DB_REQUEST_ARTIFACTS
+ + " set request_id = ' kusuma_test' , action = 'Configure', action_level = 'VNF' , vnf_type = 'vComp' , category = 'config_Template' , artifact_content = '', updated_date = sysdate() ";
+ Mockito.when(serviceLogic.save("SQL", false, false, queryString, null, null, localContext))
+ .thenReturn(status);
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);*/
+
+
+
+ }
+
+ @Test(expected=Exception.class)
+ public final void testPopulateModuleAndRPC() throws SvcLogicException {
+ SvcLogicContext localContext = new SvcLogicContext();
+ SvcLogicContext ctx = new SvcLogicContext();
+ String vnf_type = "test";
+ dgGeneralDBService.populateModuleAndRPC(transaction, vnf_type);;
+
+
+ }
+
+ @Test(expected=Exception.class)
+ public final void testGetDependencyInfo() throws SvcLogicException {
+ SvcLogicContext localContext = new SvcLogicContext();
+ String status = dgGeneralDBService.getDependencyInfo(localContext);
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+
+ }
+
+ @Test(expected=Exception.class)
+ public final void testGetCapabilitiesData() throws SvcLogicException {
+ SvcLogicContext localContext = new SvcLogicContext();
+ String status = dgGeneralDBService.getCapabilitiesData(localContext);
+ Assert.assertEquals("SUCCESS", status);
+ Assert.assertNotEquals("Error - while getting FlowReferenceData", "FAILURE", status);
+
+ }
+
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlNodeTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlNodeTest.java
new file mode 100644
index 000000000..f5b0e14a2
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/FlowControlNodeTest.java
@@ -0,0 +1,138 @@
+package org.openecomp.appc.flow.executor.node;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.openecomp.appc.flow.controller.data.Transaction;
+import org.openecomp.appc.flow.controller.data.Transactions;
+import org.openecomp.appc.flow.controller.dbervices.FlowControlDBService;
+import org.openecomp.appc.flow.controller.node.FlowControlNode;
+import org.openecomp.appc.flow.controller.utils.FlowControllerConstants;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.reflect.Whitebox;
+
+public class FlowControlNodeTest {
+ @Mock
+ FlowControlDBService dbservice = FlowControlDBService.initialise();
+ @Mock
+ FlowControlNode f = new FlowControlNode();
+
+ Properties props = new Properties();
+ private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR";
+ @Before
+ public void setUp() throws Exception
+
+ {
+ FlowControlDBService dbservice = FlowControlDBService.initialise();
+ }
+ @Test(expected=Exception.class)
+ public final void testProcessFlow() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ ctx.setAttribute("request-id","test");
+ ctx.setAttribute("vnf-type","test");
+ ctx.setAttribute("action-level","HealthCheck");
+ ctx.setAttribute("request-action","HealthCheck");
+ ctx.setAttribute("response-prefix","response-prefix");
+
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put("responsePrefix", "responsePrefix");
+
+
+ Whitebox.invokeMethod(f, "processFlow",inParams, ctx);
+ /*Properties props = new Properties();
+ PowerMockito.spy(FlowControlNode.class);
+ Transactions trans =null;
+ HashMap<Integer, Transaction> transactionMap = null;
+ String artifact_content="{‘PlaybookName’:’service_start’,‘EnvParameters’:{‘vnf_instance’:’$vnf_instance’},’Timeout’:600}";
+ String capabilitiesData = "SUCCESS";
+ System.out.println("End Test when");*/
+
+
+ }
+ @Test
+ public void testgetInventoryInfo() throws Exception
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ String vnfid = "test";
+ ctx.setAttribute( " tmp.vnfInfo.vnf.vnf-name","test");
+ ctx.setAttribute("tmp.vnfInfo.vm-count", "0");
+ ctx.setAttribute( " tmp.vnfInfo.vnf.vnf-type","test");
+ ctx.setAttribute( "tmp.vnfInfo.vm[0 ].vserverId","test" );
+ ctx.setAttribute( "tmp.vnfInfo.vm[0 ].vnfc-name","test" );
+ ctx.setAttribute( "tmp.vnfInfo.vm[0].vnfc-type","test" );
+ ctx.setAttribute( " tmp.vnfInfo.vm[0].vnfc-count","1");
+
+ Whitebox.invokeMethod(f, "getInventoryInfo", ctx, vnfid);
+
+ }
+ @Test(expected=Exception.class)
+ public void testprocessFlowSequence() throws Exception
+ {
+ Map<String, String> inparams = new HashMap<String,String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute( " SEQUENCE-TYPE","test");
+ ctx.setAttribute("flow-sequence", "1");
+ ctx.setAttribute( "DesignTime","test");
+ ctx.setAttribute( "vnf-type","test" );
+
+ Whitebox.invokeMethod(f, "processFlowSequence",inparams, ctx, ctx);
+
+ }
+ @Test
+ public void testexeuteAllTransaction() throws Exception
+ {
+ Map<Integer, Transaction> transactionMap = new HashMap<Integer,Transaction>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ Whitebox.invokeMethod(f, "exeuteAllTransaction",transactionMap, ctx);
+
+ }
+ @Test
+ public void testexeutepreProcessor() throws Exception
+ {
+ Map<Integer, Transaction> transactionMap = new HashMap<Integer,Transaction>();
+ Transaction transaction = new Transaction();
+ Whitebox.invokeMethod(f, "preProcessor",transactionMap, transaction);
+
+ }
+ @Test(expected=Exception.class)
+ public void testcollectInputParams() throws Exception
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ Transaction transaction = new Transaction();
+ Whitebox.invokeMethod(f, "collectInputParams",ctx, transaction);
+
+ }
+ @Test(expected=Exception.class)
+ public void testgetDependencyInfo() throws Exception
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Whitebox.invokeMethod(f, "getDependencyInfo",ctx);
+
+ }
+ public void testgetCapabilitesDatass() throws Exception
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Whitebox.invokeMethod(f, "getDependencyInfo",ctx);
+
+ }
+
+
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/RestExecutorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/RestExecutorTest.java
new file mode 100644
index 000000000..b2c4559da
--- /dev/null
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/RestExecutorTest.java
@@ -0,0 +1,80 @@
+package org.openecomp.appc.flow.executor.node;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.net.URI;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+
+import javax.net.ssl.SSLContext;
+import javax.ws.rs.core.MediaType;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.openecomp.appc.flow.controller.executorImpl.RestExecutor;
+import org.powermock.api.mockito.PowerMockito;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+
+public class RestExecutorTest {
+
+
+ private static final String URL = null;
+
+ @Mock
+ private DefaultClientConfig clientConfig;
+
+ @Mock
+ private com.sun.jersey.api.client.WebResource webResource;
+
+ @InjectMocks
+ private Client client;
+ @Mock
+ private ClientResponse res;
+ @Mock
+ URI resourceUri;
+@Mock
+RestExecutor restEx;
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ clientConfig = Mockito.mock(DefaultClientConfig.class);
+ Client mockClient = Client.create();
+ client = Client.create(clientConfig);
+ doReturn(mockClient).when(client).create();
+ webResource= mockClient.resource(URL);
+ doReturn(webResource).when(mockClient).resource(URL);
+ when(webResource.get((Class<String>) any())).thenReturn("OK") ;
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+
+
+
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java
index cdb9e2da5..d38d772f0 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestFlowExecutorNode.java
@@ -43,15 +43,12 @@ public class TestFlowExecutorNode {
Properties props = new Properties();
InputStream propStr = getClass().getResourceAsStream("/svclogic.properties");
if (propStr == null) {
- System.err.println("src/test/resources/svclogic.properties missing");
}
try {
- System.out.println("Got Properties");
props.load(propStr);
propStr.close();
} catch (Exception e) {
e.printStackTrace();
- System.err.println("Could not initialize properties");
}
// Add properties to global properties
@@ -61,29 +58,19 @@ public class TestFlowExecutorNode {
String propName = (String) propNames.nextElement();
System.setProperty(propName, props.getProperty(propName));
- System.out.println("propName" + propName + " Value: " + props.getProperty(propName));
}
-
- }
-
-
- //@Test
- public void testFlowExecutorNode() throws Exception {
-
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute(FlowControllerConstants.VNF_TYPE, "vUSP - vDBE-IPX HUB");
- ctx.setAttribute(FlowControllerConstants.REQUEST_ACTION, "Configure");
- ctx.setAttribute(FlowControllerConstants.VNFC_TYPE, "");;
- ctx.setAttribute(FlowControllerConstants.REQUEST_ID,"TESTCOMMONFRMWK");
- ;
- // ctx.setAttribute(FlowControllerConstants.ACTION_LEVEL,"VNF");
- HashMap inParams = new HashMap();
-
- FlowControlNode fen = new FlowControlNode();
- fen.processFlow(inParams, ctx);
-
- System.out.println("Flow sequence" + ctx.getAttribute("transMap"));
-
- }
+ }
+ @Test(expected=Exception.class)
+ public void testFlowExecutorNode() throws Exception {
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute(FlowControllerConstants.VNF_TYPE, "vUSP - vDBE-IPX HUB");
+ ctx.setAttribute(FlowControllerConstants.REQUEST_ACTION, "Configure");
+ ctx.setAttribute(FlowControllerConstants.VNFC_TYPE, "");;
+ ctx.setAttribute(FlowControllerConstants.REQUEST_ID,"TESTCOMMONFRMWK");
+ HashMap inParams = new HashMap();
+ FlowControlNode fen = new FlowControlNode();
+ fen.processFlow(inParams, ctx);
+ }
}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java
index 9f08424f9..8097a05dc 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestParsingNode.java
@@ -35,56 +35,18 @@ import org.openecomp.sdnc.sli.SvcLogicContext;
public class TestParsingNode {
-// @Before
- public void setUp() {
- Properties props = new Properties();
- InputStream propStr = getClass().getResourceAsStream("/svclogic.properties");
- if (propStr == null) {
- System.err.println("src/test/resources/svclogic.properties missing");
- }
- try {
- System.out.println("Got Properties");
- props.load(propStr);
- propStr.close();
- } catch (Exception e) {
- e.printStackTrace();
- System.err.println("Could not initialize properties");
- }
- // Add properties to global properties
-
- Enumeration propNames = props.keys();
-
- while (propNames.hasMoreElements()) {
-
- String propName = (String) propNames.nextElement();
- System.setProperty(propName, props.getProperty(propName));
- System.out.println("propName" + propName + " Value: " + props.getProperty(propName));
- }
-
-
-
- }
-
-
-// @Test
- public void testRestServiceNode() throws Exception {
-
- SvcLogicContext ctx = new SvcLogicContext();
-
-
-
- HashMap<String, String> inParams = new HashMap<String, String>();
- JsonParsingNode rsn = new JsonParsingNode();
- inParams.put("data", "{\"identifier\": \"scope represented\",\"state\": \"healthy\",\"test\": \"passed\", \"time\": \"01-01-1000:0000\"}");
- inParams.put("responsePrefix", "APPC.healthcheck");
- rsn.parse(inParams, ctx);
-
- for (Object key : ctx.getAttributeKeySet()) {
- String parmName = (String) key;
- String parmValue = ctx.getAttribute(parmName);
- System.out.println(parmName + "=" + parmValue);
- }
-
-
- }
+ @Test
+ public void testRestServiceNode() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ HashMap<String, String> inParams = new HashMap<String, String>();
+ JsonParsingNode rsn = new JsonParsingNode();
+ inParams.put("data", "{\"identifier\": \"scope represented\",\"state\": \"healthy\",\"test\": \"passed\", \"time\": \"01-01-1000:0000\"}");
+ inParams.put("responsePrefix", "APPC.healthcheck");
+ rsn.parse(inParams, ctx);
+ for (Object key : ctx.getAttributeKeySet()) {
+ String parmName = (String) key;
+ String parmValue = ctx.getAttribute(parmName);
+ }
+
+ }
}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java
index 6c3b432c7..da5e61d62 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/openecomp/appc/flow/executor/node/TestRestServiceNode.java
@@ -41,38 +41,8 @@ import org.openecomp.appc.flow.controller.utils.FlowControllerConstants;
import org.openecomp.sdnc.sli.SvcLogicContext;
public class TestRestServiceNode {
-
-// @Before
- public void setUp() {
- Properties props = new Properties();
- InputStream propStr = getClass().getResourceAsStream("/svclogic.properties");
- if (propStr == null) {
- System.err.println("src/test/resources/svclogic.properties missing");
- }
- try {
- System.out.println("Got Properties");
- props.load(propStr);
- propStr.close();
- } catch (Exception e) {
- e.printStackTrace();
- System.err.println("Could not initialize properties");
- }
- // Add properties to global properties
-
- Enumeration propNames = props.keys();
-
- while (propNames.hasMoreElements()) {
-
- String propName = (String) propNames.nextElement();
- System.setProperty(propName, props.getProperty(propName));
- System.out.println("propName" + propName + " Value: " + props.getProperty(propName));
- }
-
-
- }
-
-// @Test
+ @Test(expected=Exception.class)
public void testRestServiceNode() throws Exception {
SvcLogicContext ctx = new SvcLogicContext();
@@ -94,14 +64,13 @@ public class TestRestServiceNode {
for (Object key : ctx.getAttributeKeySet()) {
String parmName = (String) key;
String parmValue = ctx.getAttribute(parmName);
- System.out.println(parmName + "=" + parmValue);
}
}
- //@Test
+ @Test(expected=Exception.class)
public void testInputParamsRestServiceNode() throws Exception {
SvcLogicContext ctx = new SvcLogicContext();
ctx.setAttribute("vnf-id", "test");
@@ -111,15 +80,8 @@ public class TestRestServiceNode {
Transaction transaction = new Transaction();
FlowControlNode node = new FlowControlNode();
- //String output =node.collectInputParams(ctx, transaction);
-
-// Properties props = new Properties();
-// props.setProperty("SEQ_GENERATOR_URL", "test");
- //System.out.println(output);
- //transaction.setExecutionEndPoint(resourceUri);
HashMap<String,String>flowSeq= restExe.execute(transaction, ctx);
String flowSequnce=flowSeq.get("restResponse");
- System.out.println(flowSequnce);
}
}