X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-backend%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fportal%2Fnonrtric%2Fcontrolpanel%2Fcontroller%2FAbstractControllerTest.java;h=f4620962e5a8dfba4ec06d715581d2edf7ee5ce9;hb=0bcfde8903ba3f1fb99fcab3bf39f7f4e6ccbe1e;hp=08c1c740e2f4bc3c19ab7004c1cbc4fe26303154;hpb=f507d92d55ee77fad16cc024ea95c869e0d5dc32;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/AbstractControllerTest.java b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/AbstractControllerTest.java index 08c1c74..f462096 100644 --- a/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/AbstractControllerTest.java +++ b/webapp-backend/src/test/java/org/oransc/portal/nonrtric/controlpanel/controller/AbstractControllerTest.java @@ -27,13 +27,11 @@ import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.oransc.portal.nonrtric.controlpanel.config.WebSecurityMockConfiguration; +import org.oransc.portal.nonrtric.controlpanel.util.AsyncRestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -52,22 +50,19 @@ public class AbstractControllerTest { @LocalServerPort private int localServerPort; - @Autowired - protected TestRestTemplate restTemplate; + protected final AsyncRestClient webClient = new AsyncRestClient(""); /** * Flexible URI builder. * - * @param queryParams - * Map of string-string query parameters - * @param path - * Array of path components. If a component has an - * embedded slash, the string is split and each - * subcomponent is added individually. + * @param queryParams Map of string-string query parameters + * @param path Array of path components. If a component has an embedded + * slash, the string is split and each subcomponent is added + * individually. * @return URI */ protected URI buildUri(final Map queryParams, final String... path) { - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:" + localServerPort + "/"); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("https://localhost:" + localServerPort + "/"); for (int p = 0; p < path.length; ++p) { if (path[p] == null || path[p].isEmpty()) { throw new IllegalArgumentException("Unexpected null or empty at path index " + Integer.toString(p)); @@ -100,14 +95,4 @@ public class AbstractControllerTest { logger.info("Context loads on mock profile"); } - public TestRestTemplate testRestTemplateAdminRole() { - return restTemplate.withBasicAuth(WebSecurityMockConfiguration.TEST_CRED_ADMIN, - WebSecurityMockConfiguration.TEST_CRED_ADMIN); - } - - public TestRestTemplate testRestTemplateStandardRole() { - return restTemplate.withBasicAuth(WebSecurityMockConfiguration.TEST_CRED_STANDARD, - WebSecurityMockConfiguration.TEST_CRED_STANDARD); - } - }