Minor changes. 66/10366/1
authorPatrikBuhr <patrik.buhr@est.tech>
Thu, 2 Feb 2023 09:10:14 +0000 (10:10 +0100)
committerPatrikBuhr <patrik.buhr@est.tech>
Thu, 2 Feb 2023 09:10:14 +0000 (10:10 +0100)
Fixed some tests. Fixed spelling of milliseconds.

Issue-ID: NONRTRIC-834
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Change-Id: Ic5a0203d663e526830add2f081bf98d896b8442c

README.md
docs/overview.rst
pom.xml
src/main/java/org/oran/dmaapadapter/repository/Job.java
src/main/resources/typeSchema.json
src/test/java/org/oran/dmaapadapter/IntegrationWithIcs.java
src/test/java/org/oran/dmaapadapter/IntegrationWithKafka.java

index 686135a..48f2f20 100644 (file)
--- 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).
 
 
index aebb5cb..88a2606 100644 (file)
@@ -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 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
         <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>
         <docker-maven-plugin>0.30.0</docker-maven-plugin>
         <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
-        <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
+        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
         <exec.skip>true</exec.skip>
         <protobuf.version>4.0.0-rc-2</protobuf.version>
         <protobuf-java-format.version>1.4</protobuf-java-format.version>
             <groupId>software.amazon.awssdk</groupId>
             <artifactId>s3</artifactId>
             <version>2.17.292</version>
-        </dependency>  
+        </dependency>
     </dependencies>
     <build>
         <plugins>
         <system>JIRA</system>
         <url>https://jira.o-ran-sc.org/</url>
     </issueManagement>
-</project>
+</project>
\ No newline at end of file
index cda194e..b235bdc 100644 (file)
@@ -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;
     }
 
 }
index c57d066..d5b20fc 100644 (file)
@@ -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"
       ]
     }
   },
index 5f7a886..4146212 100644 (file)
@@ -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());
     }
index 01e8be6..12bec80 100644 (file)
@@ -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();