-
Notifications
You must be signed in to change notification settings - Fork 21
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 Maven and Gradle providers
- Loading branch information
1 parent
04f79be
commit f328017
Showing
11 changed files
with
287 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
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
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 @@ | ||
runtime: java |
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,35 @@ | ||
plugins { | ||
id 'application' | ||
} | ||
|
||
group 'com.pulumi.example.provider' | ||
version '0.0.1-SNAPSHOT' | ||
|
||
repositories { | ||
mavenLocal() | ||
maven { // The google mirror is less flaky than mavenCentral() | ||
url("https://maven-central.storage-download.googleapis.com/maven2/") | ||
} | ||
mavenCentral() | ||
} | ||
|
||
def grpcVersion = '1.67.1' | ||
def protobufVersion = '3.25.1' | ||
def pulumiJavaSdkVersion = System.getenv("PULUMI_JAVA_SDK_VERSION") ?: "0.0.1" | ||
|
||
dependencies { | ||
implementation("com.pulumi:pulumi:$pulumiJavaSdkVersion") { | ||
exclude group: 'io.grpc', module: 'grpc-netty-shaded' | ||
} | ||
implementation "io.grpc:grpc-netty-shaded:$grpcVersion" | ||
implementation "io.grpc:grpc-protobuf:$grpcVersion" | ||
implementation "io.grpc:grpc-stub:$grpcVersion" | ||
implementation "javax.annotation:javax.annotation-api:1.3.2" | ||
implementation "com.google.protobuf:protobuf-java:$protobufVersion" | ||
} | ||
|
||
application { | ||
mainClass = project.hasProperty("mainClass") | ||
? project.getProperty("mainClass") | ||
: "${group}.Main" | ||
} |
Empty file.
26 changes: 26 additions & 0 deletions
26
...ntegration/provider-gradle/src/main/java/com/pulumi/example/provider/ExampleProvider.java
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 @@ | ||
package com.pulumi.example.provider; | ||
|
||
import com.pulumi.provider.internal.models.*; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import com.pulumi.provider.internal.Provider; | ||
|
||
public class ExampleProvider extends Provider { | ||
@Override | ||
public CompletableFuture<GetSchemaResponse> getSchema(GetSchemaRequest request) { | ||
String schema = "{\n" + | ||
" \"name\": \"example\",\n" + | ||
" \"version\": \"0.0.1\",\n" + | ||
" \"resources\": {\n" + | ||
" \"example:index:Resource\": {\n" + | ||
" \"properties\": {\n" + | ||
" \"value\": {\n" + | ||
" \"type\": \"string\"\n" + | ||
" }\n" + | ||
" }" + | ||
" }\n" + | ||
" }\n" + | ||
"}"; | ||
return CompletableFuture.completedFuture(new GetSchemaResponse(schema)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/integration/provider-gradle/src/main/java/com/pulumi/example/provider/Main.java
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,12 @@ | ||
package com.pulumi.example.provider; | ||
|
||
import java.io.IOException; | ||
import com.pulumi.provider.internal.ResourceProviderService; | ||
|
||
public class Main { | ||
public static void main(String[] args) throws IOException, InterruptedException { | ||
var server = new ResourceProviderService(new ExampleProvider()); | ||
server.startAndBlockUntilShutdown(); | ||
} | ||
} | ||
|
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 @@ | ||
runtime: java |
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,132 @@ | ||
<?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.pulumi.example</groupId> | ||
<artifactId>provider</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<encoding>UTF-8</encoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<maven.compiler.release>11</maven.compiler.release> | ||
<mainClass>${project.groupId}.${project.artifactId}.App</mainClass> | ||
<mainArgs/> | ||
<grpc.version>1.67.1</grpc.version> | ||
<protobuf.version>3.25.1</protobuf.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<profiles> | ||
<profile> | ||
<id>default-pulumi-java-sdk-dependency</id> | ||
<activation> | ||
<property> | ||
<name>!env.PULUMI_JAVA_SDK_VERSION</name> | ||
</property> | ||
</activation> | ||
</profile> | ||
</profiles> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.pulumi</groupId> | ||
<artifactId>pulumi</artifactId> | ||
<version>0.0.1</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-netty-shaded</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-netty-shaded</artifactId> | ||
<version>${grpc.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-protobuf</artifactId> | ||
<version>${grpc.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.grpc</groupId> | ||
<artifactId>grpc-stub</artifactId> | ||
<version>${grpc.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<version>1.3.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.protobuf</groupId> | ||
<artifactId>protobuf-java</artifactId> | ||
<version>${protobuf.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.2.2</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>${mainClass}</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>${mainClass}</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-my-jar-with-dependencies</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<configuration> | ||
<mainClass>${mainClass}</mainClass> | ||
<commandlineArgs>${mainArgs}</commandlineArgs> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-wrapper-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<configuration> | ||
<mavenVersion>3.8.5</mavenVersion> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
tests/integration/provider-maven/src/main/java/com/pulumi/example/provider/App.java
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,12 @@ | ||
package com.pulumi.example.provider; | ||
|
||
import java.io.IOException; | ||
import com.pulumi.provider.internal.ResourceProviderService; | ||
|
||
public class App { | ||
public static void main(String[] args) throws IOException, InterruptedException { | ||
var server = new ResourceProviderService(new ExampleProvider()); | ||
server.startAndBlockUntilShutdown(); | ||
} | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
...integration/provider-maven/src/main/java/com/pulumi/example/provider/ExampleProvider.java
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 @@ | ||
package com.pulumi.example.provider; | ||
|
||
import com.pulumi.provider.internal.models.*; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import com.pulumi.provider.internal.Provider; | ||
|
||
public class ExampleProvider extends Provider { | ||
@Override | ||
public CompletableFuture<GetSchemaResponse> getSchema(GetSchemaRequest request) { | ||
String schema = "{\n" + | ||
" \"name\": \"example\",\n" + | ||
" \"version\": \"0.0.1\",\n" + | ||
" \"resources\": {\n" + | ||
" \"example:index:Resource\": {\n" + | ||
" \"properties\": {\n" + | ||
" \"value\": {\n" + | ||
" \"type\": \"string\"\n" + | ||
" }\n" + | ||
" }" + | ||
" }\n" + | ||
" }\n" + | ||
"}"; | ||
return CompletableFuture.completedFuture(new GetSchemaResponse(schema)); | ||
} | ||
} |