Skip to content

test: configurations that work with graalvm for jdk 21 #1448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ integration)
;;
graalvm)
# Run Unit and Integration Tests with Native Image
mvn test -Pnative -Penable-integration-tests
mvn test -Dsurefire.failIfNoSpecifiedTests=false "-Dtest=ITGcsNio#testCopy_replaceFile_withoutOption" -Djava.util.logging.config.file=src/main/resources/logging.properties -Pnative -Penable-integration-tests -X
RETURN_CODE=$?
;;
graalvm17)
Expand Down
12 changes: 12 additions & 0 deletions google-cloud-nio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-maven-plugin.version}</version>
<configuration>
<buildArgs combine.children="append">
<buildArg>-H:-AddAllFileSystemProviders</buildArg>
<!-- <buildArg>&#45;&#45;strict-image-heap</buildArg>-->
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
@ThreadSafe
public final class CloudStorageFileSystemProvider extends FileSystemProvider {

static {
System.out.println("helloooo");
}

private Storage storage;
private final StorageOptions storageOptions;
// if non-null, we pay via this project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# DefaultStorageRetryStrategy) being unexpectedly and recursively initialized at
# build time.
Args = --initialize-at-build-time=com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider,\
com.google.api.client.util.FieldInfo,\
com.google.cloud.storage.contrib.nio.CloudStorageConfiguration,\
com.google.cloud.storage.contrib.nio.CloudStorageFileSystem,\
com.google.cloud.storage.contrib.nio.StorageOptionsUtil,\
Expand Down Expand Up @@ -42,4 +43,7 @@ Args = --initialize-at-build-time=com.google.cloud.storage.contrib.nio.CloudStor
com.google.common.io.BaseEncoding,\
com.google.common.io.BaseEncoding$StandardBaseEncoding,\
com.google.api.client.util.PemReader,\
com.google.common.base.Charsets
com.google.common.base.Charsets,\
com.google.api.client.json.gson.GsonParser,\
com.google.api.client.json.JsonParser,\
org.junit.runners.model.FrameworkField
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"name": "com.google.auth.oauth2.ServiceAccountCredentials",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true

}
]
10 changes: 10 additions & 0 deletions google-cloud-nio/src/main/resources/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
handlers=java.util.logging.ConsoleHandler
java.util.logging.SimpleFormatter.format=%1$tF %1$tT,%1$tL %4$-8s %3$-50s - %5$s %6$s%n

# --- ConsoleHandler ---
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
.level=INFO

# com.google.auth is for authentication
com.google.auth.level=FINE
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.google.common.collect.Sets;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
Expand Down Expand Up @@ -129,7 +130,11 @@ public class ITGcsNio {
@BeforeClass
public static void beforeClass() throws IOException {
// loads the credentials from local disk as par README
RemoteStorageHelper gcsHelper = RemoteStorageHelper.create();
// String path = System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
// System.out.println(path);
RemoteStorageHelper gcsHelper = RemoteStorageHelper.create(System.getenv("GOOGLE_CLOUD_PROJECT"),
new FileInputStream(System.getenv("GOOGLE_APPLICATION_CREDENTIALS")));
// RemoteStorageHelper gcsHelper = RemoteStorageHelper.create();
storageOptions = gcsHelper.getOptions();
project = storageOptions.getProjectId();
storage = storageOptions.getService();
Expand Down
Loading