From f89d9e0887e41de727b4e829916ae60dd6926e0e Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Thu, 21 Nov 2019 20:48:40 -0500 Subject: Updated and added to get request processing data Updated and added to get request processing data by internal data flag Committing file that I forgot to commit. Added junit test and change method to not use bowman client. Added and updated orch request unit test ran formatter so verify job will pass and not cry Added an intergration test for new jpa method. Format unit test class for the verify job build Update param key in jpa and also changed return type. Updated method name in request client to avoid confusion Issue-ID: SO-2534 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I420f1a887835dd0d9d0ad991e5b17dddb1db5376 --- .../V6.6__UpdateRequestProcessingData.sql | 9 +++++++ .../RequestProcessingDataRequestDbQueryTest.java | 28 ++++++++++++++++++++-- .../test/resources/db/migration/afterMigrate.sql | 8 +++---- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.6__UpdateRequestProcessingData.sql (limited to 'adapters/mso-requests-db-adapter') diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.6__UpdateRequestProcessingData.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.6__UpdateRequestProcessingData.sql new file mode 100644 index 0000000000..70d1d3fd46 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.6__UpdateRequestProcessingData.sql @@ -0,0 +1,9 @@ +use requestdb; + +UPDATE request_processing_data +SET IS_DATA_INTERNAL = 1 +WHERE TAG = 'BPMNExecutionData'; + +UPDATE request_processing_data +SET IS_DATA_INTERNAL = 0 +WHERE TAG = 'StackInformation' OR TAG = 'pincFabricConfigRequest'; \ No newline at end of file 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 index abc70ed6bf..9641cb8004 100644 --- 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 @@ -7,9 +7,9 @@ * 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. @@ -86,4 +86,28 @@ public class RequestProcessingDataRequestDbQueryTest { assertEquals(dataFound.get(1).getValue(), secondEntry.getValue()); assertEquals(dataFound.get(1).getTag(), secondEntry.getTag()); } + + @Test + @Transactional + public void testGetRequestProcessingDataBySoRequestIdAndIsInternalData() { + String soRequestId = "00032ab7-na18-42e5-965d-8ea592502018"; + String tag = "pincFabricConfigRequest"; + RequestProcessingData firstEntry = new RequestProcessingData(); + List 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); + expectedList.add(firstEntry); + + List dataFound = client.getExternalRequestProcessingDataBySoRequestId(soRequestId); + + assertEquals(1, dataFound.size()); + 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()); + } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index a86065d76c..b34b272b51 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -31,11 +31,11 @@ insert into watchdog_service_mod_ver_id_lookup(distribution_id, service_model_ve insert into site_status(site_name, status, creation_timestamp) values ('testsite', 0, '2017-11-30 15:48:09'); -INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG) +INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG, IS_DATA_INTERNAL) VALUES -(1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest'), -(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'), -(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig'); +(1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest', 1), +(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest', 0), +(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig', 1); INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES -- cgit 1.2.3-korg