Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/669#discussion_r89848865
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/TestDynamicUDFSupport.java ---
    @@ -271,6 +271,75 @@ public void testDuplicatedFunctionsInLocalRegistry() 
throws Exception {
       }
     
       @Test
    +  public void testSuccessfulRegistrationAfterSeveralRetryAttempts() throws 
Exception {
    +    RemoteFunctionRegistry remoteFunctionRegistry = 
spyRemoteFunctionRegistry();
    +    copyDefaultJarsToStagingArea();
    +
    +    doThrow(new VersionMismatchException("Version mismatch detected", 1))
    +            .doThrow(new VersionMismatchException("Version mismatch 
detected", 1))
    +            .doCallRealMethod()
    +            
.when(remoteFunctionRegistry).updateRegistry(any(Registry.class), 
any(DataChangeVersion.class));
    +
    +    String summary = "The following UDFs in jar %s have been 
registered:\n" +
    +            "[custom_lower(VARCHAR-REQUIRED)]";
    +
    +    testBuilder()
    +            .sqlQuery("create function using jar '%s'", 
default_binary_name)
    +            .unOrdered()
    +            .baselineColumns("ok", "summary")
    +            .baselineValues(true, String.format(summary, 
default_binary_name))
    +            .go();
    +
    +    verify(remoteFunctionRegistry, times(3))
    +            .updateRegistry(any(Registry.class), 
any(DataChangeVersion.class));
    +
    +    FileSystem fs = remoteFunctionRegistry.getFs();
    +
    +    assertFalse("Staging area should be empty", 
fs.listFiles(remoteFunctionRegistry.getStagingArea(), false).hasNext());
    +    assertFalse("Temporary area should be empty", 
fs.listFiles(remoteFunctionRegistry.getTmpArea(), false).hasNext());
    +
    +    assertTrue("Binary should be present in registry area",
    +            fs.exists(new Path(remoteFunctionRegistry.getRegistryArea(), 
default_binary_name)));
    +    assertTrue("Source should be present in registry area",
    +            fs.exists(new Path(remoteFunctionRegistry.getRegistryArea(), 
default_source_name)));
    +
    +    Registry registry = remoteFunctionRegistry.getRegistry();
    +    assertEquals("Registry should contain one jar", 
registry.getJarList().size(), 1);
    +    assertEquals(registry.getJar(0).getName(), default_binary_name);
    +  }
    +
    +  @Test
    +  public void testSuccessfulUnregistrationAfterSeveralRetryAttempts() 
throws Exception {
    +    RemoteFunctionRegistry remoteFunctionRegistry = 
spyRemoteFunctionRegistry();
    +    copyDefaultJarsToStagingArea();
    +    test("create function using jar '%s'", default_binary_name);
    +
    +    reset(remoteFunctionRegistry);
    +    doThrow(new VersionMismatchException("Version mismatch detected", 1))
    --- End diff --
    
    Perhaps a few words of explanation about what doThrow does?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to