forked from sergei-ivanov/maven-protoc-plugin
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration tests for proto test imports in reactor projects
- Loading branch information
1 parent
396ff6f
commit b891994
Showing
28 changed files
with
814 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# An optional description for this build job to be included in the build reports. | ||
invoker.description = \ | ||
Verifies that protobuf definitions can be imported from other modules in the reactor. \ | ||
In this test, imports are scoped to the default package. | ||
|
||
invoker.goals = clean compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-10-parent</artifactId> | ||
<name>Integration Test</name> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>project1</module> | ||
<module>project2</module> | ||
</modules> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>[2.4,2.5)</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.5</source> | ||
<target>1.5</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-toolchains-plugin</artifactId> | ||
<version>1.0</version> | ||
<executions> | ||
<execution> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>toolchain</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<toolchains> | ||
<protobuf> | ||
<version>[2.4,2.5)</version> | ||
</protobuf> | ||
</toolchains> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-10-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-10-project1</artifactId> | ||
<name>Integration Test</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
option java_package = "it.project1.messages"; | ||
option java_outer_classname = "TestProtos"; | ||
option optimize_for = SPEED; | ||
|
||
message TestMessage1 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-10-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-10-project2</artifactId> | ||
<name>Integration Test</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>TEST-10-project1</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import "test1.proto"; | ||
|
||
option java_package = "it.project2.messages"; | ||
option java_outer_classname = "TestProtos"; | ||
option optimize_for = SPEED; | ||
|
||
message TestMessage2 { | ||
optional TestMessage1 included = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
outputDirectory = new File(basedir, 'project1/target/generated-sources/protoc'); | ||
assert outputDirectory.exists(); | ||
assert outputDirectory.isDirectory(); | ||
|
||
generatedJavaFile = new File(outputDirectory, 'it/project1/messages/TestProtos.java'); | ||
assert generatedJavaFile.exists(); | ||
assert generatedJavaFile.isFile(); | ||
|
||
content = generatedJavaFile.text; | ||
assert content.contains('package it.project1.messages'); | ||
assert content.contains('class TestProtos'); | ||
assert content.contains('class TestMessage1'); | ||
|
||
outputDirectory = new File(basedir, 'project2/target/generated-sources/protoc'); | ||
assert outputDirectory.exists(); | ||
assert outputDirectory.isDirectory(); | ||
|
||
generatedJavaFile = new File(outputDirectory, 'it/project2/messages/TestProtos.java'); | ||
assert generatedJavaFile.exists(); | ||
assert generatedJavaFile.isFile(); | ||
|
||
content = generatedJavaFile.text; | ||
assert content.contains('package it.project2.messages'); | ||
assert content.contains('class TestProtos'); | ||
assert content.contains('class TestMessage2'); | ||
|
||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# An optional description for this build job to be included in the build reports. | ||
invoker.description = \ | ||
Verifies that protobuf definitions can be imported from other modules in the reactor. \ | ||
In this test, imports are scoped to packages. \ | ||
We need to make sure that package structure for protobuf definitions \ | ||
is preserved in packaged jars, and correctly restored for importing. | ||
|
||
invoker.goals = clean test-compile | ||
|
||
# >>>> THIS TEST IS TEMPORARILY IGNORED <<<< | ||
# This is because protos from dependencies that are scoped to custom package | ||
# are incorrectly specified on the protoc command line | ||
# | ||
# TODO: fix command line for imports | ||
#invoker.buildResult = failure | ||
invoker.failureBehavior = fail-never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-11-parent</artifactId> | ||
<name>Integration Test</name> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<modules> | ||
<module>project1</module> | ||
<module>project2</module> | ||
</modules> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>[2.4,2.5)</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>1.5</source> | ||
<target>1.5</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-toolchains-plugin</artifactId> | ||
<version>1.0</version> | ||
<executions> | ||
<execution> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>toolchain</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<toolchains> | ||
<protobuf> | ||
<version>[2.4,2.5)</version> | ||
</protobuf> | ||
</toolchains> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-11-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-11-project1</artifactId> | ||
<name>Integration Test</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.3.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test-jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
8 changes: 8 additions & 0 deletions
8
src/it/TEST-11/project1/src/test/proto/it/project1/test1.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package it.project1; | ||
|
||
option java_package = "it.project1.messages"; | ||
option java_outer_classname = "TestProtos"; | ||
option optimize_for = SPEED; | ||
|
||
message TestMessage1 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?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> | ||
<groupId>com.google.protobuf.tools.maven-protoc-plugin.its</groupId> | ||
<artifactId>TEST-11-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-11-project2</artifactId> | ||
<name>Integration Test</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>TEST-11-project1</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.