.policyTypeId(policy.type().name()) //
.policyInstanceId(policy.id()) //
.policyInstance(policy.json()) //
- .properties(new ArrayList<String>()) //
+ .properties(new ArrayList<>()) //
.build();
String inputJsonString = SdncJsonHelper.createInputJsonString(inputParams);
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ApplicationTest {
+class ApplicationTest {
private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
@Autowired
private int port;
@BeforeEach
- public void reset() {
+ void reset() {
rics.clear();
policies.clear();
policyTypes.clear();
}
@AfterEach
- public void verifyNoRicLocks() {
+ void verifyNoRicLocks() {
for (Ric ric : this.rics.getRics()) {
ric.getLock().lockBlocking(LockType.EXCLUSIVE);
ric.getLock().unlockBlocking();
}
@Test
- public void testGetRics() throws Exception {
+ void testGetRics() throws Exception {
addRic("ric1");
this.addPolicyType("type1", "ric1");
String url = "/rics?policyType=type1";
}
@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"));
}
@Test
- public void testGetRicForManagedElement_thenReturnCorrectRic() throws Exception {
+ void testGetRicForManagedElement_thenReturnCorrectRic() throws Exception {
String ricName = "ric1";
String managedElementId = "kista_1";
addRic(ricName, managedElementId);
}
@Test
- public void testPutPolicy() throws Exception {
+ void testPutPolicy() throws Exception {
String serviceName = "service1";
String ricName = "ric1";
String policyTypeName = "type1";
*
* @throws ServiceException
*/
- public void testErrorFromRIC() throws ServiceException {
+ void testErrorFromRIC() throws ServiceException {
putService("service1");
addPolicyType("type1", "ric1");
}
@Test
- public void testPutTypelessPolicy() throws Exception {
+ void testPutTypelessPolicy() throws Exception {
putService("service1");
addPolicyType("", "ric1");
String url = putPolicyUrl("service1", "ric1", "", "id1");
}
@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");
}
@Test
- public void testGetPolicy() throws Exception {
+ void testGetPolicy() throws Exception {
String url = "/policy?id=id";
Policy policy = addPolicy("id", "typeName", "service1", "ric1");
{
}
@Test
- public void testDeletePolicy() throws Exception {
+ void testDeletePolicy() throws Exception {
addPolicy("id", "typeName", "service1", "ric1");
assertThat(policies.size()).isEqualTo(1);
}
@Test
- public void testGetPolicySchemas() throws Exception {
+ void testGetPolicySchemas() throws Exception {
addPolicyType("type1", "ric1");
addPolicyType("type2", "ric2");
}
@Test
- public void testGetPolicySchema() throws Exception {
+ void testGetPolicySchema() throws Exception {
addPolicyType("type1", "ric1");
addPolicyType("type2", "ric2");
}
@Test
- public void testGetPolicyTypes() throws Exception {
+ void testGetPolicyTypes() throws Exception {
addPolicyType("type1", "ric1");
addPolicyType("type2", "ric2");
}
@Test
- public void testGetPolicies() throws Exception {
+ void testGetPolicies() throws Exception {
addPolicy("id1", "type1", "service1");
String url = "/policies";
}
@Test
- public void testGetPoliciesFilter() throws Exception {
+ void testGetPoliciesFilter() throws Exception {
addPolicy("id1", "type1", "service1");
addPolicy("id2", "type1", "service2");
addPolicy("id3", "type2", "service1");
}
@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");
}
@Test
- public void testPutAndGetService() throws Exception {
+ void testPutAndGetService() throws Exception {
// PUT
putService("name", 0, HttpStatus.CREATED);
putService("name", 0, HttpStatus.OK);
}
@Test
- public void testServiceSupervision() throws Exception {
+ void testServiceSupervision() throws Exception {
putService("service1", 1, HttpStatus.CREATED);
addPolicyType("type1", "ric1");
}
@Test
- public void testGetPolicyStatus() throws Exception {
+ void testGetPolicyStatus() throws Exception {
addPolicy("id", "typeName", "service1", "ric1");
assertThat(policies.size()).isEqualTo(1);
}
@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));
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
-public class MockPolicyAgent {
+class MockPolicyAgent {
private static final Logger logger = LoggerFactory.getLogger(MockPolicyAgent.class);
@Autowired
@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();
}
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";
}
@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());
}
@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());
}
@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());
}
@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);
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";
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();
}
@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));
}
@Test
- public void testGetError() {
+ void testGetError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
Mono<String> returnedMono = clientUnderTest.get(REQUEST_URL);
}
@Test
- public void testPutNoError() {
+ void testPutNoError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
.setBody(TEST_JSON));
}
@Test
- public void testPutError() {
+ void testPutError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
Mono<String> returnedMono = clientUnderTest.put(REQUEST_URL, TEST_JSON);
}
@Test
- public void testDeleteNoError() {
+ void testDeleteNoError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE));
Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
}
@Test
- public void testDeleteError() {
+ void testDeleteError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
Mono<String> returnedMono = clientUnderTest.delete(REQUEST_URL);
}
@Test
- public void testPostNoError() {
+ void testPostNoError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
.setBody(TEST_JSON));
}
@Test
- public void testPostError() {
+ void testPostError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
Mono<String> returnedMono = clientUnderTest.post(REQUEST_URL, TEST_JSON);
}
@Test
- public void testPostWithAuthHeaderNoError() {
+ void testPostWithAuthHeaderNoError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(SUCCESS_CODE) //
.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) //
.setBody(TEST_JSON));
}
@Test
- public void testPostWithAuthHeaderError() {
+ void testPostWithAuthHeaderError() {
mockWebServer.enqueue(new MockResponse().setResponseCode(ERROR_CODE));
Mono<String> returnedMono = clientUnderTest.postWithAuthHeader(REQUEST_URL, TEST_JSON, USERNAME, PASSWORD);
import reactor.test.StepVerifier;
@ExtendWith(MockitoExtension.class)
-public class OscA1ClientTest {
+class OscA1ClientTest {
private static final String RIC_URL = "RicUrl";
AsyncRestClient asyncRestClientMock;
@BeforeEach
- public void init() {
+ void init() {
RicConfig ricConfig = ImmutableRicConfig.builder() //
.name("name") //
.baseUrl("RicBaseUrl") //
}
@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);
}
@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());
}
@Test
- public void testGetValidPolicyType() {
+ void testGetValidPolicyType() {
String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_VALID + "}";
Mono<String> policyTypeResp = Mono.just(policyType);
}
@Test
- public void testGetInValidPolicyTypeJson() {
+ void testGetInValidPolicyTypeJson() {
String policyType = "{\"create_schema\": " + POLICY_TYPE_SCHEMA_INVALID + "}";
Mono<String> policyTypeResp = Mono.just(policyType);
}
@Test
- public void testGetPolicyTypeWithoutCreateSchema() {
+ void testGetPolicyTypeWithoutCreateSchema() {
Mono<String> policyTypeResp = Mono.just(POLICY_TYPE_SCHEMA_VALID);
when(asyncRestClientMock.get(anyString())).thenReturn(policyTypeResp);
}
@Test
- public void testPutPolicy() {
+ void testPutPolicy() {
when(asyncRestClientMock.put(anyString(), anyString())).thenReturn(Mono.empty());
clientUnderTest
}
@Test
- public void testDeletePolicy() {
+ void testDeletePolicy() {
when(asyncRestClientMock.delete(anyString())).thenReturn(Mono.empty());
Mono<String> returnedMono = clientUnderTest
}
@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());
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";
AsyncRestClient asyncRestClientMock;
@BeforeEach
- public void init() {
+ void init() {
asyncRestClientMock = mock(AsyncRestClient.class);
ControllerConfig controllerCfg = ImmutableControllerConfig.builder() //
.name("name") //
}
@Test
- public void testGetPolicyTypeIdentities() {
+ void testGetPolicyTypeIdentities() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.build();
}
@Test
- public void testGetPolicyIdentities() {
+ void testGetPolicyIdentities() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.build();
}
@Test
- public void testGetValidPolicyType() {
+ void testGetValidPolicyType() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.policyTypeId(POLICY_TYPE_1_ID) //
}
@Test
- public void testGetInvalidPolicyType() {
+ void testGetInvalidPolicyType() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.policyTypeId(POLICY_TYPE_1_ID) //
}
@Test
- public void testPutPolicy() {
+ void testPutPolicy() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.policyTypeId(POLICY_TYPE_1_ID) //
}
@Test
- public void testDeletePolicy() {
+ void testDeletePolicy() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.policyTypeId(POLICY_TYPE_1_ID) //
}
@Test
- public void testDeleteAllPolicies() {
+ void testDeleteAllPolicies() {
SdncOnapA1Client.SdncOnapAdapterInput inputParams = ImmutableSdncOnapAdapterInput.builder() //
.nearRtRicId(RIC_1_URL) //
.build();
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";
}
@BeforeEach
- public void init() {
+ void init() {
asyncRestClientMock = mock(AsyncRestClient.class);
Ric ric = A1ClientHelper.createRic(RIC_1_URL);
}
@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);
}
@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);
}
@Test
- public void testGetPolicyIdentities() {
+ void testGetPolicyIdentities() {
String policyIdsResp = createResponse(Arrays.asList(POLICY_1_ID, POLICY_2_ID));
whenAsyncPostThenReturn(Mono.just(policyIdsResp));
}
@Test
- public void testGetValidPolicyType() {
+ void testGetValidPolicyType() {
String policyType = clientUnderTest.getPolicyTypeSchema("").block();
assertEquals("{}", policyType, "");
}
@Test
- public void testPutPolicyValidResponse() {
+ void testPutPolicyValidResponse() {
whenPostReturnOkResponse();
String returned = clientUnderTest
}
@Test
- public void testPutPolicyRejected() {
+ void testPutPolicyRejected() {
final String policyJson = "{}";
AdapterOutput adapterOutput = ImmutableAdapterOutput.builder() //
.body("NOK") //
}
@Test
- public void testDeletePolicy() {
+ void testDeletePolicy() {
whenPostReturnOkResponse();
String returned = clientUnderTest
}
@Test
- public void testGetStatus() {
+ void testGetStatus() {
whenPostReturnOkResponse();
Policy policy = A1ClientHelper.createPolicy(RIC_1_URL, POLICY_1_ID, POLICY_JSON_VALID, POLICY_TYPE_1_ID);
}
@Test
- public void testGetVersion() {
+ void testGetVersion() {
whenPostReturnOkResponse();
A1ProtocolType returnedVersion = clientUnderTest.getProtocolVersion().block();
assertEquals(A1ProtocolType.SDNC_OSC_STD_V1_1, returnedVersion, "");
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";
RicConfig ricConfigMock;
@BeforeEach
- public void init() {
+ void init() {
clientUnderTest = new StdA1ClientVersion1(asyncRestClientMock, ricConfigMock);
}
}
@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);
}
@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));
}
@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());
}
@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);
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);
}
@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();
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());
}
@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();
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());
}
@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");
}
@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");
}
@Test
- public void whenWrongMemberNameInObject() throws Exception {
+ void whenWrongMemberNameInObject() throws Exception {
JsonObject jsonRootObject = getJsonRootObject();
JsonObject json = jsonRootObject.getAsJsonObject("config");
json.remove("ric");
}
@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";
}
@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";
"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");
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") //
}
@Test
- public void gettingNotAddedRicShouldThrowException() {
+ void gettingNotAddedRicShouldThrowException() {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
}
@Test
- public void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
+ void addRicShouldNotifyAllObserversOfRicAdded() throws Exception {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
RicConfigUpdate update = appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1)).blockFirst();
}
@Test
- public void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
+ void changedRicShouldNotifyAllObserversOfRicChanged() throws Exception {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
appConfigUnderTest.setConfiguration(configParserResult(RIC_CONFIG_1));
}
@Test
- public void removedRicShouldNotifyAllObserversOfRicRemoved() {
+ void removedRicShouldNotifyAllObserversOfRicRemoved() {
ApplicationConfig appConfigUnderTest = new ApplicationConfig();
ImmutableRicConfig ricConfig2 = ImmutableRicConfig.builder() //
import org.springframework.http.HttpStatus;
@ExtendWith(MockitoExtension.class)
-public class DmaapMessageConsumerTest {
+class DmaapMessageConsumerTest {
@Mock
private ApplicationConfig applicationConfigMock;
@Mock
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));
}
@Test
- public void dmaapConfigurationRemoved_thenStopPollingDmaapSleepAndRetry() throws Exception {
+ void dmaapConfigurationRemoved_thenStopPollingDmaapSleepAndRetry() throws Exception {
messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
doNothing().when(messageConsumerUnderTest).sleep(any(Duration.class));
}
@Test
- public void dmaapConfiguredAndNoMessages_thenPollOnce() throws Exception {
+ void dmaapConfiguredAndNoMessages_thenPollOnce() throws Exception {
setUpMrConfig();
messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
}
@Test
- public void dmaapConfiguredAndErrorGettingMessages_thenLogWarningAndSleep() throws Exception {
+ void dmaapConfiguredAndErrorGettingMessages_thenLogWarningAndSleep() throws Exception {
setUpMrConfig();
messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
}
@Test
- public void dmaapConfiguredAndOneMessage_thenPollOnceAndProcessMessage() throws Exception {
+ void dmaapConfiguredAndOneMessage_thenPollOnceAndProcessMessage() throws Exception {
setUpMrConfig();
messageConsumerUnderTest = spy(new DmaapMessageConsumer(applicationConfigMock));
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;
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";
}
@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");
}
@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();
}
@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();
}
@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();
}
@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();
}
@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());
}
@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);
}
@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\"}", "");
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() {
}
@Test
- public void testLock() throws IOException, ServiceException {
+ void testLock() throws IOException, ServiceException {
Lock lock = new Lock();
lock.lockBlocking(LockType.SHARED);
lock.unlockBlocking();
}
@Test
- public void testReactiveLock() {
+ void testReactiveLock() {
Lock lock = new Lock();
Mono<Lock> seq = lock.lock(LockType.EXCLUSIVE) //
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";
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);
}
@Test
- public void consulHostMissing_thenExceptionReturned() {
+ void consulHostMissing_thenExceptionReturned() {
Properties systemEnvironment = new Properties();
StepVerifier.create(EnvironmentProcessor.readEnvironmentVariables(systemEnvironment))
}
@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);
}
@Test
- public void configBindingServiceMissing_thenExceptionReturned() {
+ void configBindingServiceMissing_thenExceptionReturned() {
Properties systemEnvironment = new Properties();
systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
}
@Test
- public void allPropertiesAvailableWithServiceName_thenAllPropertiesAreReturned() {
+ void allPropertiesAvailableWithServiceName_thenAllPropertiesAreReturned() {
Properties systemEnvironment = new Properties();
String consulPort = "8080";
systemEnvironment.put(CONSUL_HOST, CONSUL_HOST_VALUE);
}
@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);
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;
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"))) //
}
@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();
}
@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();
}
@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();
}
@Test
- public void whenTheConfigurationFits_thenConfiguredRicsArePutInRepository() throws Exception {
+ void whenTheConfigurationFits_thenConfiguredRicsArePutInRepository() throws Exception {
refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_EXISTS);
refreshTaskUnderTest.systemEnvironment = new Properties();
// When
}
@Test
- public void whenFileExistsButJsonIsIncorrect_thenNoRicsArePutInRepository() throws Exception {
+ void whenFileExistsButJsonIsIncorrect_thenNoRicsArePutInRepository() throws Exception {
refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_EXISTS);
refreshTaskUnderTest.systemEnvironment = new Properties();
}
@Test
- public void whenPeriodicConfigRefreshNoConsul_thenErrorIsLogged() {
+ void whenPeriodicConfigRefreshNoConsul_thenErrorIsLogged() {
refreshTaskUnderTest = this.createTestObject(CONFIG_FILE_DOES_NOT_EXIST);
refreshTaskUnderTest.systemEnvironment = new Properties();
}
@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);
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) //
private Rics rics = new Rics();
@BeforeEach
- public void init() {
+ void init() {
types.clear();
policies.clear();
rics.clear();
}
@AfterEach
- public void verifyNoRicLocks() {
+ void verifyNoRicLocks() {
for (Ric ric : this.rics.getRics()) {
ric.getLock().lockBlocking(LockType.EXCLUSIVE);
ric.getLock().unlockBlocking();
}
@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);
}
@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);
}
@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);
}
@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);
}
@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);
}
@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);
}
@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);
}
@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);
}
@Test
- public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
+ void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
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) //
private Services services;
@BeforeEach
- public void init() {
+ void init() {
policyTypes = new PolicyTypes();
policies = new Policies();
services = new Services();
}
@Test
- public void ricAlreadySynchronizing_thenNoSynchronization() {
+ void ricAlreadySynchronizing_thenNoSynchronization() {
RIC_1.setState(RicState.SYNCHRONIZING);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
}
@Test
- public void ricIdlePolicyTypeInRepo_thenSynchronizationWithReuseOfTypeFromRepoAndCorrectServiceNotified() {
+ void ricIdlePolicyTypeInRepo_thenSynchronizationWithReuseOfTypeFromRepoAndCorrectServiceNotified() {
RIC_1.setState(RicState.AVAILABLE);
policyTypes.put(POLICY_TYPE_1);
}
@Test
- public void ricIdlePolicyTypeNotInRepo_thenSynchronizationWithTypeFromRic() throws Exception {
+ void ricIdlePolicyTypeNotInRepo_thenSynchronizationWithTypeFromRic() throws Exception {
RIC_1.setState(RicState.AVAILABLE);
setUpCreationOfA1Client();
}
@Test
- public void ricIdleAndHavePolicies_thenSynchronizationWithRecreationOfPolicies() {
+ void ricIdleAndHavePolicies_thenSynchronizationWithRecreationOfPolicies() {
RIC_1.setState(RicState.AVAILABLE);
Policy transientPolicy = createPolicy(true);
}
@Test
- public void ricIdleAndErrorDeletingPoliciesFirstTime_thenSynchronizationWithDeletionOfPolicies() {
+ void ricIdleAndErrorDeletingPoliciesFirstTime_thenSynchronizationWithDeletionOfPolicies() {
RIC_1.setState(RicState.AVAILABLE);
policies.put(POLICY_1);
}
@Test
- public void ricIdleAndErrorDeletingPoliciesAllTheTime_thenSynchronizationWithFailedRecovery() {
+ void ricIdleAndErrorDeletingPoliciesAllTheTime_thenSynchronizationWithFailedRecovery() {
RIC_1.setState(RicState.AVAILABLE);
policies.put(POLICY_1);
}
@Test
- public void ricIdlePolicyTypeInRepo_thenSynchronizationWithErrorOnServiceNotificationErrorLogged() {
+ void ricIdlePolicyTypeInRepo_thenSynchronizationWithErrorOnServiceNotificationErrorLogged() {
RIC_1.setState(RicState.AVAILABLE);
policyTypes.put(POLICY_TYPE_1);
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";
.build();
@Test
- public void serviceExpired_policyAndServiceAreDeletedInRepoAndPolicyIsDeletedInRic() {
+ void serviceExpired_policyAndServiceAreDeletedInRepoAndPolicyIsDeletedInRic() {
setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
setUpCreationOfA1Client();
}
@Test
- public void serviceExpiredButDeleteInRicFails_policyAndServiceAreDeletedInRepoAndErrorLoggedForRic() {
+ void serviceExpiredButDeleteInRicFails_policyAndServiceAreDeletedInRepoAndErrorLoggedForRic() {
setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
setUpCreationOfA1Client();
}
@Test
- public void serviceNotExpired_shouldNotBeChecked() {
+ void serviceNotExpired_shouldNotBeChecked() {
setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(2));
ServiceSupervision serviceSupervisionUnderTest =
}
@Test
- public void serviceWithoutKeepAliveInterval_shouldNotBeChecked() {
+ void serviceWithoutKeepAliveInterval_shouldNotBeChecked() {
setUpRepositoryWithKeepAliveInterval(Duration.ofSeconds(0));
ServiceSupervision serviceSupervisionUnderTest =
<?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>
<?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>
#!/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)
<?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>
<?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>
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;
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
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
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
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
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
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
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
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
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());
}
}
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;
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 {
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
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)
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)
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)
+# ============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
#! /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
#! /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
-----------------------------------------------------------
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
#!/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
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
### 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
### 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