From: Henrik Andersson Date: Thu, 30 Jan 2020 07:07:05 +0000 (+0000) Subject: Merge "Add test for ApplicationConfig" X-Git-Tag: 1.0.1~14 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=3482ea81c8189d5cfacf4005e1c92673304e11b3;hp=dd7e4f6cd1a2273a583f05e0d86810f70272723d;p=nonrtric.git Merge "Add test for ApplicationConfig" --- diff --git a/policy-agent/config/application_configuration.json b/policy-agent/config/application_configuration.json index cb039caa..8f3f80b2 100644 --- a/policy-agent/config/application_configuration.json +++ b/policy-agent/config/application_configuration.json @@ -11,13 +11,5 @@ ] } ] - }, - "streams_subscribes": { - "dmaap_subscriber": { - "dmaap_info": { - "topic_url": "http://dradmin:dradmin@localhost:2222/events/A1-P/users/sdnc1" - }, - "type": "message_router" - } } } \ No newline at end of file diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1Client.java index 213dfa52..0a2bc8ed 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1Client.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1Client.java @@ -30,7 +30,7 @@ import reactor.core.publisher.Mono; public interface A1Client { public static enum A1ProtocolType { - UNKNOWN, STD_V1, OSC_V1, CONTROLLER + UNKNOWN, STD_V1, OSC_V1, SDNC_OSC, SDNR_ONAP } public Mono getProtocolVersion(); diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java index cd53f838..7b7e0cef 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java @@ -41,15 +41,18 @@ public class A1ClientFactory { return Mono.just(createStdA1ClientImpl(ric)); } else if (version == A1ProtocolType.OSC_V1) { return Mono.just(new OscA1Client(ric.getConfig())); - } else if (version == A1ProtocolType.CONTROLLER) { - return Mono.just(createControllerA1Client(ric)); + } else if (version == A1ProtocolType.SDNC_OSC) { + return Mono.just(createSdncOscA1Client(ric)); + } else if (version == A1ProtocolType.SDNR_ONAP) { + return Mono.just(createSdnrOnapA1Client(ric)); } return Mono.error(new ServiceException("Not supported protocoltype: " + version)); } private Mono getProtocolVersion(Ric ric) { if (ric.getProtocolVersion() == A1ProtocolType.UNKNOWN) { - return fetchVersion(ric, createControllerA1Client(ric)) // + return fetchVersion(ric, createSdnrOnapA1Client(ric)) // + .onErrorResume(err -> fetchVersion(ric, createSdncOscA1Client(ric))) .onErrorResume(err -> fetchVersion(ric, new OscA1Client(ric.getConfig()))) .onErrorResume(err -> fetchVersion(ric, createStdA1ClientImpl(ric))) .doOnNext(version -> ric.setProtocolVersion(version)) @@ -64,8 +67,12 @@ public class A1ClientFactory { return new StdA1Client(ric.getConfig()); } - protected A1Client createControllerA1Client(Ric ric) { - return new ControllerA1Client(ric.getConfig()); + protected A1Client createSdncOscA1Client(Ric ric) { + return new SdncOscA1Client(ric.getConfig()); + } + + protected A1Client createSdnrOnapA1Client(Ric ric) { + return new SdnrOnapA1Client(ric.getConfig()); } private Mono fetchVersion(Ric ric, A1Client a1Client) { diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java index 3fd16d07..b10cf279 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java @@ -56,6 +56,18 @@ public class AsyncRestClient { .bodyToMono(String.class); } + public Mono postWithAuthHeader(String uri, String body, String username, String password) { + return client.post() // + .uri(uri) // + .headers(headers -> headers.setBasicAuth(username, password)) // + .contentType(MediaType.APPLICATION_JSON) // + .bodyValue(body) // + .retrieve() // + .onStatus(HttpStatus::isError, + response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) // + .bodyToMono(String.class); + } + public Mono put(String uri, String body) { logger.debug("PUT uri = '{}''", uri); return client.put() // diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/ControllerA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java similarity index 82% rename from policy-agent/src/main/java/org/oransc/policyagent/clients/ControllerA1Client.java rename to policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java index ddb6fb67..a91f9f87 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/ControllerA1Client.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java @@ -35,18 +35,19 @@ import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public class ControllerA1Client implements A1Client { +public class SdncOscA1Client implements A1Client { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final String A1_CONTROLLER_URL = - "http://admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U@a1-controller-container:8181/restconf/operations"; + private static final String A1_CONTROLLER_URL = "http://a1-controller-container:8181/restconf/operations"; + private static final String A1_CONTROLLER_USERNAME = "admin"; + private static final String A1_CONTROLLER_PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; private final RicConfig ricConfig; private final AsyncRestClient restClient; - public ControllerA1Client(RicConfig ricConfig) { + public SdncOscA1Client(RicConfig ricConfig) { this.ricConfig = ricConfig; this.restClient = new AsyncRestClient(A1_CONTROLLER_URL); - logger.debug("ControllerA1Client for ric: {}", this.ricConfig.name()); + logger.debug("SdncOscA1Client for ric: {}", this.ricConfig.name()); } @Override @@ -56,7 +57,9 @@ public class ControllerA1Client implements A1Client { String inputJsonString = createInputJsonString(paramsJson); logger.debug("POST getPolicyTypeIdentities inputJsonString = {}", inputJsonString); - return restClient.post("/A1-ADAPTER-API:getPolicyTypeIdentities", inputJsonString) // + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyTypeIdentities", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // .flatMap(response -> getValueFromResponse(response, "policy-type-id-list")) // .flatMap(this::parseJsonArrayOfString); } @@ -68,7 +71,9 @@ public class ControllerA1Client implements A1Client { String inputJsonString = createInputJsonString(paramsJson); logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString); - return restClient.post("/A1-ADAPTER-API:getPolicyIdentities", inputJsonString) // + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyIdentities", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // .flatMap(response -> getValueFromResponse(response, "policy-id-list")) // .flatMap(this::parseJsonArrayOfString); } @@ -81,7 +86,9 @@ public class ControllerA1Client implements A1Client { String inputJsonString = createInputJsonString(paramsJson); logger.debug("POST getPolicyType inputJsonString = {}", inputJsonString); - return restClient.post("/A1-ADAPTER-API:getPolicyType", inputJsonString) // + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyType", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // .flatMap(response -> getValueFromResponse(response, "policy-type")) // .flatMap(this::extractPolicySchema); } @@ -96,7 +103,9 @@ public class ControllerA1Client implements A1Client { String inputJsonString = createInputJsonString(paramsJson); logger.debug("POST putPolicy inputJsonString = {}", inputJsonString); - return restClient.post("/A1-ADAPTER-API:putPolicy", inputJsonString) // + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:putPolicy", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // .flatMap(response -> getValueFromResponse(response, "returned-policy")) // .flatMap(this::validateJson); } @@ -120,13 +129,14 @@ public class ControllerA1Client implements A1Client { String inputJsonString = createInputJsonString(paramsJson); logger.debug("POST deletePolicy inputJsonString = {}", inputJsonString); - return restClient.post("/A1-ADAPTER-API:deletePolicy", inputJsonString); + return restClient.postWithAuthHeader("/A1-ADAPTER-API:deletePolicy", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD); } @Override public Mono getProtocolVersion() { return getPolicyTypeIdentities() // - .flatMap(x -> Mono.just(A1ProtocolType.CONTROLLER)); + .flatMap(x -> Mono.just(A1ProtocolType.SDNC_OSC)); } private String createInputJsonString(JSONObject paramsJson) { diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/SdnrOnapA1Client.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdnrOnapA1Client.java new file mode 100644 index 00000000..4a0a506c --- /dev/null +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/SdnrOnapA1Client.java @@ -0,0 +1,198 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2019 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=================================== + */ + +package org.oransc.policyagent.clients; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.List; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.oransc.policyagent.configuration.RicConfig; +import org.oransc.policyagent.repository.Policy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class SdnrOnapA1Client implements A1Client { + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static final String A1_CONTROLLER_URL = "http://sdnc_controller_container:8181/restconf/operations"; + private static final String A1_CONTROLLER_USERNAME = "admin"; + private static final String A1_CONTROLLER_PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; + + private final RicConfig ricConfig; + private final AsyncRestClient restClient; + + public SdnrOnapA1Client(RicConfig ricConfig) { + this.ricConfig = ricConfig; + this.restClient = new AsyncRestClient(A1_CONTROLLER_URL); + logger.debug("SdnrOnapA1Client for ric: {}", this.ricConfig.name()); + } + + @Override + public Mono> getPolicyTypeIdentities() { + JSONObject paramsJson = new JSONObject(); + paramsJson.put("near-rt-ric-id", ricConfig.baseUrl()); + String inputJsonString = createInputJsonString(paramsJson); + logger.debug("POST getPolicyTypeIdentities inputJsonString = {}", inputJsonString); + + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyTypes", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // + .flatMap(response -> getValueFromResponse(response, "policy-type-id-list")) // + .flatMap(this::parseJsonArrayOfString); + } + + @Override + public Mono> getPolicyIdentities() { + return getPolicyTypeIdentities() // + .flatMapMany(types -> Flux.fromIterable(types)) // + .flatMap(type -> getPolicyIdentities(type)) // + .flatMap(policyIds -> Flux.fromIterable(policyIds)) // + .collectList(); + } + + public Mono> getPolicyIdentities(String policyTypeId) { + JSONObject paramsJson = new JSONObject(); + paramsJson.put("near-rt-ric-id", ricConfig.baseUrl()); + paramsJson.put("policy-type-id", policyTypeId); + String inputJsonString = createInputJsonString(paramsJson); + logger.debug("POST getPolicyIdentities inputJsonString = {}", inputJsonString); + + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyInstances", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // + .flatMap(response -> getValueFromResponse(response, "policy-instance-id-list")) // + .flatMap(this::parseJsonArrayOfString); + } + + @Override + public Mono getPolicyTypeSchema(String policyTypeId) { + JSONObject paramsJson = new JSONObject(); + paramsJson.put("near-rt-ric-id", ricConfig.baseUrl()); + paramsJson.put("policy-type-id", policyTypeId); + String inputJsonString = createInputJsonString(paramsJson); + logger.debug("POST getPolicyType inputJsonString = {}", inputJsonString); + + return restClient + .postWithAuthHeader("/A1-ADAPTER-API:getPolicyType", inputJsonString, A1_CONTROLLER_USERNAME, + A1_CONTROLLER_PASSWORD) // + .flatMap(response -> getValueFromResponse(response, "policy-type")) // + .flatMap(this::extractPolicySchema); + } + + @Override + public Mono putPolicy(Policy policy) { + JSONObject paramsJson = new JSONObject(); + paramsJson.put("near-rt-ric-id", ricConfig.baseUrl()); + paramsJson.put("policy-instance-id", policy.id()); + paramsJson.put("policy-type-id", policy.type().name()); + paramsJson.put("policy-instance", policy.json()); + paramsJson.put("properties", new JSONArray()); + String inputJsonString = createInputJsonString(paramsJson); + logger.debug("POST putPolicy inputJsonString = {}", inputJsonString); + + return restClient.postWithAuthHeader("/A1-ADAPTER-API:createPolicyInstance", inputJsonString, + A1_CONTROLLER_USERNAME, A1_CONTROLLER_PASSWORD); + } + + public Mono deletePolicy(String policyTypeId, String policyId) { + JSONObject paramsJson = new JSONObject(); + paramsJson.put("near-rt-ric-id", ricConfig.baseUrl()); + paramsJson.put("policy-instance-id", policyId); + paramsJson.put("policy-type-id", policyTypeId); + String inputJsonString = createInputJsonString(paramsJson); + logger.debug("POST deletePolicy inputJsonString = {}", inputJsonString); + + return restClient.postWithAuthHeader("/A1-ADAPTER-API:deletePolicyInstance", inputJsonString, + A1_CONTROLLER_USERNAME, A1_CONTROLLER_PASSWORD); + } + + @Override + public Mono deletePolicy(Policy policy) { + return deletePolicy(policy.type().name(), policy.id()); + } + + @Override + public Flux deleteAllPolicies() { + return getPolicyTypeIdentities() // + .flatMapMany(types -> Flux.fromIterable(types)) // + .flatMap(typeId -> deletePoliciesForType(typeId)); // + } + + private Flux deletePoliciesForType(String typeId) { + return getPolicyIdentities(typeId) // + .flatMapMany(policyIds -> Flux.fromIterable(policyIds)) // + .flatMap(policyId -> deletePolicy(typeId, policyId)); // + } + + @Override + public Mono getProtocolVersion() { + return getPolicyTypeIdentities() // + .flatMap(x -> Mono.just(A1ProtocolType.SDNR_ONAP)); + } + + private String createInputJsonString(JSONObject paramsJson) { + JSONObject inputJson = new JSONObject(); + inputJson.put("input", paramsJson); + return inputJson.toString(); + } + + private Mono getValueFromResponse(String response, String key) { + logger.debug("A1 client: response = {}", response); + try { + JSONObject outputJson = new JSONObject(response); + JSONObject responseParams = outputJson.getJSONObject("output"); + String value = responseParams.get(key).toString(); + return Mono.just(value); + } catch (JSONException ex) { // invalid json + return Mono.error(ex); + } + } + + private Mono> parseJsonArrayOfString(String inputString) { + try { + List arrayList = new ArrayList<>(); + JSONArray jsonArray = new JSONArray(inputString); + for (int i = 0; i < jsonArray.length(); i++) { + arrayList.add(jsonArray.getString(i)); + } + logger.debug("A1 client: received list = {}", arrayList); + return Mono.just(arrayList); + } catch (JSONException ex) { // invalid json + return Mono.error(ex); + } + } + + private Mono extractPolicySchema(String inputString) { + try { + JSONObject jsonObject = new JSONObject(inputString); + JSONObject schemaObject = jsonObject.getJSONObject("policySchema"); + String schemaString = schemaObject.toString(); + return Mono.just(schemaString); + } catch (JSONException ex) { // invalid json + return Mono.error(ex); + } + } +} diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java index 889dfafa..c132fa28 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java @@ -49,11 +49,6 @@ public interface DmaapMessageConsumer { */ public boolean isAlive(); - /** - * To Stop the DMAAP Listener - */ - public void stopConsumer(); - /** * It's a infinite loop run every configured seconds to fetch the message from DMAAP. This method can be stop by * setting the alive flag to false diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerImpl.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerImpl.java index c7dab584..bd3ba69f 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerImpl.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerImpl.java @@ -20,8 +20,11 @@ package org.oransc.policyagent.dmaap; +import com.google.common.collect.Iterables; import java.io.IOException; import java.util.Properties; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import org.onap.dmaap.mr.client.MRClientFactory; import org.onap.dmaap.mr.client.MRConsumer; import org.onap.dmaap.mr.client.response.MRConsumerResponse; @@ -42,16 +45,18 @@ public class DmaapMessageConsumerImpl implements DmaapMessageConsumer { private boolean alive = false; private final ApplicationConfig applicationConfig; protected MRConsumer consumer; - private MRConsumerResponse response = null; @Autowired private DmaapMessageHandler dmaapMessageHandler; + private final long FETCHTIMEOUT = 30000; + + private CountDownLatch sleep = new CountDownLatch(1); @Autowired public DmaapMessageConsumerImpl(ApplicationConfig applicationConfig) { this.applicationConfig = applicationConfig; } - @Scheduled(fixedRate = 1000 * 10) // , initialDelay=60000) + @Scheduled(fixedRate = 1000 * 10) @Override public void run() { if (!alive) { @@ -60,9 +65,11 @@ public class DmaapMessageConsumerImpl implements DmaapMessageConsumer { if (this.alive) { try { Iterable dmaapMsgs = fetchAllMessages(); - logger.debug("Fetched all the messages from DMAAP and will start to process the messages"); - for (String msg : dmaapMsgs) { - processMsg(msg); + if (dmaapMsgs != null && Iterables.size(dmaapMsgs) > 0) { + logger.debug("Fetched all the messages from DMAAP and will start to process the messages"); + for (String msg : dmaapMsgs) { + processMsg(msg); + } } } catch (Exception e) { logger.error("{}: cannot fetch because of ", this, e.getMessage(), e); @@ -71,15 +78,17 @@ public class DmaapMessageConsumerImpl implements DmaapMessageConsumer { } private Iterable fetchAllMessages() { - response = consumer.fetchWithReturnConsumerResponse(); - if (response == null) { + MRConsumerResponse response = null; + try { + response = consumer.fetchWithReturnConsumerResponse(); + } catch (Exception e) { + logger.error("Failed to get message from DMAAP", e); + } + if (response == null || !"200".equals(response.getResponseCode())) { logger.warn("{}: DMaaP NULL response received", this); + sleepAfterFailure(); } else { logger.debug("DMaaP consumer received {} : {}", response.getResponseCode(), response.getResponseMessage()); - if (!"200".equals(response.getResponseCode())) { - logger.error("DMaaP consumer received: {} : {}", response.getResponseCode(), - response.getResponseMessage()); - } } return response.getActualMessages(); } @@ -117,8 +126,12 @@ public class DmaapMessageConsumerImpl implements DmaapMessageConsumer { return alive; } - @Override - public void stopConsumer() { - alive = false; + private void sleepAfterFailure() { + logger.warn("DMAAP message Consumer is put to Sleep for {} milliseconds", FETCHTIMEOUT); + try { + sleep.await(FETCHTIMEOUT, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + logger.error("Failed to put the thread to sleep: {}", e); + } } } diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java index 172fe989..61c1e1e2 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java @@ -45,6 +45,7 @@ public class DmaapMessageHandler { private static final Logger logger = LoggerFactory.getLogger(DmaapMessageHandler.class); + private boolean initialize = false; @Autowired private ObjectMapper mapper; @Autowired @@ -57,8 +58,9 @@ public class DmaapMessageHandler { // The publish properties is corrupted. It contains the subscribe property values. @Async("threadPoolTaskExecutor") public void handleDmaapMsg(String msg) { - logger.debug("Message ---------->{}", msg); - init(); + if (!initialize) { + init(); + } DmaapRequestMessage dmaapRequestMessage = null; Optional dmaapResponse = null; // Process the message @@ -166,6 +168,7 @@ public class DmaapMessageHandler { topic = dmaapPublisherConfig.getProperty("topic"); logger.debug("Read the topic & Service Name - {} , {}", host, topic); this.restClient = new AsyncRestClient("http://" + host + "/"); // get this value from application config + initialize = true; } } diff --git a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java index eec9c70e..3e5932f1 100644 --- a/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java +++ b/policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java @@ -21,6 +21,7 @@ package org.oransc.policyagent; import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -51,9 +52,9 @@ import org.oransc.policyagent.repository.Policy; import org.oransc.policyagent.repository.PolicyType; import org.oransc.policyagent.repository.PolicyTypes; import org.oransc.policyagent.repository.Ric; +import org.oransc.policyagent.repository.Ric.RicState; import org.oransc.policyagent.repository.Rics; import org.oransc.policyagent.repository.Services; -import org.oransc.policyagent.repository.Ric.RicState; import org.oransc.policyagent.tasks.RepositorySupervision; import org.oransc.policyagent.utils.MockA1Client; import org.oransc.policyagent.utils.MockA1ClientFactory; @@ -75,8 +76,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestTemplate; -import static org.awaitility.Awaitility.await; - @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class ApplicationTest {