aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-requests-db-adapter/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-requests-db-adapter/src/test/java/org')
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java92
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java22
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java6
4 files changed, 117 insertions, 5 deletions
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java
new file mode 100644
index 0000000000..c1e620ba74
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.so.adapters.requestdb.rest;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class RequestProcessingDataRequestDbQueryTest {
+ @Autowired
+ private RequestsDbClient client;
+
+ @LocalServerPort
+ private int port;
+
+ @Before
+ public void setPort() {
+ client.removePortFromEndpoint();
+ client.setPortToEndpoint(Integer.toString(port));
+ }
+
+ @Test
+ @Transactional
+ public void RequestProcessingDataBySoRequestIdTest() {
+ String soRequestId = "00032ab7-na18-42e5-965d-8ea592502018";
+ String tag = "pincFabricConfigRequest";
+ RequestProcessingData firstEntry = new RequestProcessingData();
+ RequestProcessingData secondEntry = new RequestProcessingData();
+ List<RequestProcessingData> expectedList = new ArrayList<>();
+ firstEntry.setSoRequestId(soRequestId);
+ firstEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
+ firstEntry.setName("configurationId");
+ firstEntry.setValue("52234bc0-d6a6-41d4-a901-79015e4877e2");
+ firstEntry.setTag(tag);
+ secondEntry.setSoRequestId(soRequestId);
+ secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ secondEntry.setName("requestAction");
+ secondEntry.setValue("assign");
+ secondEntry.setTag(tag);
+ expectedList.add(firstEntry);
+ expectedList.add(secondEntry);
+
+ List<RequestProcessingData> dataFound = client.getRequestProcessingDataBySoRequestId(soRequestId);
+ //bean comparison with shazam fails serialization: Forgot to register a type adapter?
+ assertEquals(dataFound.get(0).getSoRequestId(), firstEntry.getSoRequestId());
+ assertEquals(dataFound.get(0).getGroupingId(), firstEntry.getGroupingId());
+ assertEquals(dataFound.get(0).getName(), firstEntry.getName());
+ assertEquals(dataFound.get(0).getValue(), firstEntry.getValue());
+ assertEquals(dataFound.get(0).getTag(), firstEntry.getTag());
+ assertEquals(dataFound.get(1).getSoRequestId(), secondEntry.getSoRequestId());
+ assertEquals(dataFound.get(1).getGroupingId(), secondEntry.getGroupingId());
+ assertEquals(dataFound.get(1).getName(), secondEntry.getName());
+ assertEquals(dataFound.get(1).getValue(), secondEntry.getValue());
+ assertEquals(dataFound.get(1).getTag(), secondEntry.getTag());
+ }
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
index 11f8ff0c36..58fd517c91 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.so.adapters.requestsdb;
@@ -247,4 +267,4 @@ public class InfraActiveRequestsRepositoryCustomControllerTest {
verifyInfraActiveRequests();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 4e00ced841..21ec8f7518 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -72,7 +72,7 @@ public class HealthCheckHandlerTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index 9ac0cce841..03fd0622fa 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -376,7 +376,7 @@ public class MSORequestDBImplTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
@@ -499,7 +499,7 @@ public class MSORequestDBImplTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
@@ -517,4 +517,4 @@ public class MSORequestDBImplTest {
}
-} \ No newline at end of file
+}