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 across independent projects …
…(test-jar import)
- Loading branch information
1 parent
b53e8c6
commit 396ff6f
Showing
14 changed files
with
460 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,26 @@ | ||
# An optional description for this build job to be included in the build reports. | ||
invoker.description = \ | ||
Verifies that protobuf definitions can be imported from dependency jars. \ | ||
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. | ||
|
||
# STEP 1 | ||
# Build project1 and install into local repo | ||
invoker.profiles.1 = build-project1 | ||
invoker.goals.1 = clean install | ||
|
||
# STEP 2 | ||
# Build project2, which depends on project1 | ||
# This will test unpacking imports from project1 jar file | ||
invoker.profiles.2 = build-project2 | ||
invoker.goals.2 = 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.1 = success | ||
#invoker.buildResult.2 = 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,79 @@ | ||
<?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-7-parent</artifactId> | ||
<name>Integration Test</name> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<profiles> | ||
<profile> | ||
<id>build-project1</id> | ||
<modules> | ||
<module>project1</module> | ||
</modules> | ||
</profile> | ||
<profile> | ||
<id>build-project2</id> | ||
<modules> | ||
<module>project2</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
<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-7-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-7-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-7/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-7-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-7-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-7-project1</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
11 changes: 11 additions & 0 deletions
11
src/it/TEST-7/project2/src/test/proto/it/project2/test2.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,11 @@ | ||
package it.project2; | ||
|
||
import "it/project1/test1.proto"; | ||
|
||
option java_package = "it.project2.messages"; | ||
option java_outer_classname = "TestProtos"; | ||
option optimize_for = SPEED; | ||
|
||
message TestMessage2 { | ||
optional it.project1.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,14 @@ | ||
outputDirectory = new File(basedir, 'project1/target/generated-test-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'); | ||
|
||
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,15 @@ | ||
# An optional description for this build job to be included in the build reports. | ||
invoker.description = \ | ||
Verifies that protobuf definitions can be imported from dependency jars. \ | ||
In this test, imports are scoped to the default package. | ||
|
||
# STEP 1 | ||
# Build project1 and install into local repo | ||
invoker.profiles.1 = build-project1 | ||
invoker.goals.1 = clean install | ||
|
||
# STEP 2 | ||
# Build project2, which depends on project1 | ||
# This will test unpacking imports from project1 jar file | ||
invoker.profiles.2 = build-project2 | ||
invoker.goals.2 = clean test-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,79 @@ | ||
<?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-8-parent</artifactId> | ||
<name>Integration Test</name> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
<profiles> | ||
<profile> | ||
<id>build-project1</id> | ||
<modules> | ||
<module>project1</module> | ||
</modules> | ||
</profile> | ||
<profile> | ||
<id>build-project2</id> | ||
<modules> | ||
<module>project2</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
<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-8-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>TEST-8-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> |
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 { | ||
} |
Oops, something went wrong.