diff options
Diffstat (limited to 'wrappers/java')
| -rw-r--r-- | wrappers/java/.gitignore | 1 | ||||
| -rw-r--r-- | wrappers/java/Makefile | 16 | ||||
| -rw-r--r-- | wrappers/java/README.md | 34 | ||||
| -rw-r--r-- | wrappers/java/pom.xml | 106 | ||||
| -rw-r--r-- | wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java | 77 |
5 files changed, 0 insertions, 234 deletions
diff --git a/wrappers/java/.gitignore b/wrappers/java/.gitignore deleted file mode 100644 index b83d222..0000000 --- a/wrappers/java/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/wrappers/java/Makefile b/wrappers/java/Makefile deleted file mode 100644 index ebb8103..0000000 --- a/wrappers/java/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -.PHONY: build pack test clean - -EXPORTS_PATH ?= ../../exports -include $(EXPORTS_PATH)/common.mk - -build: - mvn --no-transfer-progress compile -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)" - -pack: - mvn --no-transfer-progress package -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)" - -test: .try_build_lib - mvn --no-transfer-progress test -DEXPORTS_LIB_PATH="$(EXPORTS_LIB_PATH)" - -clean: - rm -rf target/ diff --git a/wrappers/java/README.md b/wrappers/java/README.md deleted file mode 100644 index e19075b..0000000 --- a/wrappers/java/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Java wrapper - -## Requirements - -You will need to install JDK 8 or later ([Adoptium](https://adoptium.net/) -or [Oracle](https://www.oracle.com/java/technologies/downloads/)). To easily compile the project, you should -download [Maven](https://maven.apache.org/). - -## Build & test - -First build the shared Go library. Next: - -Build `EduVpnCommon`: - -```shell -make -``` - -Build as JAR, including shared Go library: - -```shell -make pack -``` - -The JAR will include all versions of the library that are built in the `exports` folder. - -If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"` -when calling make. This folder must contain `common.mk` and the `lib/` folder with built libraries. - -Test: - -```shell -make test -``` diff --git a/wrappers/java/pom.xml b/wrappers/java/pom.xml deleted file mode 100644 index 520bd34..0000000 --- a/wrappers/java/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ -<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>nl.eduvpn.common</groupId> - <version>0.1.0</version> - <packaging>jar</packaging> - - <artifactId>eduvpncommon</artifactId> - <name>eduVPN common library</name> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - - <EXPORTS_LIB_PATH>../../exports/lib</EXPORTS_LIB_PATH> - </properties> - - <dependencies> - <dependency> - <groupId>net.java.dev.jna</groupId> - <artifactId>jna</artifactId> - <version>5.10.0</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <version>5.8.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>5.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <resources> - <!-- See com.sun.jna.Platform#getNativeLibraryResourcePrefix --> - - <resource> - <directory>${EXPORTS_LIB_PATH}/linux/amd64</directory> - <includes> - <include>*.so</include> - </includes> - <targetPath>linux-x86-64</targetPath> - </resource> - <resource> - <directory>${EXPORTS_LIB_PATH}/linux/arm</directory> - <includes> - <include>*.so</include> - </includes> - <targetPath>linux-arm</targetPath> - </resource> - <resource> - <directory>${EXPORTS_LIB_PATH}/linux/arm64</directory> - <includes> - <include>*.so</include> - </includes> - <targetPath>linux-arm64</targetPath> - </resource> - - <resource> - <directory>${EXPORTS_LIB_PATH}/windows/amd64</directory> - <includes> - <include>*.dll</include> - </includes> - <targetPath>win32-x86-64</targetPath> - </resource> - <resource> - <directory>${EXPORTS_LIB_PATH}/windows/386</directory> - <includes> - <include>*.dll</include> - </includes> - <targetPath>win32-x86</targetPath> - </resource> - <resource> - <directory>${EXPORTS_LIB_PATH}/windows/arm</directory> - <includes> - <include>*.dll</include> - </includes> - <targetPath>win32-arm</targetPath> - </resource> - <resource> - <directory>${EXPORTS_LIB_PATH}/windows/arm64</directory> - <includes> - <include>*.dll</include> - </includes> - <targetPath>win32-arm64</targetPath> - </resource> - </resources> - - <plugins> - <plugin> - <!-- Test adapter --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.1</version> - </plugin> - </plugins> - </build> -</project> - diff --git a/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java b/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java deleted file mode 100644 index a82c019..0000000 --- a/wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java +++ /dev/null @@ -1,77 +0,0 @@ -package nl.eduvpn.common; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.Instant; - -import static org.junit.jupiter.api.Assertions.*; - -class VerifyTests { - private static final Path testDataDir = Paths.get("../../test_data"); - - @SuppressWarnings("OptionalGetWithoutIsPresent") - @BeforeAll - static void oneTimeSetup() throws IOException { - Discovery.insecureTestingSetExtraKey(Files.lines(testDataDir.resolve("public.key")).reduce((a, b) -> b).get()); - } - - @Test - void testValid() { - assertDoesNotThrow(() -> - Discovery.verify( - Files.readAllBytes(testDataDir.resolve("server_list.json.minisig")), - Files.readAllBytes(testDataDir.resolve("server_list.json")), - "server_list.json", - Instant.EPOCH - )); - } - - @Test - void testInvalidSignature() { - assertThrows(InvalidSignatureException.class, () -> - Discovery.verify( - Files.readAllBytes(testDataDir.resolve("random.txt")), - Files.readAllBytes(testDataDir.resolve("server_list.json")), - "server_list.json", - Instant.EPOCH - )); - } - - @Test - void testWrongKey() { - assertThrows(InvalidSignatureUnknownKeyException.class, () -> - Discovery.verify( - Files.readAllBytes(testDataDir.resolve("server_list.json.wrong_key.minisig")), - Files.readAllBytes(testDataDir.resolve("server_list.json")), - "server_list.json", - Instant.EPOCH - )); - } - - @Test - void testOldSignature() { - assertThrows(SignatureTooOldException.class, () -> - Discovery.verify( - Files.readAllBytes(testDataDir.resolve("server_list.json.minisig")), - Files.readAllBytes(testDataDir.resolve("server_list.json")), - "server_list.json", - Instant.MAX - )); - } - - @Test - void testUnknownExpectedFile() { - assertThrows(IllegalArgumentException.class, () -> - Discovery.verify( - Files.readAllBytes(testDataDir.resolve("other_list.json.minisig")), - Files.readAllBytes(testDataDir.resolve("other_list.json")), - "other_list.json", - Instant.EPOCH - )); - } -} |
