Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "NONRTRIC - Implement DMaaP mediator producer service in Java"
[nonrtric.git]
/
dmaap-adaptor-java
/
src
/
test
/
java
/
org
/
oran
/
dmaapadapter
/
IntegrationWithEcs.java
diff --git
a/dmaap-adaptor-java/src/test/java/org/oran/dmaapadapter/IntegrationWithEcs.java
b/dmaap-adaptor-java/src/test/java/org/oran/dmaapadapter/IntegrationWithEcs.java
index
3dde82e
..
1cceef0
100644
(file)
--- a/
dmaap-adaptor-java/src/test/java/org/oran/dmaapadapter/IntegrationWithEcs.java
+++ b/
dmaap-adaptor-java/src/test/java/org/oran/dmaapadapter/IntegrationWithEcs.java
@@
-42,8
+42,6
@@
import org.oran.dmaapadapter.repository.InfoType;
import org.oran.dmaapadapter.repository.InfoTypes;
import org.oran.dmaapadapter.repository.Jobs;
import org.oran.dmaapadapter.tasks.ProducerRegstrationTask;
import org.oran.dmaapadapter.repository.InfoTypes;
import org.oran.dmaapadapter.repository.Jobs;
import org.oran.dmaapadapter.tasks.ProducerRegstrationTask;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@@
-63,7
+61,8
@@
import org.springframework.test.context.junit.jupiter.SpringExtension;
"app.ecs-base-url=https://localhost:8434" //
})
class IntegrationWithEcs {
"app.ecs-base-url=https://localhost:8434" //
})
class IntegrationWithEcs {
- private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
+
+ private static final String EI_JOB_ID = "EI_JOB_ID";
@Autowired
private ApplicationConfig applicationConfig;
@Autowired
private ApplicationConfig applicationConfig;
@@
-164,20
+163,27
@@
class IntegrationWithEcs {
return applicationConfig.getEcsBaseUrl();
}
return applicationConfig.getEcsBaseUrl();
}
- private void createInformationJobInEcs() {
- String url = ecsBaseUrl() + "/data-consumer/v1/info-jobs/jobId";
+ private String jobUrl(String jobId) {
+ return ecsBaseUrl() + "/data-consumer/v1/info-jobs/" + jobId;
+ }
+
+ private void createInformationJobInEcs(String jobId) {
String body = gson.toJson(consumerJobInfo());
try {
// Delete the job if it already exists
String body = gson.toJson(consumerJobInfo());
try {
// Delete the job if it already exists
-
restClient().delete(url).block(
);
+
deleteInformationJobInEcs(jobId
);
} catch (Exception e) {
}
} catch (Exception e) {
}
- restClient().putForEntity(url, body).block();
+ restClient().putForEntity(jobUrl(jobId), body).block();
+ }
+
+ private void deleteInformationJobInEcs(String jobId) {
+ restClient().delete(jobUrl(jobId)).block();
}
private ConsumerJobInfo consumerJobInfo() {
InfoType type = this.types.getAll().iterator().next();
}
private ConsumerJobInfo consumerJobInfo() {
InfoType type = this.types.getAll().iterator().next();
- return consumerJobInfo(type.getId(),
"EI_JOB_ID"
);
+ return consumerJobInfo(type.getId(),
EI_JOB_ID
);
}
private Object jsonObject() {
}
private Object jsonObject() {
@@
-205,7
+211,7
@@
class IntegrationWithEcs {
void testWholeChain() throws Exception {
await().untilAsserted(() -> assertThat(producerRegstrationTask.isRegisteredInEcs()).isTrue());
void testWholeChain() throws Exception {
await().untilAsserted(() -> assertThat(producerRegstrationTask.isRegisteredInEcs()).isTrue());
- createInformationJobInEcs();
+ createInformationJobInEcs(
EI_JOB_ID
);
await().untilAsserted(() -> assertThat(this.jobs.size()).isEqualTo(1));
await().untilAsserted(() -> assertThat(this.jobs.size()).isEqualTo(1));
@@
-216,6
+222,10
@@
class IntegrationWithEcs {
await().untilAsserted(() -> assertThat(results.receivedBodies.size()).isEqualTo(2));
assertThat(results.receivedBodies.get(0)).isEqualTo("DmaapResponse1");
await().untilAsserted(() -> assertThat(results.receivedBodies.size()).isEqualTo(2));
assertThat(results.receivedBodies.get(0)).isEqualTo("DmaapResponse1");
+ deleteInformationJobInEcs(EI_JOB_ID);
+
+ await().untilAsserted(() -> assertThat(this.jobs.size()).isZero());
+
synchronized (this) {
// logger.warn("**************** Keeping server alive! " +
// this.applicationConfig.getLocalServerHttpPort());
synchronized (this) {
// logger.warn("**************** Keeping server alive! " +
// this.applicationConfig.getLocalServerHttpPort());