Create Tables Before Integration Tests
In most cases you will need tables pre-created in DynamoDB Local, which your integration tests will use. You can use create-tables
goal:
<plugin> <groupId>com.jcabi</groupId> <artifactId>jcabi-dynamodb-maven-plugin</artifactId> <version>0.10.1</version> <configuration> <tables> <table>${basedir}/first.json</table> <table>${basedir}/second.json</table> </tables> </configuration> <executions> <execution> <goals> <goal>start</goal> <goal>create-tables</goal> <goal>stop</goal> </goals> </execution> </executions> </plugin>
JSON file should have the following format (according to AWS specification of createTable
):
{ "AttributeDefinitions": [ { "AttributeName": "first", "AttributeType": "S" } ], "KeySchema": [ { "AttributeName": "first", "KeyType": "HASH" } ], "ProvisionedThroughput": { "ReadCapacityUnits": "100", "WriteCapacityUnits": "100" }, "TableName": "FirstTable" }