diff --git a/cf-manifests/log-sink-manifest.yml b/cloudfoundry/cf-manifests/log-sink-manifest.yml similarity index 100% rename from cf-manifests/log-sink-manifest.yml rename to cloudfoundry/cf-manifests/log-sink-manifest.yml diff --git a/cf-manifests/partitioning-consumer1-manifest.yml b/cloudfoundry/cf-manifests/partitioning-consumer1-manifest.yml similarity index 100% rename from cf-manifests/partitioning-consumer1-manifest.yml rename to cloudfoundry/cf-manifests/partitioning-consumer1-manifest.yml diff --git a/cf-manifests/partitioning-consumer2-manifest.yml b/cloudfoundry/cf-manifests/partitioning-consumer2-manifest.yml similarity index 100% rename from cf-manifests/partitioning-consumer2-manifest.yml rename to cloudfoundry/cf-manifests/partitioning-consumer2-manifest.yml diff --git a/cf-manifests/partitioning-consumer3-manifest.yml b/cloudfoundry/cf-manifests/partitioning-consumer3-manifest.yml similarity index 100% rename from cf-manifests/partitioning-consumer3-manifest.yml rename to cloudfoundry/cf-manifests/partitioning-consumer3-manifest.yml diff --git a/cf-manifests/partitioning-consumer4-manifest.yml b/cloudfoundry/cf-manifests/partitioning-consumer4-manifest.yml similarity index 100% rename from cf-manifests/partitioning-consumer4-manifest.yml rename to cloudfoundry/cf-manifests/partitioning-consumer4-manifest.yml diff --git a/cf-manifests/partitioning-producer-manifest.yml b/cloudfoundry/cf-manifests/partitioning-producer-manifest.yml similarity index 100% rename from cf-manifests/partitioning-producer-manifest.yml rename to cloudfoundry/cf-manifests/partitioning-producer-manifest.yml diff --git a/cf-manifests/time-source-manifest.yml b/cloudfoundry/cf-manifests/time-source-manifest.yml similarity index 100% rename from cf-manifests/time-source-manifest.yml rename to cloudfoundry/cf-manifests/time-source-manifest.yml diff --git a/cf-manifests/uppercase-processor-manifest.yml b/cloudfoundry/cf-manifests/uppercase-processor-manifest.yml similarity index 100% rename from cf-manifests/uppercase-processor-manifest.yml rename to cloudfoundry/cf-manifests/uppercase-processor-manifest.yml diff --git a/runCFAcceptanceTests.sh b/cloudfoundry/runCFAcceptanceTests.sh similarity index 82% rename from runCFAcceptanceTests.sh rename to cloudfoundry/runCFAcceptanceTests.sh index 0c292b7..5d1140f 100755 --- a/runCFAcceptanceTests.sh +++ b/cloudfoundry/runCFAcceptanceTests.sh @@ -116,15 +116,6 @@ function prepare_partitioning_test_with_rabbit_binder() { FULL_PARTITIONING_CONSUMER3_ROUTE=http://$PARTITIONING_CONSUMER3_ROUTE -# #consumer 4 -# -# cf push -f ./cf-manifests/partitioning-consumer4-manifest.yml -# -# cf app partitioning-consumer4 > /tmp/part-consumer4-route.txt -# -# PARTITIONING_CONSUMER4_ROUTE=`grep routes /tmp/part-consumer4-route.txt | awk '{ print $2 }'` -# -# FULL_PARTITIONING_CONSUMER4_ROUTE=http://$PARTITIONING_CONSUMER4_ROUTE } #Main script starting @@ -135,9 +126,13 @@ echo "Prepare artifacts for ticktock testing" prepare_ticktock_13_with_rabbit_binder $1 $2 $3 $4 $5 $6 -./mvnw -P acceptance-tests clean package -Dtest=TickTock13AcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE +pushd ../spring-cloud-stream-acceptance-tests + +../mvnw clean package -Dtest=TickTock13AcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE BUILD_RETURN_VALUE=$? +popd + cf stop ticktock-time-source cf stop ticktock-log-sink @@ -163,9 +158,13 @@ echo "Prepare artifacts for uppercase transformer testing" prepare_uppercase_transformer_with_rabbit_binder $1 $2 $3 $4 $5 $6 -./mvnw -P acceptance-tests clean package -Dtest=UppercaseTransformerAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE +pushd ../spring-cloud-stream-acceptance-tests + +../mvnw clean package -Dtest=UppercaseTransformerAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE BUILD_RETURN_VALUE=$? +popd + cf stop uppercase-transformer cf delete uppercase-transformer -f @@ -188,21 +187,22 @@ echo "Prepare artifacts for partitions testing" prepare_partitioning_test_with_rabbit_binder $1 $2 $3 $4 $5 $6 -#./mvnw clean package -Dtest=PartitioningAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE -Dpartitioning.consumer4.route=$FULL_PARTITIONING_CONSUMER4_ROUTE -./mvnw -P acceptance-tests clean package -Dtest=PartitioningAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE +pushd ../spring-cloud-stream-acceptance-tests + +../mvnw clean package -Dtest=PartitioningAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE BUILD_RETURN_VALUE=$? +popd + cf stop partitioning-producer cf stop partitioning-consumer1 cf stop partitioning-consumer2 cf stop partitioning-consumer3 -#cf stop partitioning-consumer4 cf delete partitioning-producer -f cf delete partitioning-consumer1 -f cf delete partitioning-consumer2 -f cf delete partitioning-consumer3 -f -#cf delete partitioning-consumer4 -f cf logout @@ -210,7 +210,6 @@ rm /tmp/part-producer-route.txt rm /tmp/part-consumer1-route.txt rm /tmp/part-consumer2-route.txt rm /tmp/part-consumer3-route.txt -#rm /tmp/part-consumer4-route.txt duration=$SECONDS diff --git a/k8s-templates/kafka-deployment.yaml b/kubernetes/k8s-templates/kafka-deployment.yaml similarity index 100% rename from k8s-templates/kafka-deployment.yaml rename to kubernetes/k8s-templates/kafka-deployment.yaml diff --git a/k8s-templates/kafka-svc.yaml b/kubernetes/k8s-templates/kafka-svc.yaml similarity index 100% rename from k8s-templates/kafka-svc.yaml rename to kubernetes/k8s-templates/kafka-svc.yaml diff --git a/k8s-templates/kafka-zk-deployment.yaml b/kubernetes/k8s-templates/kafka-zk-deployment.yaml similarity index 100% rename from k8s-templates/kafka-zk-deployment.yaml rename to kubernetes/k8s-templates/kafka-zk-deployment.yaml diff --git a/k8s-templates/kafka-zk-svc.yaml b/kubernetes/k8s-templates/kafka-zk-svc.yaml similarity index 100% rename from k8s-templates/kafka-zk-svc.yaml rename to kubernetes/k8s-templates/kafka-zk-svc.yaml diff --git a/k8s-templates/log-svc-lb.yaml b/kubernetes/k8s-templates/log-svc-lb.yaml similarity index 100% rename from k8s-templates/log-svc-lb.yaml rename to kubernetes/k8s-templates/log-svc-lb.yaml diff --git a/k8s-templates/log.yaml b/kubernetes/k8s-templates/log.yaml similarity index 100% rename from k8s-templates/log.yaml rename to kubernetes/k8s-templates/log.yaml diff --git a/k8s-templates/partitioning-consumer1-sample-kafka-svc-lb.yaml b/kubernetes/k8s-templates/partitioning-consumer1-sample-kafka-svc-lb.yaml similarity index 100% rename from k8s-templates/partitioning-consumer1-sample-kafka-svc-lb.yaml rename to kubernetes/k8s-templates/partitioning-consumer1-sample-kafka-svc-lb.yaml diff --git a/k8s-templates/partitioning-consumer1-sample-kafka.yaml b/kubernetes/k8s-templates/partitioning-consumer1-sample-kafka.yaml similarity index 100% rename from k8s-templates/partitioning-consumer1-sample-kafka.yaml rename to kubernetes/k8s-templates/partitioning-consumer1-sample-kafka.yaml diff --git a/k8s-templates/partitioning-consumer2-sample-kafka-svc-lb.yaml b/kubernetes/k8s-templates/partitioning-consumer2-sample-kafka-svc-lb.yaml similarity index 100% rename from k8s-templates/partitioning-consumer2-sample-kafka-svc-lb.yaml rename to kubernetes/k8s-templates/partitioning-consumer2-sample-kafka-svc-lb.yaml diff --git a/k8s-templates/partitioning-consumer2-sample-kafka.yaml b/kubernetes/k8s-templates/partitioning-consumer2-sample-kafka.yaml similarity index 100% rename from k8s-templates/partitioning-consumer2-sample-kafka.yaml rename to kubernetes/k8s-templates/partitioning-consumer2-sample-kafka.yaml diff --git a/k8s-templates/partitioning-consumer3-sample-kafka-svc-lb.yaml b/kubernetes/k8s-templates/partitioning-consumer3-sample-kafka-svc-lb.yaml similarity index 100% rename from k8s-templates/partitioning-consumer3-sample-kafka-svc-lb.yaml rename to kubernetes/k8s-templates/partitioning-consumer3-sample-kafka-svc-lb.yaml diff --git a/k8s-templates/partitioning-consumer3-sample-kafka.yaml b/kubernetes/k8s-templates/partitioning-consumer3-sample-kafka.yaml similarity index 100% rename from k8s-templates/partitioning-consumer3-sample-kafka.yaml rename to kubernetes/k8s-templates/partitioning-consumer3-sample-kafka.yaml diff --git a/k8s-templates/partitioning-producer-sample-kafka-svc-lb.yaml b/kubernetes/k8s-templates/partitioning-producer-sample-kafka-svc-lb.yaml similarity index 100% rename from k8s-templates/partitioning-producer-sample-kafka-svc-lb.yaml rename to kubernetes/k8s-templates/partitioning-producer-sample-kafka-svc-lb.yaml diff --git a/k8s-templates/partitioning-producer-sample-kafka.yaml b/kubernetes/k8s-templates/partitioning-producer-sample-kafka.yaml similarity index 100% rename from k8s-templates/partitioning-producer-sample-kafka.yaml rename to kubernetes/k8s-templates/partitioning-producer-sample-kafka.yaml diff --git a/k8s-templates/time-svc-lb.yaml b/kubernetes/k8s-templates/time-svc-lb.yaml similarity index 100% rename from k8s-templates/time-svc-lb.yaml rename to kubernetes/k8s-templates/time-svc-lb.yaml diff --git a/k8s-templates/time.yaml b/kubernetes/k8s-templates/time.yaml similarity index 100% rename from k8s-templates/time.yaml rename to kubernetes/k8s-templates/time.yaml diff --git a/k8s-templates/uppercase-transformer-kafka-svc-lb.yaml b/kubernetes/k8s-templates/uppercase-transformer-kafka-svc-lb.yaml similarity index 100% rename from k8s-templates/uppercase-transformer-kafka-svc-lb.yaml rename to kubernetes/k8s-templates/uppercase-transformer-kafka-svc-lb.yaml diff --git a/k8s-templates/uppercase-transformer-kafka.yaml b/kubernetes/k8s-templates/uppercase-transformer-kafka.yaml similarity index 100% rename from k8s-templates/uppercase-transformer-kafka.yaml rename to kubernetes/k8s-templates/uppercase-transformer-kafka.yaml diff --git a/runK8SAcceptanceTests.sh b/kubernetes/runK8SAcceptanceTests.sh similarity index 73% rename from runK8SAcceptanceTests.sh rename to kubernetes/runK8SAcceptanceTests.sh index 0a57340..68f59e5 100755 --- a/runK8SAcceptanceTests.sh +++ b/kubernetes/runK8SAcceptanceTests.sh @@ -90,25 +90,6 @@ function prepare_uppercase_transformer_with_kafka_binder() { function prepare_partitioning_test_with_kafka_binder() { -grep $CLUSTER_NAME ~/.kube/config - grep_result=$? - if [ $grep_result = 0 ]; then - kubectl config delete-context $CLUSTER_NAME - fi - - gcloud container --project ${PROJECT_NAME} clusters create ${CLUSTER_NAME} --zone ${GKE_ZONE} --machine-type "custom-2-4096" \ - --cluster-version ${CLUSTER_VERSION} --num-nodes "2" --image-type "COS" --disk-size "25" --network "default" \ - --enable-cloud-logging --enable-cloud-monitoring \ - --scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" - - gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${GKE_ZONE} --project ${PROJECT_NAME} - - kubectl create -f k8s-templates/kafka-zk-deployment.yaml - kubectl create -f k8s-templates/kafka-zk-svc.yaml - - kubectl create -f k8s-templates/kafka-deployment.yaml - kubectl create -f k8s-templates/kafka-svc.yaml - kubectl create -f k8s-templates/partitioning-consumer1-sample-kafka.yaml kubectl create -f k8s-templates/partitioning-consumer1-sample-kafka-svc-lb.yaml @@ -179,58 +160,66 @@ PROJECT_NAME=$1 CLUSTER_NAME=$2 GKE_ZONE=$3 CLUSTER_VERSION=$4 -# -#prepare_ticktock_latest_with_kafka_binder ${PROJECT_NAME} ${CLUSTER_NAME} ${GKE_ZONE} ${CLUSTER_VERSION} -# -#./mvnw -P acceptance-tests clean package -Dtest=TickTockLatestAcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE -#BUILD_RETURN_VALUE=$? -# -#delete_acceptance_test_components -# -#if [ "$BUILD_RETURN_VALUE" != 0 ] -#then -# echo "Early exit due to test failure in ticktock tests" -# duration=$SECONDS -# -# echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." -# -# delete_kafka_components -# -# delete_test_cluster ${CLUSTER_NAME} ${GKE_ZONE} ${PROJECT_NAME} -# -# exit $BUILD_RETURN_VALUE -#fi -# -# -#prepare_uppercase_transformer_with_kafka_binder -# -#./mvnw -P acceptance-tests clean package -Dtest=UppercaseTransformerAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -# -#BUILD_RETURN_VALUE=$? -# -#delete_acceptance_test_components -# -#if [ "$BUILD_RETURN_VALUE" != 0 ] -#then -# echo "Early exit due to test failure in ticktock tests" -# duration=$SECONDS -# -# echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." -# -# delete_kafka_components -# -# delete_test_cluster ${CLUSTER_NAME} ${GKE_ZONE} ${PROJECT_NAME} -# -# exit $BUILD_RETURN_VALUE -#fi +prepare_ticktock_latest_with_kafka_binder ${PROJECT_NAME} ${CLUSTER_NAME} ${GKE_ZONE} ${CLUSTER_VERSION} + +pushd ../spring-cloud-stream-acceptance-tests + +../mvnw clean package -Dtest=TickTockLatestAcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE +BUILD_RETURN_VALUE=$? + +popd + +delete_acceptance_test_components + +if [ "$BUILD_RETURN_VALUE" != 0 ] +then + echo "Early exit due to test failure in ticktock tests" + duration=$SECONDS + + echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." + + delete_kafka_components + + delete_test_cluster ${CLUSTER_NAME} ${GKE_ZONE} ${PROJECT_NAME} + + exit $BUILD_RETURN_VALUE +fi + +prepare_uppercase_transformer_with_kafka_binder + +pushd ../spring-cloud-stream-acceptance-tests + +../mvnw clean package -Dtest=UppercaseTransformerAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE +BUILD_RETURN_VALUE=$? + +popd + +delete_acceptance_test_components + +if [ "$BUILD_RETURN_VALUE" != 0 ] +then + echo "Early exit due to test failure in ticktock tests" + duration=$SECONDS + + echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." + + delete_kafka_components + + delete_test_cluster ${CLUSTER_NAME} ${GKE_ZONE} ${PROJECT_NAME} + + exit $BUILD_RETURN_VALUE +fi prepare_partitioning_test_with_kafka_binder ${PROJECT_NAME} ${CLUSTER_NAME} ${GKE_ZONE} ${CLUSTER_VERSION} -./mvnw -P acceptance-tests clean package -Dtest=PartitioningKafkaAcceptanceTests -Dmaven.test.skip=false -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE +pushd ../spring-cloud-stream-acceptance-tests +../mvnw clean package -Dtest=PartitioningKafkaAcceptanceTests -Dmaven.test.skip=false -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE BUILD_RETURN_VALUE=$? +popd + delete_acceptance_test_components if [ "$BUILD_RETURN_VALUE" != 0 ] diff --git a/pom.xml b/pom.xml index 19645c5..06fbab4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,25 +28,7 @@ - - - - - - - - - - default - - true - - - custom-stream-apps - spring-cloud-stream-acceptance-tests - - acceptance-tests diff --git a/spring-cloud-stream-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningKafkaAcceptanceTests.java b/spring-cloud-stream-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningKafkaAcceptanceTests.java index c3cf55a..f8278f1 100644 --- a/spring-cloud-stream-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningKafkaAcceptanceTests.java +++ b/spring-cloud-stream-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningKafkaAcceptanceTests.java @@ -26,24 +26,19 @@ public class PartitioningKafkaAcceptanceTests extends AbstractAcceptanceTests { String consumer1Url = System.getProperty("partitioning.consumer1.route"); String consumer2Url = System.getProperty("partitioning.consumer2.route"); String consumer3Url = System.getProperty("partitioning.consumer3.route"); - //String consumer4Url = System.getProperty("partitioning.consumer4.route"); Future future1 = verifyPartitions("Partitioning Consumer-1", consumer1Url, "f received from partition 0", "g received from partition 0", "h received from partition 0"); Future future2 = verifyPartitions("Partitioning Consumer-2", consumer2Url, - "fo received from 1", + "fo received from partition 1", "go received from partition 1", "ho received from partition 1"); Future future3 = verifyPartitions("Partitioning Consumer-3", consumer3Url, - "foo received from 2", - "goo received from 2", + "foo received from partition 2", + "goo received from partition 2", "hoo received from partition 2"); -// Future future4 = verifyPartitions("Partitioning Consumer-4",consumer4Url, -// "fooz received from partition partitioned.destination.myGroup-3", -// "gooz received from partition partitioned.destination.myGroup-3", -// "hooz received from partition partitioned.destination.myGroup-3"); verifyResults(future1, future2, future3); } @@ -55,22 +50,6 @@ public class PartitioningKafkaAcceptanceTests extends AbstractAcceptanceTests { Future submit = executorService.submit(() -> { boolean found = waitForLogEntry(consumerMsg, consumerRoute, entries); -// if (found) { -// partitions.add(consumerRoute); -// } -// if (!found) { -// found = waitForLogEntry(consumerMsg, consumer2Route, entries); -// if (found) { -// partitions.add(consumer2Route); -// } -// } -// if (!found) { -// found = waitForLogEntry(consumerMsg, consumer3Route, entries); -// if (found) { -// partitions.add(consumer3Route); -// } -// } - if (!found) { fail("Could not find the test data in the logs"); } diff --git a/spring-cloud-stream-cf-acceptance-tests/.mvn b/spring-cloud-stream-cf-acceptance-tests/.mvn deleted file mode 120000 index 19172e1..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/.mvn +++ /dev/null @@ -1 +0,0 @@ -../.mvn \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/README.adoc b/spring-cloud-stream-cf-acceptance-tests/README.adoc deleted file mode 100644 index 0fe236e..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -=== Samples Acceptance Tests - -This is an acceptance test module for the samples in this repo. -The tests launch the Spring Cloud Stream samples as stand alone Spring Boot applications and then verify their correctness. - -By default, these tests are not run as part of the normal build, as they are mainly intended for continuous integration testing with ongoing changes in the framework. - -In order to run the tests, we recommend to run the script `./runAcceptanceTest.sh` in this directory. -The script will launch all the middleware and other components in docker containers first. -Then it builds the applications and run them. \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/log-sink-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/log-sink-manifest.yml deleted file mode 100644 index 416c166..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/log-sink-manifest.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -applications: -- name: ticktock-log-sink - host: ticktock-log-sink - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/ticktock-log-sink.jar - env: -# LOGGING_FILE: ticktocklog.log -# MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile -# ENDPOINTS_LOGFILE_SENSITIVE: false -# SPRING_CLOUD_STREAM_BINDINGS_INPUT_DESTINATION: ticktock - logging.file: ticktocklog.log - endpoints.logfile.sensitive: false - spring.cloud.stream.bindings.input.destination: ticktock - #LOG_EXPRESSION: "'TICKTOCK - TIMESTAMP: '.concat(payload)" - log.expression: "'TICKTOCK - TIMESTAMP: '.concat(payload)" -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer1-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer1-manifest.yml deleted file mode 100644 index 474e9ea..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer1-manifest.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -applications: -- name: partitioning-consumer1 - host: partitioning-consumer1 - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/partitioning-consumer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: partconsumer1.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer2-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer2-manifest.yml deleted file mode 100644 index 89f5d15..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer2-manifest.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -applications: -- name: partitioning-consumer2 - host: partitioning-consumer2 - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/partitioning-consumer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: partconsumer2.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile - SPRING_CLOUD_STREAM_BINDINGS_INPUT_CONSUMER_INSTANCEINDEX: 1 -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer3-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer3-manifest.yml deleted file mode 100644 index 516c30b..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer3-manifest.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -applications: -- name: partitioning-consumer3 - host: partitioning-consumer3 - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/partitioning-consumer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: partconsumer3.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile - SPRING_CLOUD_STREAM_BINDINGS_INPUT_CONSUMER_INSTANCEINDEX: 2 -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer4-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer4-manifest.yml deleted file mode 100644 index 0b2cdef..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-consumer4-manifest.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -applications: -- name: partitioning-consumer4 - host: partitioning-consumer4 - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/partitioning-consumer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: partconsumer4.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile - SPRING_CLOUD_STREAM_BINDINGS_INPUT_CONSUMER_INSTANCEINDEX: 3 -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-producer-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-producer-manifest.yml deleted file mode 100644 index 3ce9be2..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/partitioning-producer-manifest.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -applications: -- name: partitioning-producer - host: partitioning-producer - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/partitioning-producer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: partproducer.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/time-source-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/time-source-manifest.yml deleted file mode 100644 index c15cc4a..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/time-source-manifest.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -applications: -- name: ticktock-time-source - host: ticktock-time-source - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/ticktock-time-source.jar - env: -# LOGGING_FILE: ticktocktime.log -# MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile -# ENDPOINTS_LOGFILE_SENSITIVE: false - logging.file: ticktocklog.log - endpoints.logfile.sensitive: false - #SPRING_CLOUD_STREAM_BINDINGS_OUTPUT_DESTINATION: ticktock - spring.cloud.stream.bindings.output.destination: ticktock -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/manifests/uppercase-processor-manifest.yml b/spring-cloud-stream-cf-acceptance-tests/manifests/uppercase-processor-manifest.yml deleted file mode 100644 index 5c772dc..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/manifests/uppercase-processor-manifest.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -applications: -- name: uppercase-transformer - host: uppercase-transformer - memory: 2G - disk_quota: 2G - instances: 1 - path: /tmp/uppercase-transformer-rabbit.jar - env: - SPRING_APPLICATION_JSON: '{"maven": { "remote-repositories": { "repo1": { "url": "https://repo.spring.io/libs-snapshot"} } } }' - LOGGING_FILE: uppercase.log - MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: logfile -services: -- scst-rabbit \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/mvnw b/spring-cloud-stream-cf-acceptance-tests/mvnw deleted file mode 100755 index 6efc7bd..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/mvnw +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -"$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" - diff --git a/spring-cloud-stream-cf-acceptance-tests/mvnw.cmd b/spring-cloud-stream-cf-acceptance-tests/mvnw.cmd deleted file mode 100644 index b0dc0e7..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/mvnw.cmd +++ /dev/null @@ -1,145 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/spring-cloud-stream-cf-acceptance-tests/pom.xml b/spring-cloud-stream-cf-acceptance-tests/pom.xml deleted file mode 100644 index 11e5b7b..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - spring-cloud-stream-cf-acceptance-tests - 0.0.1-SNAPSHOT - jar - spring-cloud-stream-cf-acceptance-tests - Spring Cloud Stream CF Acceptance Tests - - - io.spring.cloud.stream.acceptance - spring-cloud-stream-acceptance-tests-parent - 0.0.1-SNAPSHOT - ../ - - - - true - - - - - org.springframework.boot - spring-boot-starter-web - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - diff --git a/spring-cloud-stream-cf-acceptance-tests/runCFAcceptanceTests.sh b/spring-cloud-stream-cf-acceptance-tests/runCFAcceptanceTests.sh deleted file mode 100755 index 1c7c610..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/runCFAcceptanceTests.sh +++ /dev/null @@ -1,219 +0,0 @@ - -#!/bin/bash - -# First argument is CF URL ($1) -# Second argument is CF User ($2) -# Third argument is CF Passwrod ($3) -# Fourth argument is CF Org ($4) -# Fifth argument is CF Space ($5) -# Optional sixth argument to skip ssl validation: skip-ssl-validation (No double hiphens (--) in the front) - -pushd () { - command pushd "$@" > /dev/null -} - -popd () { - command popd "$@" > /dev/null -} - -function prepare_ticktock_13_with_rabbit_binder() { - - wget -O /tmp/ticktock-time-source.jar http://repo.spring.io/release/org/springframework/cloud/stream/app/time-source-rabbit/1.3.1.RELEASE/time-source-rabbit-1.3.1.RELEASE.jar - - wget -O /tmp/ticktock-log-sink.jar http://repo.spring.io/release/org/springframework/cloud/stream/app/log-sink-rabbit/1.3.1.RELEASE/log-sink-rabbit-1.3.1.RELEASE.jar - - if [ $6 == "skip-ssl-validation" ] - then - cf login -a $1 --skip-ssl-validation -u $2 -p $3 -o $4 -s $5 - else - cf login -a $1 -u $2 -p $3 -o $4 -s $5 - fi - - cf push -f ./manifests/time-source-manifest.yml - - cf app ticktock-time-source > /tmp/ticktock-time-source-route.txt - - TICKTOCK_TIME_SOURCE_ROUTE=`grep routes /tmp/ticktock-time-source-route.txt | awk '{ print $2 }'` - - FULL_TICKTOCK_TIME_SOURCE_ROUTE=http://$TICKTOCK_TIME_SOURCE_ROUTE - - cf push -f ./manifests/log-sink-manifest.yml - - cf app ticktock-log-sink > /tmp/ticktock-log-sink-route.txt - - TICKTOCK_LOG_SINK_ROUTE=`grep routes /tmp/ticktock-log-sink-route.txt | awk '{ print $2 }'` - - FULL_TICKTOCK_LOG_SINK_ROUTE=http://$TICKTOCK_LOG_SINK_ROUTE -} - -function prepare_uppercase_transformer_with_rabbit_binder() { - - wget -O /tmp/uppercase-transformer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/uppercase-transformer-rabbit/0.0.1-SNAPSHOT/uppercase-transformer-rabbit-0.0.1-SNAPSHOT.jar - - if [ $6 == "skip-ssl-validation" ] - then - cf login -a $1 --skip-ssl-validation -u $2 -p $3 -o $4 -s $5 - else - cf login -a $1 -u $2 -p $3 -o $4 -s $5 - fi - - cf push -f ./manifests/uppercase-processor-manifest.yml - - cf app uppercase-transformer > /tmp/uppercase-route.txt - - UPPERCASE_PROCESSOR_ROUTE=`grep routes /tmp/uppercase-route.txt | awk '{ print $2 }'` - - FULL_UPPERCASE_ROUTE=http://$UPPERCASE_PROCESSOR_ROUTE -} - -function prepare_partitioning_test_with_rabbit_binder() { - - wget -O /tmp/partitioning-producer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/acceptance/partitioning-producer-sample-rabbit/0.0.1-SNAPSHOT/partitioning-producer-sample-rabbit-0.0.1-SNAPSHOT.jar - wget -O /tmp/partitioning-consumer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/acceptance/partitioning-consumer-sample-rabbit/0.0.1-SNAPSHOT/partitioning-consumer-sample-rabbit-0.0.1-SNAPSHOT.jar - - if [ $6 == "skip-ssl-validation" ] - then - cf login -a $1 --skip-ssl-validation -u $2 -p $3 -o $4 -s $5 - else - cf login -a $1 -u $2 -p $3 -o $4 -s $5 - fi - - cf push -f ./manifests/partitioning-producer-manifest.yml - - cf app partitioning-producer > /tmp/part-producer-route.txt - - PARTITIONING_PRODUCER_ROUTE=`grep routes /tmp/part-producer-route.txt | awk '{ print $2 }'` - - FULL_PARTITIONING_PRODUCER_ROUTE=http://$PARTITIONING_PRODUCER_ROUTE - - # consumer 1 - - cf push -f ./manifests/partitioning-consumer1-manifest.yml - - cf app partitioning-consumer1 > /tmp/part-consumer1-route.txt - - PARTITIONING_CONSUMER1_ROUTE=`grep routes /tmp/part-consumer1-route.txt | awk '{ print $2 }'` - - FULL_PARTITIONING_CONSUMER1_ROUTE=http://$PARTITIONING_CONSUMER1_ROUTE - - #consumer 2 - - cf push -f ./manifests/partitioning-consumer2-manifest.yml - - cf app partitioning-consumer2 > /tmp/part-consumer2-route.txt - - PARTITIONING_CONSUMER2_ROUTE=`grep routes /tmp/part-consumer2-route.txt | awk '{ print $2 }'` - - FULL_PARTITIONING_CONSUMER2_ROUTE=http://$PARTITIONING_CONSUMER2_ROUTE - - #consumer 3 - - cf push -f ./manifests/partitioning-consumer3-manifest.yml - - cf app partitioning-consumer3 > /tmp/part-consumer3-route.txt - - PARTITIONING_CONSUMER3_ROUTE=`grep routes /tmp/part-consumer3-route.txt | awk '{ print $2 }'` - - FULL_PARTITIONING_CONSUMER3_ROUTE=http://$PARTITIONING_CONSUMER3_ROUTE - - #consumer 4 - -# cf push -f ./manifests/partitioning-consumer4-manifest.yml -# -# cf app partitioning-consumer4 > /tmp/part-consumer4-route.txt -# -# PARTITIONING_CONSUMER4_ROUTE=`grep routes /tmp/part-consumer4-route.txt | awk '{ print $2 }'` -# -# FULL_PARTITIONING_CONSUMER4_ROUTE=http://$PARTITIONING_CONSUMER4_ROUTE -} - -#Main script starting - -SECONDS=0 - -echo "Prepare artifacts for ticktock testing" - -prepare_ticktock_13_with_rabbit_binder $1 $2 $3 $4 $5 $6 - -./mvnw clean package -Dtest=TickTockCFAcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE -BUILD_RETURN_VALUE=$? - -cf stop ticktock-time-source -cf stop ticktock-log-sink - -cf delete ticktock-time-source -f -cf delete ticktock-log-sink -f - -cf logout - -rm /tmp/ticktock-time-source-route.txt -rm /tmp/ticktock-log-sink-route.txt - -if [ "$BUILD_RETURN_VALUE" != 0 ] -then - echo "Early exit due to test failure in ticktock tests" - duration=$SECONDS - - echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." - - exit $BUILD_RETURN_VALUE -fi - -echo "Prepare artifacts for uppercase transformer testing" - -prepare_uppercase_transformer_with_rabbit_binder $1 $2 $3 $4 $5 $6 - -./mvnw clean package -Dtest=UppercaseTransformerCFAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -BUILD_RETURN_VALUE=$? - -cf stop uppercase-transformer - -cf delete uppercase-transformer -f - -cf logout - -rm /tmp/uppercase-route.txt - -if [ "$BUILD_RETURN_VALUE" != 0 ] -then - echo "Early exit due to test failure in uppercase transformer" - duration=$SECONDS - - echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." - - exit $BUILD_RETURN_VALUE -fi - -echo "Prepare artifacts for partitions testing" - -prepare_partitioning_test_with_rabbit_binder $1 $2 $3 $4 $5 $6 - -./mvnw clean package -Dtest=PartitioningCFAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE -#./mvnw clean package -Dtest=PartitioningCFAcceptanceTests -Dmaven.test.skip=false -Duppercase.processor.route=$FULL_UPPERCASE_ROUTE -Dpartitioning.producer.route=$FULL_PARTITIONING_PRODUCER_ROUTE -Dpartitioning.consumer1.route=$FULL_PARTITIONING_CONSUMER1_ROUTE -Dpartitioning.consumer2.route=$FULL_PARTITIONING_CONSUMER2_ROUTE -Dpartitioning.consumer3.route=$FULL_PARTITIONING_CONSUMER3_ROUTE -Dpartitioning.consumer4.route=$FULL_PARTITIONING_CONSUMER4_ROUTE -BUILD_RETURN_VALUE=$? - -cf stop partitioning-producer -cf stop partitioning-consumer1 -cf stop partitioning-consumer2 -cf stop partitioning-consumer3 -#cf stop partitioning-consumer4 - -cf delete partitioning-producer -f -cf delete partitioning-consumer1 -f -cf delete partitioning-consumer2 -f -cf delete partitioning-consumer3 -f -#cf delete partitioning-consumer4 -f - -cf logout - -rm /tmp/part-producer-route.txt -rm /tmp/part-consumer1-route.txt -rm /tmp/part-consumer2-route.txt -rm /tmp/part-consumer3-route.txt -#rm /tmp/part-consumer4-route.txt - -duration=$SECONDS - -echo "Cumulative Build Time Across All Tests: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." - -exit $BUILD_RETURN_VALUE \ No newline at end of file diff --git a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractCFAcceptanceTests.java b/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractCFAcceptanceTests.java deleted file mode 100644 index 8d22cad..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractCFAcceptanceTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.stream.Stream; - - -/** - * @author Soby Chacko - */ -abstract class AbstractCFAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(AbstractCFAcceptanceTests.class); - - boolean waitForLogEntry(boolean noBoot2, String app, String route, String... entries) { - return waitForLogEntryInResource(noBoot2, app, route, entries); - } - - boolean waitForLogEntry(String app, String route, String... entries) { - return waitForLogEntryInResource(false, app, route, entries); - } - - private String getLog(String url) { - RestTemplate restTemplate = new RestTemplate(); - String logFileUrl = String.format("%s/logfile", url); - String log = null; - try { - log = restTemplate.getForObject(logFileUrl, String.class); - if (log == null) { - logger.info("Unable to retrieve logfile from '" + logFileUrl); - } else { - logger.info("Retrieved logfile from '" + logFileUrl); - } - } catch (HttpClientErrorException e) { - logger.info("Failed to access logfile from '" + logFileUrl + "' due to : " + e.getMessage()); - } catch (Exception e) { - logger.warn("Error while trying to access logfile from '" + logFileUrl + "' due to : " + e); - } - return log; - } - - private boolean waitForLogEntryInResource(boolean noBoot2, String app, String route, String... entries) { - logger.info("Looking for '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app + " - " + route); - long timeout = System.currentTimeMillis() + (30 * 1000); - boolean exists = false; - while (!exists && System.currentTimeMillis() < timeout) { - try { - Thread.sleep(7 * 1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IllegalStateException(e.getMessage(), e); - } - logger.info("Polling to get log file. Remaining poll time = " - + (timeout - System.currentTimeMillis() + " ms.")); - String log = noBoot2 ? getLog(route) : getLog(route + "/actuator"); - if (log != null) { - if (Stream.of(entries).allMatch(s -> log.contains(s))) { - exists = true; - } - } - } - if (exists) { - logger.info("Matched all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for app " + app); - } else { - logger.error("ERROR: Couldn't find all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app); - } - return exists; - } - -} diff --git a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningCFAcceptanceTests.java b/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningCFAcceptanceTests.java deleted file mode 100644 index d4f26e4..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningCFAcceptanceTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import static org.junit.Assert.fail; - -/** - * Do not run these tests as part of an IDE build or individually. - * These are acceptance tests for the spring cloud stream samples. - * The recommended way to run these tests are using the runAcceptanceTests.sh script in this module. - * More about running that script can be found in the README. - * - * @author Soby Chacko - */ -public class PartitioningCFAcceptanceTests extends AbstractCFAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(PartitioningCFAcceptanceTests.class); - - @Test - public void testPartitioningWith4ConsumersRabbit() throws Exception { - - Thread.sleep(10_000); - - String prodUrl = System.getProperty("partitioning.producer.route"); - - boolean foundLogs = waitForLogEntry("Partitioning producer", prodUrl, "Started PartProducerApplication in"); - if(!foundLogs) { - fail("Did not find the logging messages."); - } - - String consumer1Url = System.getProperty("partitioning.consumer1.route"); - String consumer2Url = System.getProperty("partitioning.consumer2.route"); - String consumer3Url = System.getProperty("partitioning.consumer3.route"); - //String consumer4Url = System.getProperty("partitioning.consumer4.route"); - - Future future1 = verifyPartitions("Partitioning Consumer-1", consumer1Url, - "f received from partition partitioned.destination.myGroup-0", - "g received from partition partitioned.destination.myGroup-0", - "h received from partition partitioned.destination.myGroup-0"); - Future future2 = verifyPartitions("Partitioning Consumer-2", consumer2Url, - "fo received from partition partitioned.destination.myGroup-1", - "go received from partition partitioned.destination.myGroup-1", - "ho received from partition partitioned.destination.myGroup-1"); - Future future3 = verifyPartitions("Partitioning Consumer-3",consumer3Url, - "foo received from partition partitioned.destination.myGroup-2", - "goo received from partition partitioned.destination.myGroup-2", - "hoo received from partition partitioned.destination.myGroup-2"); -// Future future4 = verifyPartitions("Partitioning Consumer-4",consumer4Url, -// "fooz received from partition partitioned.destination.myGroup-3", -// "gooz received from partition partitioned.destination.myGroup-3", -// "hooz received from partition partitioned.destination.myGroup-3"); - - verifyResults(future1, future2, future3); - } - - private Future verifyPartitions(String consumer1Msg, String consumerRoute, - String... entries) { - - ExecutorService executorService = Executors.newSingleThreadExecutor(); - - Future submit = executorService.submit(() -> { - boolean found = waitForLogEntry(consumer1Msg, consumerRoute, entries); - if (!found) { - fail("Could not find the test data in the logs"); - } - }); - - executorService.shutdown(); - return submit; - } - - private void verifyResults(Future... futures) throws Exception { - for (Future future : futures) { - try { - future.get(); - } - catch (Exception e) { - throw e; - } - } - } -} diff --git a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockCFAcceptanceTests.java b/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockCFAcceptanceTests.java deleted file mode 100644 index 72f3957..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockCFAcceptanceTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * @author Soby Chacko - */ -public class TickTockCFAcceptanceTests extends AbstractCFAcceptanceTests { - - @Test - public void testTickTock13Rabbit() { - - String timeSourceUrl = System.getProperty("time.source.route"); - String logSinkUrl = System.getProperty("log.sink.route"); - - boolean foundLogs = waitForLogEntry(true, "Time Source", timeSourceUrl, "Started TimeSource"); - if(!foundLogs) { - fail("Did not find the time source started logging message."); - } - - foundLogs = waitForLogEntry(true,"Log Sink", logSinkUrl, "Started LogSink"); - if(!foundLogs) { - fail("Did not find the log sink started logging message."); - } - - foundLogs = waitForLogEntry(true,"Log Sink", logSinkUrl, "TICKTOCK - TIMESTAMP:"); - if(!foundLogs) { - fail("Did not find the ticktock messages in log sink"); - } - } - -} diff --git a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/UppercaseTransformerCFAcceptanceTests.java b/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/UppercaseTransformerCFAcceptanceTests.java deleted file mode 100644 index ce17422..0000000 --- a/spring-cloud-stream-cf-acceptance-tests/src/test/java/sample/acceptance/tests/UppercaseTransformerCFAcceptanceTests.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.fail; - -/** - * Do not run these tests as part of an IDE build or individually. - * These are acceptance tests for the spring cloud stream samples. - * The recommended way to run these tests are using the runAcceptanceTests.sh script in this module. - * More about running that script can be found in the README. - * - * @author Soby Chacko - */ -public class UppercaseTransformerCFAcceptanceTests extends AbstractCFAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(UppercaseTransformerCFAcceptanceTests.class); - - @Test - public void testUppercaseTransformerRabbit() { - - String url = System.getProperty("uppercase.processor.route"); - - boolean foundLogs = waitForLogEntry("Uppercase Transformer", url, "Started UppercaseTransformerApplication in", - "Data received: FOO", "Data received: BAR"); - if(!foundLogs) { - fail("Did not find the logging messages."); - } - } -} diff --git a/spring-cloud-stream-k8s-acceptance-tests/.mvn b/spring-cloud-stream-k8s-acceptance-tests/.mvn deleted file mode 120000 index 19172e1..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/.mvn +++ /dev/null @@ -1 +0,0 @@ -../.mvn \ No newline at end of file diff --git a/spring-cloud-stream-k8s-acceptance-tests/README.adoc b/spring-cloud-stream-k8s-acceptance-tests/README.adoc deleted file mode 100644 index cb0f8e8..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -=== Samples Acceptance Tests - -This is an accptance test module for the samples in this repo. -The tests launch the Spring Cloud Stream samples as stand alone Spring Boot applications and then verify their correctness. - -By default, these tests are not run as part of the normal build, as they are mainly intended for continuous integration testing with ongoing changes in the framework. - -In order to run the tests, we recommend to run the script `./runAcceptanceTest.sh` in this directory. -The script will launch all the middleware and other components in docker containers first. -Then it builds the applications and run them. \ No newline at end of file diff --git a/spring-cloud-stream-k8s-acceptance-tests/mvnw b/spring-cloud-stream-k8s-acceptance-tests/mvnw deleted file mode 100755 index 6efc7bd..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/mvnw +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -"$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" - diff --git a/spring-cloud-stream-k8s-acceptance-tests/mvnw.cmd b/spring-cloud-stream-k8s-acceptance-tests/mvnw.cmd deleted file mode 100644 index b0dc0e7..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/mvnw.cmd +++ /dev/null @@ -1,145 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/spring-cloud-stream-k8s-acceptance-tests/pom.xml b/spring-cloud-stream-k8s-acceptance-tests/pom.xml deleted file mode 100644 index 355985b..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - spring-cloud-stream-k8s-acceptance-tests - 0.0.1-SNAPSHOT - jar - spring-cloud-stream-k8s-acceptance-tests - Spring Cloud Stream K8S Acceptance Tests - - - io.spring.cloud.stream.acceptance - spring-cloud-stream-acceptance-tests-parent - 0.0.1-SNAPSHOT - ../ - - - - true - - - - - org.springframework.boot - spring-boot-starter-web - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - diff --git a/spring-cloud-stream-k8s-acceptance-tests/runAcceptanceTests.sh b/spring-cloud-stream-k8s-acceptance-tests/runAcceptanceTests.sh deleted file mode 100755 index a52ff7d..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/runAcceptanceTests.sh +++ /dev/null @@ -1,127 +0,0 @@ - -#!/bin/bash - -# First argument is GKE Project -# Second argument is GKE Cluster -# Third argument is GKE Zone -# Fourth argument is GKE Cluster version - -pushd () { - command pushd "$@" > /dev/null -} - -popd () { - command popd "$@" > /dev/null -} - -function netcat_port() { - local READY_FOR_TESTS=1 - for i in $( seq 1 "${RETRIES}" ); do - nc -w1 ${1} $2 &2 - sleep "${WAIT_TIME}" - done - return ${READY_FOR_TESTS} -} - -function prepare_ticktock_latest_with_kafka_binder() { - - grep $CLUSTER_NAME ~/.kube/config - grep_result=$? - if [ $grep_result = 0 ]; then - kubectl config delete-context $CLUSTER_NAME - fi - - gcloud container --project ${PROJECT_NAME} clusters create ${CLUSTER_NAME} --zone ${GKE_ZONE} --machine-type "custom-2-4096" \ - --cluster-version ${CLUSTER_VERSION} --num-nodes "2" --image-type "COS" --disk-size "25" --network "default" \ - --enable-cloud-logging --enable-cloud-monitoring \ - --scopes "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" - - gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${GKE_ZONE} --project ${PROJECT_NAME} - - kubectl create -f templates/kafka-zk-deployment.yaml - kubectl create -f templates/kafka-zk-svc.yaml - - kubectl create -f templates/kafka-deployment.yaml - kubectl create -f templates/kafka-svc.yaml - - kubectl create -f templates/time.yaml - kubectl create -f templates/time-svc-lb.yaml - - kubectl create -f templates/log.yaml - kubectl create -f templates/log-svc-lb.yaml - - READY_FOR_TESTS=1 - for i in $( seq 1 "${RETRIES}" ); do - TIME_SOURCE_SERVER_URI=$(kubectl get service time | awk '{print $4}' | grep -v EXTERNAL-IP) - LOG_SINK_SERVER_URI=$(kubectl get service log | awk '{print $4}' | grep -v EXTERNAL-IP) - [ '' != $TIME_SOURCE_SERVER_URI ] && [ '' != $LOG_SINK_SERVER_URI ] && READY_FOR_TESTS=0 && break - echo "Waiting for server external ip for time source and log sinks. Attempt #$i/${RETRIES}... will try again in [${WAIT_TIME}] seconds" >&2 - sleep "${WAIT_TIME}" - done - TIME_SOURCE_SERVER_URI=$(kubectl get service time | awk '{print $4}' | grep -v EXTERNAL-IP) - LOG_SINK_SERVER_URI=$(kubectl get service log | awk '{print $4}' | grep -v EXTERNAL-IP) - - $(netcat_port ${TIME_SOURCE_SERVER_URI} 80) - $(netcat_port ${LOG_SINK_SERVER_URI} 80) - - FULL_TICKTOCK_TIME_SOURCE_ROUTE=http://$TIME_SOURCE_SERVER_URI - FULL_TICKTOCK_LOG_SINK_ROUTE=http://$LOG_SINK_SERVER_URI -} - -function delete_ticktock_components() { - - kubectl delete pod,deployment,rc,service -l type="acceptance-tests" -} - -function delete_kafka_components() { - - kubectl delete pod,deployment,rc,service -l app="kafka" -} - -function delete_test_cluster() { - - gcloud container clusters delete ${CLUSTER_NAME} --zone ${GKE_ZONE} --project ${PROJECT_NAME} --quiet - -} - -#Main script starting - -SECONDS=0 - -echo "Prepare artifacts for ticktock testing" - -WAIT_TIME="${WAIT_TIME:-5}" -RETRIES="${RETRIES:-60}" - -PROJECT_NAME=$1 -CLUSTER_NAME=$2 -GKE_ZONE=$3 -CLUSTER_VERSION=$4 - -prepare_ticktock_latest_with_kafka_binder ${PROJECT_NAME} ${CLUSTER_NAME} ${GKE_ZONE} ${CLUSTER_VERSION} - -./mvnw clean package -Dtest=TickTockK8SAcceptanceTests -Dmaven.test.skip=false -Dtime.source.route=$FULL_TICKTOCK_TIME_SOURCE_ROUTE -Dlog.sink.route=$FULL_TICKTOCK_LOG_SINK_ROUTE -BUILD_RETURN_VALUE=$? - -delete_ticktock_components - -delete_kafka_components - -delete_test_cluster ${CLUSTER_NAME} ${GKE_ZONE} ${PROJECT_NAME} - -if [ "$BUILD_RETURN_VALUE" != 0 ] -then - echo "Early exit due to test failure in ticktock tests" - duration=$SECONDS - - echo "Total time: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." - - exit $BUILD_RETURN_VALUE -fi - -duration=$SECONDS - -echo "Cumulative Build Time Across All Tests: Build took $(($duration / 60)) minutes and $(($duration % 60)) seconds to complete." - -exit $BUILD_RETURN_VALUE \ No newline at end of file diff --git a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractK8SAcceptanceTests.java b/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractK8SAcceptanceTests.java deleted file mode 100644 index 6e0fdbd..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractK8SAcceptanceTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.stream.Stream; - - -/** - * @author Soby Chacko - */ -abstract class AbstractK8SAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(AbstractK8SAcceptanceTests.class); - - boolean waitForLogEntry(boolean noBoot2, String app, String route, String... entries) { - return waitForLogEntryInResource(noBoot2, app, route, entries); - } - - boolean waitForLogEntry(String app, String route, String... entries) { - return waitForLogEntryInResource(false, app, route, entries); - } - - private String getLog(String url) { - RestTemplate restTemplate = new RestTemplate(); - String logFileUrl = String.format("%s/logfile", url); - String log = null; - try { - log = restTemplate.getForObject(logFileUrl, String.class); - if (log == null) { - logger.info("Unable to retrieve logfile from '" + logFileUrl); - } else { - logger.info("Retrieved logfile from '" + logFileUrl); - } - } catch (HttpClientErrorException e) { - logger.info("Failed to access logfile from '" + logFileUrl + "' due to : " + e.getMessage()); - } catch (Exception e) { - logger.warn("Error while trying to access logfile from '" + logFileUrl + "' due to : " + e); - } - return log; - } - - private boolean waitForLogEntryInResource(boolean noBoot2, String app, String route, String... entries) { - logger.info("Looking for '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app + " - " + route); - long timeout = System.currentTimeMillis() + (30 * 1000); - boolean exists = false; - while (!exists && System.currentTimeMillis() < timeout) { - try { - Thread.sleep(7 * 1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IllegalStateException(e.getMessage(), e); - } - logger.info("Polling to get log file. Remaining poll time = " - + (timeout - System.currentTimeMillis() + " ms.")); - String log = noBoot2 ? getLog(route) : getLog(route + "/actuator"); - if (log != null) { - if (Stream.of(entries).allMatch(s -> log.contains(s))) { - exists = true; - } - } - } - if (exists) { - logger.info("Matched all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for app " + app); - } else { - logger.error("ERROR: Couldn't find all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app); - } - return exists; - } - -} diff --git a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/PartitionAcceptanceTests.java b/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/PartitionAcceptanceTests.java deleted file mode 100644 index 65e1d70..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/PartitionAcceptanceTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import static org.junit.Assert.fail; - -/** - * Do not run these tests as part of an IDE build or individually. - * These are acceptance tests for the spring cloud stream samples. - * The recommended way to run these tests are using the runAcceptanceTests.sh script in this module. - * More about running that script can be found in the README. - * - * @author Soby Chacko - */ -public class PartitionAcceptanceTests extends AbstractK8SAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(PartitionAcceptanceTests.class); - - @Test - public void testPartitioningWith4ConsumersRabbit() throws Exception { - - Thread.sleep(10_000); - - String prodUrl = System.getProperty("partitioning.producer.route"); - - boolean foundLogs = waitForLogEntry("Partitioning producer", prodUrl, "Started PartProducerApplication in"); - if(!foundLogs) { - fail("Did not find the logging messages."); - } - - String consumer1Url = System.getProperty("partitioning.consumer1.route"); - String consumer2Url = System.getProperty("partitioning.consumer2.route"); - String consumer3Url = System.getProperty("partitioning.consumer3.route"); - String consumer4Url = System.getProperty("partitioning.consumer4.route"); - - Future future1 = verifyPartitions("Partitioning Consumer-1", consumer1Url, - "f received from partition partitioned.destination.myGroup-0", - "g received from partition partitioned.destination.myGroup-0", - "h received from partition partitioned.destination.myGroup-0"); - Future future2 = verifyPartitions("Partitioning Consumer-2", consumer2Url, - "fo received from partition partitioned.destination.myGroup-1", - "go received from partition partitioned.destination.myGroup-1", - "ho received from partition partitioned.destination.myGroup-1"); - Future future3 = verifyPartitions("Partitioning Consumer-3",consumer3Url, - "foo received from partition partitioned.destination.myGroup-2", - "goo received from partition partitioned.destination.myGroup-2", - "hoo received from partition partitioned.destination.myGroup-2"); - Future future4 = verifyPartitions("Partitioning Consumer-4",consumer4Url, - "fooz received from partition partitioned.destination.myGroup-3", - "gooz received from partition partitioned.destination.myGroup-3", - "hooz received from partition partitioned.destination.myGroup-3"); - - verifyResults(future1, future2, future3, future4); - } - - private Future verifyPartitions(String consumer1Msg, String consumerRoute, - String... entries) { - - ExecutorService executorService = Executors.newSingleThreadExecutor(); - - Future submit = executorService.submit(() -> { - boolean found = waitForLogEntry(consumer1Msg, consumerRoute, entries); - if (!found) { - fail("Could not find the test data in the logs"); - } - }); - - executorService.shutdown(); - return submit; - } - - private void verifyResults(Future... futures) throws Exception { - for (Future future : futures) { - try { - future.get(); - } - catch (Exception e) { - throw e; - } - } - } -} diff --git a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/SimpleProcessorTests.java b/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/SimpleProcessorTests.java deleted file mode 100644 index f2c023e..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/SimpleProcessorTests.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.fail; - -/** - * Do not run these tests as part of an IDE build or individually. - * These are acceptance tests for the spring cloud stream samples. - * The recommended way to run these tests are using the runAcceptanceTests.sh script in this module. - * More about running that script can be found in the README. - * - * @author Soby Chacko - */ -public class SimpleProcessorTests extends AbstractK8SAcceptanceTests { - - private static final Logger logger = LoggerFactory.getLogger(SimpleProcessorTests.class); - - @Test - public void testUppercaseTransformerRabbit() { - - String url = System.getProperty("uppercase.processor.route"); - - boolean foundLogs = waitForLogEntry("Uppercase Transformer", url, "Started UppercaseTransformerApplication in", - "Data received: FOO", "Data received: BAR"); - if(!foundLogs) { - fail("Did not find the logging messages."); - } - } -} diff --git a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockK8SAcceptanceTests.java b/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockK8SAcceptanceTests.java deleted file mode 100644 index 4f94304..0000000 --- a/spring-cloud-stream-k8s-acceptance-tests/src/test/java/sample/acceptance/tests/TickTockK8SAcceptanceTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * @author Soby Chacko - */ -public class TickTockK8SAcceptanceTests extends AbstractK8SAcceptanceTests { - - @Test - public void testTickTockRabbit() { - - String timeSourceUrl = System.getProperty("time.source.route"); - String logSinkUrl = System.getProperty("log.sink.route"); - - boolean foundLogs = waitForLogEntry("Time Source", timeSourceUrl, "Started TimeSource"); - if(!foundLogs) { - fail("Did not find the time source started logging message."); - } - - foundLogs = waitForLogEntry("Log Sink", logSinkUrl, "Started LogSink"); - if(!foundLogs) { - fail("Did not find the log sink started logging message."); - } - - foundLogs = waitForLogEntry("Log Sink", logSinkUrl, "TICKTOCK - TIMESTAMP:"); - if(!foundLogs) { - fail("Did not find the ticktock messages in log sink"); - } - } - -} diff --git a/spring-cloud-stream-local-acceptance-tests/.mvn b/spring-cloud-stream-local-acceptance-tests/.mvn deleted file mode 120000 index 19172e1..0000000 --- a/spring-cloud-stream-local-acceptance-tests/.mvn +++ /dev/null @@ -1 +0,0 @@ -../.mvn \ No newline at end of file diff --git a/spring-cloud-stream-local-acceptance-tests/README.adoc b/spring-cloud-stream-local-acceptance-tests/README.adoc deleted file mode 100644 index cb0f8e8..0000000 --- a/spring-cloud-stream-local-acceptance-tests/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -=== Samples Acceptance Tests - -This is an accptance test module for the samples in this repo. -The tests launch the Spring Cloud Stream samples as stand alone Spring Boot applications and then verify their correctness. - -By default, these tests are not run as part of the normal build, as they are mainly intended for continuous integration testing with ongoing changes in the framework. - -In order to run the tests, we recommend to run the script `./runAcceptanceTest.sh` in this directory. -The script will launch all the middleware and other components in docker containers first. -Then it builds the applications and run them. \ No newline at end of file diff --git a/spring-cloud-stream-local-acceptance-tests/docker-compose.yml b/spring-cloud-stream-local-acceptance-tests/docker-compose.yml deleted file mode 100644 index d2325a6..0000000 --- a/spring-cloud-stream-local-acceptance-tests/docker-compose.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '2' -volumes: - data-volume: {} -services: - mysql: - image: mariadb - ports: - - "3306:3306" - environment: - MYSQL_ROOT_PASSWORD: pwd - MYSQL_DATABASE: sample_mysql_db - volumes: - - data-volume:/var/lib/mysql - kafka: - image: wurstmeister/kafka - ports: - - "9092:9092" - environment: - - KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 - - KAFKA_ADVERTISED_PORT=9092 - - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 - depends_on: - - zookeeper - zookeeper: - image: wurstmeister/zookeeper - ports: - - "2181:2181" - environment: - - KAFKA_ADVERTISED_HOST_NAME=zookeeper - rabbitmq: - image: rabbitmq:management - ports: - - 5672:5672 - - 15672:15672 - - # used for multi Kafka cluster testing - - kafka2: - image: wurstmeister/kafka - container_name: kafka-2 - ports: - - "9093:9092" - environment: - - KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 - - KAFKA_ADVERTISED_PORT=9092 - - KAFKA_ZOOKEEPER_CONNECT=zookeeper2:2181 - depends_on: - - zookeeper2 - zookeeper2: - image: wurstmeister/zookeeper - ports: - - "2182:2181" - environment: - - KAFKA_ADVERTISED_HOST_NAME=zookeeper2 \ No newline at end of file diff --git a/spring-cloud-stream-local-acceptance-tests/mvnw b/spring-cloud-stream-local-acceptance-tests/mvnw deleted file mode 100755 index 6efc7bd..0000000 --- a/spring-cloud-stream-local-acceptance-tests/mvnw +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -"$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" - diff --git a/spring-cloud-stream-local-acceptance-tests/mvnw.cmd b/spring-cloud-stream-local-acceptance-tests/mvnw.cmd deleted file mode 100644 index b0dc0e7..0000000 --- a/spring-cloud-stream-local-acceptance-tests/mvnw.cmd +++ /dev/null @@ -1,145 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/spring-cloud-stream-local-acceptance-tests/pom.xml b/spring-cloud-stream-local-acceptance-tests/pom.xml deleted file mode 100644 index 527fb38..0000000 --- a/spring-cloud-stream-local-acceptance-tests/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - 4.0.0 - - spring-cloud-stream-local-acceptance-tests - 0.0.1-SNAPSHOT - jar - spring-cloud-stream-local-acceptance-tests - Spring Cloud Stream Local Acceptance Tests - - - io.spring.cloud.stream.acceptance - spring-cloud-stream-acceptance-tests-parent - 0.0.1-SNAPSHOT - ../ - - - - true - - - - - org.springframework.boot - spring-boot-starter-web - test - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-starter-jdbc - test - - - org.mariadb.jdbc - mariadb-java-client - 1.1.9 - test - - - - diff --git a/spring-cloud-stream-local-acceptance-tests/runAcceptanceTests.sh b/spring-cloud-stream-local-acceptance-tests/runAcceptanceTests.sh deleted file mode 100755 index 3a71aac..0000000 --- a/spring-cloud-stream-local-acceptance-tests/runAcceptanceTests.sh +++ /dev/null @@ -1,136 +0,0 @@ - -#!/bin/bash - -pushd () { - command pushd "$@" > /dev/null -} - -popd () { - command popd "$@" > /dev/null -} - -function prepare_jdbc_source_with_kafka_and_rabbit_binders() { - wget -O /tmp/jdbc-source-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sample-jdbc-source/0.0.1-SNAPSHOT/sample-jdbc-source-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/jdbc-source-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sample-jdbc-source/0.0.1-SNAPSHOT/sample-jdbc-source-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_jdbc_sink_with_kafka_and_rabbit_binders() { - wget -O /tmp/jdbc-sink-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sample-jdbc-sink/0.0.1-SNAPSHOT/sample-jdbc-sink-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/jdbc-sink-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sample-jdbc-sink/0.0.1-SNAPSHOT/sample-jdbc-sink-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_dynamic_source_with_kafka_and_rabbit_binders() { - wget -O /tmp/dynamic-destination-source-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/dynamic-destination-source/0.0.1-SNAPSHOT/dynamic-destination-source-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/dynamic-destination-source-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/dynamic-destination-source/0.0.1-SNAPSHOT/dynamic-destination-source-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_multi_binder_with_kafka_rabbit() { - wget -O /tmp/multibinder-kafka-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/multibinder-kafka-rabbit/0.0.1-SNAPSHOT/multibinder-kafka-rabbit-0.0.1-SNAPSHOT.jar -} - -function prepare_multi_binder_with_two_kafka_clusters() { - wget -O /tmp/multibinder-two-kafka-clusters-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/multibinder-two-kafka-clusters/0.0.1-SNAPSHOT/multibinder-two-kafka-clusters-0.0.1-SNAPSHOT.jar -} - -function prepare_kafka_streams_word_count() { - wget -O /tmp/kafka-streams-word-count-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/kafka-streams-word-count/0.0.1-SNAPSHOT/kafka-streams-word-count-0.0.1-SNAPSHOT.jar -} - -function prepare_streamlistener_basic_with_kafka_rabbit_binders() { - wget -O /tmp/streamlistener-basic-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/streamlistener-basic/0.0.1-SNAPSHOT/streamlistener-basic-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/streamlistener-basic-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/streamlistener-basic/0.0.1-SNAPSHOT/streamlistener-basic-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_reactive_processor_with_kafka_rabbit_binders() { - wget -O /tmp/reactive-processor-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/reactive-processor/0.0.1-SNAPSHOT/reactive-processor-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/reactive-processor-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/reactive-processor/0.0.1-SNAPSHOT/reactive-processor-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_sensor_average_reactive_with_kafka_rabbit_binders() { - wget -O /tmp/sensor-average-reactive-kafka-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sensor-average-reactive/0.0.1-SNAPSHOT/sensor-average-reactive-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/sensor-average-reactive-rabbit-sample.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/sensor-average-reactive/0.0.1-SNAPSHOT/sensor-average-reactive-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_schema_registry_vanilla_with_kafka_rabbit_binders() { - wget -O /tmp/schema-registry-vanilla-registry-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-server/0.0.1-SNAPSHOT/schema-registry-vanilla-server-0.0.1-SNAPSHOT.jar - wget -O /tmp/schema-registry-vanilla-consumer-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-consumer/0.0.1-SNAPSHOT/schema-registry-vanilla-consumer-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/schema-registry-vanilla-producer1-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-producer1/0.0.1-SNAPSHOT/schema-registry-vanilla-producer1-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/schema-registry-vanilla-producer2-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-producer2/0.0.1-SNAPSHOT/schema-registry-vanilla-producer2-0.0.1-SNAPSHOT-kafka.jar - - wget -O /tmp/schema-registry-vanilla-registry-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-server/0.0.1-SNAPSHOT/schema-registry-vanilla-server-0.0.1-SNAPSHOT.jar - wget -O /tmp/schema-registry-vanilla-consumer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-consumer/0.0.1-SNAPSHOT/schema-registry-vanilla-consumer-0.0.1-SNAPSHOT-rabbit.jar - wget -O /tmp/schema-registry-vanilla-producer1-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-producer1/0.0.1-SNAPSHOT/schema-registry-vanilla-producer1-0.0.1-SNAPSHOT-rabbit.jar - wget -O /tmp/schema-registry-vanilla-producer2-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/schema-registry-vanilla-producer2/0.0.1-SNAPSHOT/schema-registry-vanilla-producer2-0.0.1-SNAPSHOT-rabbit.jar -} - -function prepare_partitioning_with_kafka_rabbit_binders() { - wget -O /tmp/partitioning-producer-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/partitioning-producer/0.0.1-SNAPSHOT/partitioning-producer-0.0.1-SNAPSHOT-kafka.jar - wget -O /tmp/partitioning-consumer-kafka.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/partitioning-consumer-kafka/0.0.1-SNAPSHOT/partitioning-consumer-kafka-0.0.1-SNAPSHOT.jar - - wget -O /tmp/partitioning-producer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/partitioning-producer/0.0.1-SNAPSHOT/partitioning-producer-0.0.1-SNAPSHOT-rabbit.jar - wget -O /tmp/partitioning-consumer-rabbit.jar http://repo.spring.io/libs-snapshot-local/io/spring/cloud/stream/sample/partitioning-consumer-rabbit/0.0.1-SNAPSHOT/partitioning-consumer-rabbit-0.0.1-SNAPSHOT.jar -} - -#Main script starting - -echo "Prepare artifacts for testing" - -prepare_jdbc_source_with_kafka_and_rabbit_binders -prepare_jdbc_sink_with_kafka_and_rabbit_binders -prepare_dynamic_source_with_kafka_and_rabbit_binders -prepare_multi_binder_with_kafka_rabbit -prepare_multi_binder_with_two_kafka_clusters -prepare_streamlistener_basic_with_kafka_rabbit_binders -prepare_reactive_processor_with_kafka_rabbit_binders -prepare_sensor_average_reactive_with_kafka_rabbit_binders -prepare_kafka_streams_word_count - -prepare_schema_registry_vanilla_with_kafka_rabbit_binders - -prepare_partitioning_with_kafka_rabbit_binders - -echo "Starting components in docker containers..." - -docker-compose up -d - -echo "Running tests" - -./mvnw clean package -Dmaven.test.skip=false -BUILD_RETURN_VALUE=$? - -docker-compose down - -# Post cleanup - -rm /tmp/jdbc-source-kafka-sample.jar -rm /tmp/jdbc-source-rabbit-sample.jar -rm /tmp/jdbc-sink-kafka-sample.jar -rm /tmp/jdbc-sink-rabbit-sample.jar -rm /tmp/dynamic-destination-source-kafka-sample.jar -rm /tmp/dynamic-destination-source-rabbit-sample.jar -rm /tmp/multibinder-kafka-rabbit-sample.jar -rm /tmp/multibinder-two-kafka-clusters-sample.jar -rm /tmp/kafka-streams-word-count-sample.jar -rm /tmp/streamlistener-basic-kafka-sample.jar -rm /tmp/streamlistener-basic-rabbit-sample.jar -rm /tmp/reactive-processor-kafka-sample.jar -rm /tmp/reactive-processor-rabbit-sample.jar -rm /tmp/sensor-average-reactive-kafka-sample.jar -rm /tmp/sensor-average-reactive-rabbit-sample.jar - -rm /tmp/schema-registry-vanilla-registry-kafka.jar -rm /tmp/schema-registry-vanilla-consumer-kafka.jar -rm /tmp/schema-registry-vanilla-producer1-kafka.jar -rm /tmp/schema-registry-vanilla-producer2-kafka.jar -rm /tmp/schema-registry-vanilla-registry-rabbit.jar -rm /tmp/schema-registry-vanilla-consumer-rabbit.jar -rm /tmp/schema-registry-vanilla-producer1-rabbit.jar -rm /tmp/schema-registry-vanilla-producer2-rabbit.jar - -rm /tmp/partitioning-producer-kafka.jar -rm /tmp/partitioning-consumer-kafka.jar - -rm /tmp/partitioning-producer-rabbit.jar -rm /tmp/partitioning-consumer-rabbit.jar - -exit $BUILD_RETURN_VALUE \ No newline at end of file diff --git a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractLocalTests.java b/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractLocalTests.java deleted file mode 100644 index 13103f0..0000000 --- a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/AbstractLocalTests.java +++ /dev/null @@ -1,78 +0,0 @@ -package sample.acceptance.tests; - -import org.assertj.core.util.Files; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.util.stream.Stream; - -import static org.junit.Assert.fail; - -/** - * @author Soby Chacko - */ -public abstract class AbstractLocalTests { - - private static final Logger logger = LoggerFactory.getLogger(AbstractLocalTests.class); - - protected boolean waitForLogEntryInFile(String app, File f, String... entries) { - logger.info("Looking for '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app); - long timeout = System.currentTimeMillis() + (60 * 1000); - boolean exists = false; - while (!exists && System.currentTimeMillis() < timeout) { - try { - Thread.sleep(2 * 1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IllegalStateException(e.getMessage(), e); - } - logger.info("Polling to get log file. Remaining poll time = " - + (timeout - System.currentTimeMillis() + " ms.")); - String log = Files.contentOf(f, StandardCharsets.UTF_8); - - if (log != null) { - if (Stream.of(entries).allMatch(log::contains)) { - exists = true; - } - } - } - if (exists) { - logger.info("Matched all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for app " + app); - } else { - logger.error("ERROR: Couldn't find all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app); - fail("Could not find the test data in the logs"); - } - return true; - } - - protected boolean waitForLogEntryInFileWithoutFailing(String app, File f, String... entries) { - logger.info("Looking for '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for " + app); - long timeout = System.currentTimeMillis() + (60 * 1000); - boolean exists = false; - while (!exists && System.currentTimeMillis() < timeout) { - try { - Thread.sleep(2 * 1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IllegalStateException(e.getMessage(), e); - } - logger.info("Polling to get log file. Remaining poll time = " - + (timeout - System.currentTimeMillis() + " ms.")); - String log = Files.contentOf(f, StandardCharsets.UTF_8); - - if (log != null) { - if (Stream.of(entries).allMatch(log::contains)) { - exists = true; - } - } - } - if (exists) { - logger.info("Matched all '" + StringUtils.arrayToCommaDelimitedString(entries) + "' in logfile for app " + app); - } - return exists; - } - -} diff --git a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/LocalAcceptanceTests.java b/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/LocalAcceptanceTests.java deleted file mode 100644 index 80eb79f..0000000 --- a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/LocalAcceptanceTests.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2018 the original author or authors. - * - * 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. - */ - -package sample.acceptance.tests; - -import org.assertj.core.util.Files; -import org.junit.After; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.SingleConnectionDataSource; -import org.springframework.web.client.RestTemplate; - -import javax.sql.DataSource; -import java.io.File; - -import static org.junit.Assert.fail; - -/** - * Do not run these tests as part of an IDE build or individually. - * These are acceptance tests for the spring cloud stream samples. - * The recommended way to run these tests are using the runAcceptanceTests.sh script in this module. - * More about running that script can be found in the README. - * - * @author Soby Chacko - */ -public class LocalAcceptanceTests extends AbstractLocalTests { - - private static final Logger logger = LoggerFactory.getLogger(LocalAcceptanceTests.class); - - private Process process; - - @After - public void stopTheApp() { - if (process != null) { - process.destroyForcibly(); - } - } - - @Test - public void testJdbcSourceSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/jdbc-source-kafka-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("JDBC Source", file,"Started SampleJdbcSource in"); - - waitForLogEntryInFile("JDBC Source", file, - "Data received...[{id=1, name=Bob, tag=null}, {id=2, name=Jane, tag=null}, {id=3, name=John, tag=null}]"); - } - - @Test - public void testJdbcSourceSampleRabbit() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/jdbc-source-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("JDBC Source", file,"Started SampleJdbcSource in"); - - waitForLogEntryInFile("JDBC Source", file, - "Data received...[{id=1, name=Bob, tag=null}, {id=2, name=Jane, tag=null}, {id=3, name=John, tag=null}]"); - } - - @Test - public void testJdbcSinkSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/jdbc-sink-kafka-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("JDBC Sink", file,"Started SampleJdbcSink in"); - - verifyJdbcSink(); - } - - @Test - public void testJdbcSinkSampleRabbit() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/jdbc-sink-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("JDBC Sink", file,"Started SampleJdbcSink in"); - - verifyJdbcSink(); - } - - @Test - public void testDynamicSourceSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/dynamic-destination-source-kafka-sample.jar", "--management.endpoints.web.exposure.include=*"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Dynamic Source", file,"Started SourceApplication in"); - - RestTemplate restTemplate = new RestTemplate(); - restTemplate.postForObject( - "http://localhost:8080", - "{\"id\":\"customerId-1\",\"bill-pay\":\"100\"}", String.class); - - waitForLogEntryInFile("Dynamic Source", file, - "Data received from customer-1...{\"id\":\"customerId-1\",\"bill-pay\":\"100\"}"); - - restTemplate.postForObject( - "http://localhost:8080", - "{\"id\":\"customerId-2\",\"bill-pay2\":\"200\"}", String.class); - - waitForLogEntryInFile("Dynamic Source", file, - "Data received from customer-2...{\"id\":\"customerId-2\",\"bill-pay2\":\"200\"}"); - - Files.delete(file); - } - - @Test - public void testDynamicSourceSampleRabbit() throws Exception { - - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/dynamic-destination-source-rabbit-sample.jar", "--management.endpoints.web.exposure.include=*"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Dynamic Source", file,"Started SourceApplication in"); - - RestTemplate restTemplate = new RestTemplate(); - restTemplate.postForObject( - "http://localhost:8080", - "{\"id\":\"customerId-1\",\"bill-pay\":\"100\"}", String.class); - - waitForLogEntryInFile("Dynamic Source", file, - "Data received from customer-1...{\"id\":\"customerId-1\",\"bill-pay\":\"100\"}"); - - restTemplate.postForObject( - "http://localhost:8080", - "{\"id\":\"customerId-2\",\"bill-pay2\":\"200\"}", String.class); - - waitForLogEntryInFile("Dynamic Source", file, - "Data received from customer-2...{\"id\":\"customerId-2\",\"bill-pay2\":\"200\"}"); - - Files.delete(file); - } - - @Test - public void testMultiBinderKafkaInputRabbitOutput() throws Exception { - - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/multibinder-kafka-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Multibinder", file,"Started MultibinderApplication in"); - - waitForLogEntryInFile("Multibinder", file, "Data received...bar", "Data received...foo"); - } - - @Test - public void testMultiBinderTwoKafkaClusters() throws Exception { - - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/multibinder-two-kafka-clusters-sample.jar", - "--kafkaBroker1=localhost:9092", "--zk1=localhost:2181", - "--kafkaBroker2=localhost:9093", "--zk2=localhost:2182"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Multibinder 2 Kafka Clusters", file,"Started MultibinderApplication in"); - - waitForLogEntryInFile("Multibinder 2 Kafka Clusters", file, "Data received...bar", "Data received...foo"); - - Files.delete(file); - } - - @Test - public void testStreamListenerBasicSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/streamlistener-basic-kafka-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Streamlistener basic", file,"Started TypeConversionApplication in"); - - waitForLogEntryInFile("Streamlistener basic", file, - "At the Source", "Sending value: {\"value\":\"hi\"}", "At the transformer", - "Received value hi of type class demo.Bar", - "Transforming the value to HI and with the type class demo.Bar", - "At the Sink", - "Received transformed message HI of type class demo.Foo"); - } - - @Test - public void testStreamListenerBasicSampleRabbit() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/streamlistener-basic-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Streamlistener basic", file,"Started TypeConversionApplication in"); - - waitForLogEntryInFile("Streamlistener basic", file, - "At the Source", "Sending value: {\"value\":\"hi\"}", "At the transformer", - "Received value hi of type class demo.Bar", - "Transforming the value to HI and with the type class demo.Bar", - "At the Sink", - "Received transformed message HI of type class demo.Foo"); - } - - @Test - public void testReactiveProcessorSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/reactive-processor-kafka-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Reactive processor", file,"Started ReactiveProcessorApplication in"); - - waitForLogEntryInFile("Reactive processor", file, - "Data received: foobarfoobarfoo", - "Data received: barfoobarfoobar"); - } - - @Test - public void testReactiveProcessorSampleRabbit() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/reactive-processor-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Reactive processor", file,"Started ReactiveProcessorApplication in"); - - waitForLogEntryInFile("Reactive processor", file, - "Data received: foobarfoobarfoo", - "Data received: barfoobarfoobar"); - } - - @Test - public void testSensorAverageReactiveSampleKafka() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/sensor-average-reactive-kafka-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Sensor average", file,"Started SensorAverageProcessorApplication in"); - - waitForLogEntryInFile("Sensor average", file, - "Data received: {\"id\":100100,\"average\":", - "Data received: {\"id\":100200,\"average\":", "Data received: {\"id\":100300,\"average\":"); - } - - @Test - public void testSensorAverageReactiveSampleRabbit() throws Exception { - - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/sensor-average-reactive-rabbit-sample.jar"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Sensor average", file,"Started SensorAverageProcessorApplication in"); - - waitForLogEntryInFile("Sensor average", file, - "Data received: {\"id\":100100,\"average\":", - "Data received: {\"id\":100200,\"average\":", "Data received: {\"id\":100300,\"average\":"); - - Files.delete(file); - } - - @Test - public void testKafkaStreamsWordCount() throws Exception { - ProcessBuilder pb = new ProcessBuilder("java", "-jar", "/tmp/kafka-streams-word-count-sample.jar", - "--spring.cloud.stream.kafka.streams.timeWindow.length=60000"); - File file = Files.newTemporaryFile(); - logger.info("Output is redirected to " + file.getAbsolutePath()); - pb.redirectOutput(file); - process = pb.start(); - - waitForLogEntryInFile("Kafka Streams WordCount", file,"Started KafkaStreamsWordCountApplication in"); - - waitForLogEntryInFile("Kafka Streams WordCount", file, - "Data received...{\"word\":\"foo\",\"count\":", - "Data received...{\"word\":\"bar\",\"count\":", - "Data received...{\"word\":\"foobar\",\"count\":", - "Data received...{\"word\":\"baz\",\"count\":", - "Data received...{\"word\":\"fox\",\"count\":"); - - Files.delete(file); - } - - private void verifyJdbcSink() { - JdbcTemplate db; - DataSource dataSource = new SingleConnectionDataSource("jdbc:mariadb://localhost:3306/sample_mysql_db", - "root", "pwd", false); - - db = new JdbcTemplate(dataSource); - - long timeout = System.currentTimeMillis() + (30 * 1000); - boolean exists = false; - while (!exists && System.currentTimeMillis() < timeout) { - try { - Thread.sleep(5 * 1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IllegalStateException(e.getMessage(), e); - } - - Integer count = db.queryForObject("select count(*) from test", Integer.class); - - if (count > 0) { - exists = true; - } - } - if (!exists) { - fail("No records found in database!"); - } - } -} diff --git a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningLocalAcceptanceTests.java b/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningLocalAcceptanceTests.java deleted file mode 100644 index c6b0ef5..0000000 --- a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/PartitioningLocalAcceptanceTests.java +++ /dev/null @@ -1,201 +0,0 @@ -package sample.acceptance.tests; - -import org.assertj.core.util.Files; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import static org.junit.Assert.fail; - -/** - * @author Soby Chacko - */ -public class PartitioningLocalAcceptanceTests extends AbstractLocalTests { - - private static final Logger logger = LoggerFactory.getLogger(PartitioningLocalAcceptanceTests.class); - - @Test - public void testPartitioningKafka() throws Exception { - Process producerProcess = null; - Process consumer1Process = null; - Process consumer2Process = null; - - try { - ProcessBuilder producerProcessBuilder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-producer-kafka.jar"); - File producerFile = Files.newTemporaryFile(); - logger.info("Output is redirected to " + producerFile.getAbsolutePath()); - producerProcessBuilder.redirectOutput(producerFile); - producerProcess = producerProcessBuilder.start(); - - waitForLogEntryInFile("Partitioning producer", producerFile, "Started PartProducerApplication in"); - - ProcessBuilder consumer1Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-kafka.jar", "--server.port=12001"); - File consumer1File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer1File.getAbsolutePath()); - consumer1Builder.redirectOutput(consumer1File); - consumer1Process = consumer1Builder.start(); - - ProcessBuilder consumer2Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-kafka.jar", "--server.port=12002"); - File consumer2File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer2File.getAbsolutePath()); - consumer2Builder.redirectOutput(consumer2File); - consumer2Process = consumer2Builder.start(); - - Future future1 = verifyPartitions("Partitioning Consumer-1", consumer1File, "Partitioning Consumer-2", consumer2File, - "f received from partition 0", "g received from partition 0", "h received from partition 0"); - Future future2 = verifyPartitions("Partitioning Consumer-1", consumer1File, "Partitioning Consumer-2", consumer2File, - "fo received from partition 1", "go received from partition 1", "ho received from partition 1"); - Future future3 = verifyPartitions("Partitioning Consumer-2",consumer2File, "Partitioning Consumer-1", consumer1File, - "foo received from partition 2", "goo received from partition 2", "hoo received from partition 2"); - Future future4 = verifyPartitions("Partitioning Consumer-2",consumer2File, "Partitioning Consumer-1", consumer1File, - "fooz received from partition 3", "gooz received from partition 3", "hooz received from partition 3"); - - verifyResults(future1, future2, future3, future4); - } - finally { - if (producerProcess != null) { - producerProcess.destroyForcibly(); - } - if (consumer1Process != null) { - consumer1Process.destroyForcibly(); - } - if (consumer2Process != null) { - consumer2Process.destroyForcibly(); - } - } - } - - @Test - public void testPartitioningRabbit() throws Exception { - Process producerProcess = null; - Process consumer1Process = null; - Process consumer2Process = null; - Process consumer3Process = null; - Process consumer4Process = null; - - try { - ProcessBuilder producerProcessBuilder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-producer-rabbit.jar"); - File producerFile = Files.newTemporaryFile(); - logger.info("Output is redirected to " + producerFile.getAbsolutePath()); - producerProcessBuilder.redirectOutput(producerFile); - producerProcess = producerProcessBuilder.start(); - - waitForLogEntryInFile("Partitioning producer", producerFile, "Started PartProducerApplication in"); - - ProcessBuilder consumer1Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-rabbit.jar", "--server.port=12003"); - File consumer1File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer1File.getAbsolutePath()); - consumer1Builder.redirectOutput(consumer1File); - consumer1Process = consumer1Builder.start(); - - ProcessBuilder consumer2Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-rabbit.jar", "--server.port=12004", - "--spring.cloud.stream.bindings.input.consumer.instanceIndex=1"); - File consumer2File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer2File.getAbsolutePath()); - consumer2Builder.redirectOutput(consumer2File); - consumer2Process = consumer2Builder.start(); - - ProcessBuilder consumer3Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-rabbit.jar", "--server.port=12005", - "--spring.cloud.stream.bindings.input.consumer.instanceIndex=2"); - File consumer3File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer3File.getAbsolutePath()); - consumer3Builder.redirectOutput(consumer3File); - consumer3Process = consumer3Builder.start(); - - ProcessBuilder consumer4Builder = new ProcessBuilder("java", "-jar", "/tmp/partitioning-consumer-rabbit.jar", "--server.port=12006", - "--spring.cloud.stream.bindings.input.consumer.instanceIndex=3"); - File consumer4File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumer4File.getAbsolutePath()); - consumer4Builder.redirectOutput(consumer4File); - consumer4Process = consumer4Builder.start(); - - Future future1 = verifyPartitions("Partitioning Consumer-1", consumer1File, - "f received from partition partitioned.destination.myGroup-0", - "g received from partition partitioned.destination.myGroup-0", - "h received from partition partitioned.destination.myGroup-0"); - Future future2 = verifyPartitions("Partitioning Consumer-2", consumer2File, - "fo received from partition partitioned.destination.myGroup-1", - "go received from partition partitioned.destination.myGroup-1", - "ho received from partition partitioned.destination.myGroup-1"); - Future future3 = verifyPartitions("Partitioning Consumer-3",consumer3File, - "foo received from partition partitioned.destination.myGroup-2", - "goo received from partition partitioned.destination.myGroup-2", - "hoo received from partition partitioned.destination.myGroup-2"); - Future future4 = verifyPartitions("Partitioning Consumer-4",consumer4File, - "fooz received from partition partitioned.destination.myGroup-3", - "gooz received from partition partitioned.destination.myGroup-3", - "hooz received from partition partitioned.destination.myGroup-3"); - - verifyResults(future1, future2, future3, future4); - } - finally { - if (producerProcess != null) { - producerProcess.destroyForcibly(); - } - if (consumer1Process != null) { - consumer1Process.destroyForcibly(); - } - if (consumer2Process != null) { - consumer2Process.destroyForcibly(); - } - if (consumer3Process != null) { - consumer3Process.destroyForcibly(); - } - if (consumer4Process != null) { - consumer4Process.destroyForcibly(); - } - } - } - - private Future verifyPartitions(String consumer1Msg, File consumer1File, - String consumer2Msg, File consumer2File, - String... entries) { - - ExecutorService executorService = Executors.newSingleThreadExecutor(); - - Future submit = executorService.submit(() -> { - boolean found = waitForLogEntryInFileWithoutFailing(consumer1Msg, consumer1File, entries); - if (!found) { - found = waitForLogEntryInFileWithoutFailing(consumer2Msg, consumer2File, entries); - } - if (!found) { - fail("Could not find the test data in the logs"); - } - }); - - executorService.shutdown(); - return submit; - } - - private Future verifyPartitions(String consumer1Msg, File consumer1File, - String... entries) { - - ExecutorService executorService = Executors.newSingleThreadExecutor(); - - Future submit = executorService.submit(() -> { - boolean found = waitForLogEntryInFileWithoutFailing(consumer1Msg, consumer1File, entries); - if (!found) { - fail("Could not find the test data in the logs"); - } - }); - - executorService.shutdown(); - return submit; - } - - private void verifyResults(Future... futures) throws Exception { - for (Future future : futures) { - try { - future.get(); - } - catch (Exception e) { - throw e; - } - } - } -} diff --git a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/SchemaRegistryVanillaLocalAcceptanceTests.java b/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/SchemaRegistryVanillaLocalAcceptanceTests.java deleted file mode 100644 index 8a806c4..0000000 --- a/spring-cloud-stream-local-acceptance-tests/src/test/java/sample/acceptance/tests/SchemaRegistryVanillaLocalAcceptanceTests.java +++ /dev/null @@ -1,117 +0,0 @@ -package sample.acceptance.tests; - -import org.assertj.core.util.Files; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; - -import java.io.File; - -import static org.junit.Assert.fail; - -/** - * @author Soby Chacko - */ -public class SchemaRegistryVanillaLocalAcceptanceTests extends AbstractLocalTests { - - private static final Logger logger = LoggerFactory.getLogger(SchemaRegistryVanillaLocalAcceptanceTests.class); - - @Test - public void testSchemaRegistryVanillaKafka() throws Exception { - runAgainstMiddleware("/tmp/schema-registry-vanilla-registry-kafka.jar", - "/tmp/schema-registry-vanilla-consumer-kafka.jar", - "/tmp/schema-registry-vanilla-producer1-kafka.jar", - "/tmp/schema-registry-vanilla-producer2-kafka.jar"); - } - - @Test - public void testSchemaRegistryVanillaRabbit() throws Exception { - runAgainstMiddleware("/tmp/schema-registry-vanilla-registry-rabbit.jar", - "/tmp/schema-registry-vanilla-consumer-rabbit.jar", - "/tmp/schema-registry-vanilla-producer1-rabbit.jar", - "/tmp/schema-registry-vanilla-producer2-rabbit.jar"); - } - - private void runAgainstMiddleware(String registryJar, String consumerJar, String producer1Jar, String producer2Jar) throws Exception { - - Process registryProcess = null; - Process consumerProcess = null; - Process producer1Process = null; - Process producer2Process = null; - - try { - - ProcessBuilder pbRegistry = new ProcessBuilder("java", "-jar", registryJar); - File registryFile = Files.newTemporaryFile(); - logger.info("Output is redirected to " + registryFile.getAbsolutePath()); - pbRegistry.redirectOutput(registryFile); - registryProcess = pbRegistry.start(); - - waitForLogEntryInFile("Schema Registry Vanilla Server", registryFile, "Started RegistryApplication in"); - - ProcessBuilder pbConsumer = new ProcessBuilder("java", "-jar", consumerJar); - File consumerFile = Files.newTemporaryFile(); - logger.info("Output is redirected to " + consumerFile.getAbsolutePath()); - pbConsumer.redirectOutput(consumerFile); - consumerProcess = pbConsumer.start(); - - waitForLogEntryInFile("Schema Registry Vanilla Consumer", consumerFile, "Started ConsumerApplication in"); - - ProcessBuilder pbProducer1 = new ProcessBuilder("java", "-jar", producer1Jar); - File producer1File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + producer1File.getAbsolutePath()); - pbProducer1.redirectOutput(producer1File); - producer1Process = pbProducer1.start(); - - waitForLogEntryInFile("Schema Registry Vanilla Producer1", producer1File, "Started Producer1Application in"); - - ProcessBuilder pbProducer2 = new ProcessBuilder("java", "-jar", producer2Jar); - File producer2File = Files.newTemporaryFile(); - logger.info("Output is redirected to " + producer2File.getAbsolutePath()); - pbProducer2.redirectOutput(producer2File); - producer2Process = pbProducer2.start(); - - waitForLogEntryInFile("Schema Registry Vanilla Producer2", producer2File, "Started Producer2Application in"); - - RestTemplate restTemplate = new RestTemplate(); - - MultiValueMap parametersMap = new LinkedMultiValueMap<>(); - parametersMap.add("id", "foobar"); - parametersMap.add("temperature", 30); - parametersMap.add("acceleration", 10); - parametersMap.add("velocity", 20); - - restTemplate.postForObject( - "http://localhost:9009/messagesX", parametersMap, String.class); - - boolean found = waitForLogEntryInFile("Schema Registry Vanilla Consumer", consumerFile, - "{\"id\": \"foobar-v1\", \"internalTemperature\": 30.0, \"externalTemperature\": 0.0, \"acceleration\": 10.0, \"velocity\": 20.0}"); - if (!found) { - fail("Could not find the test data in the logs"); - } - - restTemplate.postForObject( - "http://localhost:9010/messagesX", parametersMap, String.class); - - waitForLogEntryInFile("Schema Registry Vanilla Consumer", consumerFile, - "{\"id\": \"foobar-v2\", \"internalTemperature\": 30.0, \"externalTemperature\": 0.0, \"acceleration\": 10.0, \"velocity\": 20.0}"); - - } finally { - if (registryProcess != null) { - registryProcess.destroyForcibly(); - } - if (consumerProcess != null) { - consumerProcess.destroyForcibly(); - } - if (producer1Process != null) { - producer1Process.destroyForcibly(); - } - if (producer2Process != null) { - producer2Process.destroyForcibly(); - } - } - } -}