Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

pubsub emulator rule moved to a separate project #2352

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -45,6 +45,7 @@
<module>spring-cloud-gcp-bigquery</module>
<module>spring-cloud-gcp-security-firebase</module>
<module>spring-cloud-gcp-secretmanager</module>
<module>spring-cloud-gcp-test-support</module>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename to spring-cloud-gcp-test.

</modules>

<properties>
Expand Down
6 changes: 6 additions & 0 deletions spring-cloud-gcp-dependencies/pom.xml
Expand Up @@ -191,6 +191,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-test-support</artifactId>
<version>${project.version}</version>
</dependency>

<!-- spring-cloud-gcp-starter-sql -->
<dependency>
<groupId>com.google.cloud.sql</groupId>
Expand Down
6 changes: 6 additions & 0 deletions spring-cloud-gcp-pubsub-stream-binder/pom.xml
Expand Up @@ -42,5 +42,11 @@
<version>3.1.0.BUILD-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-test-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Expand Up @@ -22,6 +22,7 @@

import org.springframework.cloud.gcp.stream.binder.pubsub.properties.PubSubConsumerProperties;
import org.springframework.cloud.gcp.stream.binder.pubsub.properties.PubSubProducerProperties;
import org.springframework.cloud.gcp.test.PubSubEmulator;
import org.springframework.cloud.stream.binder.AbstractBinderTests;
import org.springframework.cloud.stream.binder.ExtendedConsumerProperties;
import org.springframework.cloud.stream.binder.ExtendedProducerProperties;
Expand Down
29 changes: 29 additions & 0 deletions spring-cloud-gcp-test-support/pom.xml
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>spring-cloud-gcp</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>1.2.3.BUILD-SNAPSHOT</version>
</parent>


<artifactId>spring-cloud-gcp-test-support</artifactId>
<name>Spring Cloud GCP Test Support</name>
<description>Provides tools for testing Spring Cloud GCP projects</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.springframework.cloud.gcp.stream.binder.pubsub;
package org.springframework.cloud.gcp.test;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -33,11 +33,10 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.rules.ExternalResource;

import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

/**
* Rule for instantiating and tearing down a Pub/Sub emulator instance.
*
Expand Down Expand Up @@ -87,7 +86,7 @@ public PubSubEmulator() {
@Override
protected void before() throws IOException, InterruptedException {

assumeTrue("PubSubEmulator rule disabled. Please enable with -Dit.pubsub-emulator.", this.enableTests);
Assume.assumeTrue("PubSubEmulator rule disabled. Please enable with -Dit.pubsub-emulator.", this.enableTests);

startEmulator();
determineHostPort();
Expand Down Expand Up @@ -178,7 +177,7 @@ private void startEmulator() throws IOException, InterruptedException {
.start();
}
catch (IOException ex) {
fail("Gcloud not found; leaving host/port uninitialized.");
Assert.fail("Gcloud not found; leaving host/port uninitialized.");
}

if (configPresent) {
Expand Down Expand Up @@ -219,7 +218,7 @@ private void createConfig() throws InterruptedException {
Thread.sleep(1000);
}
if (attempts < 0) {
fail(
Assert.fail(
"Emulator could not be configured due to missing env.yaml. Are PubSub and beta tools installed?");
}
}
Expand Down Expand Up @@ -247,7 +246,7 @@ private void updateConfig(WatchService watchService) throws InterruptedException
}
}

fail("Configuration file update could not be detected");
Assert.fail("Configuration file update could not be detected");
}

/**
Expand Down