From 2aad9b6ae61337ef94b05adc377a9ad2cbaa8eb8 Mon Sep 17 00:00:00 2001 From: StevenWdV Date: Wed, 9 Feb 2022 00:40:38 +0100 Subject: Add Android wrapper, remove plain Java Maven wrapper. Fix some overrides in Makefiles. --- wrappers/java/.gitignore | 1 - wrappers/java/Makefile | 16 ---- wrappers/java/README.md | 34 ------- wrappers/java/pom.xml | 106 --------------------- .../test/java/nl/eduvpn/common/VerifyTests.java | 77 --------------- 5 files changed, 234 deletions(-) delete mode 100644 wrappers/java/.gitignore delete mode 100644 wrappers/java/Makefile delete mode 100644 wrappers/java/README.md delete mode 100644 wrappers/java/pom.xml delete mode 100644 wrappers/java/src/test/java/nl/eduvpn/common/VerifyTests.java (limited to 'wrappers/java') 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 @@ - - 4.0.0 - - nl.eduvpn.common - 0.1.0 - jar - - eduvpncommon - eduVPN common library - - - UTF-8 - 1.8 - 1.8 - - ../../exports/lib - - - - - net.java.dev.jna - jna - 5.10.0 - - - org.junit.jupiter - junit-jupiter-api - 5.8.1 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.8.1 - test - - - - - - - - - ${EXPORTS_LIB_PATH}/linux/amd64 - - *.so - - linux-x86-64 - - - ${EXPORTS_LIB_PATH}/linux/arm - - *.so - - linux-arm - - - ${EXPORTS_LIB_PATH}/linux/arm64 - - *.so - - linux-arm64 - - - - ${EXPORTS_LIB_PATH}/windows/amd64 - - *.dll - - win32-x86-64 - - - ${EXPORTS_LIB_PATH}/windows/386 - - *.dll - - win32-x86 - - - ${EXPORTS_LIB_PATH}/windows/arm - - *.dll - - win32-arm - - - ${EXPORTS_LIB_PATH}/windows/arm64 - - *.dll - - win32-arm64 - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - - - - 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 - )); - } -} -- cgit v1.2.3