-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new java project, but old source code * update self tests for the example app * fix test workflow, fix Makefile
- Loading branch information
Showing
12 changed files
with
258 additions
and
169 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,7 @@ | ||
# Java example | ||
|
||
## Run | ||
``` | ||
JAVA_TOOL_OPTIONS=-Djava.library.path=/opt/homebrew/lib ./gradlew run | ||
``` | ||
|
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 |
---|---|---|
@@ -1,27 +1,36 @@ | ||
apply plugin: 'java' | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Java application project to get you started. | ||
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle | ||
* User Manual available at https://docs.gradle.org/8.0.2/userguide/building_java_projects.html | ||
*/ | ||
|
||
plugins { | ||
// Apply the application plugin to add support for building a CLI application in Java. | ||
id 'application' | ||
} | ||
|
||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'com.cossacklabs.com:java-themis:0.14.0' | ||
} | ||
// Use JUnit Jupiter for testing. | ||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1' | ||
|
||
sourceSets { | ||
main { | ||
java.srcDirs = ["src"] | ||
} | ||
// This dependency is used by the application. | ||
implementation 'com.google.guava:guava:31.1-jre' | ||
implementation("com.cossacklabs.com:java-themis:0.15.2") | ||
} | ||
|
||
// Pack *everything* into JAR, including dependencies and their dependencies. | ||
// By default this will pack only local classes, compiled here. | ||
jar { | ||
manifest { | ||
attributes "Main-Class": "main" | ||
} | ||
application { | ||
// Define the main class for the application. | ||
mainClass = 'java_themis_example.App' | ||
} | ||
|
||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
tasks.named('test') { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} |
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
17 changes: 17 additions & 0 deletions
17
docs/examples/java/app/src/test/java/java_themis_example/AppTest.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,17 @@ | ||
/* | ||
* This Java source file was generated by the Gradle 'init' task. | ||
*/ | ||
package java_themis_example; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class AppTest { | ||
@Test void appDoesNotThrow() { | ||
App classUnderTest = new App(); | ||
assertDoesNotThrow(() -> App.encryptDataForStoring(), "encryptDataForStoring() should run without exceptions"); | ||
assertDoesNotThrow(() -> App.encryptDataForMessaging(), "encryptDataForMessaging() should run without exceptions"); | ||
} | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Mon Dec 20 16:40:39 EET 2021 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.