[dynamodb] Enforce checkstyle for DynamoDB binding (#904)

This commit is contained in:
Kevin Risden 2017-01-31 11:56:24 -05:00 коммит произвёл GitHub
Родитель 9cba207152
Коммит 7fa83311a6
2 изменённых файлов: 18 добавлений и 45 удалений

Просмотреть файл

@ -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>
@ -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>

Просмотреть файл

@ -105,7 +105,7 @@ public class DynamoDBClient extends DB {
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.");
}
}
@ -138,7 +138,7 @@ public class DynamoDBClient extends DB {
@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);
}
@ -159,7 +159,7 @@ public class DynamoDBClient extends DB {
if (null != res.getItem()) {
result.putAll(extractResult(res.getItem()));
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Result: " + res.toString());
}
}
@ -170,7 +170,7 @@ public class DynamoDBClient extends DB {
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);
}
@ -229,7 +229,7 @@ public class DynamoDBClient extends DB {
@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);
}
@ -255,7 +255,7 @@ public class DynamoDBClient extends DB {
@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);
}
@ -284,7 +284,7 @@ public class DynamoDBClient extends DB {
@Override
public Status delete(String table, String key) {
if(LOGGER.isDebugEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("deletekey: " + key + " from table: " + table);
}
@ -318,7 +318,7 @@ public class DynamoDBClient extends DB {
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()));