8000 add QLDB test for create/drop tables · localstack/localstack-java-utils@7587ad6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7587ad6

Browse files
committed
add QLDB test for create/drop tables
1 parent ce9b5f9 commit 7587ad6

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ADDITIONAL_MVN_ARGS ?= -DskipTests -q
22
export AWS_DEFAULT_REGION ?= us-east-1
33
export AWS_REGION ?= us-east-1
4-
export SERVICES ?= serverless,kinesis,sns,sqs,iam,cloudwatch
4+
export SERVICES ?= serverless,kinesis,sns,sqs,iam,cloudwatch,qldb
55

66
usage: ## Show this help
77
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

src/test/java/cloud/localstack/awssdkv2/ProFeaturesSDKV2Test.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,28 @@ public void testUpdateQueryDataTypes() throws Exception {
162162
cleanUp(ledgerName);
163163
}
164164

165+
@Test
166+
public void testCreateDropTable() throws Exception {
167+
if (!isProEnabled()) {
168+
return;
169+
}
170+
LOG.info("Running test testCreateDropTable() ...");
171+
String ledgerName = "l123";
172+
QldbDriver driver = createLedgerAndGetDriver(ledgerName);
173+
driver.execute(txn -> {
174+
txn.execute("CREATE TABLE A");
175+
});
176+
177+
driver.execute(txn -> {
178+
txn.execute("DROP TABLE A");
179+
});
180+
181+
Set<String> tableNames = StreamSupport.stream(driver.getTableNames().spliterator(), false)
182+
.collect(Collectors.toSet());
183+
184+
Assert.assertTrue(tableNames.isEmpty());
185+
}
186+
165187
// UTIL FUNCTIONS AND CLASSES BELOW
166188

167189
public static class Wallet {
@@ -218,6 +240,12 @@ public enum WalletType {
218240
BUSINESS
219241
}
220242

243+
244+
private QldbDriver createLedgerAndGetDriver(String ledgerName, String ... tableNames) throws Exception {
245+
createLedgerAndTables(ledgerName, tableNames);
246+
return getDriver(ledgerName);
247+
}
248+
221249
private void createLedgerAndTables(String ledgerName, String ... tableNames) throws Exception {
222250
QldbAsyncClient client = TestUtils.getClientQLDBAsyncV2();
223251

0 commit comments

Comments
 (0)
0