Search in sources :

Example 1 with RestClientFixture

use of org.apache.drill.test.RestClientFixture 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 RestClientFixture

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

the class StatusResourcesTest method testRetrievePublicOption.

@Test
public void testRetrievePublicOption() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).systemOption(ExecConstants.SLICE_TARGET, 20);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusInternalOption(ExecConstants.SLICE_TARGET));
        StatusResources.OptionWrapper option = restClientFixture.getStatusOption(ExecConstants.SLICE_TARGET);
        Assert.assertEquals(20, option.getValue());
        client.alterSystem(ExecConstants.SLICE_TARGET, 30);
        Assert.assertNull(restClientFixture.getStatusInternalOption(ExecConstants.SLICE_TARGET));
        option = restClientFixture.getStatusOption(ExecConstants.SLICE_TARGET);
        Assert.assertEquals(30, option.getValue());
    }
}
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) Test(org.junit.Test) BaseTest(org.apache.drill.test.BaseTest)

Example 3 with RestClientFixture

use of org.apache.drill.test.RestClientFixture 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)

Example 4 with RestClientFixture

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

the class TestResponseHeaders method checkConfiguredHeaders.

@Test
public void checkConfiguredHeaders() throws Exception {
    try (RestClientFixture restClient = cluster.restClientFixture()) {
        MultivaluedMap<String, String> responseHeaders = restClient.getResponseHeaders(BASE_URL);
        assertThat(responseHeaders.get("MyHeader").get(0), equalTo("102030"));
    }
}
Also used : RestClientFixture(org.apache.drill.test.RestClientFixture) ClusterTest(org.apache.drill.test.ClusterTest) Test(org.junit.Test)

Example 5 with RestClientFixture

use of org.apache.drill.test.RestClientFixture in project drill by axbaretto.

the class StatusResourcesTest method testRetrievePublicOption.

@Test
public void testRetrievePublicOption() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).systemOption(ExecConstants.SLICE_TARGET, 20);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusInternalOption(ExecConstants.SLICE_TARGET));
        StatusResources.OptionWrapper option = restClientFixture.getStatusOption(ExecConstants.SLICE_TARGET);
        Assert.assertEquals(20, option.getValue());
        client.alterSystem(ExecConstants.SLICE_TARGET, 30);
        Assert.assertNull(restClientFixture.getStatusInternalOption(ExecConstants.SLICE_TARGET));
        option = restClientFixture.getStatusOption(ExecConstants.SLICE_TARGET);
        Assert.assertEquals(30, option.getValue());
    }
}
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) Test(org.junit.Test)

Aggregations

RestClientFixture (org.apache.drill.test.RestClientFixture)5 Test (org.junit.Test)5 ClientFixture (org.apache.drill.test.ClientFixture)4 ClusterFixture (org.apache.drill.test.ClusterFixture)4 ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)4 OptionDefinition (org.apache.drill.exec.server.options.OptionDefinition)2 TestConfigLinkage.createMockPropOptionDefinition (org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition)2 BaseTest (org.apache.drill.test.BaseTest)2 ClusterTest (org.apache.drill.test.ClusterTest)1