Source:
<code>public void testScanContextOverridesTableContext() throws Exception { <START> FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); <END> Path srcPath = new Path(System.getProperty("user.dir") + "/target/TestIterators-tests.jar"); Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); fs.copyFromLocalFile(srcPath, dstPath); UtilWaitThread.sleep(5000); try { Connector c = getConnector(); String tableContext = "FOO"; String tableContextProperty = Property.VFS_CONTEXT_CLASSPATH_PROPERTY + tableContext; String tableContextDir = "file:/ String tableContextClasspath = tableContextDir + "/TestFoo.jar"; c.instanceOperations().setProperty(tableContextProperty, tableContextClasspath); c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), tableContext); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); for (int i = 0; i < ITERATIONS; i++) { Mutation m = new Mutation("row" + i); m.put("cf", "col1", "Test"); bw.addMutation(m); } bw.close(); scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); IteratorSetting cfg = new IteratorSetting(1, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); try { scanCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } try { batchCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } scanCheck(c, tableName, cfg, CONTEXT, "tseT"); batchCheck(c, tableName, cfg, CONTEXT, "tseT"); } finally { fs.delete(dstPath, true); } }</code><technical_language>This is repeated. Do in a before</technical_language>

Target:
public void testScanContextOverridesTableContext() throws Exception { Path baseDir = new Path(System.getProperty("user.dir")); Path targetDir = new Path(baseDir, "target"); Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); fs.copyFromLocalFile(jarPath, dstPath); UtilWaitThread.sleep(WAIT); try { Connector c = getConnector(); String tableContext = "FOO"; String tableContextProperty = Property.VFS_CONTEXT_CLASSPATH_PROPERTY + tableContext; String tableContextDir = "file:/ String tableContextClasspath = tableContextDir + "/TestFoo.jar"; c.instanceOperations().setProperty(tableContextProperty, tableContextClasspath); c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), tableContext); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); for (int i = 0; i < ITERATIONS; i++) { Mutation m = new Mutation("row" + i); m.put("cf", "col1", "Test"); bw.addMutation(m); } bw.close(); scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); try { scanCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } try { batchCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } scanCheck(c, tableName, cfg, CONTEXT, "tseT"); batchCheck(c, tableName, cfg, CONTEXT, "tseT"); } finally { fs.delete(dstPath, true); } }