Search in sources :

Example 61 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.

the class TestMemoryCalculator method TestZKBasedQueue.

@Test
public void TestZKBasedQueue() throws Exception {
    String sql = "select * from cp.`employee.json`";
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(EmbeddedQueryQueue.ENABLED, true);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        client.queryBuilder().sql(sql).run();
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test)

Example 62 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.

the class TestRMConfigLoad method testDefaultRMWithLocalCoordinatorAndRMDisabled.

@Test
public void testDefaultRMWithLocalCoordinatorAndRMDisabled() throws Exception {
    ClusterFixtureBuilder fixtureBuilder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.RM_ENABLED, false);
    try (ClusterFixture cluster = fixtureBuilder.build()) {
        ResourceManager resourceManager = cluster.drillbit().getContext().getResourceManager();
        assertTrue(resourceManager instanceof DefaultResourceManager);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) DefaultResourceManager(org.apache.drill.exec.work.foreman.rm.DefaultResourceManager) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) DefaultResourceManager(org.apache.drill.exec.work.foreman.rm.DefaultResourceManager) DistributedResourceManager(org.apache.drill.exec.work.foreman.rm.DistributedResourceManager) ResourceManager(org.apache.drill.exec.work.foreman.rm.ResourceManager) Test(org.junit.Test) ResourceManagerTest(org.apache.drill.categories.ResourceManagerTest) DrillTest(org.apache.drill.test.DrillTest)

Example 63 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.

the class TestCastEmptyStrings method setup.

@BeforeClass
public static void setup() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).sessionOption(PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY, true).systemOption(ExecConstants.CAST_EMPTY_STRING_TO_NULL, true);
    startCluster(builder);
}
Also used : ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) BeforeClass(org.junit.BeforeClass)

Example 64 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.

the class TestTypeFns method setup.

@BeforeClass
public static void setup() throws Exception {
    // Use the following three lines if you add a function
    // to avoid the need for a full Drill build.
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty("drill.classpath.scanning.cache.enabled", false);
    startCluster(builder);
// Use the following line if a full Drill build has been
// done since adding new functions.
// startCluster(ClusterFixture.builder(dirTestWatcher).maxParallelization(1));
}
Also used : ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) BeforeClass(org.junit.BeforeClass)

Example 65 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by apache.

the class TestPluginRegistry method testFormatPlugin.

@Test
public void testFormatPlugin() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher);
    try (ClusterFixture cluster = builder.build()) {
        StoragePluginRegistry registry = cluster.storageRegistry();
        StoragePluginConfig config = registry.getStoredConfig(CP_PLUGIN_NAME);
        FileSystemConfig fsConfig = (FileSystemConfig) config;
        assertFalse(fsConfig.getFormats().containsKey("bsv"));
        // Add a new format
        TextFormatConfig bsv = new TextFormatConfig(null, // line delimiter
        null, // field delimiter
        "!", // quote
        null, // escape
        null, // comment
        null, // skip first line
        false, // extract header
        false);
        registry.putFormatPlugin(CP_PLUGIN_NAME, "bsv", bsv);
        config = registry.getStoredConfig(CP_PLUGIN_NAME);
        fsConfig = (FileSystemConfig) config;
        assertTrue(fsConfig.getFormats().containsKey("bsv"));
        assertSame(bsv, fsConfig.getFormats().get("bsv"));
        // Remove the format
        registry.putFormatPlugin(CP_PLUGIN_NAME, "bsv", null);
        config = registry.getStoredConfig(CP_PLUGIN_NAME);
        fsConfig = (FileSystemConfig) config;
        assertFalse(fsConfig.getFormats().containsKey("bsv"));
        // Undefined plugin
        try {
            registry.putFormatPlugin("bogus", "bsv", bsv);
            fail();
        } catch (PluginException e) {
        // Expected
        }
        // Try to set a non-FS plugin
        try {
            registry.putFormatPlugin(SYS_PLUGIN_NAME, "bsv", bsv);
            fail();
        } catch (PluginException e) {
        // Expected
        }
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) TextFormatConfig(org.apache.drill.exec.store.easy.text.TextFormatPlugin.TextFormatConfig) PluginException(org.apache.drill.exec.store.StoragePluginRegistry.PluginException) StoragePluginConfig(org.apache.drill.common.logical.StoragePluginConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Aggregations

ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)156 ClusterFixture (org.apache.drill.test.ClusterFixture)102 Test (org.junit.Test)93 ClientFixture (org.apache.drill.test.ClientFixture)89 BeforeClass (org.junit.BeforeClass)47 SlowTest (org.apache.drill.categories.SlowTest)44 OptionsTest (org.apache.drill.categories.OptionsTest)34 BaseTest (org.apache.drill.test.BaseTest)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 DrillTest (org.apache.drill.test.DrillTest)14 OperatorTest (org.apache.drill.categories.OperatorTest)8 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)8 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)6 StoragePluginConfig (org.apache.drill.common.logical.StoragePluginConfig)5 PluginException (org.apache.drill.exec.store.StoragePluginRegistry.PluginException)5 File (java.io.File)4 ResourceManagerTest (org.apache.drill.categories.ResourceManagerTest)4 DefaultResourceManager (org.apache.drill.exec.work.foreman.rm.DefaultResourceManager)4 DistributedResourceManager (org.apache.drill.exec.work.foreman.rm.DistributedResourceManager)4 ResourceManager (org.apache.drill.exec.work.foreman.rm.ResourceManager)4