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());
}
}
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());
}
}
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());
}
}
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"));
}
}
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());
}
}
Aggregations