X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Ftest%2Fjava%2Forg%2Foransc%2Fpolicyagent%2FMockPolicyAgent.java;h=efbd57656f987d198c763d0c8ee72be2a09e58ce;hb=c5c251953f36a3a56613ad28f2d73f958ff58295;hp=1ea677cab2f85712a189b4ea5d8774aa65c94376;hpb=8f1c85c3604a0d10675cacd16a7b67dca346d478;p=nonrtric.git diff --git a/policy-agent/src/test/java/org/oransc/policyagent/MockPolicyAgent.java b/policy-agent/src/test/java/org/oransc/policyagent/MockPolicyAgent.java index 1ea677ca..efbd5765 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/MockPolicyAgent.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/MockPolicyAgent.java @@ -37,6 +37,8 @@ import org.oransc.policyagent.repository.PolicyType; import org.oransc.policyagent.repository.PolicyTypes; import org.oransc.policyagent.repository.Rics; import org.oransc.policyagent.utils.MockA1ClientFactory; +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; @@ -48,6 +50,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT) public class MockPolicyAgent { + private static final Logger logger = LoggerFactory.getLogger(MockPolicyAgent.class); @Autowired Rics rics; @@ -117,7 +120,7 @@ public class MockPolicyAgent { PolicyType type = ImmutablePolicyType.builder().name(typeName).schema(schema).build(); policyTypes.put(type); } catch (Exception e) { - System.out.println("Could not load json schema " + e); + logger.error("Could not load json schema ", e); } } } @@ -127,13 +130,13 @@ public class MockPolicyAgent { private int port; private void keepServerAlive() { - System.out.println("Keeping server alive!"); + logger.info("Keeping server alive!"); try { synchronized (this) { this.wait(); } } catch (Exception ex) { - System.out.println("Unexpected: " + ex.toString()); + logger.error("Unexpected: " + ex); } } @@ -144,6 +147,8 @@ public class MockPolicyAgent { } @Test + @SuppressWarnings("squid:S2699") // Tests should include assertions. This test is only for keeping the server alive, + // so it will only be confusing to add an assertion. public void runMock() throws Exception { keepServerAlive(); }