Skip to content

Commit

Permalink
Issue TBD54566975#94: Add an acceptance test for Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
ALRubinger committed Jul 30, 2024
1 parent ad73d03 commit 80cb5d5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ Cargo.lock
bound/kt/src/main/resources/*.dylib
bound/kt/src/main/resources/*.so

# .class file for acceptance test
tests/jvm/**.class


# ---

.hermit/
build/
.gradle/
**/.idea/
**/**.iml
**/.DS_Store
42 changes: 42 additions & 0 deletions tests/jvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# tbDEX Kotlin Acceptance Test

This is a simple Java main class which acts as an acceptance smoke test
for the tbDEX Kotlin binary distribution. The Kotlin unit tests execute in
Maven using the `classpath` as set by the Maven build process (ie.
`target/classes`). This test intentionally lives outside of the Kotlin tbDEX
project to test that it may be consumed as built (ie. the distributable JAR)
and contains the native libraries necessary to run.

This acceptance test is run by the CI jobs after building the Kotlin
distribution to ensure it may be run in all supported environments.

## Building

From this folder, run:

```shell
javac TbdexAcceptanceTest.java \
-cp ../../bound/kt/target/tbdex-0.0.0-main-SNAPSHOT-jar-with-dependencies.jar
```

You may need to replace the filename of this JAR with the version as built from
Maven (note that this includes the version).

## Running

From this folder, run:

```shell
java -classpath \
../../bound/kt/target/tbdex-0.0.0-main-SNAPSHOT-jar-with-dependencies.jar:. \
TbdexAcceptanceTest
```

You may need to replace the filename of this JAR with the version as built from
Maven (note that this includes the version).

You should see output similar to:

```shell
Successfully loaded shared library for tbdex_uniffi_aarch64_apple_darwin
```
20 changes: 20 additions & 0 deletions tests/jvm/TbdexAcceptanceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import tbdex.sdk.rust.SystemArchitecture;
import tbdex.sdk.rust.UniffiLib;

/**
* A simple main class to act as an acceptance smoke test for the Kotlin
* tbDEX binary.
*
* See README.md in this folder for usage and purpose.
*/
public class TbdexAcceptanceTest {

public static void main(String... args) {
System.setProperty("TBDEX_SDK_LOG_LEVEL", "debug");
SystemArchitecture.INSTANCE.set();
UniffiLib.Companion.getINSTANCE$tbdex();
System.out.println(
"Successfully loaded shared library for " +
System.getProperty("uniffi.component.tbdex.libraryOverride"));
}
}

0 comments on commit 80cb5d5

Please sign in to comment.