@Test public void testBasic() throws IOException { TreeMap<Key,Value> tm1 = new TreeMap<>(); TreeMap<Key,Value> expected = new TreeMap<>(); put(tm1, "2;m", ServerColumnFamily.DIRECTORY_COLUMN, "/t1"); put(tm1, "2;m", DataFileColumnFamily.NAME, "/t1/file1", new DataFileValue(1, 1).encodeAsString()); put(tm1, "2;m", BulkFileColumnFamily.NAME, "/t1/file1", "5"); put(tm1, "2;m", BulkFileColumnFamily.NAME, "/t1/file3", "7"); put(tm1, "2;m", BulkFileColumnFamily.NAME, "/t1/file4", "9"); put(tm1, "2<", ServerColumnFamily.DIRECTORY_COLUMN, "/t2"); put(tm1, "2<", DataFileColumnFamily.NAME, "/t2/file2", new DataFileValue(1, 1).encodeAsString()); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/file6", "5"); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/file7", "7"); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/file8", "9"); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/fileC", null); expected.putAll(tm1); put(tm1, "2;m", BulkFileColumnFamily.NAME, "/t1/file5", "8"); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/file9", "8"); put(tm1, "2<", BulkFileColumnFamily.NAME, "/t2/fileA", "2"); SystemIteratorEnvironment env = EasyMock.createMock(SystemIteratorEnvironment.class); EasyMock.expect(env.getServerContext()).andReturn(null); EasyMock.expect(env.isFullMajorCompaction()).andReturn(false); EasyMock.expect(env.getIteratorScope()).andReturn(IteratorScope.majc); EasyMock.replay(env); TestMetadataBulkLoadFilter iter = new TestMetadataBulkLoadFilter(); iter.init(new SortedMapIterator(tm1), new HashMap<>(), env); iter.seek(new Range(), new ArrayList<>(), false); TreeMap<Key,Value> actual = new TreeMap<>(); while (iter.hasTop()) { actual.put(iter.getTopKey(), iter.getTopValue()); iter.next(); } assertEquals(expected, actual); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (env.getIteratorScope() == IteratorScope.scan) { throw new IOException("This iterator not intended for use at scan time"); } bulkTxStatusCache = new HashMap<>(); arbitrator = getArbitrator(((SystemIteratorEnvironment) env).getServerContext()); }
MetadataBulkLoadFilter extends Filter { @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (env.getIteratorScope() == IteratorScope.scan) { throw new IOException("This iterator not intended for use at scan time"); } bulkTxStatusCache = new HashMap<>(); arbitrator = getArbitrator(((SystemIteratorEnvironment) env).getServerContext()); } }
MetadataBulkLoadFilter extends Filter { @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (env.getIteratorScope() == IteratorScope.scan) { throw new IOException("This iterator not intended for use at scan time"); } bulkTxStatusCache = new HashMap<>(); arbitrator = getArbitrator(((SystemIteratorEnvironment) env).getServerContext()); }  }
MetadataBulkLoadFilter extends Filter { @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (env.getIteratorScope() == IteratorScope.scan) { throw new IOException("This iterator not intended for use at scan time"); } bulkTxStatusCache = new HashMap<>(); arbitrator = getArbitrator(((SystemIteratorEnvironment) env).getServerContext()); }  @Override boolean accept(Key k, Value v); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); }
MetadataBulkLoadFilter extends Filter { @Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); if (env.getIteratorScope() == IteratorScope.scan) { throw new IOException("This iterator not intended for use at scan time"); } bulkTxStatusCache = new HashMap<>(); arbitrator = getArbitrator(((SystemIteratorEnvironment) env).getServerContext()); }  @Override boolean accept(Key k, Value v); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env);  }