metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ceste...@apache.org
Subject [55/89] [abbrv] incubator-metron git commit: Move all com/apache folders to org/apache
Date Tue, 26 Jan 2016 14:18:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/ConfigurationUtilTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/ConfigurationUtilTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/ConfigurationUtilTest.java
deleted file mode 100644
index 4577cb4..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/ConfigurationUtilTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.apache.metron.pcapservice;
-
-import org.eclipse.jdt.internal.core.Assert;
-import org.junit.Test;
-
-import com.apache.metron.pcapservice.ConfigurationUtil;
-import com.apache.metron.pcapservice.ConfigurationUtil.SizeUnit;
-
-/**
- * The Class ConfigurationUtilTest.
- */
-public class ConfigurationUtilTest {
-
-  /**
-   * Test_get max allowable result size in bytes.
-   */
-  @Test
-  public void test_getMaxAllowableResultSizeInBytes() {
-    long result = ConfigurationUtil.getMaxResultSize();
-    Assert.isTrue(result == 62914560);
-  }
-
-  /**
-   * Test_get max allowable results size unit.
-   */
-  @Test
-  public void test_getMaxAllowableResultsSizeUnit() {
-    SizeUnit result = ConfigurationUtil.getResultSizeUnit();
-    Assert.isTrue(SizeUnit.MB == result);
-  }
-
-  /**
-   * Test_get max row size in bytes.
-   */
-  @Test
-  public void test_getMaxRowSizeInBytes() {
-    long result = ConfigurationUtil.getMaxRowSize();
-    Assert.isTrue(result == 71680);
-  }
-
-  /**
-   * Test_get max row size unit.
-   */
-  @Test
-  public void test_getMaxRowSizeUnit() {
-    SizeUnit result = ConfigurationUtil.getRowSizeUnit();
-    Assert.isTrue(SizeUnit.KB == result);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseConfigurationUtilTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
deleted file mode 100644
index 38c2c90..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.apache.metron.pcapservice;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.util.Assert;
-
-import com.apache.metron.pcapservice.HBaseConfigurationUtil;
-
-/**
- * The Class HBaseConfigurationUtilTest.
- */
-public class HBaseConfigurationUtilTest {
-
-  /**
-   * Sets the up.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @Before
-  public void setUp() throws Exception {
-  }
-
-  /**
-   * Tear down.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  /**
-   * Test_read.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_read() throws IOException {
-    Configuration configuration = HBaseConfigurationUtil.read();
-    Assert.isTrue(configuration != null, "Configuration must not be null");
-    Assert.isTrue(configuration.get("hbase.client.retries.number").equals("1"),
-        "value must be equal");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseIntegrationTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseIntegrationTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseIntegrationTest.java
deleted file mode 100644
index acf9ae8..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/HBaseIntegrationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 
- */
-package com.apache.metron.pcapservice;
-
-import java.io.IOException;
-
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.util.Bytes;
-
-/**
- * The Class HBaseIntegrationTest.
- * 
- * @author Sayi
- */
-public class HBaseIntegrationTest {
-
-  /** The test util. */
-  private final HBaseTestingUtility testUtil = new HBaseTestingUtility();
-
-  /** The test table. */
-  private HTable testTable;
-
-  /**
-   * Inits the cluster.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  void initCluster() throws Exception {
-    // testUtil.getConfiguration().addResource("hbase-site-local.xml");
-    // testUtil.getConfiguration().reloadConfiguration();
-    // start mini hbase cluster
-    testUtil.startMiniCluster(1);
-    // create tables
-    createTable();
-
-  }
-
-  /**
-   * Creates the table.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  private void createTable() throws IOException {
-    testTable = testUtil.createTable("test_pcaps_local", "cf");
-    System.out.println("after 'test_pcaps_local' table creation ");
-    // create put
-    Put put = new Put(Bytes.toBytes("1111")); // row key =1111
-    put.add(Bytes.toBytes("cf"), Bytes.toBytes("packet"),
-        Bytes.toBytes("aaaaaaaa"));
-    testTable.put(put);
-    System.out.println("after testTable.put(put)");
-
-  }
-
-  /**
-   * The main method.
-   * 
-   * @param args
-   *          the arguments
-   * @throws Exception
-   *           the exception
-   */
-  public static void main(String[] args) throws Exception {
-    // HBaseIntegrationTest test = new HBaseIntegrationTest();
-    // test.initCluster();
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapGetterHBaseImplTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
deleted file mode 100644
index 4456bcf..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
+++ /dev/null
@@ -1,536 +0,0 @@
-package com.apache.metron.pcapservice;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.ListUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.Scan;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.springframework.util.Assert;
-
-import com.apache.metron.pcapservice.PcapGetterHBaseImpl;
-import com.apache.metron.pcapservice.PcapsResponse;
-
-/**
- * The Class PcapGetterHBaseImplTest.
- */
-public class PcapGetterHBaseImplTest {
-
-  /**
-   * Sets the up.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @Before
-  public void setUp() throws Exception {
-  }
-
-  /**
-   * Tear down.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  /**
-   * Test_get pcaps_with list.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @SuppressWarnings("unchecked")
-  @Test
-  public void test_getPcaps_withList() throws IOException {
-    // mocking
-    String[] keys = { "0a07002b-0a078039-06-1e8b-0087",
-        "0a070025-0a07807a-06-aab8-c360" };
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-
-    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
-    // Mockito.any(HTable.class), Mockito.any(Scan.class),
-    // Mockito.any(byte[].class), Mockito.any(byte[].class));
-    //
-    //
-    // actual call
-    // PcapsResponse response = spy.getPcaps(Arrays.asList(keys));
-
-    // verify
-    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
-  }
-
-  /**
-   * Test_get pcaps_with key.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @SuppressWarnings("unchecked")
-  @Test
-  public void test_getPcaps_withKey() throws IOException {
-    // mocking
-    String key = "0a07002b-0a078039-06-1e8b-0087";
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-
-    // //
-    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
-    // Mockito.any(HTable.class), Mockito.any(Scan.class),
-    // Mockito.any(byte[].class), Mockito.any(byte[].class));
-    //
-
-    // actual call
-    // PcapsResponse response = spy.getPcaps(key);
-
-    // verify
-    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
-  }
-
-  /**
-   * Test_get pcaps_with key and timestamps.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @SuppressWarnings("unchecked")
-  @Test
-  public void test_getPcaps_withKeyAndTimestamps() throws IOException {
-    // mocking
-    String key = "0a07002b-0a078039-06-1e8b-0087";
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-
-    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
-    // Mockito.any(HTable.class), Mockito.any(Scan.class),
-    // Mockito.any(byte[].class), Mockito.any(byte[].class));
-
-    // actual call
-    // PcapsResponse response = spy.getPcaps(key, startTime, endTime, false);
-
-    // verify
-    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
-  }
-
-  /**
-   * Test_get pcaps_with key_multiple pcaps.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @SuppressWarnings("unchecked")
-  @Test
-  public void test_getPcaps_withKey_multiplePcaps() throws IOException {
-    // mocking
-    String key = "0a07002b-0a078039-06-1e8b-0087";
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-    mockPcaps.add(getTestPcapBytes());
-
-    /*
-     * Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class
-     * ), Mockito.any(HTable.class), Mockito.any(Scan.class),
-     * Mockito.any(byte[].class), Mockito.any(byte[].class));
-     */
-    // actual call
-    // PcapsResponse response = spy.getPcaps(key);
-
-    // verify
-    // Assert.assertNotNull(response);
-    // Assert.assertTrue(response.getResponseSize() > mockPcaps.get(0).length);
-  }
-
-  /**
-   * Gets the test pcap bytes.
-   * 
-   * @return the test pcap bytes
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  private byte[] getTestPcapBytes() throws IOException {
-    File fin = new File("src/test/resources/test-tcp-packet.pcap");
-    byte[] pcapBytes = FileUtils.readFileToByteArray(fin);
-    return pcapBytes;
-  }
-
-  /**
-   * Test_remove duplicates.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_removeDuplicates() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0019-caac");
-    keys.add("18800006-1800000b-06-0050-5af6");
-
-    List<String> deDupKeys = pcapGetter.removeDuplicateKeys(keys);
-    Assert.isTrue(deDupKeys.size() == 3);
-    List<String> testKeys = new ArrayList<String>();
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0019-caac");
-
-    ListUtils.isEqualList(deDupKeys, testKeys);
-  }
-
-  /**
-   * Test_sort keys by asc order_with out reverse traffic.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_sortKeysByAscOrder_withOutReverseTraffic()
-      throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-06-0019-caac");
-
-    List<String> result = pcapGetter.sortKeysByAscOrder(keys, false);
-
-    List<String> testKeys = new ArrayList<String>();
-    testKeys.add("18800006-1800000b-06-0019-caac");
-    testKeys.add("18800006-1800000b-06-0050-5af6");
-    testKeys.add("18800006-1800000b-11-0035-3810");
-
-    Assert.isTrue(ListUtils.isEqualList(result, testKeys));
-  }
-
-  /**
-   * Test_sort keys by asc order_with reverse traffic.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_sortKeysByAscOrder_withReverseTraffic() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-    keys.add("18800006-1800000b-11-0035-3812");
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-11-0035-3811");
-
-    List<String> result = pcapGetter.sortKeysByAscOrder(keys, true);
-    Assert.isTrue(result.size() == 6);
-  }
-
-  /**
-   * Test_sort keys by asc order_get unprocessed sublist of keys.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_sortKeysByAscOrder_getUnprocessedSublistOfKeys()
-      throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-06-0019-caac");
-    System.out.println("original keys =" + keys.toString());
-
-    List<String> sortedKeys = pcapGetter.sortKeysByAscOrder(keys, false);
-    System.out.println("after sortKeysByAscOrder =" + sortedKeys.toString());
-
-    List<String> unprocessedKeys1 = pcapGetter.getUnprocessedSublistOfKeys(
-        sortedKeys, "18800006-1800000b-06-0019-caac-65140-40815");
-    System.out.println("unprocessedKeys1 =" + unprocessedKeys1);
-    Assert.isTrue(unprocessedKeys1.size() == 2);
-
-    List<String> unprocessedKeys2 = pcapGetter.getUnprocessedSublistOfKeys(
-        sortedKeys, "18800006-1800000b-06-0050-5af6-65140-40815");
-    // System.out.println("unprocessedKeys2 ="+unprocessedKeys2);
-    Assert.isTrue(unprocessedKeys2.size() == 1);
-
-    List<String> unprocessedKeys3 = pcapGetter.getUnprocessedSublistOfKeys(
-        sortedKeys, "18800006-1800000b-11-0035-3810-6514040815");
-    // System.out.println("unprocessedKeys3 ="+unprocessedKeys3);
-    Assert.isTrue(unprocessedKeys3.size() == 0);
-
-  }
-
-  /**
-   * Test_sort keys by asc order_get unprocessed sublist of keys_with out match.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_sortKeysByAscOrder_getUnprocessedSublistOfKeys_withOutMatch()
-      throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-06-0019-caac");
-    System.out.println("original keys =" + keys.toString());
-
-    List<String> sortedKeys = pcapGetter.sortKeysByAscOrder(keys, false);
-    System.out.println("after sortKeysByAscOrder =" + sortedKeys.toString());
-
-    List<String> unprocessedKeys1 = pcapGetter.getUnprocessedSublistOfKeys(
-        sortedKeys, "18800006-1800000b-11-89-455-65140-40815");
-    System.out.println("unprocessedKeys1 =" + unprocessedKeys1);
-    Assert.isTrue(unprocessedKeys1.size() == 3);
-  }
-
-  /**
-   * Test_create start and stop row keys.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createStartAndStopRowKeys() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String key = "18800006-1800000b-11-0035-3810";
-    Map<String, String> map = pcapGetter.createStartAndStopRowKeys(key, false,
-        false);
-    System.out.println("map =" + map.toString());
-
-    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
-    Map<String, String> map1 = pcapGetter.createStartAndStopRowKeys(
-        lastRowKey, true, false);
-    System.out.println("map1 =" + map1.toString());
-
-    String lastRowKey2 = "18800006-1800000b-11-0035-3810-23234-32423";
-    Map<String, String> map2 = pcapGetter.createStartAndStopRowKeys(
-        lastRowKey2, true, true);
-    System.out.println("map2 =" + map2.toString());
-
-  }
-
-  /**
-   * Test_check if valid input_valid.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_checkIfValidInput_valid() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    List<String> keys = new ArrayList<String>();
-    keys.add("18800006-1800000b-11-0035-3810");
-    keys.add("18800006-1800000b-06-0050-5af6");
-    keys.add("18800006-1800000b-06-0019-caac");
-
-    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
-
-    boolean response = pcapGetter.checkIfValidInput(keys, lastRowKey);
-    Assert.isTrue(response);
-
-  }
-
-  /**
-   * Test_check if valid input_in valid.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_checkIfValidInput_inValid() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    @SuppressWarnings("unchecked")
-    boolean response = pcapGetter.checkIfValidInput(Collections.EMPTY_LIST,
-        null);
-    Assert.isTrue(!response);
-
-  }
-
-  /**
-   * Test_check if valid input_valid_mixed.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_checkIfValidInput_valid_mixed() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
-    @SuppressWarnings("unchecked")
-    boolean response = pcapGetter.checkIfValidInput(Collections.EMPTY_LIST,
-        lastRowKey);
-    Assert.isTrue(response);
-  }
-
-  /**
-   * Test_create get request.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createGetRequest() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String key = "18800006-1800000b-11-0035-3810-23234-324230";
-
-    long startTime = 139812323L; // in seconds
-    long endTime = 139923424L; // in seconds
-
-    Get get = pcapGetter.createGetRequest(key, startTime, endTime);
-    Assert.notNull(get);
-
-    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
-    // compare in micros as the data creation time unit is set to Micros in
-    // properties file.
-    Assert.isTrue(get.getTimeRange().getMin() == startTime * 1000 );
-    Assert.isTrue(get.getTimeRange().getMax() == endTime * 1000 );
-  }
-
-  /**
-   * Test_create get request_default time range.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createGetRequest_defaultTimeRange() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String key = "18800006-1800000b-11-0035-3810-23234-324230";
-
-    Get get = pcapGetter.createGetRequest(key, -1, -1);
-    Assert.notNull(get);
-
-    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
-    Assert.isTrue(get.getTimeRange().getMin() == 0);
-  }
-
-  /**
-   * Test_create get request_with start time.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createGetRequest_withStartTime() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String key = "18800006-1800000b-11-0035-3810-23234-324230";
-
-    long startTime = 139812323L; // in seconds
-
-    Get get = pcapGetter.createGetRequest(key, startTime, -1);
-    Assert.notNull(get);
-
-    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
-    Assert.isTrue(get.getTimeRange().getMin() == startTime * 1000 );
-    Assert.isTrue(get.getTimeRange().getMax() == Long.valueOf(Long.MAX_VALUE));
-  }
-
-  /**
-   * Test_create get request_with end time.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createGetRequest_withEndTime() throws IOException {
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-    String key = "18800006-1800000b-11-0035-3810-23234-324230";
-
-    long endTime = 139923424L; // in seconds
-
-    Get get = pcapGetter.createGetRequest(key, -1, endTime);
-    Assert.notNull(get);
-
-    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
-    Assert.isTrue(get.getTimeRange().getMin() == 0);
-    Assert.isTrue(get.getTimeRange().getMax() == endTime * 1000 );
-  }
-
-  /**
-   * Test_create scan request.
-   * 
-   * @throws IOException
-   *           Signals that an I/O exception has occurred.
-   */
-  @Test
-  public void test_createScanRequest() throws IOException {
-    // mocking
-    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
-        .getInstance();
-
-    PcapsResponse pcapsResponse = new PcapsResponse();
-
-    Map<String, String> keysMap = new HashMap<String, String>();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087-00000-00000";
-    String endKey = "0a070025-0a07807a-06-aab8-c360-99999-99999";
-    keysMap.put("startKey", startKey);
-    keysMap.put("endKey", endKey);
-
-    long startTime = 139812323L; // in seconds
-    long endTime = 139923424L; // in seconds
-    long maxResultSize = 673424;
-
-    // actual call
-    Scan scan = pcapGetter.createScanRequest(pcapsResponse, keysMap, startTime,
-        endTime, maxResultSize);
-
-    // verify time range
-    Assert.isTrue(scan.getTimeRange().getMin() == startTime * 1000 ); // compare
-                                                                            // in
-                                                                            // millis
-    Assert.isTrue(scan.getTimeRange().getMax() == endTime * 1000 ); // compare
-                                                                          // in
-                                                                          // millis
-
-    // verify start and stop rows
-    Assert.isTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
-    Assert.isTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapHelperTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapHelperTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapHelperTest.java
deleted file mode 100644
index c013abe..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapHelperTest.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/**
- * 
- */
-package com.apache.metron.pcapservice;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.internal.core.Assert;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.apache.metron.pcapservice.PcapHelper;
-import com.apache.metron.pcapservice.PcapHelper.TimeUnit;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class PcapHelperTest.
- * 
- * @author Sayi
- */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(PcapHelper.class)
-public class PcapHelperTest {
-
-  /**
-   * Sets the up.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @Before
-  public void setUp() throws Exception {
-    PowerMockito.spy(PcapHelper.class);
-  }
-
-  /**
-   * Tear down.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in SECONDS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_seconds() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.SECONDS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222L; // input time in seconds
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222L == time);
-  }
-
-  /**
-   * Input time is in MILLIS and data creation time is in SECONDS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_millis_seconds() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.SECONDS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222333L; // input time in millis
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222L == time);
-  }
-
-  /**
-   * Input time is in MICROS and data creation time is in SECONDS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_micros_seconds() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.SECONDS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222333444L; // input time in micros
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MILLIS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_millis() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MILLIS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222L; // input time in seconds
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222000L == time);
-  }
-
-  /**
-   * Input time is in MILLIS and data creation time is in MILLIS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_millis_millis() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MILLIS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 111112222233L; // input time in millis
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(111112222233L == time);
-  }
-
-  /**
-   * Input time is in MICROS and data creation time is in MILLIS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_micros_millis() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MILLIS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 111112222233344L; // input time in micros
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(111112222233L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_micros() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222L; // input time in seconds
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222000000L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_micros_random() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 13388; // input time in seconds
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(13388000000L == time);
-  }
-
-  /**
-   * Input time is in MILLIS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_millis_micros() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 111112222233L; // input time in millis
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(111112222233000L == time);
-  }
-
-  /**
-   * Input time is in MICROS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_micros_micros() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1111122222334444L; // input time in micros
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1111122222334444L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_micros_0() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 0; // input time in micros
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(0 == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_micros_1() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = 1; // input time in micros
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(1000000L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_seconds_micros_decimal() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long inputTime = 13; // input time in seconds (double to long type casting)
-    long time = PcapHelper.convertSecondsToDataCreationTimeUnit(inputTime);
-
-    Assert.isTrue(13000000L == time);
-  }
-
-  /**
-   * Input time is in SECONDS and data creation time is in MICROS.
-   */
-  @Test
-  public void test_convertToDataCreationTimeUnit_() {
-    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
-        TimeUnit.MICROS);
-    PowerMockito.verifyNoMoreInteractions();
-
-    long endTime = (long) 111.333; // input time in seconds (double to long type
-                                   // casting)
-    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
-
-    Assert.isTrue(111000000L == time);
-  }
-
-  /**
-   * Test_get data creation time unit.
-   */
-  @Test
-  public void test_getDataCreationTimeUnit() {
-    TimeUnit dataCreationTimeUnit = PcapHelper.getDataCreationTimeUnit();
-    Assert.isTrue(TimeUnit.MILLIS == dataCreationTimeUnit);
-  }
-
-  /**
-   * Test_reverse key_valid.
-   */
-  @Test
-  public void test_reverseKey_valid() {
-    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092";
-    String reversekey = PcapHelper.reverseKey(key);
-    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
-        .equals(reversekey));
-  }
-
-  /**
-   * Test_reverse key_valid_with fragment.
-   */
-  @Test
-  public void test_reverseKey_valid_withFragment() {
-    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092-fragmentId";
-    String reversekey = PcapHelper.reverseKey(key);
-    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
-        .equals(reversekey));
-  }
-
-  /**
-   * Test_reverse key_in valid.
-   */
-  @Test
-  public void test_reverseKey_inValid() {
-    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092-ipId-fragmentId-extra";
-    String reversekey = PcapHelper.reverseKey(key);
-    Assert.isTrue("".equals(reversekey));
-  }
-
-  /**
-   * Test_reverse key_as list.
-   */
-  @Test
-  public void test_reverseKey_asList() {
-    String[] keys = {
-        "162.242.152.24-162.242.153.12-TCP-38190-9092-fragmentId",
-        "162.242.152.24-162.242.153.12-UDP-38190-9092" };
-
-    List<String> reverseKeys = PcapHelper.reverseKey(Arrays.asList(keys));
-
-    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
-        .equals(reverseKeys.get(0)));
-    Assert.isTrue("162.242.153.12-162.242.152.24-UDP-9092-38190"
-        .equals(reverseKeys.get(1)));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapScannerHBaseImplTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
deleted file mode 100644
index 8c473f6..0000000
--- a/metron-streaming/Metron-Pcap_Service/src/test/java/com/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package com.apache.metron.pcapservice;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Scan;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class PcapScannerHBaseImplTest.
- */
-public class PcapScannerHBaseImplTest {
-
-  /**
-   * Sets the up.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @Before
-  public void setUp() throws Exception {
-  }
-
-  /**
-   * Tear down.
-   * 
-   * @throws Exception
-   *           the exception
-   */
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  /**
-   * Test_create scan request.
-   * 
-   * @throws IOException
-   *           the IO exception
-   */
-  @Test
-  public void test_createScanRequest() throws IOException {
-    // mocking
-    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
-        .getInstance();
-    byte[] cf = "cf".getBytes();
-    byte[] cq = "pcap".getBytes();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087";
-    String endKey = "0a070025-0a07807a-06-aab8-c360";
-    long maxResultSize = 60;
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-
-    // actual call
-    Scan scan = pcapScanner.createScanRequest(cf, cq, startKey, endKey,
-        maxResultSize, -1, -1);
-
-    // verify
-    Assert.assertTrue(scan.getTimeRange().getMin() == 0);
-    Assert.assertTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
-    Assert.assertTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
-  }
-
-  /**
-   * Test_create scan request_with timestamps.
-   * 
-   * @throws IOException
-   *           the IO exception
-   */
-  @Test
-  public void test_createScanRequest_withTimestamps() throws IOException {
-    // mocking
-    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
-        .getInstance();
-    byte[] cf = "cf".getBytes();
-    byte[] cq = "pcap".getBytes();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087";
-    String endKey = "0a070025-0a07807a-06-aab8-c360";
-    long maxResultSize = 60;
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-
-    // actual call
-    Scan scan = pcapScanner.createScanRequest(cf, cq, startKey, endKey,
-        maxResultSize, startTime, endTime);
-
-    // verify
-    Assert.assertTrue(scan.getTimeRange().getMin() == 1376782349234L);
-    Assert.assertTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
-    Assert.assertTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
-  }
-
-  /**
-   * Test_get pcaps_with all arguments.
-   * 
-   * @throws IOException
-   *           the IO exception
-   */
-  @SuppressWarnings({ "unchecked", "unused" })
-  @Test
-  public void test_getPcaps_withAllArguments() throws IOException {
-    // mocking
-    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
-        .getInstance();
-    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
-    byte[] cf = "cf".getBytes();
-    byte[] cq = "pcap".getBytes();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087";
-    String endKey = "0a070025-0a07807a-06-aab8-c360";
-    long maxResultSize = 60;
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-
-    Mockito
-        .doReturn(mockPcaps)
-        .when(spy)
-        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
-            Mockito.any(Scan.class), Mockito.any(byte[].class),
-            Mockito.any(byte[].class));
-
-    // actual call
-    byte[] response = spy.getPcaps(startKey, endKey, maxResultSize, startTime,
-        endTime);
-
-    // verify
-    Assert.assertTrue(response.length == mockPcaps.get(0).length);
-  }
-
-  /**
-   * Test_get pcaps_with minimal arguments.
-   * 
-   * @throws IOException
-   *           the IO exception
-   */
-  @SuppressWarnings({ "unchecked", "unused" })
-  @Test
-  public void test_getPcaps_withMinimalArguments() throws IOException {
-    // mocking
-    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
-        .getInstance();
-    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
-    byte[] cf = "cf".getBytes();
-    byte[] cq = "pcap".getBytes();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087";
-    String endKey = "0a070025-0a07807a-06-aab8-c360";
-    long maxResultSize = 60;
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-
-    Mockito
-        .doReturn(mockPcaps)
-        .when(spy)
-        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
-            Mockito.any(Scan.class), Mockito.any(byte[].class),
-            Mockito.any(byte[].class));
-
-    // actual call
-    byte[] response = spy.getPcaps(startKey, endKey);
-
-    // verify
-    Assert.assertTrue(response.length == mockPcaps.get(0).length);
-  }
-
-  /**
-   * Test_get pcaps_multiple pcaps.
-   * 
-   * @throws IOException
-   *           the IO exception
-   */
-  @SuppressWarnings({ "unchecked", "unused" })
-  @Test
-  public void test_getPcaps_multiplePcaps() throws IOException {
-    // mocking
-    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
-        .getInstance();
-    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
-    byte[] cf = "cf".getBytes();
-    byte[] cq = "pcap".getBytes();
-    String startKey = "0a07002b-0a078039-06-1e8b-0087";
-    String endKey = "0a070025-0a07807a-06-aab8-c360";
-    long maxResultSize = 60;
-    long startTime = 1376782349234555L;
-    long endTime = 1396782349234555L;
-
-    List<byte[]> mockPcaps = new ArrayList<byte[]>();
-    mockPcaps.add(getTestPcapBytes());
-    mockPcaps.add(getTestPcapBytes());
-
-    Mockito
-        .doReturn(mockPcaps)
-        .when(spy)
-        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
-            Mockito.any(Scan.class), Mockito.any(byte[].class),
-            Mockito.any(byte[].class));
-
-    // actual call
-    byte[] response = spy.getPcaps(startKey, endKey);
-
-    // verify
-    Assert.assertNotNull(response);
-    Assert.assertTrue(response.length > mockPcaps.get(0).length);
-  }
-
-  /**
-   * Gets the test pcap bytes.
-   * 
-   * @return the test pcap bytes
-   * @throws IOException
-   *           the IO exception
-   */
-  private byte[] getTestPcapBytes() throws IOException {
-    File fin = new File("src/test/resources/test-tcp-packet.pcap");
-    byte[] pcapBytes = FileUtils.readFileToByteArray(fin);
-    return pcapBytes;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/CellTimestampComparatorTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/CellTimestampComparatorTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/CellTimestampComparatorTest.java
new file mode 100644
index 0000000..db38f7c
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/CellTimestampComparatorTest.java
@@ -0,0 +1,92 @@
+package com.apache.metron.pcapservice;
+
+import junit.framework.Assert;
+
+import org.apache.hadoop.hbase.Cell;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import com.apache.metron.pcapservice.CellTimestampComparator;
+
+/**
+ * The Class CellTimestampComparatorTest.
+ */
+public class CellTimestampComparatorTest {
+
+  /**
+   * Sets the up.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  /**
+   * Tear down.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  /**
+   * Test_less.
+   */
+  @Test
+  public void test_less() {
+    // mocking
+    Cell cell1 = Mockito.mock(Cell.class);
+    Mockito.when(cell1.getTimestamp()).thenReturn(13945345808L);
+    Cell cell2 = Mockito.mock(Cell.class);
+    Mockito.when(cell2.getTimestamp()).thenReturn(13845345808L);
+
+    CellTimestampComparator comparator = new CellTimestampComparator();
+
+    // actual call and verify
+    Assert.assertTrue(comparator.compare(cell2, cell1) == -1);
+
+  }
+
+  /**
+   * Test_greater.
+   */
+  @Test
+  public void test_greater() {
+    // mocking
+    Cell cell1 = Mockito.mock(Cell.class);
+    Mockito.when(cell1.getTimestamp()).thenReturn(13745345808L);
+    Cell cell2 = Mockito.mock(Cell.class);
+    Mockito.when(cell2.getTimestamp()).thenReturn(13945345808L);
+
+    CellTimestampComparator comparator = new CellTimestampComparator();
+
+    // actual call and verify
+    Assert.assertTrue(comparator.compare(cell2, cell1) == 1);
+
+  }
+
+  /**
+   * Test_equal.
+   */
+  @Test
+  public void test_equal() {
+    // mocking
+    Cell cell1 = Mockito.mock(Cell.class);
+    Mockito.when(cell1.getTimestamp()).thenReturn(13945345808L);
+    Cell cell2 = Mockito.mock(Cell.class);
+    Mockito.when(cell2.getTimestamp()).thenReturn(13945345808L);
+
+    CellTimestampComparator comparator = new CellTimestampComparator();
+
+    // actual call and verify
+    Assert.assertTrue(comparator.compare(cell2, cell1) == 0);
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/ConfigurationUtilTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/ConfigurationUtilTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/ConfigurationUtilTest.java
new file mode 100644
index 0000000..4577cb4
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/ConfigurationUtilTest.java
@@ -0,0 +1,50 @@
+package com.apache.metron.pcapservice;
+
+import org.eclipse.jdt.internal.core.Assert;
+import org.junit.Test;
+
+import com.apache.metron.pcapservice.ConfigurationUtil;
+import com.apache.metron.pcapservice.ConfigurationUtil.SizeUnit;
+
+/**
+ * The Class ConfigurationUtilTest.
+ */
+public class ConfigurationUtilTest {
+
+  /**
+   * Test_get max allowable result size in bytes.
+   */
+  @Test
+  public void test_getMaxAllowableResultSizeInBytes() {
+    long result = ConfigurationUtil.getMaxResultSize();
+    Assert.isTrue(result == 62914560);
+  }
+
+  /**
+   * Test_get max allowable results size unit.
+   */
+  @Test
+  public void test_getMaxAllowableResultsSizeUnit() {
+    SizeUnit result = ConfigurationUtil.getResultSizeUnit();
+    Assert.isTrue(SizeUnit.MB == result);
+  }
+
+  /**
+   * Test_get max row size in bytes.
+   */
+  @Test
+  public void test_getMaxRowSizeInBytes() {
+    long result = ConfigurationUtil.getMaxRowSize();
+    Assert.isTrue(result == 71680);
+  }
+
+  /**
+   * Test_get max row size unit.
+   */
+  @Test
+  public void test_getMaxRowSizeUnit() {
+    SizeUnit result = ConfigurationUtil.getRowSizeUnit();
+    Assert.isTrue(SizeUnit.KB == result);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseConfigurationUtilTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
new file mode 100644
index 0000000..38c2c90
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseConfigurationUtilTest.java
@@ -0,0 +1,52 @@
+package com.apache.metron.pcapservice;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.util.Assert;
+
+import com.apache.metron.pcapservice.HBaseConfigurationUtil;
+
+/**
+ * The Class HBaseConfigurationUtilTest.
+ */
+public class HBaseConfigurationUtilTest {
+
+  /**
+   * Sets the up.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  /**
+   * Tear down.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  /**
+   * Test_read.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_read() throws IOException {
+    Configuration configuration = HBaseConfigurationUtil.read();
+    Assert.isTrue(configuration != null, "Configuration must not be null");
+    Assert.isTrue(configuration.get("hbase.client.retries.number").equals("1"),
+        "value must be equal");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseIntegrationTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseIntegrationTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseIntegrationTest.java
new file mode 100644
index 0000000..acf9ae8
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/HBaseIntegrationTest.java
@@ -0,0 +1,74 @@
+/**
+ * 
+ */
+package com.apache.metron.pcapservice;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.util.Bytes;
+
+/**
+ * The Class HBaseIntegrationTest.
+ * 
+ * @author Sayi
+ */
+public class HBaseIntegrationTest {
+
+  /** The test util. */
+  private final HBaseTestingUtility testUtil = new HBaseTestingUtility();
+
+  /** The test table. */
+  private HTable testTable;
+
+  /**
+   * Inits the cluster.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  void initCluster() throws Exception {
+    // testUtil.getConfiguration().addResource("hbase-site-local.xml");
+    // testUtil.getConfiguration().reloadConfiguration();
+    // start mini hbase cluster
+    testUtil.startMiniCluster(1);
+    // create tables
+    createTable();
+
+  }
+
+  /**
+   * Creates the table.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  private void createTable() throws IOException {
+    testTable = testUtil.createTable("test_pcaps_local", "cf");
+    System.out.println("after 'test_pcaps_local' table creation ");
+    // create put
+    Put put = new Put(Bytes.toBytes("1111")); // row key =1111
+    put.add(Bytes.toBytes("cf"), Bytes.toBytes("packet"),
+        Bytes.toBytes("aaaaaaaa"));
+    testTable.put(put);
+    System.out.println("after testTable.put(put)");
+
+  }
+
+  /**
+   * The main method.
+   * 
+   * @param args
+   *          the arguments
+   * @throws Exception
+   *           the exception
+   */
+  public static void main(String[] args) throws Exception {
+    // HBaseIntegrationTest test = new HBaseIntegrationTest();
+    // test.initCluster();
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapGetterHBaseImplTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
new file mode 100644
index 0000000..4456bcf
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapGetterHBaseImplTest.java
@@ -0,0 +1,536 @@
+package com.apache.metron.pcapservice;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.ListUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Scan;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.util.Assert;
+
+import com.apache.metron.pcapservice.PcapGetterHBaseImpl;
+import com.apache.metron.pcapservice.PcapsResponse;
+
+/**
+ * The Class PcapGetterHBaseImplTest.
+ */
+public class PcapGetterHBaseImplTest {
+
+  /**
+   * Sets the up.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  /**
+   * Tear down.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  /**
+   * Test_get pcaps_with list.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @SuppressWarnings("unchecked")
+  @Test
+  public void test_getPcaps_withList() throws IOException {
+    // mocking
+    String[] keys = { "0a07002b-0a078039-06-1e8b-0087",
+        "0a070025-0a07807a-06-aab8-c360" };
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+
+    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
+    // Mockito.any(HTable.class), Mockito.any(Scan.class),
+    // Mockito.any(byte[].class), Mockito.any(byte[].class));
+    //
+    //
+    // actual call
+    // PcapsResponse response = spy.getPcaps(Arrays.asList(keys));
+
+    // verify
+    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
+  }
+
+  /**
+   * Test_get pcaps_with key.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @SuppressWarnings("unchecked")
+  @Test
+  public void test_getPcaps_withKey() throws IOException {
+    // mocking
+    String key = "0a07002b-0a078039-06-1e8b-0087";
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+
+    // //
+    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
+    // Mockito.any(HTable.class), Mockito.any(Scan.class),
+    // Mockito.any(byte[].class), Mockito.any(byte[].class));
+    //
+
+    // actual call
+    // PcapsResponse response = spy.getPcaps(key);
+
+    // verify
+    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
+  }
+
+  /**
+   * Test_get pcaps_with key and timestamps.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @SuppressWarnings("unchecked")
+  @Test
+  public void test_getPcaps_withKeyAndTimestamps() throws IOException {
+    // mocking
+    String key = "0a07002b-0a078039-06-1e8b-0087";
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+
+    // Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class),
+    // Mockito.any(HTable.class), Mockito.any(Scan.class),
+    // Mockito.any(byte[].class), Mockito.any(byte[].class));
+
+    // actual call
+    // PcapsResponse response = spy.getPcaps(key, startTime, endTime, false);
+
+    // verify
+    // Assert.assertTrue(response.getResponseSize() == mockPcaps.get(0).length);
+  }
+
+  /**
+   * Test_get pcaps_with key_multiple pcaps.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @SuppressWarnings("unchecked")
+  @Test
+  public void test_getPcaps_withKey_multiplePcaps() throws IOException {
+    // mocking
+    String key = "0a07002b-0a078039-06-1e8b-0087";
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    PcapGetterHBaseImpl spy = Mockito.spy(pcapGetter);
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+    mockPcaps.add(getTestPcapBytes());
+
+    /*
+     * Mockito.doReturn(mockPcaps).when(spy).scanPcaps(Mockito.any(ArrayList.class
+     * ), Mockito.any(HTable.class), Mockito.any(Scan.class),
+     * Mockito.any(byte[].class), Mockito.any(byte[].class));
+     */
+    // actual call
+    // PcapsResponse response = spy.getPcaps(key);
+
+    // verify
+    // Assert.assertNotNull(response);
+    // Assert.assertTrue(response.getResponseSize() > mockPcaps.get(0).length);
+  }
+
+  /**
+   * Gets the test pcap bytes.
+   * 
+   * @return the test pcap bytes
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  private byte[] getTestPcapBytes() throws IOException {
+    File fin = new File("src/test/resources/test-tcp-packet.pcap");
+    byte[] pcapBytes = FileUtils.readFileToByteArray(fin);
+    return pcapBytes;
+  }
+
+  /**
+   * Test_remove duplicates.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_removeDuplicates() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0019-caac");
+    keys.add("18800006-1800000b-06-0050-5af6");
+
+    List<String> deDupKeys = pcapGetter.removeDuplicateKeys(keys);
+    Assert.isTrue(deDupKeys.size() == 3);
+    List<String> testKeys = new ArrayList<String>();
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0019-caac");
+
+    ListUtils.isEqualList(deDupKeys, testKeys);
+  }
+
+  /**
+   * Test_sort keys by asc order_with out reverse traffic.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_sortKeysByAscOrder_withOutReverseTraffic()
+      throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-06-0019-caac");
+
+    List<String> result = pcapGetter.sortKeysByAscOrder(keys, false);
+
+    List<String> testKeys = new ArrayList<String>();
+    testKeys.add("18800006-1800000b-06-0019-caac");
+    testKeys.add("18800006-1800000b-06-0050-5af6");
+    testKeys.add("18800006-1800000b-11-0035-3810");
+
+    Assert.isTrue(ListUtils.isEqualList(result, testKeys));
+  }
+
+  /**
+   * Test_sort keys by asc order_with reverse traffic.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_sortKeysByAscOrder_withReverseTraffic() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+    keys.add("18800006-1800000b-11-0035-3812");
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-11-0035-3811");
+
+    List<String> result = pcapGetter.sortKeysByAscOrder(keys, true);
+    Assert.isTrue(result.size() == 6);
+  }
+
+  /**
+   * Test_sort keys by asc order_get unprocessed sublist of keys.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_sortKeysByAscOrder_getUnprocessedSublistOfKeys()
+      throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-06-0019-caac");
+    System.out.println("original keys =" + keys.toString());
+
+    List<String> sortedKeys = pcapGetter.sortKeysByAscOrder(keys, false);
+    System.out.println("after sortKeysByAscOrder =" + sortedKeys.toString());
+
+    List<String> unprocessedKeys1 = pcapGetter.getUnprocessedSublistOfKeys(
+        sortedKeys, "18800006-1800000b-06-0019-caac-65140-40815");
+    System.out.println("unprocessedKeys1 =" + unprocessedKeys1);
+    Assert.isTrue(unprocessedKeys1.size() == 2);
+
+    List<String> unprocessedKeys2 = pcapGetter.getUnprocessedSublistOfKeys(
+        sortedKeys, "18800006-1800000b-06-0050-5af6-65140-40815");
+    // System.out.println("unprocessedKeys2 ="+unprocessedKeys2);
+    Assert.isTrue(unprocessedKeys2.size() == 1);
+
+    List<String> unprocessedKeys3 = pcapGetter.getUnprocessedSublistOfKeys(
+        sortedKeys, "18800006-1800000b-11-0035-3810-6514040815");
+    // System.out.println("unprocessedKeys3 ="+unprocessedKeys3);
+    Assert.isTrue(unprocessedKeys3.size() == 0);
+
+  }
+
+  /**
+   * Test_sort keys by asc order_get unprocessed sublist of keys_with out match.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_sortKeysByAscOrder_getUnprocessedSublistOfKeys_withOutMatch()
+      throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-06-0019-caac");
+    System.out.println("original keys =" + keys.toString());
+
+    List<String> sortedKeys = pcapGetter.sortKeysByAscOrder(keys, false);
+    System.out.println("after sortKeysByAscOrder =" + sortedKeys.toString());
+
+    List<String> unprocessedKeys1 = pcapGetter.getUnprocessedSublistOfKeys(
+        sortedKeys, "18800006-1800000b-11-89-455-65140-40815");
+    System.out.println("unprocessedKeys1 =" + unprocessedKeys1);
+    Assert.isTrue(unprocessedKeys1.size() == 3);
+  }
+
+  /**
+   * Test_create start and stop row keys.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createStartAndStopRowKeys() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String key = "18800006-1800000b-11-0035-3810";
+    Map<String, String> map = pcapGetter.createStartAndStopRowKeys(key, false,
+        false);
+    System.out.println("map =" + map.toString());
+
+    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
+    Map<String, String> map1 = pcapGetter.createStartAndStopRowKeys(
+        lastRowKey, true, false);
+    System.out.println("map1 =" + map1.toString());
+
+    String lastRowKey2 = "18800006-1800000b-11-0035-3810-23234-32423";
+    Map<String, String> map2 = pcapGetter.createStartAndStopRowKeys(
+        lastRowKey2, true, true);
+    System.out.println("map2 =" + map2.toString());
+
+  }
+
+  /**
+   * Test_check if valid input_valid.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_checkIfValidInput_valid() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    List<String> keys = new ArrayList<String>();
+    keys.add("18800006-1800000b-11-0035-3810");
+    keys.add("18800006-1800000b-06-0050-5af6");
+    keys.add("18800006-1800000b-06-0019-caac");
+
+    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
+
+    boolean response = pcapGetter.checkIfValidInput(keys, lastRowKey);
+    Assert.isTrue(response);
+
+  }
+
+  /**
+   * Test_check if valid input_in valid.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_checkIfValidInput_inValid() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    @SuppressWarnings("unchecked")
+    boolean response = pcapGetter.checkIfValidInput(Collections.EMPTY_LIST,
+        null);
+    Assert.isTrue(!response);
+
+  }
+
+  /**
+   * Test_check if valid input_valid_mixed.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_checkIfValidInput_valid_mixed() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String lastRowKey = "18800006-1800000b-11-0035-3810-23234-32423";
+    @SuppressWarnings("unchecked")
+    boolean response = pcapGetter.checkIfValidInput(Collections.EMPTY_LIST,
+        lastRowKey);
+    Assert.isTrue(response);
+  }
+
+  /**
+   * Test_create get request.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createGetRequest() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String key = "18800006-1800000b-11-0035-3810-23234-324230";
+
+    long startTime = 139812323L; // in seconds
+    long endTime = 139923424L; // in seconds
+
+    Get get = pcapGetter.createGetRequest(key, startTime, endTime);
+    Assert.notNull(get);
+
+    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
+    // compare in micros as the data creation time unit is set to Micros in
+    // properties file.
+    Assert.isTrue(get.getTimeRange().getMin() == startTime * 1000 );
+    Assert.isTrue(get.getTimeRange().getMax() == endTime * 1000 );
+  }
+
+  /**
+   * Test_create get request_default time range.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createGetRequest_defaultTimeRange() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String key = "18800006-1800000b-11-0035-3810-23234-324230";
+
+    Get get = pcapGetter.createGetRequest(key, -1, -1);
+    Assert.notNull(get);
+
+    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
+    Assert.isTrue(get.getTimeRange().getMin() == 0);
+  }
+
+  /**
+   * Test_create get request_with start time.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createGetRequest_withStartTime() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String key = "18800006-1800000b-11-0035-3810-23234-324230";
+
+    long startTime = 139812323L; // in seconds
+
+    Get get = pcapGetter.createGetRequest(key, startTime, -1);
+    Assert.notNull(get);
+
+    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
+    Assert.isTrue(get.getTimeRange().getMin() == startTime * 1000 );
+    Assert.isTrue(get.getTimeRange().getMax() == Long.valueOf(Long.MAX_VALUE));
+  }
+
+  /**
+   * Test_create get request_with end time.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createGetRequest_withEndTime() throws IOException {
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+    String key = "18800006-1800000b-11-0035-3810-23234-324230";
+
+    long endTime = 139923424L; // in seconds
+
+    Get get = pcapGetter.createGetRequest(key, -1, endTime);
+    Assert.notNull(get);
+
+    Assert.isTrue(Arrays.equals(get.getRow(), key.getBytes()));
+    Assert.isTrue(get.getTimeRange().getMin() == 0);
+    Assert.isTrue(get.getTimeRange().getMax() == endTime * 1000 );
+  }
+
+  /**
+   * Test_create scan request.
+   * 
+   * @throws IOException
+   *           Signals that an I/O exception has occurred.
+   */
+  @Test
+  public void test_createScanRequest() throws IOException {
+    // mocking
+    PcapGetterHBaseImpl pcapGetter = (PcapGetterHBaseImpl) PcapGetterHBaseImpl
+        .getInstance();
+
+    PcapsResponse pcapsResponse = new PcapsResponse();
+
+    Map<String, String> keysMap = new HashMap<String, String>();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087-00000-00000";
+    String endKey = "0a070025-0a07807a-06-aab8-c360-99999-99999";
+    keysMap.put("startKey", startKey);
+    keysMap.put("endKey", endKey);
+
+    long startTime = 139812323L; // in seconds
+    long endTime = 139923424L; // in seconds
+    long maxResultSize = 673424;
+
+    // actual call
+    Scan scan = pcapGetter.createScanRequest(pcapsResponse, keysMap, startTime,
+        endTime, maxResultSize);
+
+    // verify time range
+    Assert.isTrue(scan.getTimeRange().getMin() == startTime * 1000 ); // compare
+                                                                            // in
+                                                                            // millis
+    Assert.isTrue(scan.getTimeRange().getMax() == endTime * 1000 ); // compare
+                                                                          // in
+                                                                          // millis
+
+    // verify start and stop rows
+    Assert.isTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
+    Assert.isTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapHelperTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapHelperTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapHelperTest.java
new file mode 100644
index 0000000..c013abe
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapHelperTest.java
@@ -0,0 +1,321 @@
+/**
+ * 
+ */
+package com.apache.metron.pcapservice;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.internal.core.Assert;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.apache.metron.pcapservice.PcapHelper;
+import com.apache.metron.pcapservice.PcapHelper.TimeUnit;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PcapHelperTest.
+ * 
+ * @author Sayi
+ */
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(PcapHelper.class)
+public class PcapHelperTest {
+
+  /**
+   * Sets the up.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @Before
+  public void setUp() throws Exception {
+    PowerMockito.spy(PcapHelper.class);
+  }
+
+  /**
+   * Tear down.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in SECONDS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_seconds() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.SECONDS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222L; // input time in seconds
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222L == time);
+  }
+
+  /**
+   * Input time is in MILLIS and data creation time is in SECONDS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_millis_seconds() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.SECONDS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222333L; // input time in millis
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222L == time);
+  }
+
+  /**
+   * Input time is in MICROS and data creation time is in SECONDS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_micros_seconds() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.SECONDS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222333444L; // input time in micros
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MILLIS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_millis() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MILLIS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222L; // input time in seconds
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222000L == time);
+  }
+
+  /**
+   * Input time is in MILLIS and data creation time is in MILLIS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_millis_millis() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MILLIS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 111112222233L; // input time in millis
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(111112222233L == time);
+  }
+
+  /**
+   * Input time is in MICROS and data creation time is in MILLIS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_micros_millis() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MILLIS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 111112222233344L; // input time in micros
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(111112222233L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_micros() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222L; // input time in seconds
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222000000L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_micros_random() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 13388; // input time in seconds
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(13388000000L == time);
+  }
+
+  /**
+   * Input time is in MILLIS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_millis_micros() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 111112222233L; // input time in millis
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(111112222233000L == time);
+  }
+
+  /**
+   * Input time is in MICROS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_micros_micros() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1111122222334444L; // input time in micros
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1111122222334444L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_micros_0() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 0; // input time in micros
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(0 == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_micros_1() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = 1; // input time in micros
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(1000000L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_seconds_micros_decimal() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long inputTime = 13; // input time in seconds (double to long type casting)
+    long time = PcapHelper.convertSecondsToDataCreationTimeUnit(inputTime);
+
+    Assert.isTrue(13000000L == time);
+  }
+
+  /**
+   * Input time is in SECONDS and data creation time is in MICROS.
+   */
+  @Test
+  public void test_convertToDataCreationTimeUnit_() {
+    PowerMockito.when(PcapHelper.getDataCreationTimeUnit()).thenReturn(
+        TimeUnit.MICROS);
+    PowerMockito.verifyNoMoreInteractions();
+
+    long endTime = (long) 111.333; // input time in seconds (double to long type
+                                   // casting)
+    long time = PcapHelper.convertToDataCreationTimeUnit(endTime);
+
+    Assert.isTrue(111000000L == time);
+  }
+
+  /**
+   * Test_get data creation time unit.
+   */
+  @Test
+  public void test_getDataCreationTimeUnit() {
+    TimeUnit dataCreationTimeUnit = PcapHelper.getDataCreationTimeUnit();
+    Assert.isTrue(TimeUnit.MILLIS == dataCreationTimeUnit);
+  }
+
+  /**
+   * Test_reverse key_valid.
+   */
+  @Test
+  public void test_reverseKey_valid() {
+    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092";
+    String reversekey = PcapHelper.reverseKey(key);
+    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
+        .equals(reversekey));
+  }
+
+  /**
+   * Test_reverse key_valid_with fragment.
+   */
+  @Test
+  public void test_reverseKey_valid_withFragment() {
+    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092-fragmentId";
+    String reversekey = PcapHelper.reverseKey(key);
+    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
+        .equals(reversekey));
+  }
+
+  /**
+   * Test_reverse key_in valid.
+   */
+  @Test
+  public void test_reverseKey_inValid() {
+    String key = "162.242.152.24-162.242.153.12-TCP-38190-9092-ipId-fragmentId-extra";
+    String reversekey = PcapHelper.reverseKey(key);
+    Assert.isTrue("".equals(reversekey));
+  }
+
+  /**
+   * Test_reverse key_as list.
+   */
+  @Test
+  public void test_reverseKey_asList() {
+    String[] keys = {
+        "162.242.152.24-162.242.153.12-TCP-38190-9092-fragmentId",
+        "162.242.152.24-162.242.153.12-UDP-38190-9092" };
+
+    List<String> reverseKeys = PcapHelper.reverseKey(Arrays.asList(keys));
+
+    Assert.isTrue("162.242.153.12-162.242.152.24-TCP-9092-38190"
+        .equals(reverseKeys.get(0)));
+    Assert.isTrue("162.242.153.12-162.242.152.24-UDP-9092-38190"
+        .equals(reverseKeys.get(1)));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/3854e075/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
----------------------------------------------------------------------
diff --git a/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapScannerHBaseImplTest.java b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
new file mode 100644
index 0000000..8c473f6
--- /dev/null
+++ b/metron-streaming/Metron-Pcap_Service/src/test/java/org/apache/metron/pcapservice/PcapScannerHBaseImplTest.java
@@ -0,0 +1,232 @@
+package com.apache.metron.pcapservice;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Scan;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class PcapScannerHBaseImplTest.
+ */
+public class PcapScannerHBaseImplTest {
+
+  /**
+   * Sets the up.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  /**
+   * Tear down.
+   * 
+   * @throws Exception
+   *           the exception
+   */
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  /**
+   * Test_create scan request.
+   * 
+   * @throws IOException
+   *           the IO exception
+   */
+  @Test
+  public void test_createScanRequest() throws IOException {
+    // mocking
+    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
+        .getInstance();
+    byte[] cf = "cf".getBytes();
+    byte[] cq = "pcap".getBytes();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087";
+    String endKey = "0a070025-0a07807a-06-aab8-c360";
+    long maxResultSize = 60;
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+
+    // actual call
+    Scan scan = pcapScanner.createScanRequest(cf, cq, startKey, endKey,
+        maxResultSize, -1, -1);
+
+    // verify
+    Assert.assertTrue(scan.getTimeRange().getMin() == 0);
+    Assert.assertTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
+    Assert.assertTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
+  }
+
+  /**
+   * Test_create scan request_with timestamps.
+   * 
+   * @throws IOException
+   *           the IO exception
+   */
+  @Test
+  public void test_createScanRequest_withTimestamps() throws IOException {
+    // mocking
+    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
+        .getInstance();
+    byte[] cf = "cf".getBytes();
+    byte[] cq = "pcap".getBytes();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087";
+    String endKey = "0a070025-0a07807a-06-aab8-c360";
+    long maxResultSize = 60;
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+
+    // actual call
+    Scan scan = pcapScanner.createScanRequest(cf, cq, startKey, endKey,
+        maxResultSize, startTime, endTime);
+
+    // verify
+    Assert.assertTrue(scan.getTimeRange().getMin() == 1376782349234L);
+    Assert.assertTrue(Arrays.equals(scan.getStartRow(), startKey.getBytes()));
+    Assert.assertTrue(Arrays.equals(scan.getStopRow(), endKey.getBytes()));
+  }
+
+  /**
+   * Test_get pcaps_with all arguments.
+   * 
+   * @throws IOException
+   *           the IO exception
+   */
+  @SuppressWarnings({ "unchecked", "unused" })
+  @Test
+  public void test_getPcaps_withAllArguments() throws IOException {
+    // mocking
+    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
+        .getInstance();
+    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
+    byte[] cf = "cf".getBytes();
+    byte[] cq = "pcap".getBytes();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087";
+    String endKey = "0a070025-0a07807a-06-aab8-c360";
+    long maxResultSize = 60;
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+
+    Mockito
+        .doReturn(mockPcaps)
+        .when(spy)
+        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
+            Mockito.any(Scan.class), Mockito.any(byte[].class),
+            Mockito.any(byte[].class));
+
+    // actual call
+    byte[] response = spy.getPcaps(startKey, endKey, maxResultSize, startTime,
+        endTime);
+
+    // verify
+    Assert.assertTrue(response.length == mockPcaps.get(0).length);
+  }
+
+  /**
+   * Test_get pcaps_with minimal arguments.
+   * 
+   * @throws IOException
+   *           the IO exception
+   */
+  @SuppressWarnings({ "unchecked", "unused" })
+  @Test
+  public void test_getPcaps_withMinimalArguments() throws IOException {
+    // mocking
+    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
+        .getInstance();
+    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
+    byte[] cf = "cf".getBytes();
+    byte[] cq = "pcap".getBytes();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087";
+    String endKey = "0a070025-0a07807a-06-aab8-c360";
+    long maxResultSize = 60;
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+
+    Mockito
+        .doReturn(mockPcaps)
+        .when(spy)
+        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
+            Mockito.any(Scan.class), Mockito.any(byte[].class),
+            Mockito.any(byte[].class));
+
+    // actual call
+    byte[] response = spy.getPcaps(startKey, endKey);
+
+    // verify
+    Assert.assertTrue(response.length == mockPcaps.get(0).length);
+  }
+
+  /**
+   * Test_get pcaps_multiple pcaps.
+   * 
+   * @throws IOException
+   *           the IO exception
+   */
+  @SuppressWarnings({ "unchecked", "unused" })
+  @Test
+  public void test_getPcaps_multiplePcaps() throws IOException {
+    // mocking
+    PcapScannerHBaseImpl pcapScanner = (PcapScannerHBaseImpl) PcapScannerHBaseImpl
+        .getInstance();
+    PcapScannerHBaseImpl spy = Mockito.spy(pcapScanner);
+    byte[] cf = "cf".getBytes();
+    byte[] cq = "pcap".getBytes();
+    String startKey = "0a07002b-0a078039-06-1e8b-0087";
+    String endKey = "0a070025-0a07807a-06-aab8-c360";
+    long maxResultSize = 60;
+    long startTime = 1376782349234555L;
+    long endTime = 1396782349234555L;
+
+    List<byte[]> mockPcaps = new ArrayList<byte[]>();
+    mockPcaps.add(getTestPcapBytes());
+    mockPcaps.add(getTestPcapBytes());
+
+    Mockito
+        .doReturn(mockPcaps)
+        .when(spy)
+        .scanPcaps(Mockito.any(ArrayList.class), Mockito.any(HTable.class),
+            Mockito.any(Scan.class), Mockito.any(byte[].class),
+            Mockito.any(byte[].class));
+
+    // actual call
+    byte[] response = spy.getPcaps(startKey, endKey);
+
+    // verify
+    Assert.assertNotNull(response);
+    Assert.assertTrue(response.length > mockPcaps.get(0).length);
+  }
+
+  /**
+   * Gets the test pcap bytes.
+   * 
+   * @return the test pcap bytes
+   * @throws IOException
+   *           the IO exception
+   */
+  private byte[] getTestPcapBytes() throws IOException {
+    File fin = new File("src/test/resources/test-tcp-packet.pcap");
+    byte[] pcapBytes = FileUtils.readFileToByteArray(fin);
+    return pcapBytes;
+  }
+}



Mime
View raw message