diff --git a/aws-modules/aws-dynamodb/pom.xml b/aws-modules/aws-dynamodb/pom.xml index eee01badf3..37b88327f4 100644 --- a/aws-modules/aws-dynamodb/pom.xml +++ b/aws-modules/aws-dynamodb/pom.xml @@ -1,7 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 aws-dynamodb 0.1.0-SNAPSHOT @@ -16,14 +16,9 @@ - commons-io - commons-io - ${commons-io.version} - - - com.google.code.gson - gson - ${gson.version} + com.amazonaws + aws-java-sdk + ${aws-java-sdk.version} com.amazonaws @@ -32,9 +27,14 @@ test - com.amazonaws - aws-java-sdk-dynamodb - ${aws-java-sdk.version} + commons-io + commons-io + ${commons-io.version} + + + com.google.code.gson + gson + ${gson.version} @@ -81,8 +81,6 @@ 2.8.0 1.21.1 - 1.10.L001 - 0.9.4.0006L 3.1.1 diff --git a/aws-modules/aws-dynamodb/src/main/resources/db.properties b/aws-modules/aws-dynamodb/src/main/resources/db.properties deleted file mode 100644 index e934611a2b..0000000000 --- a/aws-modules/aws-dynamodb/src/main/resources/db.properties +++ /dev/null @@ -1,4 +0,0 @@ -db_hostname= -db_username=username -db_password=password -db_database=mydb \ No newline at end of file diff --git a/aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryUnitTest.java b/aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryIntegrationTest.java similarity index 98% rename from aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryUnitTest.java rename to aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryIntegrationTest.java index 617a35bd00..e4dc0c65b8 100644 --- a/aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryUnitTest.java +++ b/aws-modules/aws-dynamodb/src/test/java/com/baeldung/dynamodb/ProductInfoRepositoryIntegrationTest.java @@ -29,7 +29,7 @@ import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertThat; -public class ProductInfoRepositoryUnitTest { +public class ProductInfoRepositoryIntegrationTest { @ClassRule public static LocalDbCreationRule dynamoDB = new LocalDbCreationRule(); diff --git a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/entity/ProductInfo.java b/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/entity/ProductInfo.java deleted file mode 100644 index 9af5d926c9..0000000000 --- a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/entity/ProductInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.dynamodb.entity; - -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey; -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable; - -@DynamoDBTable(tableName = "ProductInfo") -public class ProductInfo { - - private String id; - private String msrp; - private String cost; - - public ProductInfo() { - } - - public ProductInfo(String cost, String msrp) { - this.msrp = msrp; - this.cost = cost; - } - - @DynamoDBHashKey - @DynamoDBAutoGeneratedKey - public String getId() { - return id; - } - - @DynamoDBAttribute - public String getMsrp() { - return msrp; - } - - @DynamoDBAttribute - public String getCost() { - return cost; - } - - public void setId(String id) { - this.id = id; - } - - public void setMsrp(String msrp) { - this.msrp = msrp; - } - - public void setCost(String cost) { - this.cost = cost; - } - -} diff --git a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/AbstractRepository.java b/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/AbstractRepository.java deleted file mode 100644 index 79934c17e9..0000000000 --- a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/AbstractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.dynamodb.repository; - -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBScanExpression; - -import java.io.Serializable; -import java.lang.reflect.ParameterizedType; -import java.util.List; - -public abstract class AbstractRepository { - - protected DynamoDBMapper mapper; - protected Class entityClass; - - protected AbstractRepository() { - ParameterizedType genericSuperclass = (ParameterizedType) getClass().getGenericSuperclass(); - - // This entityClass refers to the actual entity class in the subclass declaration. - - // For instance, ProductInfoDAO extends AbstractDAO - // In this case entityClass = ProductInfo, and ID is String type - // which refers to the ProductInfo's partition key string value - this.entityClass = (Class) genericSuperclass.getActualTypeArguments()[0]; - } - - public void save(T t) { - mapper.save(t); - } - - public T findOne(ID id) { - return mapper.load(entityClass, id); - } - - /** - * WARNING: It is not recommended to perform full table scan - * targeting the real production environment. - * - * @return All items - */ - public List findAll() { - DynamoDBScanExpression scanExpression = new DynamoDBScanExpression(); - return mapper.scan(entityClass, scanExpression); - } - - public void setMapper(DynamoDBMapper dynamoDBMapper) { - this.mapper = dynamoDBMapper; - } - -} diff --git a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/ProductInfoRepository.java b/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/ProductInfoRepository.java deleted file mode 100644 index 0dfec8e05c..0000000000 --- a/aws-modules/aws-miscellaneous/src/main/java/com/baeldung/dynamodb/repository/ProductInfoRepository.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.dynamodb.repository; - -import com.baeldung.dynamodb.entity.ProductInfo; - -public class ProductInfoRepository extends AbstractRepository { -}