HBASE-19566 Fixed Checkstyle errors in hbase-archetypes and enabled Checkstyle to fail on violations
This commit is contained in:
parent
4d71f4e32f
commit
d95cf54ba6
|
@ -18,7 +18,10 @@
|
|||
*/
|
||||
package org.apache.hbase.archetypes.exemplars.client;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||
import org.apache.hadoop.hbase.client.Admin;
|
||||
|
@ -29,7 +32,6 @@ import org.apache.hadoop.hbase.client.Table;
|
|||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
@ -64,8 +66,7 @@ public class TestHelloHBase {
|
|||
assertEquals("#namespaceExists failed: found nonexistent namespace.",
|
||||
false, exists);
|
||||
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
|
||||
exists = HelloHBase.namespaceExists(admin, EXISTING_NAMESPACE);
|
||||
assertEquals("#namespaceExists failed: did NOT find existing namespace.",
|
||||
true, exists);
|
||||
|
@ -94,11 +95,9 @@ public class TestHelloHBase {
|
|||
@Test
|
||||
public void testPutRowToTable() throws IOException {
|
||||
Admin admin = TEST_UTIL.getAdmin();
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
Table table
|
||||
= TEST_UTIL.createTable
|
||||
(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
= TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
|
||||
HelloHBase.putRowToTable(table);
|
||||
Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
|
||||
|
@ -111,11 +110,9 @@ public class TestHelloHBase {
|
|||
@Test
|
||||
public void testDeleteRow() throws IOException {
|
||||
Admin admin = TEST_UTIL.getAdmin();
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
Table table
|
||||
= TEST_UTIL.createTable
|
||||
(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
= TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
|
||||
table.put(new Put(HelloHBase.MY_ROW_ID).
|
||||
addColumn(HelloHBase.MY_COLUMN_FAMILY_NAME,
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
*/
|
||||
package org.apache.hbase.archetypes.exemplars.shaded_client;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||
import org.apache.hadoop.hbase.client.Admin;
|
||||
|
@ -29,7 +32,6 @@ import org.apache.hadoop.hbase.client.Table;
|
|||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
@ -64,8 +66,7 @@ public class TestHelloHBase {
|
|||
assertEquals("#namespaceExists failed: found nonexistent namespace.",
|
||||
false, exists);
|
||||
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(EXISTING_NAMESPACE).build());
|
||||
exists = HelloHBase.namespaceExists(admin, EXISTING_NAMESPACE);
|
||||
assertEquals("#namespaceExists failed: did NOT find existing namespace.",
|
||||
true, exists);
|
||||
|
@ -94,11 +95,9 @@ public class TestHelloHBase {
|
|||
@Test
|
||||
public void testPutRowToTable() throws IOException {
|
||||
Admin admin = TEST_UTIL.getAdmin();
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
Table table
|
||||
= TEST_UTIL.createTable
|
||||
(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
= TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
|
||||
HelloHBase.putRowToTable(table);
|
||||
Result row = table.get(new Get(HelloHBase.MY_ROW_ID));
|
||||
|
@ -111,11 +110,9 @@ public class TestHelloHBase {
|
|||
@Test
|
||||
public void testDeleteRow() throws IOException {
|
||||
Admin admin = TEST_UTIL.getAdmin();
|
||||
admin.createNamespace
|
||||
(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
admin.createNamespace(NamespaceDescriptor.create(HelloHBase.MY_NAMESPACE_NAME).build());
|
||||
Table table
|
||||
= TEST_UTIL.createTable
|
||||
(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
= TEST_UTIL.createTable(HelloHBase.MY_TABLE_NAME, HelloHBase.MY_COLUMN_FAMILY_NAME);
|
||||
|
||||
table.put(new Put(HelloHBase.MY_ROW_ID).
|
||||
addColumn(HelloHBase.MY_COLUMN_FAMILY_NAME,
|
||||
|
|
|
@ -78,6 +78,22 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>checkstyle</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue