[34/44] metron git commit: METRON-958: PCAP Query job throws exception when no files returned by time range query closes apache/metron#593
METRON-958: PCAP Query job throws exception when no files returned by time range query closes apache/metron#593 Project: http://git-wip-us.apache.org/repos/asf/metron/repo Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/e2197316 Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/e2197316 Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/e2197316 Branch: refs/heads/Metron_0.4.0 Commit: e2197316df5754aba601134ecce19b12092b6f37 Parents: 356881a Author: mmiklavcAuthored: Sun May 21 21:08:45 2017 -0400 Committer: cstella Committed: Sun May 21 21:08:45 2017 -0400 -- .../org/apache/metron/pcap/PcapJobTest.java | 110 +- .../PcapTopologyIntegrationTest.java| 123 +++ .../apache/metron/pcap/PcapFilenameHelper.java | 77 ++ .../java/org/apache/metron/pcap/PcapHelper.java | 35 ++--- .../java/org/apache/metron/pcap/mr/PcapJob.java | 105 + .../metron/pcap/utils/FileFilterUtil.java | 138 + .../metron/pcap/PcapFilenameHelperTest.java | 75 ++ .../metron/pcap/mr/FileFilterUtilTest.java | 150 +++ 8 files changed, 568 insertions(+), 245 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metron/blob/e2197316/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java -- diff --git a/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java b/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java index 81725d8..3536a7e 100644 --- a/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java +++ b/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,10 +18,10 @@ package org.apache.metron.pcap; -import com.google.common.collect.Iterables; +import static java.lang.Long.toUnsignedString; +import static org.hamcrest.CoreMatchers.equalTo; + import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.LongWritable; import org.apache.metron.common.utils.timestamp.TimestampConverters; @@ -29,106 +29,9 @@ import org.apache.metron.pcap.mr.PcapJob; import org.junit.Assert; import org.junit.Test; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static java.lang.Long.toUnsignedString; -import static org.hamcrest.CoreMatchers.equalTo; - public class PcapJobTest { @Test - public void test_getPaths_NoFiles() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ - }}; - job = new PcapJob() { -@Override -protected Iterable listFiles(FileSystem fs, Path basePath) throws IOException { - return inputFiles; -} - }; - Iterable paths = job.getPaths(null, null, 0, 1000); - Assert.assertTrue(Iterables.isEmpty(paths)); -} - } - - @Test - public void test_getPaths_leftEdge() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ -add(new Path("/apps/metron/pcap/pcap_pcap_1461589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); -add(new Path("/apps/metron/pcap/pcap_pcap_1561589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); - }}; - job = new PcapJob() { -@Override -protected Iterable listFiles(FileSystem fs, Path basePath) throws IOException { - return inputFiles; -} - }; - Iterable paths = job.getPaths(null, null, 0, TimestampConverters.MILLISECONDS.toNanoseconds(System.currentTimeMillis())); - Assert.assertEquals(1, Iterables.size(paths)); -} - } - - @Test - public void test_getPaths_rightEdge() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ -add(new Path("/apps/metron/pcap/pcap0_pcap_1461589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); -add(new Path("/apps/metron/pcap/pcap1_pcap_1461589333993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); - }}; - job = new PcapJob() { -@Override -protected Iterable listFiles(FileSystem fs, Path basePath) throws IOException
metron git commit: METRON-958: PCAP Query job throws exception when no files returned by time range query closes apache/metron#593
Repository: metron Updated Branches: refs/heads/master 356881ad2 -> e2197316d METRON-958: PCAP Query job throws exception when no files returned by time range query closes apache/metron#593 Project: http://git-wip-us.apache.org/repos/asf/metron/repo Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/e2197316 Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/e2197316 Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/e2197316 Branch: refs/heads/master Commit: e2197316df5754aba601134ecce19b12092b6f37 Parents: 356881a Author: mmiklavcAuthored: Sun May 21 21:08:45 2017 -0400 Committer: cstella Committed: Sun May 21 21:08:45 2017 -0400 -- .../org/apache/metron/pcap/PcapJobTest.java | 110 +- .../PcapTopologyIntegrationTest.java| 123 +++ .../apache/metron/pcap/PcapFilenameHelper.java | 77 ++ .../java/org/apache/metron/pcap/PcapHelper.java | 35 ++--- .../java/org/apache/metron/pcap/mr/PcapJob.java | 105 + .../metron/pcap/utils/FileFilterUtil.java | 138 + .../metron/pcap/PcapFilenameHelperTest.java | 75 ++ .../metron/pcap/mr/FileFilterUtilTest.java | 150 +++ 8 files changed, 568 insertions(+), 245 deletions(-) -- http://git-wip-us.apache.org/repos/asf/metron/blob/e2197316/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java -- diff --git a/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java b/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java index 81725d8..3536a7e 100644 --- a/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java +++ b/metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/PcapJobTest.java @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,10 +18,10 @@ package org.apache.metron.pcap; -import com.google.common.collect.Iterables; +import static java.lang.Long.toUnsignedString; +import static org.hamcrest.CoreMatchers.equalTo; + import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.LongWritable; import org.apache.metron.common.utils.timestamp.TimestampConverters; @@ -29,106 +29,9 @@ import org.apache.metron.pcap.mr.PcapJob; import org.junit.Assert; import org.junit.Test; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static java.lang.Long.toUnsignedString; -import static org.hamcrest.CoreMatchers.equalTo; - public class PcapJobTest { @Test - public void test_getPaths_NoFiles() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ - }}; - job = new PcapJob() { -@Override -protected Iterable listFiles(FileSystem fs, Path basePath) throws IOException { - return inputFiles; -} - }; - Iterable paths = job.getPaths(null, null, 0, 1000); - Assert.assertTrue(Iterables.isEmpty(paths)); -} - } - - @Test - public void test_getPaths_leftEdge() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ -add(new Path("/apps/metron/pcap/pcap_pcap_1461589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); -add(new Path("/apps/metron/pcap/pcap_pcap_1561589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); - }}; - job = new PcapJob() { -@Override -protected Iterable listFiles(FileSystem fs, Path basePath) throws IOException { - return inputFiles; -} - }; - Iterable paths = job.getPaths(null, null, 0, TimestampConverters.MILLISECONDS.toNanoseconds(System.currentTimeMillis())); - Assert.assertEquals(1, Iterables.size(paths)); -} - } - - @Test - public void test_getPaths_rightEdge() throws Exception { -PcapJob job; -{ - final List inputFiles = new ArrayList() {{ -add(new Path("/apps/metron/pcap/pcap0_pcap_1461589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); -add(new Path("/apps/metron/pcap/pcap1_pcap_1461589333993573000_0_73686171-64a1-46e5-9e67-66cf603fb094")); - }}; - job = new PcapJob() { -@Override -