summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
575869c)
The concurrency testwas broken and tested nothing.
The code formatting plugin had stopped working.
Version is updated and works now.
Change-Id: I3b6d1d7ed66f863e2240906d7bb99da8f7b1324d
Issue-ID: NONRTRIC-195
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
<json.version>20190722</json.version>
<commons-net.version>3.6</commons-net.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<json.version>20190722</json.version>
<commons-net.version>3.6</commons-net.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
- <formatter-maven-plugin.version>2.8.1</formatter-maven-plugin.version>
+ <formatter-maven-plugin.version>2.12.2</formatter-maven-plugin.version>
<spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
<docker-maven-plugin>0.30.0</docker-maven-plugin>
<version.dmaap>1.1.11</version.dmaap>
<spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
<docker-maven-plugin>0.30.0</docker-maven-plugin>
<version.dmaap>1.1.11</version.dmaap>
package org.oransc.policyagent.clients;
package org.oransc.policyagent.clients;
import org.oransc.policyagent.clients.A1Client.A1ProtocolType;
import org.oransc.policyagent.configuration.ApplicationConfig;
import org.oransc.policyagent.configuration.ControllerConfig;
import org.oransc.policyagent.clients.A1Client.A1ProtocolType;
import org.oransc.policyagent.configuration.ApplicationConfig;
import org.oransc.policyagent.configuration.ControllerConfig;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.core.publisher.Mono;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.core.publisher.Mono;
/**
* Factory for A1 clients that supports four different protocol versions of the
* A1 api.
/**
* Factory for A1 clients that supports four different protocol versions of the
* A1 api.
protected DmaapMessageHandler getDmaapMessageHandler() {
if (this.dmaapMessageHandler == null) {
String agentBaseUrl = "http://localhost:" + this.localServerHttpPort;
protected DmaapMessageHandler getDmaapMessageHandler() {
if (this.dmaapMessageHandler == null) {
String agentBaseUrl = "http://localhost:" + this.localServerHttpPort;
- AsyncRestClient agentClient = new AsyncRestClient(agentBaseUrl, this.applicationConfig.getWebClientConfig());
+ AsyncRestClient agentClient =
+ new AsyncRestClient(agentBaseUrl, this.applicationConfig.getWebClientConfig());
AsyncRestClient producer = new AsyncRestClient(this.applicationConfig.getDmaapProducerTopicUrl(),
this.applicationConfig.getWebClientConfig());
this.dmaapMessageHandler = new DmaapMessageHandler(producer, agentClient);
AsyncRestClient producer = new AsyncRestClient(this.applicationConfig.getDmaapProducerTopicUrl(),
this.applicationConfig.getWebClientConfig());
this.dmaapMessageHandler = new DmaapMessageHandler(producer, agentClient);
- * Test that HttpStatus and body from failing REST call to A1 is passed on to the caller.
+ * Test that HttpStatus and body from failing REST call to A1 is passed on to
+ * the caller.
*
* @throws ServiceException
*/
*
* @throws ServiceException
*/
addRic("ric");
addPolicyType("type1", "ric");
addPolicyType("type2", "ric");
addRic("ric");
addPolicyType("type1", "ric");
addPolicyType("type2", "ric");
+ List<ConcurrencyTestRunnable> tests = new ArrayList<>();
for (int i = 0; i < 10; ++i) {
for (int i = 0; i < 10; ++i) {
- Thread thread =
- new Thread(new ConcurrencyTestRunnable(baseUrl(), supervision, a1ClientFactory, rics, policyTypes),
- "TestThread_" + i);
+ ConcurrencyTestRunnable test =
+ new ConcurrencyTestRunnable(restClient(), supervision, a1ClientFactory, rics, policyTypes);
+ Thread thread = new Thread(test, "TestThread_" + i);
thread.start();
threads.add(thread);
thread.start();
threads.add(thread);
}
for (Thread t : threads) {
t.join();
}
}
for (Thread t : threads) {
t.join();
}
+ for (ConcurrencyTestRunnable test : tests) {
+ assertThat(test.isFailed()).isFalse();
+ }
+
assertThat(policies.size()).isZero();
logger.info("Concurrency test took " + Duration.between(startTime, Instant.now()));
}
assertThat(policies.size()).isZero();
logger.info("Concurrency test took " + Duration.between(startTime, Instant.now()));
}
private final MockA1ClientFactory a1ClientFactory;
private final Rics rics;
private final PolicyTypes types;
private final MockA1ClientFactory a1ClientFactory;
private final Rics rics;
private final PolicyTypes types;
+ private boolean failed = false;
- ConcurrencyTestRunnable(String baseUrl, RicSupervision supervision, MockA1ClientFactory a1ClientFactory, Rics rics,
- PolicyTypes types) {
+ ConcurrencyTestRunnable(AsyncRestClient webClient, RicSupervision supervision, MockA1ClientFactory a1ClientFactory,
+ Rics rics, PolicyTypes types) {
this.count = nextCount.incrementAndGet();
this.supervision = supervision;
this.a1ClientFactory = a1ClientFactory;
this.rics = rics;
this.types = types;
this.count = nextCount.incrementAndGet();
this.supervision = supervision;
this.a1ClientFactory = a1ClientFactory;
this.rics = rics;
this.types = types;
- this.webClient = new AsyncRestClient(baseUrl);
+ this.webClient = webClient;
}
private void printStatusInfo() {
}
private void printStatusInfo() {
} catch (Exception e) {
logger.error("Concurrency test exception " + e.toString());
printStatusInfo();
} catch (Exception e) {
logger.error("Concurrency test exception " + e.toString());
printStatusInfo();
+ public boolean isFailed() {
+ return this.failed;
+ }
+
private Policy createPolicyObject(String id) {
Ric ric = this.rics.get("ric");
PolicyType type = this.types.get("type1");
private Policy createPolicyObject(String id) {
Ric ric = this.rics.get("ric");
PolicyType type = this.types.get("type1");
* ========================LICENSE_END===================================
*/
* ========================LICENSE_END===================================
*/
package org.oransc.policyagent.aspect;
import static ch.qos.logback.classic.Level.TRACE;
package org.oransc.policyagent.aspect;
import static ch.qos.logback.classic.Level.TRACE;