Search in sources :

Example 1 with PcapFormatConfig

use of org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig in project drill by apache.

the class TestSessionizePCAP method setup.

@BeforeClass
public static void setup() throws Exception {
    ClusterTest.startCluster(ClusterFixture.builder(dirTestWatcher));
    PcapFormatConfig sampleConfig = new PcapFormatConfig(null, true, true);
    cluster.defineFormat("cp", "pcap", sampleConfig);
    dirTestWatcher.copyResourceToRoot(Paths.get("pcap/"));
}
Also used : PcapFormatConfig(org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig) BeforeClass(org.junit.BeforeClass)

Example 2 with PcapFormatConfig

use of org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig 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());
        }
    }
}
Also used : ZookeeperClient(org.apache.drill.exec.coord.zk.ZookeeperClient) ZookeeperPersistentStore(org.apache.drill.exec.store.sys.store.ZookeeperPersistentStore) CuratorFramework(org.apache.curator.framework.CuratorFramework) PcapFormatConfig(org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig) FormatPluginConfig(org.apache.drill.common.logical.FormatPluginConfig) PcapngFormatConfig(org.apache.drill.exec.store.pcap.plugin.PcapngFormatConfig) FileSystemConfig(org.apache.drill.exec.store.dfs.FileSystemConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ZookeeperPersistentStoreProvider(org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider) Test(org.junit.Test)

Example 3 with PcapFormatConfig

use of org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig in project drill by apache.

the class TestPcapEVFReader method setup.

@BeforeClass
public static void setup() throws Exception {
    ClusterTest.startCluster(ClusterFixture.builder(dirTestWatcher));
    cluster.defineFormat("cp", "sample", new PcapFormatConfig(null, true, false));
}
Also used : PcapFormatConfig(org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig) BeforeClass(org.junit.BeforeClass)

Example 4 with PcapFormatConfig

use of org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig in project drill by apache.

the class TestPcapngStatRecordReader method setup.

@BeforeClass
public static void setup() throws Exception {
    ClusterTest.startCluster(ClusterFixture.builder(dirTestWatcher));
    cluster.defineFormat("dfs", "pcapng", new PcapFormatConfig(ImmutableList.of("pcapng"), true, false));
    dirTestWatcher.copyResourceToRoot(Paths.get("pcapng/"));
}
Also used : PcapFormatConfig(org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig) BeforeClass(org.junit.BeforeClass)

Aggregations

PcapFormatConfig (org.apache.drill.exec.store.pcap.plugin.PcapFormatConfig)4 BeforeClass (org.junit.BeforeClass)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 FormatPluginConfig (org.apache.drill.common.logical.FormatPluginConfig)1 ZookeeperClient (org.apache.drill.exec.coord.zk.ZookeeperClient)1 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)1 PcapngFormatConfig (org.apache.drill.exec.store.pcap.plugin.PcapngFormatConfig)1 ZookeeperPersistentStore (org.apache.drill.exec.store.sys.store.ZookeeperPersistentStore)1 ZookeeperPersistentStoreProvider (org.apache.drill.exec.store.sys.store.provider.ZookeeperPersistentStoreProvider)1 Test (org.junit.Test)1