Search in sources :

Example 1 with OptionDefinition

use of org.apache.drill.exec.server.options.OptionDefinition in project drill by axbaretto.

the class StatusResourcesTest method testRetrieveInternalOption.

@Test
public void testRetrieveInternalOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        StatusResources.OptionWrapper option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("a", option.getValueAsString());
        client.alterSystem(MOCK_PROPERTY, "c");
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("c", option.getValueAsString());
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) TestConfigLinkage.createMockPropOptionDefinition(org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition) Test(org.junit.Test)

Example 2 with OptionDefinition

use of org.apache.drill.exec.server.options.OptionDefinition in project drill by axbaretto.

the class TestConfigLinkage method testDefaultValidatorInternalValue.

@Test
public void testDefaultValidatorInternalValue() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    FixtureBuilder builder = ClusterFixture.builder().putDefinition(optionDefinition).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a");
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS.getTableName(), MOCK_PROPERTY).singletonString();
        String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL.getTableName(), MOCK_PROPERTY).singletonString();
        assertEquals("a", mockProp);
        assertEquals("a", mockProp2);
    }
}
Also used : OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest)

Example 3 with OptionDefinition

use of org.apache.drill.exec.server.options.OptionDefinition in project drill by axbaretto.

the class TestConfigLinkage method testAlterInternalSystemOption.

@Test
public void testAlterInternalSystemOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    FixtureBuilder builder = ClusterFixture.builder().configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        client.queryBuilder().sql("ALTER SYSTEM SET `%s` = 'bleh'", MOCK_PROPERTY).run();
        client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS.getTableName()).printCsv();
        client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS_VAL.getTableName()).printCsv();
        String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS, MOCK_PROPERTY).singletonString();
        String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL, MOCK_PROPERTY).singletonString();
        assertEquals("bleh", mockProp);
        assertEquals("bleh", mockProp2);
    }
}
Also used : OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest)

Example 4 with OptionDefinition

use of org.apache.drill.exec.server.options.OptionDefinition in project drill by axbaretto.

the class TestConfigLinkage method testInternalSystemOption.

@Test
public void testInternalSystemOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    FixtureBuilder builder = ClusterFixture.builder().putDefinition(optionDefinition).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").systemOption(MOCK_PROPERTY, "blah");
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS.getTableName(), MOCK_PROPERTY).singletonString();
        String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL.getTableName(), MOCK_PROPERTY).singletonString();
        assertEquals("blah", mockProp);
        assertEquals("blah", mockProp2);
    }
}
Also used : OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest)

Example 5 with OptionDefinition

use of org.apache.drill.exec.server.options.OptionDefinition in project drill by apache.

the class StatusResourcesTest method testRetrieveInternalOption.

@Test
public void testRetrieveInternalOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        StatusResources.OptionWrapper option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("a", option.getValueAsString());
        client.alterSystem(MOCK_PROPERTY, "c");
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("c", option.getValueAsString());
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) TestConfigLinkage.createMockPropOptionDefinition(org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition) OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest)

Aggregations

OptionDefinition (org.apache.drill.exec.server.options.OptionDefinition)9 Test (org.junit.Test)6 OptionsTest (org.apache.drill.categories.OptionsTest)4 IOException (java.io.IOException)2 TestConfigLinkage.createMockPropOptionDefinition (org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition)2 ClientFixture (org.apache.drill.test.ClientFixture)2 ClusterFixture (org.apache.drill.test.ClusterFixture)2 ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)2 RestClientFixture (org.apache.drill.test.RestClientFixture)2 SqlLiteral (org.apache.calcite.sql.SqlLiteral)1 SqlNode (org.apache.calcite.sql.SqlNode)1 SqlSetOption (org.apache.calcite.sql.SqlSetOption)1 NlsString (org.apache.calcite.util.NlsString)1 DrillSqlSetOption (org.apache.drill.exec.planner.sql.parser.DrillSqlSetOption)1 OptionManager (org.apache.drill.exec.server.options.OptionManager)1 OptionScope (org.apache.drill.exec.server.options.OptionValue.OptionScope)1 BaseTest (org.apache.drill.test.BaseTest)1