Skip to content

Commit ba8fcb7

Browse files
chore(java): fix GetEncryptedDataKeyDescription java Example (#1973)
1 parent 85309a0 commit ba8fcb7

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
11
package software.amazon.cryptography.examples;
22

3+
import java.util.UUID;
34
import org.testng.annotations.Test;
45

56
public class TestGetEncryptedDataKeyDescriptionExample {
67

78
@Test
89
public void TestGetEncryptedDataKeyDescription() {
10+
final String partitionKeyValue =
11+
"GetEncryptedDataKeyDescriptionExample" + UUID.randomUUID();
12+
final String partitionKeyName = "partition_key";
13+
final String sortKeyValue = "0";
14+
final String sortKeyName = "sort_key";
15+
// `getEncryptedDataKeyDescription` assumes that there is already existing item in dynamodb.
16+
// So, we need to run `PutItemGetItem` before `getEncryptedDataKeyDescription`
17+
BasicPutGetExample.PutItemGetItem(
18+
TestUtils.TEST_KMS_KEY_ID,
19+
TestUtils.TEST_DDB_TABLE_NAME,
20+
partitionKeyName,
21+
sortKeyName,
22+
partitionKeyValue,
23+
sortKeyValue
24+
);
925
GetEncryptedDataKeyDescriptionExample.getEncryptedDataKeyDescription(
1026
TestUtils.TEST_DDB_TABLE_NAME,
11-
"partition_key",
12-
"BasicPutGetExample",
13-
"sort_key",
14-
"0",
27+
partitionKeyName,
28+
partitionKeyValue,
29+
sortKeyName,
30+
sortKeyValue,
1531
"aws-kms",
1632
TestUtils.TEST_KMS_KEY_ID,
1733
null,
1834
null
1935
);
36+
TestUtils.cleanUpDDBItem(
37+
TestUtils.TEST_DDB_TABLE_NAME,
38+
partitionKeyName,
39+
sortKeyName,
40+
partitionKeyValue,
41+
sortKeyValue
42+
);
2043
}
2144
}

0 commit comments

Comments
 (0)