From 2e971ba4b99e987a18237675e50adc4a5f21d0d6 Mon Sep 17 00:00:00 2001 From: "Kajur, Harish (vk250x)" Date: Wed, 10 Apr 2019 15:43:25 -0400 Subject: Make changes to integrate latest changes Add perm flags with metaspace flags as permgen has been replaced by metaspace in java 8 Update junits to remove the certificate Fix password configruation and schema changes to work with the increase nodes tool Correct service.name for making sure the correct DB connection name is set Add aaiconfig properties for the deleted objects to log Issue-ID: AAI-2327 Change-Id: I5a8a70f6d6630960b0e8ec4780fce3e1baf79cc1 Signed-off-by: Kajur, Harish (vk250x) --- .../org/onap/aai/ResourcesTestConfiguration.java | 42 ++++++++++++---------- .../org/onap/aai/rest/AbstractSpringRestTest.java | 2 +- .../java/org/onap/aai/rest/ConfigurationTest.java | 2 +- .../onap/aai/rest/CustomerFilterSearchTest.java | 2 +- .../java/org/onap/aai/rest/PserverMissingTest.java | 4 +-- 5 files changed, 28 insertions(+), 24 deletions(-) (limited to 'aai-resources/src/test/java/org') diff --git a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java index 77f82db..8ec82ff 100644 --- a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java +++ b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java @@ -58,31 +58,35 @@ public class ResourcesTestConfiguration { @Bean RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception { - char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray(); - char[] keyStorePassword = env.getProperty("server.ssl.key-store-password").toCharArray(); - String keyStore = env.getProperty("server.ssl.key-store"); - String trustStore = env.getProperty("server.ssl.trust-store"); + RestTemplate restTemplate = null; + if(env.acceptsProfiles("one-way-ssl", "two-way-ssl")) { + char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray(); + char[] keyStorePassword = env.getProperty("server.ssl.key-store-password").toCharArray(); - SSLContextBuilder sslContextBuilder = SSLContextBuilder.create(); + String keyStore = env.getProperty("server.ssl.key-store"); + String trustStore = env.getProperty("server.ssl.trust-store"); + SSLContextBuilder sslContextBuilder = SSLContextBuilder.create(); - if(env.acceptsProfiles("two-way-ssl")){ - sslContextBuilder = sslContextBuilder.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword); - } - - SSLContext sslContext = sslContextBuilder - .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword) - .build(); + if (env.acceptsProfiles("two-way-ssl")) { + sslContextBuilder = sslContextBuilder.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword); + } - HttpClient client = HttpClients.custom() - .setSSLContext(sslContext) - .setSSLHostnameVerifier((s, sslSession) -> true) - .build(); + SSLContext sslContext = sslContextBuilder + .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword) + .build(); - RestTemplate restTemplate = builder - .requestFactory(new HttpComponentsClientHttpRequestFactory(client)) - .build(); + HttpClient client = HttpClients.custom() + .setSSLContext(sslContext) + .setSSLHostnameVerifier((s, sslSession) -> true) + .build(); + restTemplate = builder + .requestFactory(new HttpComponentsClientHttpRequestFactory(client)) + .build(); + }else { + restTemplate = builder.build(); + } restTemplate.setErrorHandler(new ResponseErrorHandler() { @Override public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java index ab9fdd1..c755838 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java @@ -98,7 +98,7 @@ public abstract class AbstractSpringRestTest { headers.add("Authorization", "Basic " + authorization); httpEntity = new HttpEntity(headers); - baseUrl = "https://localhost:" + randomPort; + baseUrl = "http://localhost:" + randomPort; } @After diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java index f030f20..0e1cbe4 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java @@ -78,7 +78,7 @@ public class ConfigurationTest extends AbstractSpringRestTest { headers.add("Authorization", "Basic " + authorization); httpEntity = new HttpEntity(headers); - baseUrl = "https://localhost:" + randomPort; + baseUrl = "http://localhost:" + randomPort; } @Test diff --git a/aai-resources/src/test/java/org/onap/aai/rest/CustomerFilterSearchTest.java b/aai-resources/src/test/java/org/onap/aai/rest/CustomerFilterSearchTest.java index f22c915..a52d774 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/CustomerFilterSearchTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/CustomerFilterSearchTest.java @@ -49,7 +49,7 @@ public class CustomerFilterSearchTest extends AbstractSpringRestTest { String body = PayloadUtil.getResourcePayload("customer.json"); httpEntity = new HttpEntity(body, headers); - baseUrl = "https://localhost:" + randomPort; + baseUrl = "http://localhost:" + randomPort; ResponseEntity responseEntity; responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class); diff --git a/aai-resources/src/test/java/org/onap/aai/rest/PserverMissingTest.java b/aai-resources/src/test/java/org/onap/aai/rest/PserverMissingTest.java index da982a9..511cf84 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/PserverMissingTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/PserverMissingTest.java @@ -50,7 +50,7 @@ public class PserverMissingTest extends AbstractSpringRestTest { String body = PayloadUtil.getTemplatePayload("pserver.json", templateMap); httpEntity = new HttpEntity(body, headers); - baseUrl = "https://localhost:" + randomPort; + baseUrl = "http://localhost:" + randomPort; ResponseEntity responseEntity; responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class); @@ -72,7 +72,7 @@ public class PserverMissingTest extends AbstractSpringRestTest { headers.add("Authorization", "Basic " + authorization); httpEntity = new HttpEntity(headers); - baseUrl = "https://localhost:" + randomPort; + baseUrl = "http://localhost:" + randomPort; ResponseEntity responseEntity; responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.GET, httpEntity, String.class); -- cgit 1.2.3-korg