You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/05/15 13:46:54 UTC

[GitHub] [accumulo] elinaawise commented on a change in pull request #1161: Issue576

elinaawise commented on a change in pull request #1161: Issue576
URL: https://github.com/apache/accumulo/pull/1161#discussion_r284263328
 
 

 ##########
 File path: core/src/test/java/org/apache/accumulo/core/client/admin/NewTableConfigurationTest.java
 ##########
 @@ -93,4 +107,75 @@ public void testCreateOffline() {
     NewTableConfiguration ntcOnline = new NewTableConfiguration();
     assertTrue(ntcOnline.getInitialTableState() == InitialTableState.ONLINE);
   }
+
+  public void populateOptions() {
+    options = new HashMap<>();
+    options.put("hasher", "murmur3_32");
+    options.put("modulus", "5");
+  }
+
+  public void populateInvalidOptions() {}
+
+  /**
+   * Verify enableSampling returns
+   */
+  @Test
+  public void testEnableSampling() {
+    SamplerConfiguration samplerConfig = new SamplerConfiguration("test");
+    NewTableConfiguration ntcSample1 = new NewTableConfiguration().enableSampling(samplerConfig);
+    assertTrue(ntcSample1.getProperties().containsValue("test"));
+
+    RowSampler rowSampler = new RowSampler();
+    SamplerConfiguration sha1SamplerConfig = new SamplerConfiguration(rowSampler.getClass());
+    sha1SamplerConfig.setOptions(options);
+    rowSampler.init(sha1SamplerConfig);
+    NewTableConfiguration ntcSample2 =
+        new NewTableConfiguration().enableSampling(sha1SamplerConfig);
+    assertTrue(ntcSample2.getProperties().containsValue("murmur3_32"));
+  }
+
+  /**
+   * Verify enableSummarization returns SummarizerConfiguration with the expected class name.
+   */
+  @Test
+  public void testEnableSummarization() {
+    SummarizerConfiguration summarizerConfig1 = SummarizerConfiguration.builder("test").build();
+    NewTableConfiguration ntcSummarization1 =
+            new NewTableConfiguration().enableSummarization(summarizerConfig1);
+
+    ArrayList<String> summarizerValues = new ArrayList<String>();
+    for (Map.Entry<String,String> e : ntcSummarization1.getProperties().entrySet()) {
+      if (e.getKey().contains("table.summarizer")) {
+        summarizerValues.add(e.getValue());
+      }
+    }
+    assertTrue(summarizerValues.get(0) instanceof String);
+
+    Class<? extends Summarizer> builderClass = FamilySummarizer.class;
+    assertTrue(Summarizer.class.isAssignableFrom(builderClass));
+
+    summarizerValues.clear();
+    SummarizerConfiguration summarizerConfig2 =
 
 Review comment:
   Intent for ntcSummarization2 is to test passing a class, that extends Summarizer.class, into enableConfiguration().
   Intent for ntcSummarization3 is to test passing more than 1 SummarizerConfiguration into enableConfiguartion(). 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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