Fixed some tests. Fixed spelling of milliseconds.
Issue-ID: NONRTRIC-834
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Change-Id: Ic5a0203d663e526830add2f081bf98d896b8442c
"maxSize": {
"type": "integer"
},
- "maxTimeMiliseconds": {
+ "maxTimeMilliseconds": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"maxSize",
- "maxTimeMiliseconds"
+ "maxTimeMilliseconds"
]
}
},
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).
* 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.
{
"bufferTimeout":{
"maxSize":123,
- "maxTimeMiliseconds":456
+ "maxTimeMilliseconds":456
},
"maxConcurrency":1
}
<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
}
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() {}
@Getter
private int maxSize;
- private long maxTimeMiliseconds;
+ private long maxTimeMilliseconds;
public Duration getMaxTime() {
- return Duration.ofMillis(maxTimeMiliseconds);
+ return Duration.ofMillis(maxTimeMilliseconds);
}
}
public boolean isBuffered() {
return parameters != null && parameters.bufferTimeout != null && parameters.bufferTimeout.maxSize > 0
- && parameters.bufferTimeout.maxTimeMiliseconds > 0;
+ && parameters.bufferTimeout.maxTimeMilliseconds > 0;
}
}
"type": "integer",
"minimum": 1
},
- "maxTimeMiliseconds": {
+ "maxTimeMilliseconds": {
"type": "integer",
"minimum": 0,
"maximum": 160000
"additionalProperties": false,
"required": [
"maxSize",
- "maxTimeMiliseconds"
+ "maxTimeMilliseconds"
]
}
},
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;
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;
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());
}
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();