Merge "Change formatting of API documentation"
[nonrtric.git] / policy-agent / src / test / java / org / oransc / policyagent / ApplicationTest.java
index 0027cca..d274d5a 100644 (file)
@@ -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);
@@ -663,7 +675,7 @@ public class ApplicationTest {
     }
 
     private String jsonString() {
-        return "{\n  \"servingCellNrcgi\": \"1\"\n }";
+        return "{\"servingCellNrcgi\":\"1\"}";
     }
 
     @Test