summaryrefslogtreecommitdiffstats
path: root/aai-resources/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'aai-resources/src/test')
-rw-r--r--aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java42
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/CustomerFilterSearchTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/PserverMissingTest.java4
-rw-r--r--aai-resources/src/test/resources/application-test.properties18
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