You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2017/03/10 22:09:51 UTC
[11/50] [abbrv] hbase git commit: HBASE-17532 Replaced explicit type
with diamond operator
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateBasic.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateBasic.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateBasic.java
index c7c1b89..15d15b3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateBasic.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateBasic.java
@@ -205,9 +205,9 @@ public abstract class TestReplicationStateBasic {
rqc.init();
List<Pair<Path, Path>> files1 = new ArrayList<>(3);
- files1.add(new Pair<Path, Path>(null, new Path("file_1")));
- files1.add(new Pair<Path, Path>(null, new Path("file_2")));
- files1.add(new Pair<Path, Path>(null, new Path("file_3")));
+ files1.add(new Pair<>(null, new Path("file_1")));
+ files1.add(new Pair<>(null, new Path("file_2")));
+ files1.add(new Pair<>(null, new Path("file_3")));
assertNull(rqc.getReplicableHFiles(ID_ONE));
assertEquals(0, rqc.getAllPeersFromHFileRefsQueue().size());
rp.registerPeer(ID_ONE, new ReplicationPeerConfig().setClusterKey(KEY_ONE));
@@ -241,9 +241,9 @@ public abstract class TestReplicationStateBasic {
rq1.addPeerToHFileRefs(ID_TWO);
List<Pair<Path, Path>> files1 = new ArrayList<>(3);
- files1.add(new Pair<Path, Path>(null, new Path("file_1")));
- files1.add(new Pair<Path, Path>(null, new Path("file_2")));
- files1.add(new Pair<Path, Path>(null, new Path("file_3")));
+ files1.add(new Pair<>(null, new Path("file_1")));
+ files1.add(new Pair<>(null, new Path("file_2")));
+ files1.add(new Pair<>(null, new Path("file_3")));
rq1.addHFileRefs(ID_ONE, files1);
rq1.addHFileRefs(ID_TWO, files1);
assertEquals(2, rqc.getAllPeersFromHFileRefsQueue().size());
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
index e61ceb2..9ec9b99 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
@@ -277,7 +277,7 @@ public class TestReplicationSyncUpTool extends TestReplicationBase {
LOG.debug("mimicSyncUpAfterDelete");
utility2.shutdownMiniHBaseCluster();
- List<Delete> list = new ArrayList<Delete>();
+ List<Delete> list = new ArrayList<>();
// delete half of the rows
for (int i = 0; i < NB_ROWS_IN_BATCH / 2; i++) {
String rowKey = "row" + i;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java
index 0222513..388b6cc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java
@@ -99,7 +99,7 @@ public class TestReplicationTrackerZKImpl {
rsRemovedCount = new AtomicInteger(0);
rsRemovedData = "";
plChangedCount = new AtomicInteger(0);
- plChangedData = new ArrayList<String>();
+ plChangedData = new ArrayList<>();
peerRemovedCount = new AtomicInteger(0);
peerRemovedData = "";
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWALEntryFilters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWALEntryFilters.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWALEntryFilters.java
index 2dbacaf..8ea0bae 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWALEntryFilters.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWALEntryFilters.java
@@ -93,19 +93,19 @@ public class TestReplicationWALEntryFilters {
assertEquals(null, filter.filter(userEntry));
// empty scopes
- TreeMap<byte[], Integer> scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ TreeMap<byte[], Integer> scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
userEntry = createEntry(scopes, a, b);
assertEquals(null, filter.filter(userEntry));
// different scope
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(c, HConstants.REPLICATION_SCOPE_GLOBAL);
userEntry = createEntry(scopes, a, b);
// all kvs should be filtered
assertEquals(userEntryEmpty, filter.filter(userEntry));
// local scope
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(a, HConstants.REPLICATION_SCOPE_LOCAL);
userEntry = createEntry(scopes, a, b);
assertEquals(userEntryEmpty, filter.filter(userEntry));
@@ -113,7 +113,7 @@ public class TestReplicationWALEntryFilters {
assertEquals(userEntryEmpty, filter.filter(userEntry));
// only scope a
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(a, HConstants.REPLICATION_SCOPE_GLOBAL);
userEntry = createEntry(scopes, a, b);
assertEquals(userEntryA, filter.filter(userEntry));
@@ -121,7 +121,7 @@ public class TestReplicationWALEntryFilters {
assertEquals(userEntryA, filter.filter(userEntry));
// only scope b
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(b, HConstants.REPLICATION_SCOPE_GLOBAL);
userEntry = createEntry(scopes, a, b);
assertEquals(userEntryB, filter.filter(userEntry));
@@ -129,7 +129,7 @@ public class TestReplicationWALEntryFilters {
assertEquals(userEntryB, filter.filter(userEntry));
// scope a and b
- scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
scopes.put(b, HConstants.REPLICATION_SCOPE_GLOBAL);
userEntry = createEntry(scopes, a, b);
assertEquals(userEntryB, filter.filter(userEntry));
@@ -213,14 +213,14 @@ public class TestReplicationWALEntryFilters {
// 2. Only config table-cfs in peer
// empty map
userEntry = createEntry(null, a, b, c);
- Map<TableName, List<String>> tableCfs = new HashMap<TableName, List<String>>();
+ Map<TableName, List<String>> tableCfs = new HashMap<>();
when(peer.getTableCFs()).thenReturn(tableCfs);
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
assertEquals(null, filter.filter(userEntry));
// table bar
userEntry = createEntry(null, a, b, c);
- tableCfs = new HashMap<TableName, List<String>>();
+ tableCfs = new HashMap<>();
tableCfs.put(TableName.valueOf("bar"), null);
when(peer.getTableCFs()).thenReturn(tableCfs);
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
@@ -228,7 +228,7 @@ public class TestReplicationWALEntryFilters {
// table foo:a
userEntry = createEntry(null, a, b, c);
- tableCfs = new HashMap<TableName, List<String>>();
+ tableCfs = new HashMap<>();
tableCfs.put(TableName.valueOf("foo"), Lists.newArrayList("a"));
when(peer.getTableCFs()).thenReturn(tableCfs);
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
@@ -236,7 +236,7 @@ public class TestReplicationWALEntryFilters {
// table foo:a,c
userEntry = createEntry(null, a, b, c, d);
- tableCfs = new HashMap<TableName, List<String>>();
+ tableCfs = new HashMap<>();
tableCfs.put(TableName.valueOf("foo"), Lists.newArrayList("a", "c"));
when(peer.getTableCFs()).thenReturn(tableCfs);
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
@@ -245,7 +245,7 @@ public class TestReplicationWALEntryFilters {
// 3. Only config namespaces in peer
when(peer.getTableCFs()).thenReturn(null);
// empty set
- Set<String> namespaces = new HashSet<String>();
+ Set<String> namespaces = new HashSet<>();
when(peer.getNamespaces()).thenReturn(namespaces);
userEntry = createEntry(null, a, b, c);
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
@@ -259,7 +259,7 @@ public class TestReplicationWALEntryFilters {
assertEquals(createEntry(null, a,b,c), filter.filter(userEntry));
// namespace ns1
- namespaces = new HashSet<String>();;
+ namespaces = new HashSet<>();
namespaces.add("ns1");
when(peer.getNamespaces()).thenReturn(namespaces);
userEntry = createEntry(null, a, b, c);
@@ -268,8 +268,8 @@ public class TestReplicationWALEntryFilters {
// 4. Config namespaces and table-cfs both
// Namespaces config should not confict with table-cfs config
- namespaces = new HashSet<String>();
- tableCfs = new HashMap<TableName, List<String>>();
+ namespaces = new HashSet<>();
+ tableCfs = new HashMap<>();
namespaces.add("ns1");
when(peer.getNamespaces()).thenReturn(namespaces);
tableCfs.put(TableName.valueOf("foo"), Lists.newArrayList("a", "c"));
@@ -278,8 +278,8 @@ public class TestReplicationWALEntryFilters {
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
assertEquals(createEntry(null, a, c), filter.filter(userEntry));
- namespaces = new HashSet<String>();;
- tableCfs = new HashMap<TableName, List<String>>();
+ namespaces = new HashSet<>();
+ tableCfs = new HashMap<>();
namespaces.add("default");
when(peer.getNamespaces()).thenReturn(namespaces);
tableCfs.put(TableName.valueOf("ns1:foo"), Lists.newArrayList("a", "c"));
@@ -288,8 +288,8 @@ public class TestReplicationWALEntryFilters {
filter = new ChainWALEntryFilter(new NamespaceTableCfWALEntryFilter(peer));
assertEquals(createEntry(null, a, b, c), filter.filter(userEntry));
- namespaces = new HashSet<String>();;
- tableCfs = new HashMap<TableName, List<String>>();
+ namespaces = new HashSet<>();
+ tableCfs = new HashMap<>();
namespaces.add("ns1");
when(peer.getNamespaces()).thenReturn(namespaces);
tableCfs.put(TableName.valueOf("bar"), null);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
index ebf00e3..4369e5e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
@@ -203,7 +203,7 @@ public class TestReplicationWithTags {
final WALEdit edit, final Durability durability) throws IOException {
byte[] attribute = put.getAttribute("visibility");
byte[] cf = null;
- List<Cell> updatedCells = new ArrayList<Cell>();
+ List<Cell> updatedCells = new ArrayList<>();
if (attribute != null) {
for (List<? extends Cell> edits : put.getFamilyCellMap().values()) {
for (Cell cell : edits) {
@@ -212,7 +212,7 @@ public class TestReplicationWithTags {
cf = CellUtil.cloneFamily(kv);
}
Tag tag = new ArrayBackedTag(TAG_TYPE, attribute);
- List<Tag> tagList = new ArrayList<Tag>(1);
+ List<Tag> tagList = new ArrayList<>(1);
tagList.add(tag);
KeyValue newKV = new KeyValue(CellUtil.cloneRow(kv), 0, kv.getRowLength(),
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
index dcfa736..ad5063a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
@@ -146,7 +146,7 @@ public class TestRegionReplicaReplicationEndpointNoMaster {
public void after() throws Exception {
}
- static ConcurrentLinkedQueue<Entry> entries = new ConcurrentLinkedQueue<Entry>();
+ static ConcurrentLinkedQueue<Entry> entries = new ConcurrentLinkedQueue<>();
public static class WALEditCopro implements WALObserver {
public WALEditCopro() {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
index 4ae14b7..0e08c90 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java
@@ -153,8 +153,8 @@ public class TestReplicationSink {
*/
@Test
public void testBatchSink() throws Exception {
- List<WALEntry> entries = new ArrayList<WALEntry>(BATCH_SIZE);
- List<Cell> cells = new ArrayList<Cell>();
+ List<WALEntry> entries = new ArrayList<>(BATCH_SIZE);
+ List<Cell> cells = new ArrayList<>();
for(int i = 0; i < BATCH_SIZE; i++) {
entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
}
@@ -171,16 +171,16 @@ public class TestReplicationSink {
*/
@Test
public void testMixedPutDelete() throws Exception {
- List<WALEntry> entries = new ArrayList<WALEntry>(BATCH_SIZE/2);
- List<Cell> cells = new ArrayList<Cell>();
+ List<WALEntry> entries = new ArrayList<>(BATCH_SIZE/2);
+ List<Cell> cells = new ArrayList<>();
for(int i = 0; i < BATCH_SIZE/2; i++) {
entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
}
SINK.replicateEntries(entries, CellUtil.createCellScanner(cells), replicationClusterId,
baseNamespaceDir, hfileArchiveDir);
- entries = new ArrayList<WALEntry>(BATCH_SIZE);
- cells = new ArrayList<Cell>();
+ entries = new ArrayList<>(BATCH_SIZE);
+ cells = new ArrayList<>();
for(int i = 0; i < BATCH_SIZE; i++) {
entries.add(createEntry(TABLE_NAME1, i,
i % 2 != 0 ? KeyValue.Type.Put: KeyValue.Type.DeleteColumn, cells));
@@ -199,8 +199,8 @@ public class TestReplicationSink {
*/
@Test
public void testMixedPutTables() throws Exception {
- List<WALEntry> entries = new ArrayList<WALEntry>(BATCH_SIZE/2);
- List<Cell> cells = new ArrayList<Cell>();
+ List<WALEntry> entries = new ArrayList<>(BATCH_SIZE/2);
+ List<Cell> cells = new ArrayList<>();
for(int i = 0; i < BATCH_SIZE; i++) {
entries.add(createEntry( i % 2 == 0 ? TABLE_NAME2 : TABLE_NAME1,
i, KeyValue.Type.Put, cells));
@@ -221,15 +221,15 @@ public class TestReplicationSink {
*/
@Test
public void testMixedDeletes() throws Exception {
- List<WALEntry> entries = new ArrayList<WALEntry>(3);
- List<Cell> cells = new ArrayList<Cell>();
+ List<WALEntry> entries = new ArrayList<>(3);
+ List<Cell> cells = new ArrayList<>();
for(int i = 0; i < 3; i++) {
entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
}
SINK.replicateEntries(entries, CellUtil.createCellScanner(cells.iterator()),
replicationClusterId, baseNamespaceDir, hfileArchiveDir);
- entries = new ArrayList<WALEntry>(3);
- cells = new ArrayList<Cell>();
+ entries = new ArrayList<>(3);
+ cells = new ArrayList<>();
entries.add(createEntry(TABLE_NAME1, 0, KeyValue.Type.DeleteColumn, cells));
entries.add(createEntry(TABLE_NAME1, 1, KeyValue.Type.DeleteFamily, cells));
entries.add(createEntry(TABLE_NAME1, 2, KeyValue.Type.DeleteColumn, cells));
@@ -249,8 +249,8 @@ public class TestReplicationSink {
*/
@Test
public void testApplyDeleteBeforePut() throws Exception {
- List<WALEntry> entries = new ArrayList<WALEntry>(5);
- List<Cell> cells = new ArrayList<Cell>();
+ List<WALEntry> entries = new ArrayList<>(5);
+ List<Cell> cells = new ArrayList<>();
for(int i = 0; i < 2; i++) {
entries.add(createEntry(TABLE_NAME1, i, KeyValue.Type.Put, cells));
}
@@ -284,7 +284,7 @@ public class TestReplicationSink {
}
List<Integer> numberList = new ArrayList<>(numbers);
Collections.sort(numberList);
- Map<String, Long> storeFilesSize = new HashMap<String, Long>(1);
+ Map<String, Long> storeFilesSize = new HashMap<>(1);
// 2. Create 25 hfiles
Configuration conf = TEST_UTIL.getConfiguration();
@@ -313,7 +313,7 @@ public class TestReplicationSink {
storeFiles, storeFilesSize, 1);
edit = WALEdit.createBulkLoadEvent(regionInfo, loadDescriptor);
}
- List<WALEntry> entries = new ArrayList<WALEntry>(1);
+ List<WALEntry> entries = new ArrayList<>(1);
// 4. Create a WALEntryBuilder
WALEntry.Builder builder = createWALEntryBuilder(TABLE_NAME1);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
index af3bf83..026f8e4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
@@ -144,7 +144,7 @@ public abstract class TestReplicationSourceManager {
protected static CountDownLatch latch;
- protected static List<String> files = new ArrayList<String>();
+ protected static List<String> files = new ArrayList<>();
protected static NavigableMap<byte[], Integer> scopes;
protected static void setupZkAndReplication() throws Exception {
@@ -182,8 +182,7 @@ public abstract class TestReplicationSourceManager {
col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
htd.addFamily(col);
- scopes = new TreeMap<byte[], Integer>(
- Bytes.BYTES_COMPARATOR);
+ scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
for(byte[] fam : htd.getFamiliesKeys()) {
scopes.put(fam, 0);
}
@@ -225,7 +224,7 @@ public abstract class TestReplicationSourceManager {
WALEdit edit = new WALEdit();
edit.add(kv);
- List<WALActionsListener> listeners = new ArrayList<WALActionsListener>(1);
+ List<WALActionsListener> listeners = new ArrayList<>(1);
listeners.add(replication);
final WALFactory wals = new WALFactory(utility.getConfiguration(), listeners,
URLEncoder.encode("regionserver:60020", "UTF8"));
@@ -233,8 +232,7 @@ public abstract class TestReplicationSourceManager {
manager.init();
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("tableame"));
htd.addFamily(new HColumnDescriptor(f1));
- NavigableMap<byte[], Integer> scopes = new TreeMap<byte[], Integer>(
- Bytes.BYTES_COMPARATOR);
+ NavigableMap<byte[], Integer> scopes = new TreeMap<>(Bytes.BYTES_COMPARATOR);
for(byte[] fam : htd.getFamiliesKeys()) {
scopes.put(fam, 0);
}
@@ -341,7 +339,7 @@ public abstract class TestReplicationSourceManager {
server.getZooKeeper()));
rq.init(server.getServerName().toString());
// populate some znodes in the peer znode
- SortedSet<String> files = new TreeSet<String>();
+ SortedSet<String> files = new TreeSet<>();
String group = "testgroup";
String file1 = group + ".log1";
String file2 = group + ".log2";
@@ -393,7 +391,7 @@ public abstract class TestReplicationSourceManager {
@Test
public void testBulkLoadWALEditsWithoutBulkLoadReplicationEnabled() throws Exception {
- NavigableMap<byte[], Integer> scope = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
// 1. Get the bulk load wal edit event
WALEdit logEdit = getBulkLoadWALEdit(scope);
// 2. Create wal key
@@ -410,7 +408,7 @@ public abstract class TestReplicationSourceManager {
@Test
public void testBulkLoadWALEdits() throws Exception {
// 1. Get the bulk load wal edit event
- NavigableMap<byte[], Integer> scope = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ NavigableMap<byte[], Integer> scope = new TreeMap<>(Bytes.BYTES_COMPARATOR);
WALEdit logEdit = getBulkLoadWALEdit(scope);
// 2. Create wal key
WALKey logKey = new WALKey(scope);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/HbaseObjectWritableFor96Migration.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/HbaseObjectWritableFor96Migration.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/HbaseObjectWritableFor96Migration.java
index 3739d75..adf09d4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/HbaseObjectWritableFor96Migration.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/HbaseObjectWritableFor96Migration.java
@@ -127,10 +127,8 @@ class HbaseObjectWritableFor96Migration implements Writable, WritableWithSize, C
// Here we maintain two static maps of classes to code and vice versa.
// Add new classes+codes as wanted or figure way to auto-generate these
// maps.
- static final Map<Integer, Class<?>> CODE_TO_CLASS =
- new HashMap<Integer, Class<?>>();
- static final Map<Class<?>, Integer> CLASS_TO_CODE =
- new HashMap<Class<?>, Integer>();
+ static final Map<Integer, Class<?>> CODE_TO_CLASS = new HashMap<>();
+ static final Map<Class<?>, Integer> CLASS_TO_CODE = new HashMap<>();
// Special code that means 'not-encoded'; in this case we do old school
// sending of the class name using reflection, etc.
private static final byte NOT_ENCODED = 0;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
index cf01463..06389ab 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
@@ -112,7 +112,7 @@ public class TestAccessControlFilter extends SecureTestUtil {
Permission.Action.READ);
// put some test data
- List<Put> puts = new ArrayList<Put>(100);
+ List<Put> puts = new ArrayList<>(100);
for (int i=0; i<100; i++) {
Put p = new Put(Bytes.toBytes(i));
p.addColumn(FAMILY, PRIVATE_COL, Bytes.toBytes("secret " + i));
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index 0377190..8bf2c5c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -640,7 +640,7 @@ public class TestAccessController extends SecureTestUtil {
AccessTestAction listProceduresAction = new AccessTestAction() {
@Override
public Object run() throws Exception {
- List<ProcedureInfo> procInfoListClone = new ArrayList<ProcedureInfo>(procInfoList.size());
+ List<ProcedureInfo> procInfoListClone = new ArrayList<>(procInfoList.size());
for(ProcedureInfo pi : procInfoList) {
procInfoListClone.add(pi.clone());
}
@@ -1763,7 +1763,7 @@ public class TestAccessController extends SecureTestUtil {
}
List<String> superUsers = Superusers.getSuperUsers();
- List<UserPermission> adminPerms = new ArrayList<UserPermission>(superUsers.size() + 1);
+ List<UserPermission> adminPerms = new ArrayList<>(superUsers.size() + 1);
adminPerms.add(new UserPermission(Bytes.toBytes(USER_ADMIN.getShortName()),
AccessControlLists.ACL_TABLE_NAME, null, null, Bytes.toBytes("ACRW")));
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
index bbc6ad0..88cdf1d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
@@ -248,7 +248,7 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
}
private Map<String, Permission> prepareCellPermissions(String[] users, Action... action) {
- Map<String, Permission> perms = new HashMap<String, Permission>(2);
+ Map<String, Permission> perms = new HashMap<>(2);
for (String user : users) {
perms.put(user, new Permission(action));
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
index 29bbbbb..102b28a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
@@ -447,7 +447,7 @@ public class TestCellACLs extends SecureTestUtil {
}
private Map<String, Permission> prepareCellPermissions(String[] users, Action... action) {
- Map<String, Permission> perms = new HashMap<String, Permission>(2);
+ Map<String, Permission> perms = new HashMap<>(2);
for (String user : users) {
perms.put(user, new Permission(action));
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java
index 7c60f68..08c8107 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestWithDisabledAuthorization.java
@@ -931,7 +931,7 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
@Override
public Object run() throws Exception {
ACCESS_CONTROLLER.preBatchMutate(ObserverContext.createAndPrepare(RCP_ENV, null),
- new MiniBatchOperationInProgress<Mutation>(null, null, null, 0, 0));
+ new MiniBatchOperationInProgress<>(null, null, null, 0, 0));
return null;
}
}, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
index 6582751..cb36246 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestZKPermissionsWatcher.java
@@ -111,7 +111,7 @@ public class TestZKPermissionsWatcher {
TablePermission.Action.WRITE));
// update ACL: george RW
- List<TablePermission> acl = new ArrayList<TablePermission>(1);
+ List<TablePermission> acl = new ArrayList<>(1);
acl.add(new TablePermission(TEST_TABLE, null, TablePermission.Action.READ,
TablePermission.Action.WRITE));
final long mtimeB = AUTH_B.getMTime();
@@ -144,7 +144,7 @@ public class TestZKPermissionsWatcher {
TablePermission.Action.WRITE));
// update ACL: hubert R
- acl = new ArrayList<TablePermission>(1);
+ acl = new ArrayList<>(1);
acl.add(new TablePermission(TEST_TABLE, null, TablePermission.Action.READ));
final long mtimeA = AUTH_A.getMTime();
AUTH_B.setTableUserPermissions("hubert", TEST_TABLE, acl);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
index 5b46af5..0324359 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
@@ -137,7 +137,7 @@ public class TestTokenAuthentication {
if (initialIsa.getAddress() == null) {
throw new IllegalArgumentException("Failed resolve of " + initialIsa);
}
- final List<BlockingServiceAndInterface> sai = new ArrayList<BlockingServiceAndInterface>(1);
+ final List<BlockingServiceAndInterface> sai = new ArrayList<>(1);
// Make a proxy to go between the shaded Service that rpc expects and the
// non-shaded Service this CPEP is providing. This is because this test does a neat
// little trick of testing the CPEP Service by inserting it as RpcServer Service. This
@@ -351,8 +351,7 @@ public class TestTokenAuthentication {
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
final NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>
- callback =
- new NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>();
+ callback = new NonShadedBlockingRpcCallback<>();
getAuthenticationToken((RpcController)null, request, callback);
try {
serverController.checkFailed();
@@ -370,7 +369,7 @@ public class TestTokenAuthentication {
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
NonShadedBlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =
- new NonShadedBlockingRpcCallback<AuthenticationProtos.WhoAmIResponse>();
+ new NonShadedBlockingRpcCallback<>();
whoAmI(null, request, callback);
try {
serverController.checkFailed();
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
index 8cef21e..d8d6f1e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
@@ -152,7 +152,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
@Override
public List<String> getUserAuths(byte[] user, boolean systemCall) throws IOException {
assert (labelsRegion != null || systemCall);
- List<String> auths = new ArrayList<String>();
+ List<String> auths = new ArrayList<>();
Get get = new Get(user);
List<Cell> cells = null;
if (labelsRegion == null) {
@@ -187,7 +187,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
@Override
public List<String> getGroupAuths(String[] groups, boolean systemCall) throws IOException {
assert (labelsRegion != null || systemCall);
- List<String> auths = new ArrayList<String>();
+ List<String> auths = new ArrayList<>();
if (groups != null && groups.length > 0) {
for (String group : groups) {
Get get = new Get(Bytes.toBytes(AuthUtil.toGroupEntry(group)));
@@ -224,7 +224,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
@Override
public List<String> listLabels(String regex) throws IOException {
// return an empty list for this implementation.
- return new ArrayList<String>();
+ return new ArrayList<>();
}
@Override
@@ -237,7 +237,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
throw new IOException(e);
}
node = this.expressionExpander.expand(node);
- List<Tag> tags = new ArrayList<Tag>();
+ List<Tag> tags = new ArrayList<>();
if (withSerializationFormat) {
tags.add(STRING_SERIALIZATION_FORMAT_TAG);
}
@@ -270,7 +270,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
try {
// null authorizations to be handled inside SLG impl.
authLabels = scanLabelGenerator.getLabels(VisibilityUtils.getActiveUser(), authorizations);
- authLabels = (authLabels == null) ? new ArrayList<String>() : authLabels;
+ authLabels = (authLabels == null) ? new ArrayList<>() : authLabels;
authorizations = new Authorizations(authLabels);
} catch (Throwable t) {
LOG.error(t);
@@ -334,8 +334,8 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
private Tag createTag(ExpressionNode node) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
- List<String> labels = new ArrayList<String>();
- List<String> notLabels = new ArrayList<String>();
+ List<String> labels = new ArrayList<>();
+ List<String> notLabels = new ArrayList<>();
extractLabels(node, labels, notLabels);
Collections.sort(labels);
Collections.sort(notLabels);
@@ -402,7 +402,7 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
if (Superusers.isSuperUser(user)) {
return true;
}
- Set<String> auths = new HashSet<String>();
+ Set<String> auths = new HashSet<>();
auths.addAll(this.getUserAuths(Bytes.toBytes(user.getShortName()), true));
auths.addAll(this.getGroupAuths(user.getGroupNames(), true));
return auths.contains(SYSTEM_LABEL);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/LabelFilteringScanLabelGenerator.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/LabelFilteringScanLabelGenerator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/LabelFilteringScanLabelGenerator.java
index df77400..ed90274 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/LabelFilteringScanLabelGenerator.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/LabelFilteringScanLabelGenerator.java
@@ -44,7 +44,7 @@ public class LabelFilteringScanLabelGenerator implements ScanLabelGenerator {
public List<String> getLabels(User user, Authorizations authorizations) {
if (authorizations != null) {
if (labelToFilter == null) return authorizations.getLabels();
- List<String> newAuths = new ArrayList<String>();
+ List<String> newAuths = new ArrayList<>();
for (String auth : authorizations.getLabels()) {
if (!labelToFilter.equals(auth)) newAuths.add(auth);
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
index 2111229..8348679 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
@@ -438,7 +438,7 @@ public abstract class TestVisibilityLabels {
scan.setAuthorizations(new Authorizations(VisibilityUtils.SYSTEM_LABEL));
ResultScanner scanner = ht.getScanner(scan);
Result result = null;
- List<Result> results = new ArrayList<Result>();
+ List<Result> results = new ArrayList<>();
while ((result = scanner.next()) != null) {
results.add(result);
}
@@ -456,7 +456,7 @@ public abstract class TestVisibilityLabels {
} catch (Throwable e) {
fail("Should not have failed");
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -482,7 +482,7 @@ public abstract class TestVisibilityLabels {
}
} catch (Throwable e) {
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -496,7 +496,7 @@ public abstract class TestVisibilityLabels {
}
protected List<String> extractAuths(String user, List<Result> results) {
- List<String> auths = new ArrayList<String>();
+ List<String> auths = new ArrayList<>();
for (Result result : results) {
Cell labelCell = result.getColumnLatestCell(LABELS_TABLE_FAMILY, LABEL_QUALIFIER);
Cell userAuthCell = result.getColumnLatestCell(LABELS_TABLE_FAMILY, user.getBytes());
@@ -542,7 +542,7 @@ public abstract class TestVisibilityLabels {
Table ht = connection.getTable(LABELS_TABLE_NAME)) {
ResultScanner scanner = ht.getScanner(new Scan());
Result result = null;
- List<Result> results = new ArrayList<Result>();
+ List<Result> results = new ArrayList<>();
while ((result = scanner.next()) != null) {
results.add(result);
}
@@ -557,7 +557,7 @@ public abstract class TestVisibilityLabels {
} catch (Throwable e) {
fail("Should not have failed");
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -853,7 +853,7 @@ public abstract class TestVisibilityLabels {
static Table createTableAndWriteDataWithLabels(TableName tableName, String... labelExps)
throws Exception {
- List<Put> puts = new ArrayList<Put>(labelExps.length);
+ List<Put> puts = new ArrayList<>(labelExps.length);
for (int i = 0; i < labelExps.length; i++) {
Put put = new Put(Bytes.toBytes("row" + (i+1)));
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, value);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOpWithDifferentUsersNoACL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOpWithDifferentUsersNoACL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOpWithDifferentUsersNoACL.java
index 307bd00..a3c926e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOpWithDifferentUsersNoACL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOpWithDifferentUsersNoACL.java
@@ -128,7 +128,7 @@ public class TestVisibilityLabelsOpWithDifferentUsersNoACL {
authsResponse = NORMAL_USER1.runAs(action1);
assertTrue(authsResponse.getAuthList().isEmpty());
authsResponse = SUPERUSER.runAs(action1);
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
index a10e3a9..d79e30d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
@@ -378,7 +378,7 @@ public class TestVisibilityLabelsReplication {
static Table writeData(TableName tableName, String... labelExps) throws Exception {
Table table = TEST_UTIL.getConnection().getTable(TABLE_NAME);
int i = 1;
- List<Put> puts = new ArrayList<Put>(labelExps.length);
+ List<Put> puts = new ArrayList<>(labelExps.length);
for (String labelExp : labelExps) {
Put put = new Put(Bytes.toBytes("row" + i));
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, value);
@@ -399,7 +399,7 @@ public class TestVisibilityLabelsReplication {
Durability durability) throws IOException {
byte[] attribute = m.getAttribute(NON_VISIBILITY);
byte[] cf = null;
- List<Cell> updatedCells = new ArrayList<Cell>();
+ List<Cell> updatedCells = new ArrayList<>();
if (attribute != null) {
for (List<? extends Cell> edits : m.getFamilyCellMap().values()) {
for (Cell cell : edits) {
@@ -408,7 +408,7 @@ public class TestVisibilityLabelsReplication {
cf = CellUtil.cloneFamily(kv);
}
Tag tag = new ArrayBackedTag((byte) NON_VIS_TAG_TYPE, attribute);
- List<Tag> tagList = new ArrayList<Tag>(kv.getTags().size() + 1);
+ List<Tag> tagList = new ArrayList<>(kv.getTags().size() + 1);
tagList.add(tag);
tagList.addAll(kv.getTags());
Cell newcell = CellUtil.createCell(kv, tagList);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
index e236be2..f6ff640 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
@@ -300,7 +300,7 @@ public class TestVisibilityLabelsWithACL {
GetAuthsResponse authsResponse = NORMAL_USER1.runAs(action1);
assertNull(authsResponse);
authsResponse = SUPERUSER.runAs(action1);
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -315,7 +315,7 @@ public class TestVisibilityLabelsWithACL {
try {
table = TEST_UTIL.createTable(tableName, fam);
int i = 1;
- List<Put> puts = new ArrayList<Put>(labelExps.length);
+ List<Put> puts = new ArrayList<>(labelExps.length);
for (String labelExp : labelExps) {
Put put = new Put(Bytes.toBytes("row" + i));
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, value);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithCustomVisLabService.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithCustomVisLabService.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithCustomVisLabService.java
index 5cc72d2..7b5a5b7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithCustomVisLabService.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithCustomVisLabService.java
@@ -66,7 +66,7 @@ public class TestVisibilityLabelsWithCustomVisLabService extends TestVisibilityL
}
protected List<String> extractAuths(String user, List<Result> results) {
- List<String> auths = new ArrayList<String>();
+ List<String> auths = new ArrayList<>();
for (Result result : results) {
if (Bytes.equals(result.getRow(), Bytes.toBytes(user))) {
NavigableMap<byte[], byte[]> familyMap = result.getFamilyMap(LABELS_TABLE_FAMILY);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index 9853fa2..9e244ab 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -1146,7 +1146,7 @@ public class TestVisibilityLabelsWithDeletes {
desc.addFamily(colDesc);
hBaseAdmin.createTable(desc);
- List<Put> puts = new ArrayList<Put>(5);
+ List<Put> puts = new ArrayList<>(5);
Put put = new Put(Bytes.toBytes("row1"));
put.addColumn(fam, qual, 123l, value);
put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -3225,7 +3225,7 @@ public class TestVisibilityLabelsWithDeletes {
Table table = null;
table = TEST_UTIL.createTable(tableName, fam);
int i = 1;
- List<Put> puts = new ArrayList<Put>(labelExps.length);
+ List<Put> puts = new ArrayList<>(labelExps.length);
for (String labelExp : labelExps) {
Put put = new Put(Bytes.toBytes("row" + i));
put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, value);
@@ -3243,7 +3243,7 @@ public class TestVisibilityLabelsWithDeletes {
Table table = null;
table = TEST_UTIL.createTable(tableName, fam);
int i = 1;
- List<Put> puts = new ArrayList<Put>(labelExps.length);
+ List<Put> puts = new ArrayList<>(labelExps.length);
for (String labelExp : labelExps) {
Put put = new Put(Bytes.toBytes("row" + i));
put.addColumn(fam, qual, timestamp[i - 1], value);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
index 940d6dc..9f24f6c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
@@ -185,7 +185,7 @@ public class TestVisibilityLablesWithGroups {
} catch (Throwable e) {
fail("Should not have failed");
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -302,7 +302,7 @@ public class TestVisibilityLablesWithGroups {
} catch (Throwable e) {
fail("Should not have failed");
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestWithDisabledAuthorization.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestWithDisabledAuthorization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestWithDisabledAuthorization.java
index ff348db..3d53a1e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestWithDisabledAuthorization.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestWithDisabledAuthorization.java
@@ -142,7 +142,7 @@ public class TestWithDisabledAuthorization {
} catch (Throwable t) {
fail("Should not have failed");
}
- List<String> authsList = new ArrayList<String>(authsResponse.getAuthList().size());
+ List<String> authsList = new ArrayList<>(authsResponse.getAuthList().size());
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
@@ -227,7 +227,7 @@ public class TestWithDisabledAuthorization {
static Table createTableAndWriteDataWithLabels(TableName tableName, String... labelExps)
throws Exception {
- List<Put> puts = new ArrayList<Put>(labelExps.length + 1);
+ List<Put> puts = new ArrayList<>(labelExps.length + 1);
for (int i = 0; i < labelExps.length; i++) {
Put put = new Put(Bytes.toBytes("row" + (i+1)));
put.addColumn(TEST_FAMILY, TEST_QUALIFIER, HConstants.LATEST_TIMESTAMP, ZERO);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
index 74f4974..ccad85b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
@@ -112,7 +112,7 @@ public final class SnapshotTestingUtils {
// list the snapshot
List<SnapshotDescription> snapshots = admin.listSnapshots();
- List<SnapshotDescription> returnedSnapshots = new ArrayList<SnapshotDescription>();
+ List<SnapshotDescription> returnedSnapshots = new ArrayList<>();
for (SnapshotDescription sd : snapshots) {
if (snapshotName.equals(sd.getName()) && tableName.equals(sd.getTableName())) {
returnedSnapshots.add(sd);
@@ -213,7 +213,7 @@ public final class SnapshotTestingUtils {
HBaseProtos.SnapshotDescription desc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
// Extract regions and families with store files
- final Set<byte[]> snapshotFamilies = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
+ final Set<byte[]> snapshotFamilies = new TreeSet<>(Bytes.BYTES_COMPARATOR);
SnapshotManifest manifest = SnapshotManifest.open(conf, fs, snapshotDir, desc);
Map<String, SnapshotRegionManifest> regionManifests = manifest.getRegionManifestsMap();
@@ -355,7 +355,7 @@ public final class SnapshotTestingUtils {
*/
public static ArrayList<String> listHFileNames(final FileSystem fs, final Path tableDir)
throws IOException {
- final ArrayList<String> hfiles = new ArrayList<String>();
+ final ArrayList<String> hfiles = new ArrayList<>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
@Override
public void storeFile(final String region, final String family, final String hfileName)
@@ -376,7 +376,7 @@ public final class SnapshotTestingUtils {
TableName tableName, String familyName, String snapshotNameString,
Path rootDir, FileSystem fs, boolean onlineSnapshot)
throws Exception {
- ArrayList<byte[]> nonEmptyFamilyNames = new ArrayList<byte[]>(1);
+ ArrayList<byte[]> nonEmptyFamilyNames = new ArrayList<>(1);
nonEmptyFamilyNames.add(Bytes.toBytes(familyName));
createSnapshotAndValidate(admin, tableName, nonEmptyFamilyNames, /* emptyFamilyNames= */ null,
snapshotNameString, rootDir, fs, onlineSnapshot);
@@ -869,7 +869,7 @@ public final class SnapshotTestingUtils {
public static void verifyReplicasCameOnline(TableName tableName, Admin admin,
int regionReplication) throws IOException {
List<HRegionInfo> regions = admin.getTableRegions(tableName);
- HashSet<HRegionInfo> set = new HashSet<HRegionInfo>();
+ HashSet<HRegionInfo> set = new HashSet<>();
for (HRegionInfo hri : regions) {
set.add(RegionReplicaUtil.getRegionInfoForDefaultReplica(hri));
for (int i = 0; i < regionReplication; i++) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
index 47601ca..1beb518 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
@@ -205,7 +205,7 @@ public class TestExportSnapshot {
FileSystem fs = FileSystem.get(copyDir.toUri(), new Configuration());
copyDir = copyDir.makeQualified(fs);
- List<String> opts = new ArrayList<String>();
+ List<String> opts = new ArrayList<>();
opts.add("--snapshot");
opts.add(Bytes.toString(snapshotName));
opts.add("--copy-to");
@@ -302,7 +302,7 @@ public class TestExportSnapshot {
final RegionPredicate bypassregionPredicate) throws IOException {
final Path exportedSnapshot = new Path(rootDir,
new Path(HConstants.SNAPSHOT_DIR_NAME, snapshotName));
- final Set<String> snapshotFiles = new HashSet<String>();
+ final Set<String> snapshotFiles = new HashSet<>();
final Path exportedArchive = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY);
SnapshotReferenceUtil.visitReferencedFiles(conf, fs, exportedSnapshot,
new SnapshotReferenceUtil.SnapshotVisitor() {
@@ -338,7 +338,7 @@ public class TestExportSnapshot {
private static Set<String> listFiles(final FileSystem fs, final Path root, final Path dir)
throws IOException {
- Set<String> files = new HashSet<String>();
+ Set<String> files = new HashSet<>();
int rootPrefix = root.makeQualified(fs).toString().length();
FileStatus[] list = FSUtils.listStatus(fs, dir);
if (list != null) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotHelpers.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotHelpers.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotHelpers.java
index 77cfbcc..e31e81e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotHelpers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotHelpers.java
@@ -47,13 +47,13 @@ public class TestExportSnapshotHelpers {
@Test
public void testBalanceSplit() throws Exception {
// Create a list of files
- List<Pair<SnapshotFileInfo, Long>> files = new ArrayList<Pair<SnapshotFileInfo, Long>>(21);
+ List<Pair<SnapshotFileInfo, Long>> files = new ArrayList<>(21);
for (long i = 0; i <= 20; i++) {
SnapshotFileInfo fileInfo = SnapshotFileInfo.newBuilder()
.setType(SnapshotFileInfo.Type.HFILE)
.setHfile("file-" + i)
.build();
- files.add(new Pair<SnapshotFileInfo, Long>(fileInfo, i));
+ files.add(new Pair<>(fileInfo, i));
}
// Create 5 groups (total size 210)
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
index deb3320..86405dc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
@@ -224,7 +224,7 @@ public class TestFlushSnapshotFromClient {
// take a snapshot of the enabled table
String snapshotString = "offlineTableSnapshot";
byte[] snapshot = Bytes.toBytes(snapshotString);
- Map<String, String> props = new HashMap<String, String>();
+ Map<String, String> props = new HashMap<>();
props.put("table", TABLE_NAME.getNameAsString());
admin.execProcedure(SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION,
snapshotString, props);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
index b7fb9f7..02bd49b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
@@ -259,7 +259,7 @@ public class BaseTestHBaseFsck {
createTable(TEST_UTIL, desc, SPLITS);
tbl = connection.getTable(tablename, tableExecutorService);
- List<Put> puts = new ArrayList<Put>(ROWKEYS.length);
+ List<Put> puts = new ArrayList<>(ROWKEYS.length);
for (byte[] row : ROWKEYS) {
Put p = new Put(row);
p.addColumn(FAM, Bytes.toBytes("val"), row);
@@ -283,7 +283,7 @@ public class BaseTestHBaseFsck {
createTable(TEST_UTIL, desc, SPLITS);
tbl = connection.getTable(tablename, tableExecutorService);
- List<Put> puts = new ArrayList<Put>(ROWKEYS.length);
+ List<Put> puts = new ArrayList<>(ROWKEYS.length);
for (byte[] row : ROWKEYS) {
Put p = new Put(row);
p.addColumn(FAM, Bytes.toBytes("val"), row);
@@ -328,8 +328,7 @@ public class BaseTestHBaseFsck {
Map<ServerName, List<String>> getDeployedHRIs(final Admin admin) throws IOException {
ClusterStatus status = admin.getClusterStatus();
Collection<ServerName> regionServers = status.getServers();
- Map<ServerName, List<String>> mm =
- new HashMap<ServerName, List<String>>();
+ Map<ServerName, List<String>> mm = new HashMap<>();
for (ServerName hsi : regionServers) {
AdminProtos.AdminService.BlockingInterface server = connection.getAdmin(hsi);
@@ -525,7 +524,7 @@ public class BaseTestHBaseFsck {
@Override
public ArrayList<ERROR_CODE> getErrorList() {
calledCount++;
- return new ArrayList<ERROR_CODE>();
+ return new ArrayList<>();
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ConstantDelayQueue.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ConstantDelayQueue.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ConstantDelayQueue.java
index 73ce71a..ddf26a0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ConstantDelayQueue.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ConstantDelayQueue.java
@@ -57,7 +57,7 @@ public class ConstantDelayQueue<E> implements BlockingQueue<E> {
private final long delayMs;
// backing DelayQueue
- private DelayQueue<DelayedElement<E>> queue = new DelayQueue<DelayedElement<E>>();
+ private DelayQueue<DelayedElement<E>> queue = new DelayQueue<>();
public ConstantDelayQueue(TimeUnit timeUnit, long delay) {
this.delayMs = TimeUnit.MILLISECONDS.convert(delay, timeUnit);
@@ -139,22 +139,22 @@ public class ConstantDelayQueue<E> implements BlockingQueue<E> {
@Override
public boolean add(E e) {
- return queue.add(new DelayedElement<E>(e, delayMs));
+ return queue.add(new DelayedElement<>(e, delayMs));
}
@Override
public boolean offer(E e) {
- return queue.offer(new DelayedElement<E>(e, delayMs));
+ return queue.offer(new DelayedElement<>(e, delayMs));
}
@Override
public void put(E e) throws InterruptedException {
- queue.put(new DelayedElement<E>(e, delayMs));
+ queue.put(new DelayedElement<>(e, delayMs));
}
@Override
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
- return queue.offer(new DelayedElement<E>(e, delayMs), timeout, unit);
+ return queue.offer(new DelayedElement<>(e, delayMs), timeout, unit);
}
@Override
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
index d68c578..bf95a9e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
@@ -143,14 +143,14 @@ public class HFileArchiveTestingUtil {
* @return <expected, gotten, backup>, where each is sorted
*/
private static List<List<String>> getFileLists(FileStatus[] previous, FileStatus[] archived) {
- List<List<String>> files = new ArrayList<List<String>>(3);
+ List<List<String>> files = new ArrayList<>(3);
// copy over the original files
List<String> originalFileNames = convertToString(previous);
files.add(originalFileNames);
- List<String> currentFiles = new ArrayList<String>(previous.length);
- List<FileStatus> backedupFiles = new ArrayList<FileStatus>(previous.length);
+ List<String> currentFiles = new ArrayList<>(previous.length);
+ List<FileStatus> backedupFiles = new ArrayList<>(previous.length);
for (FileStatus f : archived) {
String name = f.getPath().getName();
// if the file has been backed up
@@ -177,7 +177,7 @@ public class HFileArchiveTestingUtil {
}
private static List<String> convertToString(List<FileStatus> files) {
- List<String> originalFileNames = new ArrayList<String>(files.size());
+ List<String> originalFileNames = new ArrayList<>(files.size());
for (FileStatus f : files) {
originalFileNames.add(f.getPath().getName());
}
@@ -188,7 +188,7 @@ public class HFileArchiveTestingUtil {
private static String compareFileLists(List<String> expected, List<String> gotten) {
StringBuilder sb = new StringBuilder("Expected (" + expected.size() + "): \t\t Gotten ("
+ gotten.size() + "):\n");
- List<String> notFound = new ArrayList<String>();
+ List<String> notFound = new ArrayList<>();
for (String s : expected) {
if (gotten.contains(s)) sb.append(s + "\t\t" + s + "\n");
else notFound.add(s);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestDataGeneratorWithTags.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestDataGeneratorWithTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestDataGeneratorWithTags.java
index 87cb070..2ea01bb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestDataGeneratorWithTags.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestDataGeneratorWithTags.java
@@ -64,7 +64,7 @@ public class LoadTestDataGeneratorWithTags extends DefaultDataGenerator {
@Override
public Mutation beforeMutate(long rowkeyBase, Mutation m) throws IOException {
if (m instanceof Put) {
- List<Cell> updatedCells = new ArrayList<Cell>();
+ List<Cell> updatedCells = new ArrayList<>();
int numTags;
if (minNumTags == maxNumTags) {
numTags = minNumTags;
@@ -76,7 +76,7 @@ public class LoadTestDataGeneratorWithTags extends DefaultDataGenerator {
Cell cell = cellScanner.current();
byte[] tag = LoadTestTool.generateData(random,
minTagLength + random.nextInt(maxTagLength - minTagLength));
- tags = new ArrayList<Tag>();
+ tags = new ArrayList<>();
for (int n = 0; n < numTags; n++) {
tags.add(new ArrayBackedTag((byte) 127, tag));
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
index 9d62693..9a5e6f1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
@@ -864,7 +864,7 @@ public class LoadTestTool extends AbstractHBaseTool {
}
// starting to load multiple tables
- List<WorkerThread> workers = new ArrayList<WorkerThread>();
+ List<WorkerThread> workers = new ArrayList<>();
for (int i = 0; i < numTables; i++) {
String[] workerArgs = newArgs.clone();
workerArgs[tableNameValueIndex] = tableName + "_" + (i+1);
@@ -892,7 +892,7 @@ public class LoadTestTool extends AbstractHBaseTool {
// If an exception is thrown by one of worker threads, it will be
// stored here.
- protected AtomicReference<Throwable> thrown = new AtomicReference<Throwable>();
+ protected AtomicReference<Throwable> thrown = new AtomicReference<>();
private void workerThreadError(Throwable t) {
thrown.compareAndSet(null, t);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java
index db42659..8da92b2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedAction.java
@@ -533,7 +533,7 @@ public abstract class MultiThreadedAction {
// Parse mutate info into a map of <column name> => <update action>
private Map<String, MutationType> parseMutateInfo(byte[] mutateInfo) {
- Map<String, MutationType> mi = new HashMap<String, MutationType>();
+ Map<String, MutationType> mi = new HashMap<>();
if (mutateInfo != null) {
String mutateInfoStr = Bytes.toString(mutateInfo);
String[] mutations = mutateInfoStr.split("#");
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReader.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReader.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReader.java
index 77443e1..e6de33d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReader.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReader.java
@@ -41,7 +41,7 @@ public class MultiThreadedReader extends MultiThreadedAction
{
private static final Log LOG = LogFactory.getLog(MultiThreadedReader.class);
- protected Set<HBaseReaderThread> readers = new HashSet<HBaseReaderThread>();
+ protected Set<HBaseReaderThread> readers = new HashSet<>();
private final double verifyPercent;
protected volatile boolean aborted;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
index cdf814c..1e7e341 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
@@ -43,8 +43,8 @@ public class MultiThreadedReaderWithACL extends MultiThreadedReader {
* Maps user with Table instance. Because the table instance has to be created
* per user inorder to work in that user's context
*/
- private Map<String, Table> userVsTable = new HashMap<String, Table>();
- private Map<String, User> users = new HashMap<String, User>();
+ private Map<String, Table> userVsTable = new HashMap<>();
+ private Map<String, User> users = new HashMap<>();
private String[] userNames;
public MultiThreadedReaderWithACL(LoadTestDataGenerator dataGen, Configuration conf,
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java
index dbcfddb..1505fc1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdater.java
@@ -57,7 +57,7 @@ import com.google.common.base.Preconditions;
public class MultiThreadedUpdater extends MultiThreadedWriterBase {
private static final Log LOG = LogFactory.getLog(MultiThreadedUpdater.class);
- protected Set<HBaseUpdaterThread> updaters = new HashSet<HBaseUpdaterThread>();
+ protected Set<HBaseUpdaterThread> updaters = new HashSet<>();
private MultiThreadedWriterBase writer = null;
private boolean isBatchUpdate = false;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
index bf27dde..40e23fb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
@@ -53,8 +53,8 @@ public class MultiThreadedUpdaterWithACL extends MultiThreadedUpdater {
* Maps user with Table instance. Because the table instance has to be created
* per user inorder to work in that user's context
*/
- private Map<String, Table> userVsTable = new HashMap<String, Table>();
- private Map<String, User> users = new HashMap<String, User>();
+ private Map<String, Table> userVsTable = new HashMap<>();
+ private Map<String, User> users = new HashMap<>();
private String[] userNames;
public MultiThreadedUpdaterWithACL(LoadTestDataGenerator dataGen, Configuration conf,
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriter.java
index d53ab25..d62f72d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriter.java
@@ -43,7 +43,7 @@ import org.apache.hadoop.util.StringUtils;
public class MultiThreadedWriter extends MultiThreadedWriterBase {
private static final Log LOG = LogFactory.getLog(MultiThreadedWriter.class);
- protected Set<HBaseWriterThread> writers = new HashSet<HBaseWriterThread>();
+ protected Set<HBaseWriterThread> writers = new HashSet<>();
protected boolean isMultiPut = false;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java
index 1bbd410..fbf745f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterBase.java
@@ -60,7 +60,7 @@ public abstract class MultiThreadedWriterBase extends MultiThreadedAction {
protected AtomicLong wroteUpToKey = new AtomicLong();
/** The sorted set of keys NOT inserted/updated by the writers */
- protected Set<Long> failedKeySet = new ConcurrentSkipListSet<Long>();
+ protected Set<Long> failedKeySet = new ConcurrentSkipListSet<>();
/**
* The total size of the temporary inserted/updated key set that have not yet lined
@@ -79,7 +79,7 @@ public abstract class MultiThreadedWriterBase extends MultiThreadedAction {
}
protected BlockingQueue<Long> createWriteKeysQueue(Configuration conf) {
- return new ArrayBlockingQueue<Long>(10000);
+ return new ArrayBlockingQueue<>(10000);
}
@Override
@@ -129,7 +129,7 @@ public abstract class MultiThreadedWriterBase extends MultiThreadedAction {
Thread.currentThread().setName(getClass().getSimpleName());
try {
long expectedKey = startKey;
- Queue<Long> sortedKeys = new PriorityQueue<Long>();
+ Queue<Long> sortedKeys = new PriorityQueue<>();
while (expectedKey < endKey) {
// Block until a new element is available.
Long k;
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
index 6d992a5..a5cf0bd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
@@ -140,7 +140,7 @@ public class ProcessBasedLocalHBaseCluster {
* in the returned array, e.g. server #0, #1, etc.
*/
private static List<Integer> sortedPorts(int n) {
- List<Integer> ports = new ArrayList<Integer>(n);
+ List<Integer> ports = new ArrayList<>(n);
for (int i = 0; i < n; ++i) {
ports.add(HBaseTestingUtility.randomFreePort());
}
@@ -216,8 +216,7 @@ public class ProcessBasedLocalHBaseCluster {
try {
String [] envp = null;
if (envOverrides != null) {
- Map<String, String> map = new HashMap<String, String>(
- System.getenv());
+ Map<String, String> map = new HashMap<>(System.getenv());
map.putAll(envOverrides);
envp = new String[map.size()];
int idx = 0;
@@ -250,7 +249,7 @@ public class ProcessBasedLocalHBaseCluster {
private void shutdownAllProcesses() {
LOG.info("Killing daemons using pid files");
- final List<String> pidFiles = new ArrayList<String>(daemonPidFiles);
+ final List<String> pidFiles = new ArrayList<>(daemonPidFiles);
for (String pidFile : pidFiles) {
int pid = 0;
try {
@@ -359,7 +358,7 @@ public class ProcessBasedLocalHBaseCluster {
"HBASE_ZOOKEEPER_JMX_OPTS=' '\n",
dir + "/hbase-env.sh");
- Map<String, String> envOverrides = new HashMap<String, String>();
+ Map<String, String> envOverrides = new HashMap<>();
envOverrides.put("HBASE_LOG_DIR", dir);
envOverrides.put("HBASE_PID_DIR", dir);
try {
@@ -379,7 +378,7 @@ public class ProcessBasedLocalHBaseCluster {
private final String generateConfig(ServerType serverType, int rpcPort,
String daemonDir) {
StringBuilder sb = new StringBuilder();
- Map<String, Object> confMap = new TreeMap<String, Object>();
+ Map<String, Object> confMap = new TreeMap<>();
confMap.put(HConstants.CLUSTER_DISTRIBUTED, true);
if (serverType == ServerType.MASTER) {
@@ -446,8 +445,8 @@ public class ProcessBasedLocalHBaseCluster {
}
private final class LocalDaemonLogTailer implements Runnable {
- private final Set<String> tailedFiles = new HashSet<String>();
- private final List<String> dirList = new ArrayList<String>();
+ private final Set<String> tailedFiles = new HashSet<>();
+ private final List<String> dirList = new ArrayList<>();
private final Object printLock = new Object();
private final FilenameFilter LOG_FILES = new FilenameFilter() {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBoundedPriorityBlockingQueue.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBoundedPriorityBlockingQueue.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBoundedPriorityBlockingQueue.java
index 34c4ec0..7112d50 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBoundedPriorityBlockingQueue.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestBoundedPriorityBlockingQueue.java
@@ -73,7 +73,7 @@ public class TestBoundedPriorityBlockingQueue {
@Before
public void setUp() throws Exception {
- this.queue = new BoundedPriorityBlockingQueue<TestObject>(CAPACITY, new TestObjectComparator());
+ this.queue = new BoundedPriorityBlockingQueue<>(CAPACITY, new TestObjectComparator());
}
@After
@@ -186,7 +186,7 @@ public class TestBoundedPriorityBlockingQueue {
@Test
public void testPoll() {
assertNull(queue.poll());
- PriorityQueue<TestObject> testList = new PriorityQueue<TestObject>(CAPACITY, new TestObjectComparator());
+ PriorityQueue<TestObject> testList = new PriorityQueue<>(CAPACITY, new TestObjectComparator());
for (int i = 0; i < CAPACITY; ++i) {
TestObject obj = new TestObject(i, i);
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index 304717a..caf8de9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -210,10 +210,8 @@ public class TestCoprocessorScanPolicy {
}
public static class ScanObserver implements RegionObserver {
- private Map<TableName, Long> ttls =
- new HashMap<TableName, Long>();
- private Map<TableName, Integer> versions =
- new HashMap<TableName, Integer>();
+ private Map<TableName, Long> ttls = new HashMap<>();
+ private Map<TableName, Integer> versions = new HashMap<>();
// lame way to communicate with the coprocessor,
// since it is loaded by a different class loader
@@ -301,4 +299,4 @@ public class TestCoprocessorScanPolicy {
}
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSVisitor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSVisitor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSVisitor.java
index 4a870f8..e455b0a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSVisitor.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSVisitor.java
@@ -59,9 +59,9 @@ public class TestFSVisitor {
fs = FileSystem.get(TEST_UTIL.getConfiguration());
rootDir = TEST_UTIL.getDataTestDir("hbase");
- tableFamilies = new HashSet<String>();
- tableRegions = new HashSet<String>();
- tableHFiles = new HashSet<String>();
+ tableFamilies = new HashSet<>();
+ tableRegions = new HashSet<>();
+ tableHFiles = new HashSet<>();
tableDir = createTableFiles(rootDir, TABLE_NAME, tableRegions, tableFamilies, tableHFiles);
FSUtils.logFileSystemState(fs, rootDir, LOG);
}
@@ -73,9 +73,9 @@ public class TestFSVisitor {
@Test
public void testVisitStoreFiles() throws IOException {
- final Set<String> regions = new HashSet<String>();
- final Set<String> families = new HashSet<String>();
- final Set<String> hfiles = new HashSet<String>();
+ final Set<String> regions = new HashSet<>();
+ final Set<String> families = new HashSet<>();
+ final Set<String> hfiles = new HashSet<>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
public void storeFile(final String region, final String family, final String hfileName)
throws IOException {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
index 501bfc4..54f310d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
@@ -139,7 +139,7 @@ public class TestHBaseFsckEncryption {
}
private List<Path> findStorefilePaths(TableName tableName) throws Exception {
- List<Path> paths = new ArrayList<Path>();
+ List<Path> paths = new ArrayList<>();
for (Region region:
TEST_UTIL.getRSForFirstRegionInTable(tableName).getOnlineRegions(htd.getTableName())) {
for (Store store: region.getStores()) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/b53f3547/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckMOB.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckMOB.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckMOB.java
index b04689c..b6a185b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckMOB.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckMOB.java
@@ -62,7 +62,7 @@ public class TestHBaseFsckMOB extends BaseTestHBaseFsck {
TEST_UTIL.startMiniCluster(1);
tableExecutorService = new ThreadPoolExecutor(1, POOL_SIZE, 60, TimeUnit.SECONDS,
- new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("testhbck"));
+ new SynchronousQueue<>(), Threads.newDaemonThreadFactory("testhbck"));
hbfsckExecutorService = new ScheduledThreadPoolExecutor(POOL_SIZE);