This repository has been archived by the owner on Feb 12, 2018. It is now read-only.
forked from dtrott/maven-protoc-plugin
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#30 Added an integration test for custom protoc plugins
- Loading branch information
1 parent
5e991ee
commit 5afebeb
Showing
4 changed files
with
135 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 a binary artifact for a protoc plugin can be downloaded from Maven repository. | ||
|
||
# A comma or space separated list of goals/phases to execute, may | ||
# specify an empty list to execute the default goal of the IT project | ||
invoker.goals = clean package |
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,76 @@ | ||
<?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>it-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>TEST-28</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<name>Integration Test 28</name> | ||
|
||
<properties> | ||
<protobufVersion>3.0.0-alpha-3</protobufVersion> | ||
<grpcVersion>0.7.2</grpcVersion> | ||
</properties> | ||
|
||
<build> | ||
<extensions> | ||
<extension> | ||
<groupId>kr.motd.maven</groupId> | ||
<artifactId>os-maven-plugin</artifactId> | ||
<version>1.3.0.Final</version> | ||
</extension> | ||
</extensions> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>com.google.protobuf.tools</groupId> | ||
<artifactId>maven-protoc-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>protoc-compile</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>compile-custom</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>protoc-test-compile</id> | ||
<phase>generate-test-sources</phase> | ||
<goals> | ||
<goal>test-compile</goal> | ||
<goal>test-compile-custom</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<protocArtifact>com.google.protobuf:protoc:${protobufVersion}:exe:${os.detected.classifier} | ||
</protocArtifact> | ||
<pluginId>grpc</pluginId> | ||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpcVersion}:exe:${os.detected.classifier} | ||
</pluginArtifact> | ||
<pluginParameter>nano=false</pluginParameter> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-all</artifactId> | ||
<version>${grpcVersion}</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,25 @@ | ||
syntax = "proto3"; | ||
|
||
option java_package = "test"; | ||
option java_outer_classname = "TestProtos"; | ||
option optimize_for = SPEED; | ||
|
||
message TestMessage { | ||
message NestedMessage { | ||
int32 zz = 1; | ||
} | ||
|
||
enum NestedEnum { | ||
FOO = 0; | ||
BAR = 1; | ||
BAZ = 2; | ||
} | ||
|
||
// Singular | ||
int32 xx = 1; | ||
repeated NestedEnum yy = 2; | ||
} | ||
|
||
service MyService { | ||
rpc MyMethod(TestMessage) returns(TestMessage) {} | ||
} |
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,28 @@ | ||
outputDirectory = new File(basedir, 'target/generated-sources/protobuf/java'); | ||
assert outputDirectory.exists(); | ||
assert outputDirectory.isDirectory(); | ||
|
||
generatedJavaFile = new File(outputDirectory, 'test/TestProtos.java'); | ||
assert generatedJavaFile.exists(); | ||
assert generatedJavaFile.isFile(); | ||
|
||
content = generatedJavaFile.text; | ||
assert content.contains('package test'); | ||
assert content.contains('class TestProtos'); | ||
assert content.contains('class TestMessage'); | ||
|
||
outputDirectory = new File(basedir, 'target/generated-sources/protobuf/grpc'); | ||
assert outputDirectory.exists(); | ||
assert outputDirectory.isDirectory(); | ||
|
||
generatedJavaFile = new File(outputDirectory, 'test/MyServiceGrpc.java'); | ||
assert generatedJavaFile.exists(); | ||
assert generatedJavaFile.isFile(); | ||
|
||
content = generatedJavaFile.text; | ||
assert content.contains('package test'); | ||
assert content.contains('class MyServiceGrpc'); | ||
assert content.contains('interface MyService'); | ||
|
||
|
||
return true; |