Skip to content

Commit

Permalink
[dynamodb] Enforce checkstyle for DynamoDB binding (brianfrankcooper#904
Browse files Browse the repository at this point in the history
)
  • Loading branch information
risdenk authored Jan 31, 2017
1 parent 9cba207 commit 7fa8331
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 deletions.
47 changes: 10 additions & 37 deletions dynamodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ permissions and limitations under the License. See accompanying
LICENSE file.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.ycsb</groupId>
Expand All @@ -28,50 +29,22 @@ LICENSE file.
<artifactId>dynamodb-binding</artifactId>
<name>DynamoDB DB Binding</name>

<properties>
<checkstyle.failOnViolation>false</checkstyle.failOnViolation>
</properties>

<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.10.48</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.yahoo.ycsb</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.15</version>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>../checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
16 changes: 8 additions & 8 deletions dynamodb/src/main/java/com/yahoo/ycsb/db/DynamoDBClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void init() throws DBException {
this.primaryKeyType = PrimaryKeyType.valueOf(primaryKeyTypeString.trim().toUpperCase());
} catch (IllegalArgumentException e) {
throw new DBException("Invalid primary key mode specified: " + primaryKeyTypeString +
". Expecting HASH or HASH_AND_RANGE.");
". Expecting HASH or HASH_AND_RANGE.");
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public void init() throws DBException {

@Override
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("readkey: " + key + " from table: " + table);
}

Expand All @@ -159,7 +159,7 @@ public Status read(String table, String key, Set<String> fields, HashMap<String,

if (null != res.getItem()) {
result.putAll(extractResult(res.getItem()));
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Result: " + res.toString());
}
}
Expand All @@ -170,7 +170,7 @@ public Status read(String table, String key, Set<String> fields, HashMap<String,
public Status scan(String table, String startkey, int recordcount,
Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {

if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("scan " + recordcount + " records from key: " + startkey + " on table: " + table);
}

Expand Down Expand Up @@ -229,7 +229,7 @@ public Status scan(String table, String startkey, int recordcount,

@Override
public Status update(String table, String key, HashMap<String, ByteIterator> values) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updatekey: " + key + " from table: " + table);
}

Expand All @@ -255,7 +255,7 @@ public Status update(String table, String key, HashMap<String, ByteIterator> val

@Override
public Status insert(String table, String key, HashMap<String, ByteIterator> values) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("insertkey: " + primaryKeyName + "-" + key + " from table: " + table);
}

Expand Down Expand Up @@ -284,7 +284,7 @@ public Status insert(String table, String key, HashMap<String, ByteIterator> val

@Override
public Status delete(String table, String key) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("deletekey: " + key + " from table: " + table);
}

Expand Down Expand Up @@ -318,7 +318,7 @@ private HashMap<String, ByteIterator> extractResult(Map<String, AttributeValue>
HashMap<String, ByteIterator> rItems = new HashMap<>(item.size());

for (Entry<String, AttributeValue> attr : item.entrySet()) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Result- key: %s, value: %s", attr.getKey(), attr.getValue()));
}
rItems.put(attr.getKey(), new StringByteIterator(attr.getValue().getS()));
Expand Down

0 comments on commit 7fa8331

Please sign in to comment.