accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jmark99 commented on a change in pull request #409: ACCUMULO-4791 fix setshelliter usage
Date Fri, 30 Mar 2018 17:03:41 GMT
jmark99 commented on a change in pull request #409: ACCUMULO-4791 fix setshelliter usage
URL: https://github.com/apache/accumulo/pull/409#discussion_r178328644
 
 

 ##########
 File path: test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
 ##########
 @@ -1737,60 +1737,112 @@ public void scansWithClassLoaderContext() throws Exception {
       assertTrue(true);
     }
     ts.exec("createtable t");
+    // Assert that the TabletServer does not know anything about our class
+    String result = ts.exec("setiter -scan -n reverse -t t -p 21 -class org.apache.accumulo.test.functional.ValueReversingIterator");
+    assertTrue(result.contains("class not found"));
     make10();
     setupFakeContextPath();
-    // Add the context to the table so that setscaniter works. After setscaniter succeeds,
then
-    // remove the property from the table.
-    ts.exec("config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY + FAKE_CONTEXT + "=" +
FAKE_CONTEXT_CLASSPATH);
-    ts.exec("config -t t -s table.classpath.context=" + FAKE_CONTEXT);
-    ts.exec("setscaniter -n reverse -t t -p 21 -class org.apache.accumulo.test.functional.ValueReversingIterator");
-    String result = ts.exec("scan -np -b row1 -e row1");
+    // Add the context to the table so that setiter works.
+    result = ts.exec("config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY + FAKE_CONTEXT
+ "=" + FAKE_CONTEXT_CLASSPATH);
+    assertEquals("root@miniInstance t> config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY
+ FAKE_CONTEXT + "=" + FAKE_CONTEXT_CLASSPATH + "\n", result);
+
+    result = ts.exec("config -t t -s table.classpath.context=" + FAKE_CONTEXT);
+    assertEquals("root@miniInstance t> config -t t -s table.classpath.context=" + FAKE_CONTEXT
+ "\n", result);
+
+    result = ts.exec("setshelliter -pn baz -n reverse -p 21 -class org.apache.accumulo.test"
+ ".functional.ValueReversingIterator");
+    assertTrue(result.contains("The iterator class does not implement OptionDescriber"));
+
+    // The implementation of ValueReversingIterator in the FAKE context does nothing, the
value is not reversed.
+    result = ts.exec("scan -pn baz -np -b row1 -e row1");
     assertEquals(2, result.split("\n").length);
-    log.error(result);
     assertTrue(result.contains("value"));
-    result = ts.exec("scan -np -b row3 -e row5");
+    result = ts.exec("scan -pn baz -np -b row3 -e row5");
     assertEquals(4, result.split("\n").length);
     assertTrue(result.contains("value"));
-    result = ts.exec("scan -np -r row3");
+    result = ts.exec("scan -pn baz -np -r row3");
     assertEquals(2, result.split("\n").length);
     assertTrue(result.contains("value"));
-    result = ts.exec("scan -np -b row:");
+    result = ts.exec("scan -pn baz -np -b row:");
     assertEquals(1, result.split("\n").length);
-    result = ts.exec("scan -np -b row");
+    result = ts.exec("scan -pn baz -np -b row");
     assertEquals(11, result.split("\n").length);
     assertTrue(result.contains("value"));
-    result = ts.exec("scan -np -e row:");
+    result = ts.exec("scan -pn baz -np -e row:");
     assertEquals(11, result.split("\n").length);
     assertTrue(result.contains("value"));
 
     setupRealContextPath();
-    ts.exec("config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY + REAL_CONTEXT + "=" +
REAL_CONTEXT_CLASSPATH);
-    result = ts.exec("scan -np -b row1 -e row1 -cc " + REAL_CONTEXT);
-    log.error(result);
+    // Define a new classloader context, but don't set it on the table
+    result = ts.exec("config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY + REAL_CONTEXT
+ "=" + REAL_CONTEXT_CLASSPATH);
+    assertEquals("root@miniInstance t> config -s " + Property.VFS_CONTEXT_CLASSPATH_PROPERTY
+ REAL_CONTEXT + "=" + REAL_CONTEXT_CLASSPATH + "\n", result);
+    // Override the table classloader context with the REAL implementation of ValueReversingIterator,
which does reverse the value.
+    result = ts.exec("scan -pn baz -np -b row1 -e row1 -cc " + REAL_CONTEXT);
     assertEquals(2, result.split("\n").length);
     assertTrue(result.contains("eulav"));
     assertFalse(result.contains("value"));
-    result = ts.exec("scan -np -b row3 -e row5 -cc " + REAL_CONTEXT);
+    result = ts.exec("scan -pn baz -np -b row3 -e row5 -cc " + REAL_CONTEXT);
     assertEquals(4, result.split("\n").length);
     assertTrue(result.contains("eulav"));
     assertFalse(result.contains("value"));
-    result = ts.exec("scan -np -r row3 -cc " + REAL_CONTEXT);
+    result = ts.exec("scan -pn baz -np -r row3 -cc " + REAL_CONTEXT);
     assertEquals(2, result.split("\n").length);
     assertTrue(result.contains("eulav"));
     assertFalse(result.contains("value"));
-    result = ts.exec("scan -np -b row: -cc " + REAL_CONTEXT);
+    result = ts.exec("scan -pn baz -np -b row: -cc " + REAL_CONTEXT);
     assertEquals(1, result.split("\n").length);
-    result = ts.exec("scan -np -b row -cc " + REAL_CONTEXT);
+    result = ts.exec("scan -pn baz -np -b row -cc " + REAL_CONTEXT);
     assertEquals(11, result.split("\n").length);
     assertTrue(result.contains("eulav"));
     assertFalse(result.contains("value"));
-    result = ts.exec("scan -np -e row: -cc " + REAL_CONTEXT);
+    result = ts.exec("scan -pn baz -np -e row: -cc " + REAL_CONTEXT);
     assertEquals(11, result.split("\n").length);
     assertTrue(result.contains("eulav"));
     assertFalse(result.contains("value"));
     ts.exec("deletetable -f t");
   }
 
+  /**
+   * The purpose of this test is to verify that you can successfully scan a table that has
an iterator set but not via the shellIter capability. Purpose is to
+   * verify that the scansWithClassLoaderContext test can handle situations with both normal
iterators and shell iterators.
 
 Review comment:
   On re-reading it was rather confusing to me as well. It must have been late when writing
it :) Reworded to hopefully clear things up.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message