Search in sources :

Example 36 with ScanResult

use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.

the class TestFormatPluginOptionExtractor method test.

@Test
public void test() {
    DrillConfig config = DrillConfig.create();
    ScanResult scanResult = RunTimeScan.fromPrescan(config);
    FormatPluginOptionExtractor e = new FormatPluginOptionExtractor(scanResult);
    Collection<FormatPluginOptionsDescriptor> options = e.getOptions();
    for (FormatPluginOptionsDescriptor d : options) {
        assertEquals(d.pluginConfigClass.getAnnotation(JsonTypeName.class).value(), d.typeName);
        switch(d.typeName) {
            case "text":
                assertEquals(TextFormatConfig.class, d.pluginConfigClass);
                assertEquals("(type: String, lineDelimiter: String, fieldDelimiter: String, quote: String, escape: String, comment: String, skipFirstLine: boolean, extractHeader: boolean)", d.presentParams());
                break;
            case "named":
                assertEquals(NamedFormatPluginConfig.class, d.pluginConfigClass);
                assertEquals("(type: String, name: String)", d.presentParams());
                break;
            case "parquet":
                assertEquals(d.typeName, "(type: String, autoCorrectCorruptDates: boolean)", d.presentParams());
                break;
            case "json":
            case "sequencefile":
            case "pcap":
            case "avro":
                assertEquals(d.typeName, "(type: String)", d.presentParams());
                break;
            case "httpd":
                assertEquals("(type: String, logFormat: String, timestampFormat: String)", d.presentParams());
                break;
            default:
                fail("add validation for format plugin type " + d.typeName);
        }
    }
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) Test(org.junit.Test)

Example 37 with ScanResult

use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.

the class CheckStorageConfig method checkPlanParsing.

@Test
public void checkPlanParsing() throws Exception {
    DrillConfig config = DrillConfig.create();
    ScanResult scan = ClassPathScanner.fromPrescan(config);
    LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), DrillFileUtils.getResourceAsString("/storage_engine_plan.json"));
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) LogicalPlan(org.apache.drill.common.logical.LogicalPlan) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 38 with ScanResult

use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by axbaretto.

the class CheckStorageConfig method ensureStorageEnginePickup.

@Test
public void ensureStorageEnginePickup() {
    DrillConfig config = DrillConfig.create();
    ScanResult scan = ClassPathScanner.fromPrescan(config);
    Collection<?> engines = scan.getImplementations(StoragePluginConfig.class);
    assertEquals(engines.size(), 1);
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 39 with ScanResult

use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by apache.

the class TestFormatPluginOptionExtractor method test.

@Test
public void test() {
    DrillConfig config = DrillConfig.create();
    ScanResult scanResult = RunTimeScan.fromPrescan(config);
    FormatPluginOptionExtractor e = new FormatPluginOptionExtractor(scanResult);
    Collection<FormatPluginOptionsDescriptor> options = e.getOptions();
    for (FormatPluginOptionsDescriptor d : options) {
        assertEquals(d.pluginConfigClass.getAnnotation(JsonTypeName.class).value(), d.typeName);
        switch(d.typeName) {
            case "text":
                assertEquals(TextFormatConfig.class, d.pluginConfigClass);
                assertEquals("(type: String, lineDelimiter: String, fieldDelimiter: String, quote: String, escape: String, comment: String, skipFirstLine: boolean, extractHeader: boolean)", d.presentParams());
                break;
            case "named":
                assertEquals(NamedFormatPluginConfig.class, d.pluginConfigClass);
                assertEquals("(type: String, name: String)", d.presentParams());
                break;
            case "parquet":
                assertEquals(d.typeName, "(type: String, autoCorrectCorruptDates: boolean, enableStringsSignedMinMax: boolean, " + "blockSize: Integer, pageSize: Integer, useSingleFSBlock: Boolean, writerCompressionType: String, " + "writerLogicalTypeForDecimals: String, writerUsePrimitivesForDecimals: Boolean, " + "writerFormatVersion: String)", d.presentParams());
                break;
            case "json":
                assertEquals(d.typeName, "(type: String)", d.presentParams());
                break;
            case "sequencefile":
                assertEquals(d.typeName, "(type: String)", d.presentParams());
                break;
            case "avro":
                assertEquals(d.typeName, "(type: String)", d.presentParams());
                break;
            case "pcap":
                assertEquals(d.typeName, "(type: String, sessionizeTCPStreams: boolean)", d.presentParams());
                break;
            case "httpd":
                assertEquals("(type: String, logFormat: String, timestampFormat: String)", d.presentParams());
                break;
            case "logRegex":
                assertEquals(d.typeName, "(type: String, regex: String, extension: String, maxErrors: int, schema: List)", d.presentParams());
                break;
            default:
                fail("add validation for format plugin type " + d.typeName);
        }
    }
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) BaseTest(org.apache.drill.test.BaseTest) Test(org.junit.Test)

Example 40 with ScanResult

use of org.apache.drill.common.scanner.persistence.ScanResult in project drill by apache.

the class CheckStorageConfig method checkPlanParsing.

@Test
public void checkPlanParsing() throws Exception {
    DrillConfig config = DrillConfig.create();
    ScanResult scan = ClassPathScanner.fromPrescan(config);
    LogicalPlan plan = LogicalPlan.parse(new LogicalPlanPersistence(config, scan), DrillFileUtils.getResourceAsString("/storage_engine_plan.json"));
}
Also used : ScanResult(org.apache.drill.common.scanner.persistence.ScanResult) DrillConfig(org.apache.drill.common.config.DrillConfig) LogicalPlan(org.apache.drill.common.logical.LogicalPlan) LogicalPlanPersistence(org.apache.drill.common.config.LogicalPlanPersistence) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Aggregations

ScanResult (org.apache.drill.common.scanner.persistence.ScanResult)48 DrillConfig (org.apache.drill.common.config.DrillConfig)29 Test (org.junit.Test)26 SecurityTest (org.apache.drill.categories.SecurityTest)16 DrillbitContext (org.apache.drill.exec.server.DrillbitContext)12 IOException (java.io.IOException)10 DrillbitStartupException (org.apache.drill.exec.exception.DrillbitStartupException)10 AuthenticatorProviderImpl (org.apache.drill.exec.rpc.security.AuthenticatorProviderImpl)10 DrillHttpSecurityHandlerProvider (org.apache.drill.exec.server.rest.auth.DrillHttpSecurityHandlerProvider)10 URL (java.net.URL)9 LogicalPlanPersistence (org.apache.drill.common.config.LogicalPlanPersistence)7 BootStrapContext (org.apache.drill.exec.server.BootStrapContext)7 AtomicLong (java.util.concurrent.atomic.AtomicLong)6 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)6 FragmentWritableBatch (org.apache.drill.exec.record.FragmentWritableBatch)6 WorkEventBus (org.apache.drill.exec.rpc.control.WorkEventBus)6 WorkerBee (org.apache.drill.exec.work.WorkManager.WorkerBee)6 BaseTest (org.apache.drill.test.BaseTest)6 URLClassLoader (java.net.URLClassLoader)4 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)4