diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-04-10 15:43:25 -0400 |
---|---|---|
committer | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-04-10 15:50:25 -0400 |
commit | 2e971ba4b99e987a18237675e50adc4a5f21d0d6 (patch) | |
tree | cbc3a956906d881f70f9147673882d3c9e65ccdb /aai-resources/src/test | |
parent | ff3d7893be5cbc83eb1cd3ea2e85b309d799a7fd (diff) |
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) <vk250x@att.com>
Diffstat (limited to 'aai-resources/src/test')
6 files changed, 38 insertions, 32 deletions
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<String>(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); diff --git a/aai-resources/src/test/resources/application-test.properties b/aai-resources/src/test/resources/application-test.properties index 55717b9..320b8e1 100644 --- a/aai-resources/src/test/resources/application-test.properties +++ b/aai-resources/src/test/resources/application-test.properties @@ -13,7 +13,7 @@ spring.jersey.application-path=${schema.uri.base.path} spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration -spring.profiles.active=production,one-way-ssl +spring.profiles.active=production #The max number of active threads in this pool server.tomcat.max-threads=200 #The minimum number of threads always kept alive @@ -25,13 +25,15 @@ server.local.startpath=src/main/resources/ server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties server.port=8447 -server.ssl.enabled-protocols=TLSv1.1,TLSv1.2 -server.ssl.key-store=${server.local.startpath}etc/auth/aai_keystore -server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) -server.ssl.trust-store=${server.local.startpath}etc/auth/aai_keystore -server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) -server.ssl.client-auth=want -server.ssl.key-store-type=JKS +security.require-ssl=false +server.ssl.enabled=false +#server.ssl.enabled-protocols=TLSv1.1,TLSv1.2 +#server.ssl.key-store=${server.local.startpath}etc/auth/aai_keystore +#server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) +#server.ssl.trust-store=${server.local.startpath}etc/auth/aai_keystore +#server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0) +#server.ssl.client-auth=want +#server.ssl.key-store-type=JKS # JMS bind address host port jms.bind.address=tcp://localhost:61647 |