Merge "Version Up & Removed unncessary properties"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Tue, 26 May 2020 10:27:25 +0000 (10:27 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 26 May 2020 10:27:25 +0000 (10:27 +0000)
34 files changed:
policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOnapA1Client.java
policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java
policy-agent/src/test/java/org/oransc/policyagent/MockPolicyAgent.java
policy-agent/src/test/java/org/oransc/policyagent/clients/A1ClientFactoryTest.java
policy-agent/src/test/java/org/oransc/policyagent/clients/AsyncRestClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/clients/OscA1ClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOnapA1ClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/clients/StdA1ClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/configuration/ApplicationConfigParserTest.java
policy-agent/src/test/java/org/oransc/policyagent/configuration/ApplicationConfigTest.java
policy-agent/src/test/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerTest.java
policy-agent/src/test/java/org/oransc/policyagent/dmaap/DmaapMessageHandlerTest.java
policy-agent/src/test/java/org/oransc/policyagent/repository/LockTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/EnvironmentProcessorTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/RefreshConfigTaskTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSynchronizationTaskTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/ServiceSupervisionTest.java
sdnc-a1-controller/northbound/features/features-sdnc-a1-northbound/pom.xml
sdnc-a1-controller/northbound/features/installer/pom.xml
sdnc-a1-controller/northbound/features/installer/src/main/resources/scripts/install-feature.sh
sdnc-a1-controller/northbound/features/pom.xml
sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProviderTest.java
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapterImplTest.java
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/docker/standalone.Dockerfile
sdnc-a1-controller/oam/platform-logic/src/main/scripts/updateDgNamespace.sh
sdnc-a1-controller/oam/platform-logic/src/main/scripts/updatePackages.sh
test/auto-test/README.md
test/auto-test/Suite-interfaces.sh
test/common/README.md
test/cr/README.md
test/mrstub/README.md

index 9e9e7ab..a10decd 100644 (file)
@@ -111,7 +111,7 @@ public class SdncOnapA1Client implements A1Client {
             .policyTypeId(policy.type().name()) //
             .policyInstanceId(policy.id()) //
             .policyInstance(policy.json()) //
-            .properties(new ArrayList<String>()) //
+            .properties(new ArrayList<>()) //
             .build();
 
         String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
index a8fc6e1..cffd1c4 100644 (file)
@@ -90,7 +90,7 @@ import reactor.util.annotation.Nullable;
 
 @ExtendWith(SpringExtension.class)
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ApplicationTest {
+class ApplicationTest {
     private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
 
     @Autowired
@@ -183,7 +183,7 @@ public class ApplicationTest {
     private int port;
 
     @BeforeEach
-    public void reset() {
+    void reset() {
         rics.clear();
         policies.clear();
         policyTypes.clear();
@@ -192,7 +192,7 @@ public class ApplicationTest {
     }
 
     @AfterEach
-    public void verifyNoRicLocks() {
+    void verifyNoRicLocks() {
         for (Ric ric : this.rics.getRics()) {
             ric.getLock().lockBlocking(LockType.EXCLUSIVE);
             ric.getLock().unlockBlocking();
@@ -202,7 +202,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetRics() throws Exception {
+    void testGetRics() throws Exception {
         addRic("ric1");
         this.addPolicyType("type1", "ric1");
         String url = "/rics?policyType=type1";
@@ -231,7 +231,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testSynchronization() throws Exception {
+    void testSynchronization() throws Exception {
         // Two polictypes will be put in the NearRT RICs
         PolicyTypes nearRtRicPolicyTypes = new PolicyTypes();
         nearRtRicPolicyTypes.put(createPolicyType("typeName"));
@@ -267,7 +267,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetRicForManagedElement_thenReturnCorrectRic() throws Exception {
+    void testGetRicForManagedElement_thenReturnCorrectRic() throws Exception {
         String ricName = "ric1";
         String managedElementId = "kista_1";
         addRic(ricName, managedElementId);
@@ -301,7 +301,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testPutPolicy() throws Exception {
+    void testPutPolicy() throws Exception {
         String serviceName = "service1";
         String ricName = "ric1";
         String policyTypeName = "type1";
@@ -358,7 +358,7 @@ public class ApplicationTest {
      *
      * @throws ServiceException
      */
-    public void testErrorFromRIC() throws ServiceException {
+    void testErrorFromRIC() throws ServiceException {
         putService("service1");
         addPolicyType("type1", "ric1");
 
@@ -392,7 +392,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testPutTypelessPolicy() throws Exception {
+    void testPutTypelessPolicy() throws Exception {
         putService("service1");
         addPolicyType("", "ric1");
         String url = putPolicyUrl("service1", "ric1", "", "id1");
@@ -407,7 +407,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testRefuseToUpdatePolicy() throws Exception {
+    void testRefuseToUpdatePolicy() throws Exception {
         // Test that only the json can be changed for a already created policy
         // In this case service is attempted to be changed
         this.addRic("ric1");
@@ -421,7 +421,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicy() throws Exception {
+    void testGetPolicy() throws Exception {
         String url = "/policy?id=id";
         Policy policy = addPolicy("id", "typeName", "service1", "ric1");
         {
@@ -435,7 +435,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testDeletePolicy() throws Exception {
+    void testDeletePolicy() throws Exception {
         addPolicy("id", "typeName", "service1", "ric1");
         assertThat(policies.size()).isEqualTo(1);
 
@@ -450,7 +450,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicySchemas() throws Exception {
+    void testGetPolicySchemas() throws Exception {
         addPolicyType("type1", "ric1");
         addPolicyType("type2", "ric2");
 
@@ -474,7 +474,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicySchema() throws Exception {
+    void testGetPolicySchema() throws Exception {
         addPolicyType("type1", "ric1");
         addPolicyType("type2", "ric2");
 
@@ -490,7 +490,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicyTypes() throws Exception {
+    void testGetPolicyTypes() throws Exception {
         addPolicyType("type1", "ric1");
         addPolicyType("type2", "ric2");
 
@@ -508,7 +508,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicies() throws Exception {
+    void testGetPolicies() throws Exception {
         addPolicy("id1", "type1", "service1");
 
         String url = "/policies";
@@ -524,7 +524,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPoliciesFilter() throws Exception {
+    void testGetPoliciesFilter() throws Exception {
         addPolicy("id1", "type1", "service1");
         addPolicy("id2", "type1", "service2");
         addPolicy("id3", "type2", "service1");
@@ -553,7 +553,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicyIdsFilter() throws Exception {
+    void testGetPolicyIdsFilter() throws Exception {
         addPolicy("id1", "type1", "service1", "ric1");
         addPolicy("id2", "type1", "service2", "ric1");
         addPolicy("id3", "type2", "service1", "ric1");
@@ -579,7 +579,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testPutAndGetService() throws Exception {
+    void testPutAndGetService() throws Exception {
         // PUT
         putService("name", 0, HttpStatus.CREATED);
         putService("name", 0, HttpStatus.OK);
@@ -625,7 +625,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testServiceSupervision() throws Exception {
+    void testServiceSupervision() throws Exception {
         putService("service1", 1, HttpStatus.CREATED);
         addPolicyType("type1", "ric1");
 
@@ -642,7 +642,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testGetPolicyStatus() throws Exception {
+    void testGetPolicyStatus() throws Exception {
         addPolicy("id", "typeName", "service1", "ric1");
         assertThat(policies.size()).isEqualTo(1);
 
@@ -707,7 +707,7 @@ public class ApplicationTest {
     }
 
     @Test
-    public void testConcurrency() throws Exception {
+    void testConcurrency() throws Exception {
         final Instant startTime = Instant.now();
         List<Thread> threads = new ArrayList<>();
         a1ClientFactory.setResponseDelay(Duration.ofMillis(1));
index 7f57ceb..d37a2be 100644 (file)
@@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
 
 @ExtendWith(SpringExtension.class)
 @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
-public class MockPolicyAgent {
+class MockPolicyAgent {
     private static final Logger logger = LoggerFactory.getLogger(MockPolicyAgent.class);
 
     @Autowired
@@ -199,9 +199,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 {
+                                     // alive, so it will only be confusing to add an assertion.
+    void runMock() throws Exception {
         keepServerAlive();
     }
 
index d696770..74cebb0 100644 (file)
@@ -46,7 +46,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class A1ClientFactoryTest {
+class A1ClientFactoryTest {
     private static final String RIC_NAME = "Name";
     private static final String EXCEPTION_MESSAGE = "Error";
 
@@ -78,14 +78,14 @@ public class A1ClientFactoryTest {
     }
 
     @BeforeEach
-    public void createFactoryUnderTest() {
+    void createFactoryUnderTest() {
         factoryUnderTest = spy(new A1ClientFactory(applicationConfigMock));
         this.ric = new Ric(ricConfig(""));
 
     }
 
     @Test
-    public void getProtocolVersion_ok() throws ServiceException {
+    void getProtocolVersion_ok() throws ServiceException {
         whenGetProtocolVersionThrowException(clientMock1);
         whenGetProtocolVersionReturn(clientMock2, A1ProtocolType.STD_V1_1);
         doReturn(clientMock1, clientMock2).when(factoryUnderTest).createClient(any(), any());
@@ -97,7 +97,7 @@ public class A1ClientFactoryTest {
     }
 
     @Test
-    public void getProtocolVersion_ok_Last() throws ServiceException {
+    void getProtocolVersion_ok_Last() throws ServiceException {
         whenGetProtocolVersionThrowException(clientMock1, clientMock2, clientMock3);
         whenGetProtocolVersionReturn(clientMock4, A1ProtocolType.STD_V1_1);
         doReturn(clientMock1, clientMock2, clientMock3, clientMock4).when(factoryUnderTest).createClient(any(), any());
@@ -109,7 +109,7 @@ public class A1ClientFactoryTest {
     }
 
     @Test
-    public void getProtocolVersion_error() throws ServiceException {
+    void getProtocolVersion_error() throws ServiceException {
         whenGetProtocolVersionThrowException(clientMock1, clientMock2, clientMock3, clientMock4);
         doReturn(clientMock1, clientMock2, clientMock3, clientMock4).when(factoryUnderTest).createClient(any(), any());
 
@@ -126,13 +126,13 @@ public class A1ClientFactoryTest {
     }
 
     @Test
-    public void create_check_types() throws ServiceException {
+    void create_check_types() throws ServiceException {
         assertTrue(createClient(A1ProtocolType.STD_V1_1) instanceof StdA1ClientVersion1);
         assertTrue(createClient(A1ProtocolType.OSC_V1) instanceof OscA1Client);
     }
 
     @Test
-    public void create_check_types_controllers() throws ServiceException {
+    void create_check_types_controllers() throws ServiceException {
         this.ric = new Ric(ricConfig("anythingButEmpty"));
         whenGetGetControllerConfigReturn();
         assertTrue(createClient(A1ProtocolType.SDNC_ONAP) instanceof SdncOnapA1Client);
index 884b36f..f3b9482 100644 (file)
@@ -39,7 +39,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 import reactor.util.Loggers;
 
-public class AsyncRestClientTest {
+class AsyncRestClientTest {
     private static final String BASE_URL = "BaseUrl";
     private static final String REQUEST_URL = "/test";
     private static final String USERNAME = "username";
@@ -53,7 +53,7 @@ public class AsyncRestClientTest {
     private static AsyncRestClient clientUnderTest;
 
     @BeforeAll
-    public static void init() {
+    static void init() {
         // skip a lot of unnecessary logs from MockWebServer
         InternalLoggerFactory.setDefaultFactory(JdkLoggerFactory.INSTANCE);
         Loggers.useJdkLoggers();
@@ -62,12 +62,12 @@ public class AsyncRestClientTest {
     }
 
     @AfterAll
-    public static void tearDown() throws IOException {
+    static void tearDown() throws IOException {
         mockWebServer.shutdown();
     }
 
     @Test
-    public void testGetNoError() {
+    void testGetNoError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
             .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
             .setBody(TEST_JSON));
@@ -77,7 +77,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testGetError() {
+    void testGetError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
 
         Mono<String> returnedMono = clientUnderTest.get(REQUEST_URL);
@@ -86,7 +86,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPutNoError() {
+    void testPutNoError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
             .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
             .setBody(TEST_JSON));
@@ -96,7 +96,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPutError() {
+    void testPutError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
 
         Mono<String> returnedMono = clientUnderTest.put(REQUEST_URL, TEST_JSON);
@@ -105,7 +105,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testDeleteNoError() {
+    void testDeleteNoError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE));
 
         Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
@@ -113,7 +113,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testDeleteError() {
+    void testDeleteError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
 
         Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
@@ -122,7 +122,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPostNoError() {
+    void testPostNoError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
             .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
             .setBody(TEST_JSON));
@@ -132,7 +132,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPostError() {
+    void testPostError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
 
         Mono<String> returnedMono = clientUnderTest.post(REQUEST_URL, TEST_JSON);
@@ -141,7 +141,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPostWithAuthHeaderNoError() {
+    void testPostWithAuthHeaderNoError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
             .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
             .setBody(TEST_JSON));
@@ -151,7 +151,7 @@ public class AsyncRestClientTest {
     }
 
     @Test
-    public void testPostWithAuthHeaderError() {
+    void testPostWithAuthHeaderError() {
         mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
 
         Mono<String> returnedMono = clientUnderTest.postWithAuthHeader(REQUEST_URL, TEST_JSON, USERNAME, PASSWORD);
index b66340b..d23276d 100644 (file)
@@ -43,7 +43,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class OscA1ClientTest {
+class OscA1ClientTest {
 
     private static final String RIC_URL = "RicUrl";
 
@@ -65,7 +65,7 @@ public class OscA1ClientTest {
     AsyncRestClient asyncRestClientMock;
 
     @BeforeEach
-    public void init() {
+    void init() {
         RicConfig ricConfig = ImmutableRicConfig.builder() //
             .name("name") //
             .baseUrl("RicBaseUrl") //
@@ -77,7 +77,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyTypeIdentities() {
+    void testGetPolicyTypeIdentities() {
         List<String> policyTypeIds = Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID);
         Mono<String> policyTypeIdsResp = Mono.just(policyTypeIds.toString());
         when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeIdsResp);
@@ -88,7 +88,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyIdentities() {
+    void testGetPolicyIdentities() {
         Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString());
         Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString());
         Mono<String> policyIdsType2Resp = Mono.just(Arrays.asList(POLICY_2_ID).toString());
@@ -104,7 +104,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testGetValidPolicyType() {
+    void testGetValidPolicyType() {
         String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_VALID + "}";
         Mono<String> policyTypeResp = Mono.just(policyType);
 
@@ -117,7 +117,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testGetInValidPolicyTypeJson() {
+    void testGetInValidPolicyTypeJson() {
         String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_INVALID + "}";
         Mono<String> policyTypeResp = Mono.just(policyType);
 
@@ -129,7 +129,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyTypeWithoutCreateSchema() {
+    void testGetPolicyTypeWithoutCreateSchema() {
         Mono<String> policyTypeResp = Mono.just(POLICY_TYPE_SCHEMA_VALID);
 
         when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
@@ -140,7 +140,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testPutPolicy() {
+    void testPutPolicy() {
         when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.empty());
 
         clientUnderTest
@@ -150,7 +150,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testDeletePolicy() {
+    void testDeletePolicy() {
         when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty());
 
         Mono<String> returnedMono = clientUnderTest
@@ -160,7 +160,7 @@ public class OscA1ClientTest {
     }
 
     @Test
-    public void testDeleteAllPolicies() {
+    void testDeleteAllPolicies() {
         Mono<String> policyTypeIdsResp = Mono.just(Arrays.asList(POLICY_TYPE_1_ID, POLICY_TYPE_2_ID).toString());
         Mono<String> policyIdsType1Resp = Mono.just(Arrays.asList(POLICY_1_ID).toString());
         Mono<String> policyIdsType2Resp = Mono.just(Arrays.asList(POLICY_2_ID).toString());
index c7f9073..6b4ebd6 100644 (file)
@@ -43,7 +43,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class SdncOnapA1ClientTest {
+class SdncOnapA1ClientTest {
     private static final String CONTROLLER_USERNAME = "username";
     private static final String CONTROLLER_PASSWORD = "password";
     private static final String RIC_1_URL = "RicUrl";
@@ -66,7 +66,7 @@ public class SdncOnapA1ClientTest {
     AsyncRestClient asyncRestClientMock;
 
     @BeforeEach
-    public void init() {
+    void init() {
         asyncRestClientMock = mock(AsyncRestClient.class);
         ControllerConfig controllerCfg = ImmutableControllerConfig.builder() //
             .name("name") //
@@ -80,7 +80,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyTypeIdentities() {
+    void testGetPolicyTypeIdentities() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .build();
@@ -98,7 +98,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyIdentities() {
+    void testGetPolicyIdentities() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .build();
@@ -136,7 +136,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testGetValidPolicyType() {
+    void testGetValidPolicyType() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .policyTypeId(POLICY_TYPE_1_ID) //
@@ -154,7 +154,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testGetInvalidPolicyType() {
+    void testGetInvalidPolicyType() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .policyTypeId(POLICY_TYPE_1_ID) //
@@ -172,7 +172,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testPutPolicy() {
+    void testPutPolicy() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .policyTypeId(POLICY_TYPE_1_ID) //
@@ -192,7 +192,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testDeletePolicy() {
+    void testDeletePolicy() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .policyTypeId(POLICY_TYPE_1_ID) //
@@ -210,7 +210,7 @@ public class SdncOnapA1ClientTest {
     }
 
     @Test
-    public void testDeleteAllPolicies() {
+    void testDeleteAllPolicies() {
         SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
             .nearRtRicId(RIC_1_URL) //
             .build();
index fecbccb..7a1daad 100644 (file)
@@ -55,7 +55,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class SdncOscA1ClientTest {
+class SdncOscA1ClientTest {
     private static final String CONTROLLER_USERNAME = "username";
     private static final String CONTROLLER_PASSWORD = "password";
     private static final String RIC_1_URL = "RicUrl";
@@ -82,7 +82,7 @@ public class SdncOscA1ClientTest {
     }
 
     @BeforeEach
-    public void init() {
+    void init() {
         asyncRestClientMock = mock(AsyncRestClient.class);
         Ric ric = A1ClientHelper.createRic(RIC_1_URL);
 
@@ -91,14 +91,14 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyTypeIdentities_STD() {
+    void testGetPolicyTypeIdentities_STD() {
         List<String> policyTypeIds = clientUnderTest.getPolicyTypeIdentities().block();
         assertEquals(1, policyTypeIds.size(), "should hardcoded to one");
         assertEquals("", policyTypeIds.get(0), "should hardcoded to empty");
     }
 
     @Test
-    public void testGetPolicyTypeIdentities_OSC() {
+    void testGetPolicyTypeIdentities_OSC() {
         clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
             A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
             controllerConfig(), asyncRestClientMock);
@@ -127,7 +127,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetTypeSchema_OSC() throws IOException {
+    void testGetTypeSchema_OSC() throws IOException {
         clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
             A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
             controllerConfig(), asyncRestClientMock);
@@ -171,7 +171,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyIdentities() {
+    void testGetPolicyIdentities() {
 
         String policyIdsResp = createResponse(Arrays.asList(POLICY_1_ID, POLICY_2_ID));
         whenAsyncPostThenReturn(Mono.just(policyIdsResp));
@@ -189,13 +189,13 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetValidPolicyType() {
+    void testGetValidPolicyType() {
         String policyType = clientUnderTest.getPolicyTypeSchema("").block();
         assertEquals("{}", policyType, "");
     }
 
     @Test
-    public void testPutPolicyValidResponse() {
+    void testPutPolicyValidResponse() {
         whenPostReturnOkResponse();
 
         String returned = clientUnderTest
@@ -213,7 +213,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testPutPolicyRejected() {
+    void testPutPolicyRejected() {
         final String policyJson = "{}";
         AdapterOutput adapterOutput = ImmutableAdapterOutput.builder() //
             .body("NOK") //
@@ -243,7 +243,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testDeletePolicy() {
+    void testDeletePolicy() {
         whenPostReturnOkResponse();
 
         String returned = clientUnderTest
@@ -261,7 +261,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetStatus() {
+    void testGetStatus() {
         whenPostReturnOkResponse();
 
         Policy policy = A1ClientHelper.createPolicy(RIC_1_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID);
@@ -281,7 +281,7 @@ public class SdncOscA1ClientTest {
     }
 
     @Test
-    public void testGetVersion() {
+    void testGetVersion() {
         whenPostReturnOkResponse();
         A1ProtocolType returnedVersion = clientUnderTest.getProtocolVersion().block();
         assertEquals(A1ProtocolType.SDNC_OSC_STD_V1_1, returnedVersion, "");
index 15fe05a..beb2ca9 100644 (file)
@@ -42,7 +42,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class StdA1ClientTest {
+class StdA1ClientTest {
     private static final String RIC_URL = "RicUrl";
     private static final String POLICY_TYPE_1_NAME = "type1";
     private static final String POLICY_1_ID = "policy1";
@@ -59,7 +59,7 @@ public class StdA1ClientTest {
     RicConfig ricConfigMock;
 
     @BeforeEach
-    public void init() {
+    void init() {
         clientUnderTest = new StdA1ClientVersion1(asyncRestClientMock, ricConfigMock);
     }
 
@@ -72,14 +72,14 @@ public class StdA1ClientTest {
     }
 
     @Test
-    public void testGetPolicyTypeIdentities() {
+    void testGetPolicyTypeIdentities() {
         List<String> policyTypeIds = clientUnderTest.getPolicyTypeIdentities().block();
         assertEquals(1, policyTypeIds.size(), "should hardcoded to one");
         assertEquals("", policyTypeIds.get(0), "should hardcoded to empty");
     }
 
     @Test
-    public void testGetPolicyIdentities() {
+    void testGetPolicyIdentities() {
         doReturn(RIC_URL).when(ricConfigMock).baseUrl();
         Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString());
         when(asyncRestClientMock.get(anyString())).thenReturn(policyIds);
@@ -91,13 +91,13 @@ public class StdA1ClientTest {
     }
 
     @Test
-    public void testGetValidPolicyType() {
+    void testGetValidPolicyType() {
         String policyType = clientUnderTest.getPolicyTypeSchema(POLICY_TYPE_1_NAME).block();
         assertEquals("{}", policyType, "");
     }
 
     @Test
-    public void testPutPolicyValidResponse() {
+    void testPutPolicyValidResponse() {
         doReturn(RIC_URL).when(ricConfigMock).baseUrl();
         when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.just(POLICY_JSON));
 
@@ -109,7 +109,7 @@ public class StdA1ClientTest {
     }
 
     @Test
-    public void testDeletePolicy() {
+    void testDeletePolicy() {
         doReturn(RIC_URL).when(ricConfigMock).baseUrl();
         final String url = policiesBaseUrl() + POLICY_1_ID;
         when(asyncRestClientMock.delete(url)).thenReturn(Mono.empty());
@@ -121,7 +121,7 @@ public class StdA1ClientTest {
     }
 
     @Test
-    public void testDeleteAllPolicies() {
+    void testDeleteAllPolicies() {
         doReturn(RIC_URL).when(ricConfigMock).baseUrl();
         Mono<String> policyIds = Mono.just(Arrays.asList(POLICY_1_ID, POLICY_2_ID).toString());
         when(asyncRestClientMock.get(policiesUrl())).thenReturn(policyIds);
index 79eb07a..6b106c9 100644 (file)
@@ -47,12 +47,12 @@ import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
 import org.oransc.policyagent.exceptions.ServiceException;
 import org.springframework.http.MediaType;
 
-public class ApplicationConfigParserTest {
+class ApplicationConfigParserTest {
 
     ApplicationConfigParser parserUnderTest = new ApplicationConfigParser();
 
     @Test
-    public void whenCorrectConfig() throws Exception {
+    void whenCorrectConfig() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
 
         ApplicationConfigParser.ConfigParserResult result = parserUnderTest.parse(jsonRootObject);
@@ -111,7 +111,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenDmaapConfigHasSeveralStreamsPublishing() throws Exception {
+    void whenDmaapConfigHasSeveralStreamsPublishing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_publishes");
         JsonObject fake_info_object = new JsonObject();
@@ -131,6 +131,7 @@ public class ApplicationConfigParserTest {
         private JsonObject dmaap_publisher;
         private JsonObject fake_info_object;
 
+        @Override
         public String toString() {
             return String.format("[dmaap_publisher=%s, fake_info_object=%s]", dmaap_publisher.toString(),
                 fake_info_object.toString());
@@ -138,7 +139,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenDmaapConfigHasSeveralStreamsSubscribing() throws Exception {
+    void whenDmaapConfigHasSeveralStreamsSubscribing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         JsonObject json = jsonRootObject.getAsJsonObject("config").getAsJsonObject("streams_subscribes");
         JsonObject fake_info_object = new JsonObject();
@@ -158,6 +159,7 @@ public class ApplicationConfigParserTest {
         private JsonObject dmaap_subscriber;
         private JsonObject fake_info_object;
 
+        @Override
         public String toString() {
             return String.format("[dmaap_subscriber=%s, fake_info_object=%s]", dmaap_subscriber.toString(),
                 fake_info_object.toString());
@@ -165,7 +167,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenMalformedUrlStreamsSubscribing() throws Exception {
+    void whenMalformedUrlStreamsSubscribing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         final String wrongTopicUrl = "WrongTopicUrl";
         JsonObject json = getDmaapInfo(jsonRootObject, "streams_subscribes", "dmaap_subscriber");
@@ -181,7 +183,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenMalformedUrlStreamsPublishing() throws Exception {
+    void whenMalformedUrlStreamsPublishing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         final String wrongTopicUrl = "WrongTopicUrl";
         JsonObject json = getDmaapInfo(jsonRootObject, "streams_publishes", "dmaap_publisher");
@@ -197,7 +199,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenWrongMemberNameInObject() throws Exception {
+    void whenWrongMemberNameInObject() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         JsonObject json = jsonRootObject.getAsJsonObject("config");
         json.remove("ric");
@@ -209,7 +211,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenWrongUrlPathStreamsSubscribing() throws Exception {
+    void whenWrongUrlPathStreamsSubscribing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         final String wrongTopicUrlString =
             "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent/wrong-topic-url";
@@ -225,7 +227,7 @@ public class ApplicationConfigParserTest {
     }
 
     @Test
-    public void whenWrongUrlPathStreamsPublishing() throws Exception {
+    void whenWrongUrlPathStreamsPublishing() throws Exception {
         JsonObject jsonRootObject = getJsonRootObject();
         final String wrongTopicUrlString =
             "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE/wrong-topic-url";
@@ -240,7 +242,7 @@ public class ApplicationConfigParserTest {
             "Wrong error message when the streams publishes' URL has incorrect syntax");
     }
 
-    public JsonObject getDmaapInfo(JsonObject jsonRootObject, String streamsPublishesOrSubscribes,
+    JsonObject getDmaapInfo(JsonObject jsonRootObject, String streamsPublishesOrSubscribes,
         String dmaapPublisherOrSubscriber) throws Exception {
         return jsonRootObject.getAsJsonObject("config").getAsJsonObject(streamsPublishesOrSubscribes)
             .getAsJsonObject(dmaapPublisherOrSubscriber).getAsJsonObject("dmaap_info");
index 96abd1c..6a6f447 100644 (file)
@@ -38,7 +38,7 @@ import org.oransc.policyagent.configuration.ApplicationConfigParser.ConfigParser
 import org.oransc.policyagent.exceptions.ServiceException;
 
 @ExtendWith(MockitoExtension.class)
-public class ApplicationConfigTest {
+class ApplicationConfigTest {
 
     private static final ImmutableRicConfig RIC_CONFIG_1 = ImmutableRicConfig.builder() //
         .name("ric1") //
@@ -57,7 +57,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void gettingNotAddedRicShouldThrowException() {
+    void gettingNotAddedRicShouldThrowException() {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
@@ -70,7 +70,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
+    void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         RicConfigUpdate update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).blockFirst();
@@ -87,7 +87,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
+    void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
@@ -107,7 +107,7 @@ public class ApplicationConfigTest {
     }
 
     @Test
-    public void removedRicShouldNotifyAllObserversOfRicRemoved() {
+    void removedRicShouldNotifyAllObserversOfRicRemoved() {
         ApplicationConfig appConfigUnderTest = new ApplicationConfig();
 
         ImmutableRicConfig ricConfig2 = ImmutableRicConfig.builder() //
index 7b338cc..5c11830 100644 (file)
@@ -54,7 +54,7 @@ import org.oransc.policyagent.utils.LoggingUtils;
 import org.springframework.http.HttpStatus;
 
 @ExtendWith(MockitoExtension.class)
-public class DmaapMessageConsumerTest {
+class DmaapMessageConsumerTest {
     @Mock
     private ApplicationConfig applicationConfigMock;
     @Mock
@@ -65,12 +65,12 @@ public class DmaapMessageConsumerTest {
     private DmaapMessageConsumer messageConsumerUnderTest;
 
     @AfterEach
-    public void resetLogging() {
+    void resetLogging() {
         LoggingUtils.getLogListAppender(DmaapMessageConsumer.class);
     }
 
     @Test
-    public void dmaapNotConfigured_thenSleepAndRetryUntilConfig() throws Exception {
+    void dmaapNotConfigured_thenSleepAndRetryUntilConfig() throws Exception {
         messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
 
         doNothing().when(messageConsumerUnderTest).sleep(any(Duration.class));
@@ -86,7 +86,7 @@ public class DmaapMessageConsumerTest {
     }
 
     @Test
-    public void dmaapConfigurationRemoved_thenStopPollingDmaapSleepAndRetry() throws Exception {
+    void dmaapConfigurationRemoved_thenStopPollingDmaapSleepAndRetry() throws Exception {
         messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
 
         doNothing().when(messageConsumerUnderTest).sleep(any(Duration.class));
@@ -102,7 +102,7 @@ public class DmaapMessageConsumerTest {
     }
 
     @Test
-    public void dmaapConfiguredAndNoMessages_thenPollOnce() throws Exception {
+    void dmaapConfiguredAndNoMessages_thenPollOnce() throws Exception {
         setUpMrConfig();
 
         messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
@@ -123,7 +123,7 @@ public class DmaapMessageConsumerTest {
     }
 
     @Test
-    public void dmaapConfiguredAndErrorGettingMessages_thenLogWarningAndSleep() throws Exception {
+    void dmaapConfiguredAndErrorGettingMessages_thenLogWarningAndSleep() throws Exception {
         setUpMrConfig();
 
         messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
@@ -153,7 +153,7 @@ public class DmaapMessageConsumerTest {
     }
 
     @Test
-    public void dmaapConfiguredAndOneMessage_thenPollOnceAndProcessMessage() throws Exception {
+    void dmaapConfiguredAndOneMessage_thenPollOnceAndProcessMessage() throws Exception {
         setUpMrConfig();
         messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
 
index 6b3457b..f1ae7fb 100644 (file)
@@ -22,6 +22,7 @@ package org.oransc.policyagent.dmaap;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
@@ -61,7 +62,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
 import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
-public class DmaapMessageHandlerTest {
+class DmaapMessageHandlerTest {
     private static final Logger logger = LoggerFactory.getLogger(DmaapMessageHandlerTest.class);
     private static final String URL = "url";
 
@@ -112,22 +113,22 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void testMessageParsing() {
+    void testMessageParsing() {
         String message = dmaapInputMessage(Operation.DELETE);
         logger.info(message);
         DmaapRequestMessage parsedMessage = gson.fromJson(message, ImmutableDmaapRequestMessage.class);
-        assertTrue(parsedMessage != null);
+        assertNotNull(parsedMessage);
         assertFalse(parsedMessage.payload().isPresent());
 
         message = dmaapInputMessage(Operation.PUT);
         logger.info(message);
         parsedMessage = gson.fromJson(message, ImmutableDmaapRequestMessage.class);
-        assertTrue(parsedMessage != null);
+        assertNotNull(parsedMessage);
         assertTrue(parsedMessage.payload().isPresent());
     }
 
     @Test
-    public void unparseableMessage_thenWarning() {
+    void unparseableMessage_thenWarning() {
         final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DmaapMessageHandler.class);
 
         testedObject.handleDmaapMsg("bad message");
@@ -137,7 +138,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void successfulDelete() throws IOException {
+    void successfulDelete() throws IOException {
         doReturn(okResponse()).when(agentClient).deleteForEntity(anyString());
         doReturn(1).when(dmaapClient).send(anyString());
         doReturn(new MRPublisherResponse()).when(dmaapClient).sendBatchWithResponse();
@@ -159,7 +160,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void successfulGet() throws IOException {
+    void successfulGet() throws IOException {
         doReturn(okResponse()).when(agentClient).getForEntity(anyString());
         doReturn(1).when(dmaapClient).send(anyString());
         doReturn(new MRPublisherResponse()).when(dmaapClient).sendBatchWithResponse();
@@ -179,7 +180,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void successfulPut() throws IOException {
+    void successfulPut() throws IOException {
         doReturn(okResponse()).when(agentClient).putForEntity(anyString(), anyString());
         doReturn(1).when(dmaapClient).send(anyString());
         doReturn(new MRPublisherResponse()).when(dmaapClient).sendBatchWithResponse();
@@ -199,7 +200,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void successfulPost() throws IOException {
+    void successfulPost() throws IOException {
         doReturn(okResponse()).when(agentClient).postForEntity(anyString(), anyString());
         doReturn(1).when(dmaapClient).send(anyString());
         doReturn(new MRPublisherResponse()).when(dmaapClient).sendBatchWithResponse();
@@ -219,7 +220,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void exceptionWhenCallingPolicyAgent_thenNotFoundResponse() throws IOException {
+    void exceptionWhenCallingPolicyAgent_thenNotFoundResponse() throws IOException {
         WebClientResponseException except = new WebClientResponseException(400, "Refused", null, null, null, null);
         doReturn(Mono.error(except)).when(agentClient).putForEntity(anyString(), any());
         doReturn(1).when(dmaapClient).send(anyString());
@@ -243,7 +244,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void unsupportedOperationInMessage_thenNotFoundResponseWithNotImplementedOperation() throws Exception {
+    void unsupportedOperationInMessage_thenNotFoundResponseWithNotImplementedOperation() throws Exception {
         String message = dmaapInputMessage(Operation.PUT).toString();
         String badOperation = "BAD";
         message = message.replace(Operation.PUT.toString(), badOperation);
@@ -261,7 +262,7 @@ public class DmaapMessageHandlerTest {
     }
 
     @Test
-    public void putWithoutPayload_thenNotFoundResponseWithWarning() throws Exception {
+    void putWithoutPayload_thenNotFoundResponseWithWarning() throws Exception {
         String message = dmaapInputMessage(Operation.PUT).toString();
         message = message.replace(",\"payload\":{\"name\":\"name\",\"schema\":\"schema\"}", "");
 
index 5c1cc14..fd75978 100644 (file)
@@ -34,7 +34,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class LockTest {
+class LockTest {
 
     @SuppressWarnings("squid:S2925") // "Thread.sleep" should not be used in tests.
     private void sleep() {
@@ -54,7 +54,7 @@ public class LockTest {
     }
 
     @Test
-    public void testLock() throws IOException, ServiceException {
+    void testLock() throws IOException, ServiceException {
         Lock lock = new Lock();
         lock.lockBlocking(LockType.SHARED);
         lock.unlockBlocking();
@@ -69,7 +69,7 @@ public class LockTest {
     }
 
     @Test
-    public void testReactiveLock() {
+    void testReactiveLock() {
         Lock lock = new Lock();
 
         Mono<Lock> seq = lock.lock(LockType.EXCLUSIVE) //
index c22629b..5d8c74c 100644 (file)
@@ -35,7 +35,7 @@ import org.oransc.policyagent.exceptions.EnvironmentLoaderException;
 import org.oransc.policyagent.utils.LoggingUtils;
 import reactor.test.StepVerifier;
 
-public class EnvironmentProcessorTest {
+class EnvironmentProcessorTest {
     private static final String CONSUL_HOST = "CONSUL_HOST";
     private static final String CONSUL_HOST_VALUE = "consulHost";
 
@@ -46,7 +46,7 @@ public class EnvironmentProcessorTest {
     private static final String HOSTNAME_VALUE = "hostname";
 
     @Test
-    public void allPropertiesAvailableWithHostname_thenAllPropertiesAreReturnedWithGivenConsulPort() {
+    void allPropertiesAvailableWithHostname_thenAllPropertiesAreReturnedWithGivenConsulPort() {
         Properties systemEnvironment = new Properties();
         String consulPort = "8080";
         systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
@@ -66,7 +66,7 @@ public class EnvironmentProcessorTest {
     }
 
     @Test
-    public void consulHostMissing_thenExceptionReturned() {
+    void consulHostMissing_thenExceptionReturned() {
         Properties systemEnvironment = new Properties();
 
         StepVerifier.create(EnvironmentProcessor.readEnvironmentVariables(systemEnvironment))
@@ -76,7 +76,7 @@ public class EnvironmentProcessorTest {
     }
 
     @Test
-    public void withAllPropertiesExceptConsulPort_thenAllPropertiesAreReturnedWithDefaultConsulPortAndWarning() {
+    void withAllPropertiesExceptConsulPort_thenAllPropertiesAreReturnedWithDefaultConsulPortAndWarning() {
         Properties systemEnvironment = new Properties();
         systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
         systemEnvironment.put(CONFIG_BINDING_SERVICE, CONFIG_BINDING_SERVICE_VALUE);
@@ -101,7 +101,7 @@ public class EnvironmentProcessorTest {
     }
 
     @Test
-    public void configBindingServiceMissing_thenExceptionReturned() {
+    void configBindingServiceMissing_thenExceptionReturned() {
         Properties systemEnvironment = new Properties();
         systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
 
@@ -112,7 +112,7 @@ public class EnvironmentProcessorTest {
     }
 
     @Test
-    public void allPropertiesAvailableWithServiceName_thenAllPropertiesAreReturned() {
+    void allPropertiesAvailableWithServiceName_thenAllPropertiesAreReturned() {
         Properties systemEnvironment = new Properties();
         String consulPort = "8080";
         systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
@@ -132,7 +132,7 @@ public class EnvironmentProcessorTest {
     }
 
     @Test
-    public void serviceNameAndHostnameMissing_thenExceptionIsReturned() {
+    void serviceNameAndHostnameMissing_thenExceptionIsReturned() {
         Properties systemEnvironment = new Properties();
         systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
         systemEnvironment.put(CONFIG_BINDING_SERVICE, CONFIG_BINDING_SERVICE_VALUE);
index 6edd4e3..4823a44 100644 (file)
@@ -85,7 +85,7 @@ import reactor.core.publisher.Mono;
 import reactor.test.StepVerifier;
 
 @ExtendWith(MockitoExtension.class)
-public class RefreshConfigTaskTest {
+class RefreshConfigTaskTest {
 
     private static final boolean CONFIG_FILE_EXISTS = true;
     private static final boolean CONFIG_FILE_DOES_NOT_EXIST = false;
@@ -99,7 +99,7 @@ public class RefreshConfigTaskTest {
     CbsClient cbsClient;
 
     private static final String RIC_1_NAME = "ric1";
-    public static final ImmutableRicConfig CORRECT_RIC_CONIFG = ImmutableRicConfig.builder() //
+    private static final ImmutableRicConfig CORRECT_RIC_CONIFG = ImmutableRicConfig.builder() //
         .name(RIC_1_NAME) //
         .baseUrl("http://localhost:8080/") //
         .managedElementIds(new Vector<String>(Arrays.asList("kista_1", "kista_2"))) //
@@ -130,7 +130,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void startWithStubbedRefresh_thenTerminationLogged() {
+    void startWithStubbedRefresh_thenTerminationLogged() {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, null, null, false);
         doReturn(Flux.empty()).when(refreshTaskUnderTest).createRefreshTask();
 
@@ -142,7 +142,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void startWithStubbedRefreshReturnError_thenErrorAndTerminationLogged() {
+    void startWithStubbedRefreshReturnError_thenErrorAndTerminationLogged() {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, null, null, false);
         doReturn(Flux.error(new Exception("Error"))).when(refreshTaskUnderTest).createRefreshTask();
 
@@ -156,7 +156,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void stop_thenTaskIsDisposed() throws Exception {
+    void stop_thenTaskIsDisposed() throws Exception {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, null, null, false);
         refreshTaskUnderTest.systemEnvironment = new Properties();
 
@@ -167,7 +167,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void whenTheConfigurationFits_thenConfiguredRicsArePutInRepository() throws Exception {
+    void whenTheConfigurationFits_thenConfiguredRicsArePutInRepository() throws Exception {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_EXISTS);
         refreshTaskUnderTest.systemEnvironment = new Properties();
         // When
@@ -193,7 +193,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void whenFileExistsButJsonIsIncorrect_thenNoRicsArePutInRepository() throws Exception {
+    void whenFileExistsButJsonIsIncorrect_thenNoRicsArePutInRepository() throws Exception {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_EXISTS);
         refreshTaskUnderTest.systemEnvironment = new Properties();
 
@@ -213,7 +213,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void whenPeriodicConfigRefreshNoConsul_thenErrorIsLogged() {
+    void whenPeriodicConfigRefreshNoConsul_thenErrorIsLogged() {
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST);
         refreshTaskUnderTest.systemEnvironment = new Properties();
 
@@ -239,7 +239,7 @@ public class RefreshConfigTaskTest {
     }
 
     @Test
-    public void whenPeriodicConfigRefreshSuccess_thenNewConfigIsCreatedAndRepositoryUpdated() throws Exception {
+    void whenPeriodicConfigRefreshSuccess_thenNewConfigIsCreatedAndRepositoryUpdated() throws Exception {
         Rics rics = new Rics();
         Policies policies = new Policies();
         refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST, rics, policies, false);
index a42142b..5ac4cb0 100644 (file)
@@ -56,7 +56,7 @@ import org.oransc.policyagent.repository.Rics;
 import reactor.core.publisher.Mono;
 
 @ExtendWith(MockitoExtension.class)
-public class RicSupervisionTest {
+class RicSupervisionTest {
     private static final String POLICY_TYPE_1_NAME = "type1";
     private static final PolicyType POLICY_TYPE_1 = ImmutablePolicyType.builder() //
         .name(POLICY_TYPE_1_NAME) //
@@ -105,7 +105,7 @@ public class RicSupervisionTest {
     private Rics rics = new Rics();
 
     @BeforeEach
-    public void init() {
+    void init() {
         types.clear();
         policies.clear();
         rics.clear();
@@ -114,7 +114,7 @@ public class RicSupervisionTest {
     }
 
     @AfterEach
-    public void verifyNoRicLocks() {
+    void verifyNoRicLocks() {
         for (Ric ric : this.rics.getRics()) {
             ric.getLock().lockBlocking(LockType.EXCLUSIVE);
             ric.getLock().unlockBlocking();
@@ -123,7 +123,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
+    void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
@@ -145,7 +145,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicUndefined_thenSynchronization() {
+    void whenRicUndefined_thenSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.UNAVAILABLE);
         rics.put(RIC_1);
@@ -163,7 +163,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicSynchronizing_thenNoSynchronization() {
+    void whenRicSynchronizing_thenNoSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.SYNCHRONIZING);
         rics.put(RIC_1);
@@ -177,7 +177,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
+    void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
@@ -194,7 +194,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
+    void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         rics.put(RIC_1);
@@ -217,7 +217,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
+    void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         rics.put(RIC_1);
@@ -240,7 +240,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() {
+    void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
@@ -257,7 +257,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
+    void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         RIC_1.setState(RicState.AVAILABLE);
         RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
@@ -281,7 +281,7 @@ public class RicSupervisionTest {
     }
 
     @Test
-    public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
+    void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
         doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
         PolicyType policyType2 = ImmutablePolicyType.builder() //
             .name("policyType2") //
index c8ebe27..f74c908 100644 (file)
@@ -65,7 +65,7 @@ import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
 @ExtendWith(MockitoExtension.class)
-public class RicSynchronizationTaskTest {
+class RicSynchronizationTaskTest {
     private static final String POLICY_TYPE_1_NAME = "type1";
     private static final PolicyType POLICY_TYPE_1 = ImmutablePolicyType.builder() //
         .name(POLICY_TYPE_1_NAME) //
@@ -109,7 +109,7 @@ public class RicSynchronizationTaskTest {
     private Services services;
 
     @BeforeEach
-    public void init() {
+    void init() {
         policyTypes = new PolicyTypes();
         policies = new Policies();
         services = new Services();
@@ -118,7 +118,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricAlreadySynchronizing_thenNoSynchronization() {
+    void ricAlreadySynchronizing_thenNoSynchronization() {
         RIC_1.setState(RicState.SYNCHRONIZING);
         RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
 
@@ -139,7 +139,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdlePolicyTypeInRepo_thenSynchronizationWithReuseOfTypeFromRepoAndCorrectServiceNotified() {
+    void ricIdlePolicyTypeInRepo_thenSynchronizationWithReuseOfTypeFromRepoAndCorrectServiceNotified() {
         RIC_1.setState(RicState.AVAILABLE);
 
         policyTypes.put(POLICY_TYPE_1);
@@ -175,7 +175,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdlePolicyTypeNotInRepo_thenSynchronizationWithTypeFromRic() throws Exception {
+    void ricIdlePolicyTypeNotInRepo_thenSynchronizationWithTypeFromRic() throws Exception {
         RIC_1.setState(RicState.AVAILABLE);
 
         setUpCreationOfA1Client();
@@ -198,7 +198,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdleAndHavePolicies_thenSynchronizationWithRecreationOfPolicies() {
+    void ricIdleAndHavePolicies_thenSynchronizationWithRecreationOfPolicies() {
         RIC_1.setState(RicState.AVAILABLE);
 
         Policy transientPolicy = createPolicy(true);
@@ -227,7 +227,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdleAndErrorDeletingPoliciesFirstTime_thenSynchronizationWithDeletionOfPolicies() {
+    void ricIdleAndErrorDeletingPoliciesFirstTime_thenSynchronizationWithDeletionOfPolicies() {
         RIC_1.setState(RicState.AVAILABLE);
 
         policies.put(POLICY_1);
@@ -253,7 +253,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdleAndErrorDeletingPoliciesAllTheTime_thenSynchronizationWithFailedRecovery() {
+    void ricIdleAndErrorDeletingPoliciesAllTheTime_thenSynchronizationWithFailedRecovery() {
         RIC_1.setState(RicState.AVAILABLE);
 
         policies.put(POLICY_1);
@@ -284,7 +284,7 @@ public class RicSynchronizationTaskTest {
     }
 
     @Test
-    public void ricIdlePolicyTypeInRepo_thenSynchronizationWithErrorOnServiceNotificationErrorLogged() {
+    void ricIdlePolicyTypeInRepo_thenSynchronizationWithErrorOnServiceNotificationErrorLogged() {
         RIC_1.setState(RicState.AVAILABLE);
 
         policyTypes.put(POLICY_TYPE_1);
index 90a3581..495b2a5 100644 (file)
@@ -56,7 +56,7 @@ import org.oransc.policyagent.utils.LoggingUtils;
 import reactor.core.publisher.Mono;
 
 @ExtendWith(MockitoExtension.class)
-public class ServiceSupervisionTest {
+class ServiceSupervisionTest {
 
     private static final String SERVICE_NAME = "Service name";
     private static final String RIC_NAME = "name";
@@ -92,7 +92,7 @@ public class ServiceSupervisionTest {
         .build();
 
     @Test
-    public void serviceExpired_policyAndServiceAreDeletedInRepoAndPolicyIsDeletedInRic() {
+    void serviceExpired_policyAndServiceAreDeletedInRepoAndPolicyIsDeletedInRic() {
         setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
 
         setUpCreationOfA1Client();
@@ -113,7 +113,7 @@ public class ServiceSupervisionTest {
     }
 
     @Test
-    public void serviceExpiredButDeleteInRicFails_policyAndServiceAreDeletedInRepoAndErrorLoggedForRic() {
+    void serviceExpiredButDeleteInRicFails_policyAndServiceAreDeletedInRepoAndErrorLoggedForRic() {
         setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
 
         setUpCreationOfA1Client();
@@ -140,7 +140,7 @@ public class ServiceSupervisionTest {
     }
 
     @Test
-    public void serviceNotExpired_shouldNotBeChecked() {
+    void serviceNotExpired_shouldNotBeChecked() {
         setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
 
         ServiceSupervision serviceSupervisionUnderTest =
@@ -156,7 +156,7 @@ public class ServiceSupervisionTest {
     }
 
     @Test
-    public void serviceWithoutKeepAliveInterval_shouldNotBeChecked() {
+    void serviceWithoutKeepAliveInterval_shouldNotBeChecked() {
         setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(0));
 
         ServiceSupervision serviceSupervisionUnderTest =
index 3929062..c637817 100644 (file)
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+O-RAN-SC
+%%
+Modifications Copyright (C) 2020 Nordix Foundation
+%%
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+========================LICENSE_END===================================
+]]>-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
index 238fad3..2366499 100755 (executable)
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+O-RAN-SC
+%%
+Modifications Copyright (C) 2020 Nordix Foundation
+%%
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+========================LICENSE_END===================================
+]]>-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
 
index e16e79a..0af54c2 100644 (file)
@@ -1,5 +1,22 @@
 #!/bin/bash
 
+#  ============LICENSE_START===============================================
+#  Modifications Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
 ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
 INSTALLERDIR=$(dirname $0)
index 6e6c676..96dfb7b 100755 (executable)
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+O-RAN-SC
+%%
+Modifications Copyright (C) 2020 Nordix Foundation
+%%
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+========================LICENSE_END===================================
+]]>-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
 
index 2ab2bb8..3490585 100644 (file)
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+O-RAN-SC
+%%
+Modifications Copyright (C) 2020 Nordix Foundation
+%%
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+========================LICENSE_END===================================
+]]>-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
 
index b33b771..472250b 100644 (file)
 
 package org.o_ran_sc.nonrtric.sdnc_a1.northbound.provider;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
 import java.util.concurrent.ExecutionException;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -63,6 +63,9 @@ import org.springframework.web.client.RestClientResponseException;
 public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
 
   protected static final Logger LOG = LoggerFactory.getLogger(NonrtRicApiProviderTest.class);
+
+  private static final Integer HTTP_OK_AS_INTEGER = HttpStatus.OK.value();
+
   protected NonrtRicApiProvider nonrtRicApiProvider;
   protected DataBroker dataBroker;
   @Mock
@@ -88,8 +91,8 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     ResponseEntity<Object> getResponse = new ResponseEntity<>(returnedBody, HttpStatus.OK);
     when(restAdapter.get(eq(nearRtRicUrl.getValue()), eq(String.class))).thenReturn(getResponse);
     GetA1PolicyOutput result = nonrtRicApiProvider.getA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(HttpStatus.OK.value() == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(HTTP_OK_AS_INTEGER, result.getHttpStatus());
   }
 
   @Test
@@ -101,8 +104,8 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     ResponseEntity<Object> getResponse = new ResponseEntity<>(returnedBody, HttpStatus.OK);
     when(restAdapter.get(eq(nearRtRicUrl.getValue()), eq(String.class))).thenReturn(getResponse);
     GetA1PolicyTypeOutput result = nonrtRicApiProvider.getA1PolicyType(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(HttpStatus.OK.value() == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(HTTP_OK_AS_INTEGER, result.getHttpStatus());
   }
 
   @Test
@@ -114,8 +117,8 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     ResponseEntity<Object> getResponse = new ResponseEntity<>(returnedBody, HttpStatus.OK);
     when(restAdapter.get(eq(nearRtRicUrl.getValue()), eq(String.class))).thenReturn(getResponse);
     GetA1PolicyStatusOutput result = nonrtRicApiProvider.getA1PolicyStatus(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(HttpStatus.OK.value() == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(HTTP_OK_AS_INTEGER, result.getHttpStatus());
   }
 
   @Test
@@ -124,12 +127,12 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     inputBuilder.setNearRtRicUrl(nearRtRicUrl);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
     String returnedBody = "GET failed";
-    int returnedStatusCode = 404;
+    Integer notFoundStatusCode = HttpStatus.NOT_FOUND.value();
     when(restAdapter.get(eq(nearRtRicUrl.getValue()), eq(String.class)))
-    .thenThrow(new RestClientResponseException(null, returnedStatusCode, null, null, returnedBody.getBytes(), null));
+    .thenThrow(new RestClientResponseException(null, notFoundStatusCode, null, null, returnedBody.getBytes(), null));
     GetA1PolicyOutput result = nonrtRicApiProvider.getA1(inputBuilder.build());
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(returnedStatusCode == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(notFoundStatusCode, result.getHttpStatus());
   }
 
   @Test
@@ -140,11 +143,12 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     inputBuilder.setBody(testPolicy);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
     String returnedBody = "returned body";
+    Integer createdStatusCode = HttpStatus.CREATED.value();
     ResponseEntity<String> putResponse = new ResponseEntity<>(returnedBody, HttpStatus.CREATED);
     when(restAdapter.put(eq(nearRtRicUrl.getValue()), eq(testPolicy), eq(String.class))).thenReturn(putResponse);
     PutA1PolicyOutput result = nonrtRicApiProvider.putA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(HttpStatus.CREATED.value() == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(createdStatusCode, result.getHttpStatus());
   }
 
   @Test
@@ -155,12 +159,12 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     inputBuilder.setBody(testPolicy);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
     String returnedBody = "PUT failed";
-    int returnedStatusCode = 400;
+    Integer badRequestStatusCode = HttpStatus.BAD_REQUEST.value();
     when(restAdapter.put(eq(nearRtRicUrl.getValue()), eq(testPolicy), eq(String.class)))
-    .thenThrow(new RestClientResponseException(null, returnedStatusCode, null, null, returnedBody.getBytes(), null));
+    .thenThrow(new RestClientResponseException(null, badRequestStatusCode, null, null, returnedBody.getBytes(), null));
     PutA1PolicyOutput result = nonrtRicApiProvider.putA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(returnedStatusCode == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(badRequestStatusCode, result.getHttpStatus());
   }
 
   @Test
@@ -173,10 +177,10 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     ResponseEntity<Object> getResponseOk = new ResponseEntity<>(returnedBody, HttpStatus.OK);
     when(restAdapter.delete(nearRtRicUrl.getValue())).thenReturn(getResponseNoContent).thenReturn(getResponseOk);
     DeleteA1PolicyOutput resultNoContent = nonrtRicApiProvider.deleteA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertTrue(HttpStatus.NO_CONTENT.value() == resultNoContent.getHttpStatus());
+    assertEquals(Integer.valueOf(HttpStatus.NO_CONTENT.value()), resultNoContent.getHttpStatus());
     DeleteA1PolicyOutput resultOk = nonrtRicApiProvider.deleteA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, resultOk.getBody());
-    Assert.assertTrue(HttpStatus.OK.value() == resultOk.getHttpStatus());
+    assertEquals(returnedBody, resultOk.getBody());
+    assertEquals(HTTP_OK_AS_INTEGER, resultOk.getHttpStatus());
   }
 
   @Test
@@ -185,12 +189,12 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
     inputBuilder.setNearRtRicUrl(nearRtRicUrl);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
     String returnedBody = "DELETE failed";
-    int returnedStatusCode = 404;
+    Integer notFoundStatusCode = HttpStatus.NOT_FOUND.value();
     when(restAdapter.delete(nearRtRicUrl.getValue()))
-    .thenThrow(new RestClientResponseException(null, returnedStatusCode, null, null, returnedBody.getBytes(), null));
+    .thenThrow(new RestClientResponseException(null, notFoundStatusCode, null, null, returnedBody.getBytes(), null));
     DeleteA1PolicyOutput result = nonrtRicApiProvider.deleteA1Policy(inputBuilder.build()).get().getResult();
-    Assert.assertEquals(returnedBody, result.getBody());
-    Assert.assertTrue(returnedStatusCode == result.getHttpStatus());
+    assertEquals(returnedBody, result.getBody());
+    assertEquals(notFoundStatusCode, result.getHttpStatus());
   }
 
 }
index 8e1d806..182d9f7 100644 (file)
 
 package org.o_ran_sc.nonrtric.sdnc_a1.northbound.restadapter;
 
+import static org.junit.Assert.assertEquals;
 import java.io.IOException;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
+import okhttp3.mockwebserver.RecordedRequest;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.RestClientException;
-import okhttp3.mockwebserver.MockResponse;
-import okhttp3.mockwebserver.MockWebServer;
-import okhttp3.mockwebserver.RecordedRequest;
 
 public class RestAdapterImplTest {
     private static MockWebServer mockWebServer;
@@ -40,8 +40,8 @@ public class RestAdapterImplTest {
     private static final String INVALID_PROTOCOL = "ftp";
     private static final String REQUEST_URL = "/test";
     private static final String TEST_BODY = "test";
-    private static final int SUCCESS_CODE = 200;
-    private static final int ERROR_CODE = 500;
+    private static final Integer SUCCESS_CODE = 200;
+    private static final Integer ERROR_CODE = 500;
 
     @Before
     public void init() throws IOException {
@@ -59,10 +59,10 @@ public class RestAdapterImplTest {
     public void testInvalidUrlOrProtocol() throws InterruptedException {
         ResponseEntity<String> response = adapterUnderTest.get("://localhost:" + mockWebServer.getPort() + REQUEST_URL,
                 String.class);
-        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());
+        assertEquals(HttpStatus.BAD_REQUEST.value(), response.getStatusCodeValue());
         response = adapterUnderTest.get(INVALID_PROTOCOL + "://localhost:" + mockWebServer.getPort() + REQUEST_URL,
                 String.class);
-        Assert.assertTrue(HttpStatus.BAD_REQUEST.value() == response.getStatusCodeValue());
+        assertEquals(HttpStatus.BAD_REQUEST.value(), response.getStatusCodeValue());
     }
 
     @Test
@@ -71,10 +71,10 @@ public class RestAdapterImplTest {
         ResponseEntity<String> response = adapterUnderTest.get(VALID_PROTOCOL + "://localhost:"
                 + mockWebServer.getPort() + REQUEST_URL, String.class);
         RecordedRequest recordedRequest = mockWebServer.takeRequest();
-        Assert.assertEquals(TEST_BODY, response.getBody());
-        Assert.assertTrue(SUCCESS_CODE == response.getStatusCodeValue());
-        Assert.assertEquals("GET", recordedRequest.getMethod());
-        Assert.assertEquals(REQUEST_URL, recordedRequest.getPath());
+        assertEquals(TEST_BODY, response.getBody());
+        assertEquals(SUCCESS_CODE.intValue(), response.getStatusCodeValue());
+        assertEquals("GET", recordedRequest.getMethod());
+        assertEquals(REQUEST_URL, recordedRequest.getPath());
     }
 
     @Test(expected = RestClientException.class)
@@ -89,11 +89,11 @@ public class RestAdapterImplTest {
         ResponseEntity<String> response = adapterUnderTest.put(VALID_PROTOCOL + "://localhost:"
                 + mockWebServer.getPort() + REQUEST_URL, TEST_BODY, String.class);
         RecordedRequest recordedRequest = mockWebServer.takeRequest();
-        Assert.assertEquals(TEST_BODY, response.getBody());
-        Assert.assertTrue(SUCCESS_CODE == response.getStatusCodeValue());
-        Assert.assertEquals("PUT", recordedRequest.getMethod());
-        Assert.assertEquals(REQUEST_URL, recordedRequest.getPath());
-        Assert.assertEquals(TEST_BODY, recordedRequest.getBody().readUtf8());
+        assertEquals(TEST_BODY, response.getBody());
+        assertEquals(SUCCESS_CODE.intValue(), response.getStatusCodeValue());
+        assertEquals("PUT", recordedRequest.getMethod());
+        assertEquals(REQUEST_URL, recordedRequest.getPath());
+        assertEquals(TEST_BODY, recordedRequest.getBody().readUtf8());
     }
 
     @Test(expected = RestClientException.class)
@@ -109,9 +109,9 @@ public class RestAdapterImplTest {
         ResponseEntity<String> response = adapterUnderTest.delete(VALID_PROTOCOL + "://localhost:"
                 + mockWebServer.getPort() + REQUEST_URL);
         RecordedRequest recordedRequest = mockWebServer.takeRequest();
-        Assert.assertTrue(SUCCESS_CODE == response.getStatusCodeValue());
-        Assert.assertEquals("DELETE", recordedRequest.getMethod());
-        Assert.assertEquals(REQUEST_URL, recordedRequest.getPath());
+        assertEquals(SUCCESS_CODE.intValue(), response.getStatusCodeValue());
+        assertEquals("DELETE", recordedRequest.getMethod());
+        assertEquals(REQUEST_URL, recordedRequest.getPath());
     }
 
     @Test(expected = RestClientException.class)
index 80262ff..03977f8 100755 (executable)
@@ -1,3 +1,20 @@
+#  ============LICENSE_START===============================================
+#  Modifications Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
 # Prepare stage for multistage image build
 ## START OF STAGE0 ##
 FROM nexus3.onap.org:10001/onap/ccsdk-odlsli-alpine-image:${ccsdk.docker.version} AS stage0
index dde8891..9e716c8 100755 (executable)
@@ -1,5 +1,22 @@
 #! /bin/bash
 
+#  ============LICENSE_START===============================================
+#  Modifications Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
 updateFile() {
 sed  -i .orig -e '
 s/openecomp.org/onap.org/g
index 2fd0e36..9bc70ed 100755 (executable)
@@ -1,5 +1,22 @@
 #! /bin/bash
 
+#  ============LICENSE_START===============================================
+#  Modifications Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
 updateFile() {
 sed  -i .orig -e '
 s/\(plugin=.\)org.openecomp.sdnc.\(prop\)/\org.onap.ccsdk.sli.plugins.\2/g
index 6f96355..8c8ffd0 100644 (file)
@@ -81,4 +81,19 @@ store_logs          END
 -----------------------------------------------------------
 
 The ../common/testcase_common.sh contains all functions needed for the test case file. See the README.md file in
-the ../common dir for a description of all available functions.
\ No newline at end of file
+the ../common dir for a description of all available functions.
+
+## License
+
+Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
index d57133d..1723555 100755 (executable)
@@ -1,5 +1,22 @@
 #!/bin/bash
 
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
 TS_ONELINE_DESCR="Test suite - interface testing. Agent REST, DMAAP and SNDC controller resconf"
 
 . ../common/testsuite_common.sh
index 6defc8d..dd1ddf3 100644 (file)
@@ -30,3 +30,18 @@ Store all Policy Agent app and simulators log to the test case log dir. All logs
 separate logs stored at different steps in the test script.
 If logs need to be stored in several locations, use different prefix to easily identify the location
 when the logs where taken.
+
+## License
+
+Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
index 74205f4..31dae4c 100644 (file)
@@ -41,4 +41,19 @@ The script ```crstub-build-start.sh``` do the above two steps in one go. This st
 
 ### Basic test ###
 
-Basic test is made with the script ```basic_test.sh``` which tests all the available urls with a subset of the possible operations. Use the script ```cr-build-start.sh``` to start the callback-receiver in a container first.
\ No newline at end of file
+Basic test is made with the script ```basic_test.sh``` which tests all the available urls with a subset of the possible operations. Use the script ```cr-build-start.sh``` to start the callback-receiver in a container first.
+
+## License
+
+Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
index 16d846e..e8e8edf 100644 (file)
@@ -90,4 +90,19 @@ The script ```mrstub-build-start.sh``` do the build and docker run in one go. Th
 
 ### Basic test ###
 
-Basic test is made with the script ```basic_test.sh nonsecure|secure``` which tests all the available urls with a subset of the possible operations. Choose nonsecure for http and secure for https. Use the script ```mrstub-build-start.sh``` to start the mrstub in a container first.
\ No newline at end of file
+Basic test is made with the script ```basic_test.sh nonsecure|secure``` which tests all the available urls with a subset of the possible operations. Choose nonsecure for http and secure for https. Use the script ```mrstub-build-start.sh``` to start the mrstub in a container first.
+
+## License
+
+Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file