From bf94b2907e5178b47500a5a388cdd56477ba9155 Mon Sep 17 00:00:00 2001 From: "Kajur, Harish (vk250x)" Date: Wed, 11 Apr 2018 00:00:39 -0400 Subject: Fix the basic auth issue which got broken with spring boot Issue-ID: AAI-1019 Change-Id: I59c7351c381be07ae1be5abe6473d9c8614a0673 Signed-off-by: Kajur, Harish (vk250x) --- aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'aai-resources/src/test') diff --git a/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java b/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java index 7c4c3a7..2acc3c4 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java @@ -36,6 +36,8 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate; +import java.io.UnsupportedEncodingException; +import java.util.Base64; import java.util.Collections; import java.util.UUID; @@ -70,7 +72,7 @@ public class PserverTest { private String baseUrl; @Before - public void setup(){ + public void setup() throws UnsupportedEncodingException { HttpHeaders headers = new HttpHeaders(); @@ -80,6 +82,9 @@ public class PserverTest { headers.add("X-FromAppId", "JUNIT"); headers.add("X-TransactionId", "JUNIT"); + String authorization = Base64.getEncoder().encodeToString("AAI:AAI".getBytes("UTF-8")); + headers.add("Authorization", "Basic " + authorization); + httpEntity = new HttpEntity(headers); baseUrl = "https://localhost:" + randomPort; } -- cgit 1.2.3-korg