drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vrozov <...@git.apache.org>
Subject [GitHub] drill pull request #1225: DRILL-6272: Refactor dynamic UDFs and function ini...
Date Wed, 02 May 2018 01:32:11 GMT
Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1225#discussion_r185373456
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestCTTAS.java ---
    @@ -35,41 +39,46 @@
     import org.apache.hadoop.fs.RemoteIterator;
     import org.apache.hadoop.fs.permission.FsPermission;
     import org.junit.BeforeClass;
    +import org.junit.Rule;
     import org.junit.Test;
     import org.junit.experimental.categories.Category;
    +import org.junit.rules.ExpectedException;
     
     import java.io.File;
     import java.io.IOException;
    +import java.nio.file.Files;
     import java.nio.file.Paths;
     import java.util.List;
    +import java.util.Optional;
     import java.util.Properties;
    -import java.util.UUID;
     
     import static org.apache.drill.exec.util.StoragePluginTestUtils.DFS_PLUGIN_NAME;
     import static org.apache.drill.exec.util.StoragePluginTestUtils.DFS_TMP_SCHEMA;
     import static org.hamcrest.CoreMatchers.containsString;
     import static org.junit.Assert.assertEquals;
    -import static org.junit.Assert.assertThat;
     import static org.junit.Assert.assertTrue;
     
     @Category(SqlTest.class)
     public class TestCTTAS extends BaseTestQuery {
     
    -  private static final UUID session_id = UUID.nameUUIDFromBytes("sessionId".getBytes());
       private static final String temp2_wk = "tmp2";
       private static final String temp2_schema = String.format("%s.%s", DFS_PLUGIN_NAME,
temp2_wk);
     
    +  private static String sessionId;
       private static FileSystem fs;
       private static FsPermission expectedFolderPermission;
       private static FsPermission expectedFilePermission;
     
    +  @Rule
    +  public ExpectedException thrown = ExpectedException.none();
    +
       @BeforeClass
       public static void init() throws Exception {
    -    MockUp<UUID> uuidMockUp = mockRandomUUID(session_id);
    --- End diff --
    
     It is hard to say whether you want to change test logic or need a workaround for the
removed `MockUp.tearDown()` method. In the latter case consider adding `getTemporaryName()`
method to the `UserSession` class. The method can delegate to `UUID.randomUUID()` in production
and can be mocked to return a predefined value in tests like this one. It will allow not to
mock `UUID.randomUUID()` at all.


---

Mime
View raw message