use of org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider in project drill by axbaretto.
the class TestPStoreProviders method zkBackwardCompatabilityTest.
/**
* DRILL-5809
* Note: If this test breaks you are probably breaking backward and forward compatibility. Verify with the community
* that breaking compatibility is acceptable and planned for.
* @throws Exception
*/
@Test
public void zkBackwardCompatabilityTest() throws Exception {
final String oldName = "myOldOption";
try (CuratorFramework curator = createCurator()) {
curator.start();
PersistentStoreConfig<PersistedOptionValue> storeConfig = PersistentStoreConfig.newJacksonBuilder(new ObjectMapper(), PersistedOptionValue.class).name("sys.test").build();
try (ZookeeperClient zkClient = new ZookeeperClient(curator, PathUtils.join("/", storeConfig.getName()), CreateMode.PERSISTENT)) {
zkClient.start();
String oldOptionJson = DrillFileUtils.getResourceAsString("/options/old_booleanopt.json");
zkClient.put(oldName, oldOptionJson.getBytes(), null);
}
try (ZookeeperPersistentStoreProvider provider = new ZookeeperPersistentStoreProvider(zkHelper.getConfig(), curator)) {
PersistentStore<PersistedOptionValue> store = provider.getOrCreateStore(storeConfig);
assertTrue(store instanceof ZookeeperPersistentStore);
PersistedOptionValue oldOptionValue = ((ZookeeperPersistentStore<PersistedOptionValue>) store).get(oldName, null);
PersistedOptionValue expectedValue = new PersistedOptionValue("true");
Assert.assertEquals(expectedValue, oldOptionValue);
}
}
}
use of org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider in project drill by axbaretto.
the class TestPStoreProviders method verifyZkStore.
@Test
public void verifyZkStore() throws Exception {
try (CuratorFramework curator = createCurator()) {
curator.start();
ZookeeperPersistentStoreProvider provider = new ZookeeperPersistentStoreProvider(zkHelper.getConfig(), curator);
PStoreTestUtil.test(provider);
}
}
use of org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider in project drill by apache.
the class TestPStoreProviders method zkBackwardCompatabilityTest.
/**
* DRILL-5809
* Note: If this test breaks you are probably breaking backward and forward compatibility. Verify with the community
* that breaking compatibility is acceptable and planned for.
* @throws Exception
*/
@Test
public void zkBackwardCompatabilityTest() throws Exception {
final String oldName = "myOldOption";
try (CuratorFramework curator = createCurator()) {
curator.start();
PersistentStoreConfig<PersistedOptionValue> storeConfig = PersistentStoreConfig.newJacksonBuilder(new ObjectMapper(), PersistedOptionValue.class).name("sys.test").build();
try (ZookeeperClient zkClient = new ZookeeperClient(curator, PathUtils.join("/", storeConfig.getName()), CreateMode.PERSISTENT)) {
zkClient.start();
String oldOptionJson = DrillFileUtils.getResourceAsString("/options/old_booleanopt.json");
zkClient.put(oldName, oldOptionJson.getBytes(), null);
}
try (ZookeeperPersistentStoreProvider provider = new ZookeeperPersistentStoreProvider(zkHelper.getConfig(), curator)) {
PersistentStore<PersistedOptionValue> store = provider.getOrCreateStore(storeConfig);
assertTrue(store instanceof ZookeeperPersistentStore);
PersistedOptionValue oldOptionValue = ((ZookeeperPersistentStore<PersistedOptionValue>) store).get(oldName, null);
PersistedOptionValue expectedValue = new PersistedOptionValue("true");
Assert.assertEquals(expectedValue, oldOptionValue);
}
}
}
use of org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider in project drill by apache.
the class TestPStoreProviders method verifyZkStore.
@Test
public void verifyZkStore() throws Exception {
try (CuratorFramework curator = createCurator()) {
curator.start();
PersistentStoreProvider provider = new ZookeeperPersistentStoreProvider(zkHelper.getConfig(), curator);
PStoreTestUtil.test(provider);
}
}
use of org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider in project drill by apache.
the class TestPcapWithPersistentStore method pcapPluginBackwardCompatabilityTest.
/**
* DRILL-7828
* Note: If this test breaks you are probably breaking backward and forward compatibility. Verify with the community
* that breaking compatibility is acceptable and planned for.
*/
@Test
public void pcapPluginBackwardCompatabilityTest() throws Exception {
final String oldPlugin = "oldFormatPlugin";
try (CuratorFramework curator = createCurator()) {
curator.start();
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerSubtypes(PcapFormatConfig.class, PcapngFormatConfig.class);
PersistentStoreConfig<FileSystemConfig> storeConfig = PersistentStoreConfig.newJacksonBuilder(objectMapper, FileSystemConfig.class).name("type").build();
try (ZookeeperClient zkClient = new ZookeeperClient(curator, PathUtils.join("/", storeConfig.getName()), CreateMode.PERSISTENT)) {
zkClient.start();
String oldFormatPlugin = DrillFileUtils.getResourceAsString("/config/oldPcapPlugins.json");
zkClient.put(oldPlugin, oldFormatPlugin.getBytes(), null);
}
try (ZookeeperPersistentStoreProvider provider = new ZookeeperPersistentStoreProvider(zkHelper.getConfig(), curator)) {
PersistentStore<FileSystemConfig> store = provider.getOrCreateStore(storeConfig);
assertTrue(store instanceof ZookeeperPersistentStore);
FileSystemConfig oldPluginConfig = ((ZookeeperPersistentStore<FileSystemConfig>) store).get(oldPlugin, null);
Map<String, FormatPluginConfig> formats = oldPluginConfig.getFormats();
Assert.assertEquals(formats.keySet(), ImmutableSet.of("pcap", "pcapng"));
PcapFormatConfig pcap = (PcapFormatConfig) formats.get("pcap");
PcapngFormatConfig pcapng = (PcapngFormatConfig) formats.get("pcapng");
Assert.assertEquals(pcap.getExtensions(), ImmutableList.of("pcap"));
assertTrue(pcapng.getStat());
}
}
}
Aggregations