Skip to content

Commit

Permalink
first integration test as in #1
Browse files Browse the repository at this point in the history
  • Loading branch information
rikcarve committed Mar 6, 2018
1 parent fd29c89 commit 2af3893
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.pszymczyk.consul</groupId>
<artifactId>embedded-consul</artifactId>
<version>0.3.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -74,6 +80,39 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<addTestClassPath>true</addTestClassPath>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<debug>false</debug>
<goals>
<goal>clean</goal>
<goal>consulkv:configure</goal>
</goals>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
<pluginManagement>
<plugins>
Expand Down
34 changes: 34 additions & 0 deletions src/it/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<settings>
<profiles>
<profile>
<id>it-repo</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
33 changes: 33 additions & 0 deletions src/it/testWithPrefix/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<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>
<groupId>ch.carve</groupId>
<artifactId>consulkv-maven-plugin</artifactId>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>com.ecwid.consul</groupId>
<artifactId>consul-api</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<url>localhost:10001</url>
<configDirs>
<configDir>src/main/resources/consul</configDir>
</configDirs>
<prefix>hello</prefix>
</configuration>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions src/it/testWithPrefix/setup.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import com.pszymczyk.consul.ConsulStarterBuilder;

context.put("consul", ConsulStarterBuilder.consulStarter().withHttpPort(10001).build().start());
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hello-prefix=maven say
db.url=jdbc:thin:bla
6 changes: 6 additions & 0 deletions src/it/testWithPrefix/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import com.ecwid.consul.v1.ConsulClient;

ConsulClient consul = new ConsulClient("localhost:10001");
String value = consul.getKVValue("hello/hello-prefix").getValue().getDecodedValue();
context.get("consul").close();
return "maven say".equals(value);

0 comments on commit 2af3893

Please sign in to comment.