drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #669: DRILL-5044: After the dynamic registration of multi...
Date Mon, 28 Nov 2016 18:40:35 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message