You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by mm...@apache.org on 2019/06/28 22:38:12 UTC
[metron] branch master updated: METRON-2166
FileFilterUtilTest.test_getPaths_leftEdge:116 expected:<1> but was:<2>
(mmiklavc) closes apache/metron#1452
This is an automated email from the ASF dual-hosted git repository.
mmiklavcic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metron.git
The following commit(s) were added to refs/heads/master by this push:
new c9604c2 METRON-2166 FileFilterUtilTest.test_getPaths_leftEdge:116 expected:<1> but was:<2> (mmiklavc) closes apache/metron#1452
c9604c2 is described below
commit c9604c255aa596202c6fb348fca3aa9816c0b297
Author: mmiklavc <mi...@gmail.com>
AuthorDate: Fri Jun 28 16:37:45 2019 -0600
METRON-2166 FileFilterUtilTest.test_getPaths_leftEdge:116 expected:<1> but was:<2> (mmiklavc) closes apache/metron#1452
---
.../apache/metron/pcap/mr/FileFilterUtilTest.java | 37 +++++++++++++---------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/metron-platform/metron-pcap/src/test/java/org/apache/metron/pcap/mr/FileFilterUtilTest.java b/metron-platform/metron-pcap/src/test/java/org/apache/metron/pcap/mr/FileFilterUtilTest.java
index cc05a9a..72e2b93 100644
--- a/metron-platform/metron-pcap/src/test/java/org/apache/metron/pcap/mr/FileFilterUtilTest.java
+++ b/metron-platform/metron-pcap/src/test/java/org/apache/metron/pcap/mr/FileFilterUtilTest.java
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.hadoop.fs.Path;
-import org.apache.metron.common.utils.timestamp.TimestampConverters;
import org.apache.metron.pcap.utils.FileFilterUtil;
import org.junit.Assert;
import org.junit.Before;
@@ -108,43 +107,51 @@ public class FileFilterUtilTest {
@Test
public void test_getPaths_leftEdge() throws Exception {
+ final long firstFileTSNanos = 1461589332993573000L;
+ final long secondFileTSNanos = 1561589332993573000L;
final List<Path> inputFiles = new ArrayList<Path>() {{
- 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"));
+ add(new Path("/apps/metron/pcap/pcap_pcap_" + firstFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap_pcap_" + secondFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
}};
- Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(0, TimestampConverters.MILLISECONDS.toNanoseconds(System.currentTimeMillis()), inputFiles);
+ Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(0, secondFileTSNanos - 1L, inputFiles);
Assert.assertEquals(1, Iterables.size(paths));
}
@Test
public void test_getPaths_rightEdge() throws Exception {
+ final long firstFileTSNanos = 1461589332993573000L;
+ final long secondFileTSNanos = 1461589333993573000L;
+ final long thirdFileTSNanos = 1461589334993573000L;
{
final List<Path> inputFiles = new ArrayList<Path>() {{
- 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"));
+ add(new Path("/apps/metron/pcap/pcap0_pcap_" + firstFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap1_pcap_" + secondFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
}};
- Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(1461589333993573000L - 1L, 1461589333993573000L + 1L, inputFiles);
+ Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(secondFileTSNanos - 1L, secondFileTSNanos + 1L, inputFiles);
Assert.assertEquals(2, Iterables.size(paths));
}
{
final List<Path> inputFiles = new ArrayList<Path>() {{
- 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"));
- add(new Path("/apps/metron/pcap/pcap1_pcap_1461589334993573000_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap0_pcap_" + firstFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap1_pcap_" + secondFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap1_pcap_" + thirdFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
}};
- Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(1461589334993573000L - 1L, 1461589334993573000L + 1L, inputFiles);
+ Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(thirdFileTSNanos - 1L, thirdFileTSNanos + 1L, inputFiles);
Assert.assertEquals(2, Iterables.size(paths));
}
}
@Test
public void test_getPaths_bothEdges() throws Exception {
+ final long firstFileTSNanos = 1461589332993573000L;
+ final long secondFileTSNanos = 1461589333993573000L;
+ final long thirdFileTSNanos = 1461589334993573000L;
final List<Path> inputFiles = new ArrayList<Path>() {{
- add(new Path("/apps/metron/pcap/pcap_pcap_1461589332993573000_0_73686171-64a1-46e5-9e67-66cf603fb094"));
- add(new Path("/apps/metron/pcap/pcap_pcap_1461589333993573000_0_73686171-64a1-46e5-9e67-66cf603fb094"));
- add(new Path("/apps/metron/pcap/pcap1_pcap_1461589334993573000_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap_pcap_" + firstFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap_pcap_" + secondFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
+ add(new Path("/apps/metron/pcap/pcap1_pcap_" + thirdFileTSNanos + "_0_73686171-64a1-46e5-9e67-66cf603fb094"));
}};
- Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(0, TimestampConverters.MILLISECONDS.toNanoseconds(System.currentTimeMillis()), inputFiles);
+ Iterable<String> paths = FileFilterUtil.getPathsInTimeRange(0, thirdFileTSNanos + 1L, inputFiles);
Assert.assertEquals(3, Iterables.size(paths));
}
}