diff options
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src')
4 files changed, 94 insertions, 6 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/data/Transaction.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/data/Transaction.java index 2eb75ff7a..327028f00 100644 --- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/data/Transaction.java +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/data/Transaction.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-18 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. @@ -77,7 +77,7 @@ public class Transaction { private String status = "PENDING"; - public String getId() { + public String getuId() { return uId; } diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java index 2f64a21c6..d18f2a3e2 100644 --- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java +++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-18 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. @@ -65,7 +65,7 @@ public class RestExecutor implements FlowExecutorInterface { HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(getHostnameVerifier(), sslContext)); client = createClient(defaultClientConfig); - client.addFilter(new HTTPBasicAuthFilter(transaction.getId(), transaction.getPswd())); + client.addFilter(new HTTPBasicAuthFilter(transaction.getuId(), transaction.getPswd())); WebResource webResource = client.resource(new URI(transaction.getExecutionEndPoint())); webResource.setProperty("Content-Type", "application/json;charset=UTF-8"); diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/MapperTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/MapperTest.java new file mode 100644 index 000000000..dfeb4971a --- /dev/null +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/MapperTest.java @@ -0,0 +1,67 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.appc.flow.controller.node;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onap.appc.flow.controller.data.Transaction;
+import org.onap.appc.flow.controller.data.Transactions;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/*
+ * Adding this test case to ensure that JSON mapping works as expected.
+ * Add or modify test case if changes are made to class attributes.
+ *
+*/
+public class MapperTest {
+
+ @Test
+ public void testsIfJsonGenerationisValid() throws JsonProcessingException {
+
+ Transaction t = new Transaction();
+ Transactions transactions = new Transactions();
+ t.setAction("testAction");
+ t.setTransactionId(100);
+ t.setActionLevel("testActionLevel");
+ t.setExecutionRPC("testMethod");
+ List<Transaction> tList = new ArrayList<Transaction>();
+ tList.add(t);
+ transactions.setTransactions(tList);
+ Transactions trans = transactions;
+ ObjectMapper mapper = new ObjectMapper();
+ String flowSequence = mapper.writeValueAsString(trans);
+ String compareString = "{\"transactions\":[{\"executionType\":null,\"uId\":null,\"statusCode\":null,\"pswd\":null,"
+ + "\"executionEndPoint\":null,\"executionModule\":null,\"executionRPC\":\"testMethod\","
+ + "\"status\":\"PENDING\",\"transaction-id\":100,\"action\":\"testAction\","
+ + "\"action-level\":\"testActionLevel\",\"action-identifier\":null,"
+ + "\"parameters\":null,\"state\":null,\"precheck\":null,\"payload\":null,\"responses\":null}]}";
+ assertEquals(flowSequence, compareString);
+
+ }
+
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java index f16dd65cc..637a9ea6e 100644 --- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java @@ -1,3 +1,24 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2018 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.onap.appc.flow.controller.node; import static org.mockito.Mockito.mock; @@ -69,8 +90,8 @@ public class TransactionHandlerTest { Assert.assertEquals(INPUT_REQUEST_ACTION, transaction.getAction()); Assert.assertEquals("input-ra-type", transaction.getExecutionRPC()); Assert.assertEquals("some uri", transaction.getExecutionEndPoint()); - Assert.assertEquals("rest-user", transaction.getId()); + Assert.assertEquals("rest-user", transaction.getuId()); Assert.assertEquals("rest-pass", transaction.getPswd()); } -}
\ No newline at end of file +} |