Skip to content

Commit d3b71b5

Browse files
committed
feat: Add DDB-EC v1
This is a copy from the DDB-EC SHA 6536e7406c9746079a809fb8c607d622e17e13f7 This only addes the relevant files. So there are files, like `pom.xml`, that do not exist her.
1 parent ce43443 commit d3b71b5

File tree

157 files changed

+31906
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+31906
-9
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.idea/*
22
**/.idea/*
3-
**/*.iml
43
.vscode/*
54
*.sln?*
65
**/.DS_Store

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ [email protected] with any additional questions or comments.
5151

5252

5353
## Security issue notifications
54-
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
54+
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public GitHub issue.
5555

5656

5757
## Licensing

DynamoDbItemEncryptor/runtimes/java/build.gradle.kts

+87-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import java.net.URI
22
import javax.annotation.Nullable
3+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
4+
import org.gradle.api.tasks.testing.logging.TestLogEvent
35

46
plugins {
57
`java-library`
@@ -16,9 +18,11 @@ java {
1618
srcDir("src/main/java")
1719
srcDir("src/main/dafny-generated")
1820
srcDir("src/main/smithy-generated")
21+
srcDir("src/main/sdkv1")
1922
}
2023
sourceSets["test"].java {
2124
srcDir("src/test/dafny-generated")
25+
srcDir("src/test/sdkv1")
2226
}
2327
}
2428

@@ -37,6 +41,10 @@ if (!caPasswordString.isNullOrBlank()) {
3741
}
3842

3943
repositories {
44+
maven {
45+
name = "DynamoDB Local Release Repository - US West (Oregon) Region"
46+
url = URI.create("https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
47+
}
4048
mavenCentral()
4149
mavenLocal()
4250
if (caUrl != null && caPassword != null) {
@@ -51,6 +59,10 @@ repositories {
5159
}
5260
}
5361

62+
// Configuration to hold SQLLite information.
63+
// DynamoDB-Local needs to have access to native sqllite4java.
64+
val dynamodb by configurations.creating
65+
5466
dependencies {
5567
implementation("dafny.lang:DafnyRuntime:3.10.0")
5668
implementation("software.amazon.dafny:conversion:1.0-SNAPSHOT")
@@ -62,6 +74,33 @@ dependencies {
6274
implementation("software.amazon.cryptography:ComAmazonawsKms:1.0-SNAPSHOT")
6375
implementation(platform("software.amazon.awssdk:bom:2.19.1"))
6476
implementation("software.amazon.awssdk:dynamodb")
77+
78+
// For the DDB-EC v1
79+
implementation("com.amazonaws:aws-java-sdk-dynamodb:1.12.409")
80+
// https://mvnrepository.com/artifact/org.testng/testng
81+
testImplementation("org.testng:testng:7.5")
82+
// https://mvnrepository.com/artifact/com.amazonaws/DynamoDBLocal
83+
testImplementation("com.amazonaws:DynamoDBLocal:1.+")
84+
// This is where we gather the SQLLite files to copy over
85+
dynamodb("com.amazonaws:DynamoDBLocal:1.+")
86+
// As of 1.21.0 DynamoDBLocal does not support Apple Silicon
87+
// This checks the dependencies and adds a native library
88+
// to support this architecture.
89+
if (org.apache.tools.ant.taskdefs.condition.Os.isArch("aarch64")) {
90+
testImplementation("io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392")
91+
dynamodb("io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392")
92+
}
93+
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
94+
testImplementation("org.hamcrest:hamcrest-all:1.3")
95+
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
96+
testImplementation("org.bouncycastle:bcprov-jdk15on:1.70")
97+
// https://mvnrepository.com/artifact/org.quicktheories/quicktheories
98+
testImplementation("org.quicktheories:quicktheories:0.26")
99+
// https://mvnrepository.com/artifact/junit/junit
100+
testImplementation("junit:junit:4.13.2")
101+
// https://mvnrepository.com/artifact/edu.umd.cs.mtc/multithreadedtc
102+
testImplementation("edu.umd.cs.mtc:multithreadedtc:1.01")
103+
65104
}
66105

67106
publishing {
@@ -77,9 +116,53 @@ tasks.withType<JavaCompile>() {
77116
options.encoding = "UTF-8"
78117
}
79118

80-
tasks {
81-
register("runTests", JavaExec::class.java) {
82-
mainClass.set("TestsFromDafny")
83-
classpath = sourceSets["test"].runtimeClasspath
119+
tasks.register<JavaExec>("runTests") {
120+
mainClass.set("TestsFromDafny")
121+
classpath = sourceSets["test"].runtimeClasspath
122+
}
123+
124+
tasks.test {
125+
useTestNG()
126+
dependsOn("CopyDynamoDb")
127+
systemProperty("java.library.path", "build/libs")
128+
129+
testLogging {
130+
lifecycle {
131+
events = mutableSetOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
132+
exceptionFormat = TestExceptionFormat.FULL
133+
showExceptions = true
134+
showCauses = true
135+
showStackTraces = true
136+
showStandardStreams = true
137+
}
138+
info.events = lifecycle.events
139+
info.exceptionFormat = lifecycle.exceptionFormat
140+
}
141+
142+
// See https://github.com/gradle/kotlin-dsl/issues/836
143+
addTestListener(object : TestListener {
144+
override fun beforeSuite(suite: TestDescriptor) {}
145+
override fun beforeTest(testDescriptor: TestDescriptor) {}
146+
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
147+
148+
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
149+
if (suite.parent == null) { // root suite
150+
logger.lifecycle("----")
151+
logger.lifecycle("Test result: ${result.resultType}")
152+
logger.lifecycle("Test summary: ${result.testCount} tests, " +
153+
"${result.successfulTestCount} succeeded, " +
154+
"${result.failedTestCount} failed, " +
155+
"${result.skippedTestCount} skipped")
156+
}
157+
}
158+
})
159+
}
160+
161+
tasks.register<Copy>("CopyDynamoDb") {
162+
from (dynamodb) {
163+
include("*.dll")
164+
include("*.dylib")
165+
include("*.so")
84166
}
167+
into("build/libs")
85168
}

0 commit comments

Comments
 (0)