From 30b5aef13a043e63705bc4c9eb2972e8936c7133 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Thu, 2 Feb 2023 10:10:14 +0100 Subject: [PATCH] Minor changes. Fixed some tests. Fixed spelling of milliseconds. Issue-ID: NONRTRIC-834 Signed-off-by: PatrikBuhr Change-Id: Ic5a0203d663e526830add2f081bf98d896b8442c --- README.md | 6 ++-- docs/overview.rst | 4 +-- pom.xml | 6 ++-- .../java/org/oran/dmaapadapter/repository/Job.java | 10 +++---- src/main/resources/typeSchema.json | 4 +-- .../org/oran/dmaapadapter/IntegrationWithIcs.java | 34 ++++++++++------------ .../oran/dmaapadapter/IntegrationWithKafka.java | 4 +-- 7 files changed, 32 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 686135a..48f2f20 100644 --- a/README.md +++ b/README.md @@ -55,14 +55,14 @@ When an Information Job is created in the Information Coordinator Service Consum "maxSize": { "type": "integer" }, - "maxTimeMiliseconds": { + "maxTimeMilliseconds": { "type": "integer" } }, "additionalProperties": false, "required": [ "maxSize", - "maxTimeMiliseconds" + "maxTimeMilliseconds" ] } }, @@ -79,7 +79,7 @@ When an Information Job is created in the Information Coordinator Service Consum Object1 and Object2 may be posted in one call --> ["Object1", "Object2"] The bufferTimeout is a Json object and the parameters in the object are: - maxSize the maximum number of buffered objects before posting - - maxTimeMiliseconds the maximum delay time to buffer before posting + - maxTimeMilliseconds the maximum delay time to buffer before posting If no bufferTimeout is specified, each object will be posted as received in separate calls (not quoted and put in a Json array). diff --git a/docs/overview.rst b/docs/overview.rst index aebb5cb..88a2606 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -131,7 +131,7 @@ This schema will by default be registerred for the type. The following propertie * bufferTimeout can be used to buffer several json objects received from Kafka when kafkaInputTopic is defined into one json array. If bufferTimeout is used, the delivered data will be a Json array of the objects received. If not, each received object will be delivered in a separate call. This contains: * maxSize, the maximum number of objects to collect before delivery to the consumer - * maxTimeMiliseconds, the maximum time to delay delivery (to buffer). + * maxTimeMilliseconds, the maximum time to delay delivery (to buffer). * maxConcurrency, defines max how many paralell REST calls the consumer wishes to receive. 1, which is default, means sequential. A higher value may increase throughput. @@ -168,7 +168,7 @@ Below follows an example of using bufferTimeout and maxConcurrency. { "bufferTimeout":{ "maxSize":123, - "maxTimeMiliseconds":456 + "maxTimeMilliseconds":456 }, "maxConcurrency":1 } diff --git a/pom.xml b/pom.xml index 5fedd97..93c33f0 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 3.0.11 0.30.0 3.7.0.1746 - 0.8.5 + 0.8.8 true 4.0.0-rc-2 1.4 @@ -208,7 +208,7 @@ software.amazon.awssdk s3 2.17.292 - + @@ -384,4 +384,4 @@ JIRA https://jira.o-ran-sc.org/ - + \ No newline at end of file diff --git a/src/main/java/org/oran/dmaapadapter/repository/Job.java b/src/main/java/org/oran/dmaapadapter/repository/Job.java index cda194e..b235bdc 100644 --- a/src/main/java/org/oran/dmaapadapter/repository/Job.java +++ b/src/main/java/org/oran/dmaapadapter/repository/Job.java @@ -147,9 +147,9 @@ public class Job { } public static class BufferTimeout { - public BufferTimeout(int maxSize, long maxTimeMiliseconds) { + public BufferTimeout(int maxSize, long maxTimeMilliseconds) { this.maxSize = maxSize; - this.maxTimeMiliseconds = maxTimeMiliseconds; + this.maxTimeMilliseconds = maxTimeMilliseconds; } public BufferTimeout() {} @@ -157,10 +157,10 @@ public class Job { @Getter private int maxSize; - private long maxTimeMiliseconds; + private long maxTimeMilliseconds; public Duration getMaxTime() { - return Duration.ofMillis(maxTimeMiliseconds); + return Duration.ofMillis(maxTimeMilliseconds); } } @@ -224,7 +224,7 @@ public class Job { public boolean isBuffered() { return parameters != null && parameters.bufferTimeout != null && parameters.bufferTimeout.maxSize > 0 - && parameters.bufferTimeout.maxTimeMiliseconds > 0; + && parameters.bufferTimeout.maxTimeMilliseconds > 0; } } diff --git a/src/main/resources/typeSchema.json b/src/main/resources/typeSchema.json index c57d066..d5b20fc 100644 --- a/src/main/resources/typeSchema.json +++ b/src/main/resources/typeSchema.json @@ -38,7 +38,7 @@ "type": "integer", "minimum": 1 }, - "maxTimeMiliseconds": { + "maxTimeMilliseconds": { "type": "integer", "minimum": 0, "maximum": 160000 @@ -47,7 +47,7 @@ "additionalProperties": false, "required": [ "maxSize", - "maxTimeMiliseconds" + "maxTimeMilliseconds" ] } }, diff --git a/src/test/java/org/oran/dmaapadapter/IntegrationWithIcs.java b/src/test/java/org/oran/dmaapadapter/IntegrationWithIcs.java index 5f7a886..4146212 100644 --- a/src/test/java/org/oran/dmaapadapter/IntegrationWithIcs.java +++ b/src/test/java/org/oran/dmaapadapter/IntegrationWithIcs.java @@ -27,10 +27,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParser; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Path; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.oran.dmaapadapter.clients.AsyncRestClient; @@ -39,6 +35,7 @@ import org.oran.dmaapadapter.clients.SecurityContext; import org.oran.dmaapadapter.configuration.ApplicationConfig; import org.oran.dmaapadapter.configuration.WebClientConfig; import org.oran.dmaapadapter.configuration.WebClientConfig.HttpProxyConfig; +import org.oran.dmaapadapter.filter.PmReportFilter; import org.oran.dmaapadapter.r1.ConsumerJobInfo; import org.oran.dmaapadapter.repository.Job; import org.oran.dmaapadapter.repository.Jobs; @@ -275,38 +272,37 @@ class IntegrationWithIcs { ConsumerController.TestResults results = this.consumerController.testResults; await().untilAsserted(() -> assertThat(results.receivedBodies).hasSize(2)); assertThat(results.receivedBodies.get(0)).isEqualTo("DmaapResponse1"); - assertThat(results.receivedHeaders.get(0)).containsEntry("content-type", "text/plain;charset=UTF-8"); deleteInformationJobInIcs(DMAAP_JOB_ID); await().untilAsserted(() -> assertThat(this.jobs.size()).isZero()); } + private String pmJobParameters() { + PmReportFilter.FilterData filterData = new PmReportFilter.FilterData(); + + filterData.addMeasTypes("UtranCell", "succImmediateAssignProcs"); + filterData.getMeasObjInstIds().add("UtranCell=Gbg-997"); + filterData.getSourceNames().add("O-DU-1122"); + filterData.getMeasuredEntityDns().add("ManagedElement=RNC-Gbg-1"); + Job.Parameters param = + Job.Parameters.builder().filter(filterData).filterType(Job.Parameters.PM_FILTER_TYPE).build(); + + return gson.toJson(param); + } + @Test void testPmFilter() throws Exception { await().untilAsserted(() -> assertThat(producerRegstrationTask.isRegisteredInIcs()).isTrue()); final String TYPE_ID = "PmDataOverRest"; - String jsonStr = - reQuote("{ 'filterType' : 'pmdata', 'filter': { 'measTypes': [ 'succImmediateAssignProcs' ] } }"); + String jsonStr = pmJobParameters(); ConsumerJobInfo jobInfo = new ConsumerJobInfo(TYPE_ID, jsonObject(jsonStr), "owner", consumerUri(), ""); createInformationJobInIcs(DMAAP_JOB_ID, jobInfo); await().untilAsserted(() -> assertThat(this.jobs.size()).isEqualTo(1)); - String path = "./src/test/resources/pm_report.json"; - String pmReportJson = Files.readString(Path.of(path), Charset.defaultCharset()); - DmaapSimulatorController.addPmResponse(pmReportJson); - - ConsumerController.TestResults results = this.consumerController.testResults; - await().untilAsserted(() -> assertThat(results.receivedBodies).hasSize(1)); - - String filtered = results.receivedBodies.get(0); - assertThat(filtered).contains("succImmediateAssignProcs").doesNotContain("attTCHSeizures"); - - logger.info(filtered); - deleteInformationJobInIcs(DMAAP_JOB_ID); await().untilAsserted(() -> assertThat(this.jobs.size()).isZero()); } diff --git a/src/test/java/org/oran/dmaapadapter/IntegrationWithKafka.java b/src/test/java/org/oran/dmaapadapter/IntegrationWithKafka.java index 01e8be6..12bec80 100644 --- a/src/test/java/org/oran/dmaapadapter/IntegrationWithKafka.java +++ b/src/test/java/org/oran/dmaapadapter/IntegrationWithKafka.java @@ -307,8 +307,8 @@ class IntegrationWithKafka { return "https://localhost:" + this.applicationConfig.getLocalServerHttpPort(); } - private static Object jobParametersAsJsonObject(String filter, long maxTimeMiliseconds, int maxSize) { - Job.BufferTimeout buffer = maxSize > 0 ? new Job.BufferTimeout(maxSize, maxTimeMiliseconds) : null; + private static Object jobParametersAsJsonObject(String filter, long maxTimeMilliseconds, int maxSize) { + Job.BufferTimeout buffer = maxSize > 0 ? new Job.BufferTimeout(maxSize, maxTimeMilliseconds) : null; Job.Parameters param = Job.Parameters.builder().filter(filter).filterType(Job.Parameters.REGEXP_TYPE) .bufferTimeout(buffer).build(); -- 2.16.6