X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fpolicyagent%2FApplicationTest.java;h=d274d5a30782fd7dda771f81b49fcfc401383ea0;hb=e2a037745508a3c1ada650ea3571ca57f0a90851;hp=6905c70c998372a9bf756df6c37857e257f53523;hpb=7de2f355ed1956001d15cb7e57fdd37fdf88cdc5;p=nonrtric.git diff --git a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java index 6905c70c..d274d5a3 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java @@ -72,7 +72,9 @@ 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.context.TestConfiguration; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.http.HttpStatus; @@ -164,6 +166,12 @@ public class ApplicationTest { Duration checkInterval = Duration.ofMillis(1); return new ServiceSupervision(this.services, this.policies, this.getA1ClientFactory(), checkInterval); } + + @Bean + public ServletWebServerFactory servletContainer() { + return new TomcatServletWebServerFactory(); + } + } @LocalServerPort @@ -301,6 +309,10 @@ public class ApplicationTest { String rsp = restClient().get(url).block(); assertThat(rsp.contains(policyInstanceId)).isTrue(); + url = "/policy?id=" + policyInstanceId; + rsp = restClient().get(url).block(); + assertThat(rsp).isEqualTo(policyBody); + // Test of error codes url = putPolicyUrl(serviceName, ricName + "XX", policyTypeName, policyInstanceId); testErrorCode(restClient().put(url, policyBody), HttpStatus.NOT_FOUND); @@ -659,11 +671,11 @@ public class ApplicationTest { } private String baseUrl() { - return "http://localhost:" + port; + return "https://localhost:" + port; } private String jsonString() { - return "{\n \"servingCellNrcgi\": \"1\"\n }"; + return "{\"servingCellNrcgi\":\"1\"}"; } @Test