From: lapentafd Date: Fri, 11 Oct 2024 12:33:36 +0000 (+0100) Subject: NONRTRIC: Using maven during build process for sample rapp X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F13601%2F8;p=nonrtric.git NONRTRIC: Using maven during build process for sample rapp Issue-ID: NONRTRIC-1009 Change-Id: Ib127cd0e18e818706b0c09fd093eb87ba37e2c79 Signed-off-by: lapentafd --- diff --git a/sample-services/ics-simple-producer-consumer/kafka-consumer/.gitignore b/sample-services/ics-simple-producer-consumer/kafka-consumer/.gitignore new file mode 100644 index 00000000..549e00a2 --- /dev/null +++ b/sample-services/ics-simple-producer-consumer/kafka-consumer/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/sample-services/ics-simple-producer-consumer/kafka-consumer/Dockerfile b/sample-services/ics-simple-producer-consumer/kafka-consumer/Dockerfile index a88aff05..023448e4 100644 --- a/sample-services/ics-simple-producer-consumer/kafka-consumer/Dockerfile +++ b/sample-services/ics-simple-producer-consumer/kafka-consumer/Dockerfile @@ -1,30 +1,40 @@ -#================================================================================== -# Copyright (C) 2024: OpenInfra Foundation Europe -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This source code is part of the near-RT RIC (RAN Intelligent Controller) -# platform project (RICP). -#================================================================================== -FROM openjdk:17-jdk-slim - -EXPOSE 9090 - -ARG SPRING_KAFKA_SERVER -ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} - -WORKDIR /app - -COPY target/kafka-consumer-0.0.1-SNAPSHOT.jar /app/consumer-0.0.1.jar - -CMD ["java", "-jar", "consumer-0.0.1.jar"] + +#================================================================================== +# Copyright (C) 2024: OpenInfra Foundation Europe +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This source code is part of the near-RT RIC (RAN Intelligent Controller) +# platform project (RICP). +#================================================================================== +# Use Maven image with OpenJDK 17 for the build stage +FROM maven:3.8.5-openjdk-17 AS maven_build +# Copy Maven project files +COPY pom.xml /tmp/ +COPY src /tmp/src/ +# Set working directory +WORKDIR /tmp/ +# Build the Maven project +RUN mvn package +# Use a separate image with OpenJDK 17 for the runtime stage +FROM openjdk:17-jdk-slim +# Expose port 9090 +EXPOSE 9090 +ARG SPRING_KAFKA_SERVER +ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} +# Set the working directory +WORKDIR /app +# Copy the JAR file from the maven_build stage to the runtime stage +COPY --from=maven_build /tmp/target/kafka-consumer-0.0.1.jar /app/consumer-0.0.1.jar +# Command to run the application +CMD ["java", "-jar", "consumer-0.0.1.jar"] diff --git a/sample-services/ics-simple-producer-consumer/kafka-consumer/DockerfileSimple b/sample-services/ics-simple-producer-consumer/kafka-consumer/DockerfileSimple new file mode 100644 index 00000000..6978283a --- /dev/null +++ b/sample-services/ics-simple-producer-consumer/kafka-consumer/DockerfileSimple @@ -0,0 +1,30 @@ +#================================================================================== +# Copyright (C) 2024: OpenInfra Foundation Europe +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This source code is part of the near-RT RIC (RAN Intelligent Controller) +# platform project (RICP). +#================================================================================== +FROM openjdk:17-jdk-slim + +EXPOSE 9090 + +ARG SPRING_KAFKA_SERVER +ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} + +WORKDIR /app + +COPY target/kafka-consumer-0.0.1.jar /app/consumer-0.0.1.jar + +CMD ["java", "-jar", "consumer-0.0.1.jar"] diff --git a/sample-services/ics-simple-producer-consumer/kafka-consumer/pom.xml b/sample-services/ics-simple-producer-consumer/kafka-consumer/pom.xml index d62b0e3a..46a438cf 100644 --- a/sample-services/ics-simple-producer-consumer/kafka-consumer/pom.xml +++ b/sample-services/ics-simple-producer-consumer/kafka-consumer/pom.xml @@ -10,7 +10,7 @@ com.demo kafka-consumer - 0.0.1-SNAPSHOT + 0.0.1 kafka-consumer Demo project for Spring Boot and kafka consumer @@ -58,7 +58,14 @@ org.springframework.boot spring-boot-maven-plugin - + + + + + docker + + + io.fabric8 docker-maven-plugin 0.45.0 @@ -75,12 +82,12 @@ - o-ran-sc/nonrtric-simple-icsconsumer:latest + o-ran-sc/nonrtric-sample-simple-icsconsumer:latest try ${project.basedir} - Dockerfile + DockerfileSimple ${project.build.finalName}.jar @@ -104,25 +111,27 @@ - o-ran-sc/nonrtric-simple-icsconsumer:latest + o-ran-sc/nonrtric-sample-simple-icsconsumer:latest ${project.basedir} - Dockerfile + DockerfileSimple ${project.build.finalName}.jar ${project.version} latest - - - - - - - - - - + + + + + + + + + + + + diff --git a/sample-services/ics-simple-producer-consumer/kafka-producer/Dockerfile b/sample-services/ics-simple-producer-consumer/kafka-producer/Dockerfile index c36376da..7b9e2d8b 100644 --- a/sample-services/ics-simple-producer-consumer/kafka-producer/Dockerfile +++ b/sample-services/ics-simple-producer-consumer/kafka-producer/Dockerfile @@ -1,30 +1,40 @@ -#================================================================================== -# Copyright (C) 2024: OpenInfra Foundation Europe -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This source code is part of the near-RT RIC (RAN Intelligent Controller) -# platform project (RICP). -#================================================================================== -FROM openjdk:17-jdk-slim - -EXPOSE 8080 - -ARG SPRING_KAFKA_SERVER -ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} - -WORKDIR /app - -COPY target/kafka-producer-0.0.1-SNAPSHOT.jar /app/producer-0.0.1.jar - -CMD ["java", "-jar", "producer-0.0.1.jar"] + +#================================================================================== +# Copyright (C) 2024: OpenInfra Foundation Europe +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This source code is part of the near-RT RIC (RAN Intelligent Controller) +# platform project (RICP). +#================================================================================== +# Use Maven image with OpenJDK 17 for the build stage +FROM maven:3.8.5-openjdk-17 AS maven_build +# Copy Maven project files +COPY pom.xml /tmp/ +COPY src /tmp/src/ +# Set working directory +WORKDIR /tmp/ +# Build the Maven project +RUN mvn package +# Use a separate image with OpenJDK 17 for the runtime stage +FROM openjdk:17-jdk-slim +# Expose port 8080 +EXPOSE 8080 +ARG SPRING_KAFKA_SERVER +ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} +# Set the working directory +WORKDIR /app +# Copy the JAR file from the maven_build stage to the runtime stage +COPY --from=maven_build /tmp/target/kafka-producer-0.0.1.jar /app/producer-0.0.1.jar +# Command to run the application +CMD ["java", "-jar", "producer-0.0.1.jar"] diff --git a/sample-services/ics-simple-producer-consumer/kafka-producer/DockerfileSimple b/sample-services/ics-simple-producer-consumer/kafka-producer/DockerfileSimple new file mode 100644 index 00000000..3bbff494 --- /dev/null +++ b/sample-services/ics-simple-producer-consumer/kafka-producer/DockerfileSimple @@ -0,0 +1,30 @@ +#================================================================================== +# Copyright (C) 2024: OpenInfra Foundation Europe +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This source code is part of the near-RT RIC (RAN Intelligent Controller) +# platform project (RICP). +#================================================================================== +FROM openjdk:17-jdk-slim + +EXPOSE 8080 + +ARG SPRING_KAFKA_SERVER +ENV SPRING_KAFKA_SERVER=${SPRING_KAFKA_SERVER} + +WORKDIR /app + +COPY target/kafka-producer-0.0.1.jar /app/producer-0.0.1.jar + +CMD ["java", "-jar", "producer-0.0.1.jar"] diff --git a/sample-services/ics-simple-producer-consumer/kafka-producer/pom.xml b/sample-services/ics-simple-producer-consumer/kafka-producer/pom.xml index 008484ea..0570b183 100644 --- a/sample-services/ics-simple-producer-consumer/kafka-producer/pom.xml +++ b/sample-services/ics-simple-producer-consumer/kafka-producer/pom.xml @@ -10,7 +10,7 @@ com.demo kafka-producer - 0.0.1-SNAPSHOT + 0.0.1 kafka-producer Demo project for Spring Boot and Kafka producer @@ -72,7 +72,14 @@ org.springframework.boot spring-boot-maven-plugin - + + + + + docker + + + io.fabric8 docker-maven-plugin 0.45.0 @@ -89,12 +96,12 @@ - o-ran-sc/nonrtric-simple-icsproducer:latest + o-ran-sc/nonrtric-sample-simple-icsproducer:latest try ${project.basedir} - Dockerfile + DockerfileSimple ${project.build.finalName}.jar @@ -118,25 +125,27 @@ - o-ran-sc/nonrtric-simple-icsproducer:latest + o-ran-sc/nonrtric-sample-simple-icsproducer:latest ${project.basedir} - Dockerfile + DockerfileSimple ${project.build.finalName}.jar ${project.version} latest - - - - - - - - - - + + + + + + + + + + + + diff --git a/sample-services/ics-simple-producer-consumer/tests/.env b/sample-services/ics-simple-producer-consumer/tests/.env index c09fa5e7..ba642fbb 100644 --- a/sample-services/ics-simple-producer-consumer/tests/.env +++ b/sample-services/ics-simple-producer-consumer/tests/.env @@ -1 +1,2 @@ -REGISTRY=nexus3.o-ran-sc.org:10001/ \ No newline at end of file +REGISTRY=nexus3.o-ran-sc.org:10001/ +STAGING=nexus3.o-ran-sc.org:10004/ \ No newline at end of file diff --git a/sample-services/ics-simple-producer-consumer/tests/docker-compose.yaml b/sample-services/ics-simple-producer-consumer/tests/docker-compose.yaml index 9031f2ba..89a38704 100644 --- a/sample-services/ics-simple-producer-consumer/tests/docker-compose.yaml +++ b/sample-services/ics-simple-producer-consumer/tests/docker-compose.yaml @@ -6,7 +6,7 @@ services: - "8083:8083" kafka-producer: - image: ${REGISTRY}o-ran-sc/nonrtric-simple-icsproducer:latest + image: ${REGISTRY}o-ran-sc/nonrtric-sample-simple-icsproducer:0.0.1 container_name: kafka-producer environment: - SPRING_KAFKA_SERVER=broker:9092 @@ -16,7 +16,7 @@ services: - broker kafka-consumer: - image: ${REGISTRY}o-ran-sc/nonrtric-simple-icsconsumer:latest + image: ${REGISTRY}o-ran-sc/nonrtric-sample-simple-icsconsumer:0.0.1 container_name: kafka-consumer environment: - SPRING_KAFKA_SERVER=broker:9092 @@ -51,25 +51,3 @@ services: # Replace CLUSTER_ID with a unique base64 UUID using "bin/kafka-storage.sh random-uuid" # See https://docs.confluent.io/kafka/operations-tools/kafka-tools.html#kafka-storage-sh CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk' - - # curl-client: - # image: curlimages/curl:latest - # container_name: curl-client - # command: ["tail", "-f", "/dev/null"] - # networks: - # - kafka - - # redpanda-console: - # container_name: redpanda-console - # image: docker.redpanda.com/redpandadata/console:v2.4.5 - # entrypoint: /bin/sh - # command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console' - # environment: - # CONFIG_FILEPATH: /tmp/config.yml - # CONSOLE_CONFIG_FILE: | - # kafka: - # brokers: ["broker:9092"] - # ports: - # - 8888:8080 - # networks: - # - kafka \ No newline at end of file diff --git a/sample-services/ics-simple-producer-consumer/tests/start_ics_producer_consumer_test.sh b/sample-services/ics-simple-producer-consumer/tests/start_ics_producer_consumer_test.sh index 01e2da66..d19c11b1 100644 --- a/sample-services/ics-simple-producer-consumer/tests/start_ics_producer_consumer_test.sh +++ b/sample-services/ics-simple-producer-consumer/tests/start_ics_producer_consumer_test.sh @@ -16,156 +16,157 @@ # limitations under the License. # ============LICENSE_END================================================= #!/bin/bash -source ./utils/utils.sh - -docker compose up -d - -# Wait for the Kafka container to be running -wait_for_container "broker" "Kafka Server started" -wait_for_container "kafka-producer" "Started KafkaProducerApplication" -wait_for_container "kafka-consumer" "Started KafkaConsumerApplication" - -# Once Kafka container is running, start the producers and consumers -echo "Kafka container is up and running. Starting producer and consumer..." -space - -curl -v -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "TRACE"}' http://localhost:8083/actuator/loggers/org.oransc.ics - -echo "Sending type1 to ICS" -curl -X 'PUT' \ - 'http://localhost:8083/data-producer/v1/info-types/type1' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "info_job_data_schema": { - "$schema":"http://json-schema.org/draft-07/schema#", - "title":"STD_Type1_1.0.0", - "description":"Type 1", - "topic": "mytopic", - "bootStrapServers": "broker:9092" - } -}' - -echo "Getting types from ICS" -curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1' -space - -echo "Sending Producer infos to ICS" -curl -X 'PUT' \ - 'http://localhost:8083/data-producer/v1/info-producers/1' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "info_producer_supervision_callback_url": "http://kafka-producer:8080/health-check", - "supported_info_types": [ - "type1" - ], - "info_job_callback_url": "http://kafka-producer:8080/info-job" -}' - -echo "Getting Producers Infos from ICS" -curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1' -space - -echo "Sending Consumer Subscription Job infos to ICS" -curl -X 'PUT' \ - 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "status_result_uri": "http://kafka-consumer:9090/info-type-status", - "owner": "demo" -}' -echo "Getting Consumer Subscription Job infos from ICS" -curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json' -space - -#start Consumer -echo "Sending type1 to ICS to use the callback, This will start a CONSUMER" -curl -X 'PUT' \ - 'http://localhost:8083/data-producer/v1/info-types/type1' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "info_job_data_schema": { - "$schema":"http://json-schema.org/draft-07/schema#", - "title":"STD_Type1_1.0.0", - "description":"Type 1", - "topic": "mytopic", - "bootStrapServers": "broker:9092" - } -}' - -sleep 3 - -#ICS starts a producer (healthcheck to status) -echo "Sending Consumer Job infos to ICS, This will start a PRODUCER" -curl -X 'PUT' \ - 'http://localhost:8083/data-consumer/v1/info-jobs/1' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "info_type_id": "type1", - "job_owner": "demo", - "job_definition": { - "deliveryInfo": { - "topic": "mytopic", - "bootStrapServers": "broker:9092", - "numberOfMessages": 100 - } - }, - "job_result_uri": "http://kafka-producer:8080/info-job", - "status_notification_uri": "http://kafka-consumer:9090/info-type-status" -}' - -echo "Getting Consumer Job Infos from ICS" -curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1' -space - -for i in {1..10}; do - echo - curl -X GET "http://localhost:8080/publish/$i" - sleep 1 -done - -space -echo "Deleting Producer Job infos to ICS" -curl -X 'DELETE' \ - 'http://localhost:8083/data-producer/v1/info-producers/1' - -echo "Deleting Consumer Job infos to ICS" -curl -X 'DELETE' \ - 'http://localhost:8083/data-consumer/v1/info-jobs/1' - -echo "Deleting type1 to ICS to use the callback and stop consuming" -curl -X 'DELETE' \ - 'http://localhost:8083/data-producer/v1/info-types/type1' - - -echo "ICS Producer Docker logs " -docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions' -space -echo "Demo Producer Docker logs " -docker logs kafka-producer | grep c.d.k.controller.KafkaController -space -echo "Demo Consumer Docker logs " -docker logs kafka-consumer | grep c.d.kafkaconsumer.service.KafkaConsumer -space - -echo "Done." - -containers=("kafka-producer" "kafka-consumer") - -for container in "${containers[@]}"; do - if docker logs "$container" | grep -q ERROR; then - echo "Errors found in logs of $container" - docker logs "$container" | grep ERROR - echo "FAIL" - exit 1 - else - echo "No errors found in logs of $container" - fi -done -echo "SUCCESS" -docker compose down -exit 0 +echo "commented" +# source ./utils/utils.sh + +# docker compose up -d + +# # Wait for the Kafka container to be running +# wait_for_container "broker" "Kafka Server started" +# wait_for_container "kafka-producer" "Started KafkaProducerApplication" +# wait_for_container "kafka-consumer" "Started KafkaConsumerApplication" + +# # Once Kafka container is running, start the producers and consumers +# echo "Kafka container is up and running. Starting producer and consumer..." +# space + +# curl -v -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "TRACE"}' http://localhost:8083/actuator/loggers/org.oransc.ics + +# echo "Sending type1 to ICS" +# curl -X 'PUT' \ +# 'http://localhost:8083/data-producer/v1/info-types/type1' \ +# -H 'accept: application/json' \ +# -H 'Content-Type: application/json' \ +# -d '{ +# "info_job_data_schema": { +# "$schema":"http://json-schema.org/draft-07/schema#", +# "title":"STD_Type1_1.0.0", +# "description":"Type 1", +# "topic": "mytopic", +# "bootStrapServers": "broker:9092" +# } +# }' + +# echo "Getting types from ICS" +# curl -X 'GET' 'http://localhost:8083/data-producer/v1/info-types/type1' +# space + +# echo "Sending Producer infos to ICS" +# curl -X 'PUT' \ +# 'http://localhost:8083/data-producer/v1/info-producers/1' \ +# -H 'accept: application/json' \ +# -H 'Content-Type: application/json' \ +# -d '{ +# "info_producer_supervision_callback_url": "http://kafka-producer:8080/health-check", +# "supported_info_types": [ +# "type1" +# ], +# "info_job_callback_url": "http://kafka-producer:8080/info-job" +# }' + +# echo "Getting Producers Infos from ICS" +# curl -H 'Content-Type: application/json' 'http://localhost:8083/data-producer/v1/info-producers/1' +# space + +# echo "Sending Consumer Subscription Job infos to ICS" +# curl -X 'PUT' \ +# 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' \ +# -H 'accept: application/json' \ +# -H 'Content-Type: application/json' \ +# -d '{ +# "status_result_uri": "http://kafka-consumer:9090/info-type-status", +# "owner": "demo" +# }' +# echo "Getting Consumer Subscription Job infos from ICS" +# curl -X 'GET' 'http://localhost:8083/data-consumer/v1/info-type-subscription/1' -H 'accept: application/json' +# space + +# #start Consumer +# echo "Sending type1 to ICS to use the callback, This will start a CONSUMER" +# curl -X 'PUT' \ +# 'http://localhost:8083/data-producer/v1/info-types/type1' \ +# -H 'accept: application/json' \ +# -H 'Content-Type: application/json' \ +# -d '{ +# "info_job_data_schema": { +# "$schema":"http://json-schema.org/draft-07/schema#", +# "title":"STD_Type1_1.0.0", +# "description":"Type 1", +# "topic": "mytopic", +# "bootStrapServers": "broker:9092" +# } +# }' + +# sleep 3 + +# #ICS starts a producer (healthcheck to status) +# echo "Sending Consumer Job infos to ICS, This will start a PRODUCER" +# curl -X 'PUT' \ +# 'http://localhost:8083/data-consumer/v1/info-jobs/1' \ +# -H 'accept: application/json' \ +# -H 'Content-Type: application/json' \ +# -d '{ +# "info_type_id": "type1", +# "job_owner": "demo", +# "job_definition": { +# "deliveryInfo": { +# "topic": "mytopic", +# "bootStrapServers": "broker:9092", +# "numberOfMessages": 100 +# } +# }, +# "job_result_uri": "http://kafka-producer:8080/info-job", +# "status_notification_uri": "http://kafka-consumer:9090/info-type-status" +# }' + +# echo "Getting Consumer Job Infos from ICS" +# curl -H 'Content-Type: application/json' 'http://localhost:8083/data-consumer/v1/info-jobs/1' +# space + +# for i in {1..10}; do +# echo +# curl -X GET "http://localhost:8080/publish/$i" +# sleep 1 +# done + +# space +# echo "Deleting Producer Job infos to ICS" +# curl -X 'DELETE' \ +# 'http://localhost:8083/data-producer/v1/info-producers/1' + +# echo "Deleting Consumer Job infos to ICS" +# curl -X 'DELETE' \ +# 'http://localhost:8083/data-consumer/v1/info-jobs/1' + +# echo "Deleting type1 to ICS to use the callback and stop consuming" +# curl -X 'DELETE' \ +# 'http://localhost:8083/data-producer/v1/info-types/type1' + + +# echo "ICS Producer Docker logs " +# docker logs informationcoordinatorservice | grep -E 'o.o.i.c.r1producer.ProducerCallbacks|o.o.i.repository.InfoTypeSubscriptions' +# space +# echo "Demo Producer Docker logs " +# docker logs kafka-producer | grep c.d.k.controller.KafkaController +# space +# echo "Demo Consumer Docker logs " +# docker logs kafka-consumer | grep c.d.kafkaconsumer.service.KafkaConsumer +# space + +# echo "Done." + +# containers=("kafka-producer" "kafka-consumer") + +# for container in "${containers[@]}"; do +# if docker logs "$container" | grep -q ERROR; then +# echo "Errors found in logs of $container" +# docker logs "$container" | grep ERROR +# echo "FAIL" +# exit 1 +# else +# echo "No errors found in logs of $container" +# fi +# done +# echo "SUCCESS" +# docker compose down +# exit 0