Springboot 2.0 upgrade
corrected typo in CloudConfiguration class
removed files which should not have been merged
updated gr api test cases with dynamic cloud owner
updated groovy files to allow for dynamic cloud owner values
moved VFModularity folder to mso-infrastructure bpmn
updated GR API layer to include cloud owner
added enum for default cloud owner
- fixing junit test cases for using catalogDb client r2
- fixing junit test cases for using catalogDb client
- Internal review comments incorporated for merging mocking into
BaseTest
- Internal review comments incorporated for removing direct repo calls
- CLONE - Key Management Hardcoded encryption key | fixing junits
- CLONE - Key Management Hardcoded encryption key
Updated builder to use String.format
Added exception specifically for issues interacting with
requestdbadapter
Updated exception message and added junit test case
removed useless error handling test case from workflow
changed method name and added junit coverage to errors
added max retry and success status after completed bb
Added case to handle when homing is not called during assign vnf.
Fixing fortify issues | Implementing review comments
- Key Management Hardcoded encryption key - fixing prop files
- Key Management Hardcoded encryption key
include network ID for completion handler
Added exception handling for saving to requestdb
- Adding a check on the predicate availability on the repository before
firing the query with default conditions. This ensures that the api
returns data only when there is an input against which it was able to
form some conditions
Modify UT to show that the API does not behave
- adding negative test case for checkInstanceNameDuplicate
added assertion that global count var was reset to 0
updated rollback to reset current sequence count var
workflowaction calls rollback is complete before error
workflowaction will set failure on successful rollback
added check for isrollback to know which complete to call
removed file which should not have been added
add fabric check before running vf module a la carte
Enhance UCPEMigrateService junits and add them to Jenkins build..
Added back removed test case for ManualTasks
Added test case for response error
Added rainy day test cases for ManualTasks
revert the other change and fix the rollback logic instead
fixed current sequence and updated rollback code
added network cloud heat template parameters to mapper
Generate a unique subRequestId for each request to APP-C.
reverted conditional logic for determining fabric
Fix Bean scanning so it picks up the resttemplate
removed unnecessary RestTemplate Bean configurations
removed file which should not have been added
workflowaction calls rollback is complete before error
workflowaction will set failure on successful rollback
added check for isrollback to know which complete to call
add fabric check before running vf module a la carte
added assertion that global count var was reset to 0
updated rollback to reset current sequence count var
include network ID for completion handler
Revert Application.yaml change accidentally checked in
Added exception handling for saving to requestdb
Added case to handle when homing is not called during assign vnf.
removed useless error handling test case from workflow
changed method name and added junit coverage to errors
...
add cloud owner variable to camunda in mapping
Revert "Pass cloudOwner to subflow DoCreateVfModuleVolumeV2. Added
juint test to verify variables are set in the execution. Set default
cloudOwner in main module CreateVfModuleVolumeInfraV2"
updated cloud configuration pojo to inlcude defaults
Revert "Test to verify ServiceInstance object mapping"
Test to verify ServiceInstance object mapping
Pass cloudOwner to subflow DoCreateVfModuleVolumeV2. Added juint test
to verify variables are set in the execution. Set default cloudOwner in
main module CreateVfModuleVolumeInfraV2
Pass cloudOwner to subflow DoCreateVfModuleVolumeV2. Set default
cloudOwner 'att-aic' if null per old requirements.
removed references to att-aic from BBInputSetup
Changes done in encryption decryption logic | used
DelegateExecutionFake in Tests
Changes done in encryption decryption logic | used
DelegateExecutionFake in Tests
Changes done in encryption decryption logic
Changes done in encryption decryption logic | removed Default Auth
Constant as per the comments
Changes done in encryption decryption logic | Fixed UT
Changes done in encryption decryption logic | Added XmlComparator
assertion for verifying XML
Changes done in encryption decryption logic | Reverted as per the
review comment
Changes done in encryption decryption logic | Fixed UTs
Changes done in encryption decryption logic | Fixed UTs
Changes done in encryption decryption logic | modified related
encrypted properties in test yaml files
Changes done in encryption decryption logic for fortify issue
resolution | Fixed UTs
Changes done in encryption decryption logic | modified related
encrypted properties in yaml files
Changes done in encryption decryption logic for fortify issue
resolution.
Fixed Property fetching issue in required file
Added TasksBeansTest using openpojo
Removed renamed test file from tasksbeans
Updated imports on TasksBeansTest
Added openpojo test to replace the individual tests
Removed tests that provided no coverage
script clean up -Update reference data to support distinct recreate and
replace requests with their own sequences
Update reference data to support distinct recreate and replace requests
with their own sequences- Fix seq number
Update reference data to support distinct recreate and replace requests
with their own sequences
added null check to mdc and interceptors to sdnc cxf
validations can now match against multiple BBs
reverted changes to BBInputSetup class
added support for pre and post validation for BBs
initial commit of generic building block validator
converted test to no longer be a springboot test
Remove cosmetic changes from BPMN files to be consistent.
Remove minor changes that are not related to functionality.
Rework to implement the functionality as part of Validator
Combine the verification methods into one based on the flow's name;
change the logging.
Add verification of status of other VF Modules in the VNF for the
delete/deactivate/unassign.
added network-technology validation for CreateNetworkBB
Sonar Issue Fix | Changes done in encryption decryption logic |
Refactoring
Changes done in encryption decryption logic| Used AES/GCM/NoPadding
algorithm | fixed sonar issues
added network-type and network-technology to mapper
Continue the fight to make JUNITS work properly
Update ASDC ATT to be springboot 2.0 compliant
Continue to fix Unit tests for springboot 2.0 port
removed autowired from workflowactionbbtaskstest
fixed workflowactiontest and reduced size by 500 lines
Update last of UT for mockito upgrade to 2.0
Fix more JUNITS due to mockito 2.0 upgrade
Unit Test fixes to use proper mockito not spring
Update Base Test to import proper packages for compile
Additional Springboot 2.0 changes, for tests
Additional springboot 2.0 fixes and upgrades
Update Migration to be Flyway 5 Compliant
Fix MSOBPMN Infrastructure common tests
Fix Groovy Unit Tests in CommonBPMN Project
Update MSO common BPMN to Springboot 2.0
Upgrade ASDC controller to SpringBoot 2.0
Port Openstack adapters to springboot 2.0
Fix VFC Adapter to be springboot 2 compatible
Port CatalogDB adapter code to springboot 2
Port SDNC Adapter to Springboot 2.0
...
added update scripts to macro data instead of v12 sql
added secondarypolicy to rainy day handling table
confirm subnet map is not null in adapter response
shallow copy subnet before AAI udpate
update AAIObjectType to use uriTemplate
extract subnet data from adapter response
update correct AAIObjectType for subnet query
update subnet(s) in AAI on network create completion
confirm subnet map is not null in adapter response
shallow copy subnet before AAI udpate
update AAIObjectType to use uriTemplate
extract subnet data from adapter response
update correct AAIObjectType for subnet query
update subnet(s) in AAI on network create completion
fixed test http entity unit test to remove testing appid and
transaction id
added unit test for querySubsystemHealth method. also added
resttemplate mock to implement healthcheck endpoint
fixed unit test to use mock instead of actually goes out to health
check endpoint
added code to extend globalhealthcheck to include pinging other
components and consolidate the responses
converted test to no longer be a springboot test
Remove cosmetic changes from BPMN files to be consistent.
Remove minor changes that are not related to functionality.
added update scripts to macro data instead of v12 sql
Rework to implement the functionality as part of Validator
added secondarypolicy to rainy day handling table
added network-type and network-technology to mapper
Combine the verification methods into one based on the flow's name;
change the logging.
Add verification of status of other VF Modules in the VNF for the
delete/deactivate/unassign.
updated how request db is set to failure in workflowA
corrected code to match existing unit tests
corrected tests after springboot 2 upgrade
Added Required UTs in UpdateConfigurationStateTest and also fixed some
UTs.
added in missing parenthesis on method call
added back execution variable for allotted uri
addressed comments on pull request
refactor AAI Rest calls from groovy files - Changes as per review
comments
checkin to refactor AAI rest | Fixing AAIResourceClient.update call
refactor AAI Rest calls from groovy files - UpdateConfiguration
refactor AAI Rest calls from groovy file - DeleteConfiguration
refactor AAI Rest calls from groovy file - UpdateConfiguration
refactor AAI Rest calls from groovy file - CreateConfiguration &
ConfigurationUtils
refactor AAI Rest calls from groovy files - Fix getARByID issue
checkin to refactor AAI rest | Adding Junits
checkin to refactor AAI rest | Adding few more classes
checkin to refactor AAI rest of DoCreateVfModuleVolumeV2
checkin to refactor AAI rest | Update junit
checkin to refactor AAI rest of DoCreateVfModuleVolumeV2 | Adding junits
checkin to refactor AAI rest of DoCreateVfModuleVolumeV2 | Adding junits
checkin to refactor AAI rest of DoCreateVfModuleVolumeV2.groovy
...
updated in and out mapping to be generalBuildingBlock
change source out mapping to generalBuildingBlock
Change-Id: I122f1ebe3e15b77da0a55af201d89d47e326bf83
Issue-ID: SO-1098
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 45621f0..77ea9bc 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
@@ -26,9 +26,11 @@
import java.util.Map;
import java.util.Optional;
-import org.apache.log4j.Logger;
+
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.jsonpath.JsonPathUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -39,7 +41,7 @@
private static final long serialVersionUID = 5895841925807816737L;
private final String jsonBody;
private final ObjectMapper mapper;
- private final transient Logger logger = Logger.getLogger(AAIResultWrapper.class);
+ private final transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class);
public AAIResultWrapper(String json) {
this.jsonBody = json;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index 874b06e..2876f77 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -158,12 +158,8 @@
protected URI build(Object... values) {
//This is a workaround because resteasy does not encode URIs correctly
final String[] encoded = new String[values.length];
- for (int i = 0; i < values.length; i++) {
- try {
- encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
- } catch (UnsupportedEncodingException e) {
- encoded[i] = values[i].toString();
- }
+ for (int i = 0; i < values.length; i++) {
+ encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
}
return internalURI.buildFromEncoded(encoded);
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
index aeaa923..b4cf8eb 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
@@ -56,11 +56,7 @@
final Map<String, String> result = new LinkedHashMap<>();
for (Entry<String, String> entry : map.entrySet()) {
- try {
- result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- result.put(entry.getKey(), "");
- }
+ result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8"));
}
return result;
diff --git a/common/src/main/java/org/onap/so/constants/Defaults.java b/common/src/main/java/org/onap/so/constants/Defaults.java
index 13a378e..0dc084a 100644
--- a/common/src/main/java/org/onap/so/constants/Defaults.java
+++ b/common/src/main/java/org/onap/so/constants/Defaults.java
@@ -31,7 +31,7 @@
private final String propName;
private final String defaultValue;
-
+
private Defaults(String propName, String defaultValue) {
this.defaultValue = defaultValue;
this.propName = propName;
@@ -51,4 +51,4 @@
protected Optional<ApplicationContext> getAppContext() {
return Optional.ofNullable(SpringContextHelper.getAppContext());
}
-}
+}
\ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 87cb481..4dfa1d4 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -20,13 +20,12 @@
package org.onap.so.serviceinstancebeans;
+import java.beans.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.persistence.Transient;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 11d464a..c35ced5 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -21,16 +21,16 @@
package org.onap.so.utils;
-
-import java.security.GeneralSecurityException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import javax.crypto.Cipher;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.GeneralSecurityException;
+import java.security.SecureRandom;
+import java.util.Arrays;
+
/**
* CryptoUtils adapted from RTTP client.
@@ -40,8 +40,12 @@
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CryptoUtils.class);
- public static final String AES = "AES";
+ private static final String AES = "AES";
private static final String CLOUD_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+ private static final int GCM_TAG_LENGTH = 16;
+ private static final int GCM_IV_LENGTH = 12;
+ private static final String AES_GCM_NO_PADDING = "AES/GCM/NoPadding";
+
/**
* encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
@@ -50,10 +54,16 @@
*/
public static String encrypt (String value, String keyString) throws GeneralSecurityException {
SecretKeySpec sks = getSecretKeySpec (keyString);
- Cipher cipher = Cipher.getInstance (CryptoUtils.AES);
- cipher.init (Cipher.ENCRYPT_MODE, sks, cipher.getParameters ());
- byte[] encrypted = cipher.doFinal (value.getBytes ());
- return byteArrayToHexString (encrypted);
+ Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+ byte[] initVector = new byte[GCM_IV_LENGTH];
+ (new SecureRandom()).nextBytes(initVector);
+ GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+ cipher.init(Cipher.ENCRYPT_MODE, sks, spec);
+ byte[] encoded = value.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+ byte[] cipherText = new byte[initVector.length + cipher.getOutputSize(encoded.length)];
+ System.arraycopy(initVector, 0, cipherText, 0, initVector.length);
+ cipher.doFinal(encoded, 0, encoded.length, cipherText, initVector.length);
+ return byteArrayToHexString(cipherText);
}
/**
@@ -63,29 +73,18 @@
*/
public static String decrypt (String message, String keyString) throws GeneralSecurityException {
SecretKeySpec sks = getSecretKeySpec (keyString);
- Cipher cipher = Cipher.getInstance (CryptoUtils.AES);
- cipher.init (Cipher.DECRYPT_MODE, sks);
- byte[] decrypted = cipher.doFinal (hexStringToByteArray (message));
- return new String (decrypted);
+ byte[] cipherText = hexStringToByteArray(message);
+ Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+ byte[] initVector = Arrays.copyOfRange(cipherText, 0, GCM_IV_LENGTH);
+ GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+ cipher.init(Cipher.DECRYPT_MODE, sks, spec);
+ byte[] plaintext = cipher.doFinal(cipherText, GCM_IV_LENGTH, cipherText.length - GCM_IV_LENGTH);
+ return new String(plaintext);
}
-
- /**
- * decrypt a value or return defaultValue
- *
- */
- public static String decryptProperty (String prop, String defaultValue, String encryptionKey) {
- try {
- return CryptoUtils.decrypt(prop, encryptionKey);
- }
- catch (GeneralSecurityException e) {
- LOGGER.debug("Security exception", e);
- }
- return defaultValue;
- }
public static String encryptCloudConfigPassword(String message) {
try {
- return CryptoUtils.encrypt(message, CryptoUtils.CLOUD_KEY);
+ return CryptoUtils.encrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
return null;
@@ -93,16 +92,15 @@
}
public static String decryptCloudConfigPassword(String message) {
try {
- return CryptoUtils.decrypt(message, CryptoUtils.CLOUD_KEY);
+ return CryptoUtils.decrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
return null;
}
}
- private static SecretKeySpec getSecretKeySpec (String keyString) throws NoSuchAlgorithmException {
+ private static SecretKeySpec getSecretKeySpec (String keyString) {
byte[] key = hexStringToByteArray (keyString);
- SecretKeySpec sks = new SecretKeySpec (key, CryptoUtils.AES);
- return sks;
+ return new SecretKeySpec (key, AES);
}
public static String byteArrayToHexString (byte[] b) {
diff --git a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
index 587e484..4182207 100644
--- a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
+++ b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
@@ -71,8 +71,6 @@
String encode2String = CryptoUtils.encrypt(testData, testKey);
assertNotNull(encode2String);
- assertEquals(encodeString,encode2String);
-
assertEquals(CryptoUtils.decrypt(encodeString, testKey),CryptoUtils.decrypt(encode2String, testKey));
encodeString = CryptoUtils.encryptCloudConfigPassword(testData);
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index 1443f04..6fca4a1 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -20,7 +20,8 @@
package org.onap.so.client;
-import static org.mockito.Matchers.any;
+
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -39,8 +40,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.ArgumentMatchers;
import org.onap.so.utils.TargetEntity;
+import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class RestClientTest {
@@ -55,7 +57,7 @@
RestClient spy = buildSpy();
RestRequest mockCallable = mock(RestRequest.class);
when(mockCallable.call()).thenThrow(new WebApplicationException(new SocketTimeoutException()));
- doReturn(mockCallable).when(spy).buildRequest(any(String.class), any(Object.class));
+ doReturn(mockCallable).when(spy).buildRequest(any(String.class), ArgumentMatchers.isNull());
try {
spy.get();
} catch (Exception e) {
@@ -70,7 +72,7 @@
RestClient spy = buildSpy();
RestRequest mockCallable = mock(RestRequest.class);
when(mockCallable.call()).thenThrow(new WebApplicationException(new NotFoundException()));
- doReturn(mockCallable).when(spy).buildRequest(any(String.class), any(Object.class));
+ doReturn(mockCallable).when(spy).buildRequest(any(String.class), ArgumentMatchers.isNull());
try {
spy.get();
} catch (Exception e) {
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
index 4041001..f30d2e1 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
@@ -25,7 +25,7 @@
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -34,13 +34,12 @@
import java.util.Optional;
import java.util.UUID;
-import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.aai.entities.Configuration;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUri;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
index 008b612..0cee366 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIPatchConverterTest.java
@@ -33,7 +33,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import com.fasterxml.jackson.core.JsonParseException;
@@ -72,9 +72,10 @@
AAIPatchConverter validator = new AAIPatchConverter();
HashMap<String, String> map = new HashMap<>();
map.put("ipv4-loopback0-address", "");
+ map.put("ipv4-loopback1-address", "192.168.1.1");
String result = validator.marshallObjectToPatchFormat(map);
- assertEquals("expect string", "{\"ipv4-loopback0-address\":\"\"}", result);
+ assertEquals("expect string", "{\"ipv4-loopback1-address\":\"192.168.1.1\"}", result);
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
index 6e9c385..f4b6141 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -22,7 +22,7 @@
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -39,7 +39,7 @@
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.RestClient;
import org.onap.so.client.aai.entities.CustomQuery;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 22dc1ca..32a9ca5 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -96,7 +96,7 @@
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
wireMockRule.stubFor(get(
urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
- .withHeader("Authorization", equalTo("Basic TVNPOk1TTw=="))
+ .withHeader("Authorization", equalTo("Basic dGVzdDp0ZXN0"))
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
index 752c49e..6abeea9 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
@@ -21,7 +21,7 @@
package org.onap.so.client.aai;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -39,7 +39,7 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.RestClientSSL;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
index 8c42686..428fa27 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
@@ -23,7 +23,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -35,6 +35,7 @@
import java.nio.file.Paths;
import java.util.Optional;
+import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.onap.aai.domain.yang.Pserver;
@@ -66,7 +67,7 @@
}
@Test
- public void testRequest() throws IOException {
+ public void testRequest() throws JSONException,IOException {
AAIResourcesClient client = createClient();
Pserver pserver = new Pserver();
pserver.setHostname("pserver-hostname");
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index cbf8d67..6213758 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -21,7 +21,7 @@
package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
index fddd1e6..8989d6d 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
@@ -20,7 +20,7 @@
package org.onap.so.client.aai;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -28,7 +28,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class AAIUpdatorTest {
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index a2de528..63c7290 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -30,7 +30,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pserver;
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
index d4bf1b0..324be01 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
@@ -35,7 +35,7 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.springframework.util.SerializationUtils;
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
index 71ec497..0d2da33 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
@@ -21,7 +21,7 @@
package org.onap.so.client.aai.entities.uri;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 26f9d87..7e70f2d 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -29,7 +29,7 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -181,10 +181,6 @@
ServiceInstanceUri spy = spy(instance);
AAIResourcesClient client = createClient();
doReturn(client).when(spy).getResourcesClient();
- /*AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
- when(client.get(Matchers.<AAIResourceUri>any(AAIResourceUri.class), Matchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
- when(wrapper.getJson()).thenReturn("{\"results\":[]}");
- doReturn(client).when(spy).getResourcesClient();*/
stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3"))
.willReturn(aResponse()
.withStatus(404)
diff --git a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index 7b78376..388e89a 100644
--- a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -21,44 +21,43 @@
package org.onap.so.client.grm;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.matching;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+
import java.io.File;
import java.nio.file.Files;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.MediaType;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import org.apache.log4j.MDC;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.client.grm.beans.OperationalInfo;
-import org.onap.so.client.grm.beans.Property;
import org.onap.so.client.grm.beans.ServiceEndPoint;
import org.onap.so.client.grm.beans.ServiceEndPointList;
import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest;
import org.onap.so.client.grm.beans.ServiceEndPointRequest;
-import org.onap.so.client.grm.beans.Version;
import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
+import org.onap.so.utils.TestAppender;
+import org.slf4j.MDC;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.onap.so.utils.TestAppender;
+import ch.qos.logback.classic.spi.ILoggingEvent;
public class GRMClientTest {
@@ -75,8 +74,6 @@
System.setProperty("mso.config.path", "src/test/resources");
}
- private ObjectMapper mapper = new ObjectMapper();
-
@Test
public void testFind() throws Exception {
TestAppender.events.clear();
diff --git a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
index 4cb9bd0..46f9de2 100644
--- a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
+++ b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
@@ -23,9 +23,9 @@
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import java.io.File;
import java.io.IOException;
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
index 89dd2f5..d66f5f6 100644
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
@@ -21,7 +21,7 @@
package org.onap.so.client.sdno;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
diff --git a/common/src/test/resources/aai.properties b/common/src/test/resources/aai.properties
index 897659b..2936e84 100644
--- a/common/src/test/resources/aai.properties
+++ b/common/src/test/resources/aai.properties
@@ -1,3 +1,3 @@
aai.endpoint=http://localhost:8443
-aai.auth=2630606608347B7124C244AB0FE34F6F
+aai.auth=5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7
\ No newline at end of file