nickwallen commented on a change in pull request #1458: METRON-2177 Upgrade Profiler for HBase 2.0.2 URL: https://github.com/apache/metron/pull/1458#discussion_r311193875
########## File path: metron-analytics/metron-profiler-spark/src/test/java/org/apache/metron/profiler/spark/function/HBaseWriterFunctionTest.java ########## @@ -35,61 +41,69 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; -import static org.apache.metron.profiler.spark.BatchProfilerConfig.HBASE_COLUMN_FAMILY; -import static org.apache.metron.profiler.spark.BatchProfilerConfig.HBASE_TABLE_NAME; +import static org.apache.metron.hbase.client.FakeHBaseClient.Mutation; public class HBaseWriterFunctionTest { - Properties profilerProperties; + private HBaseWriterFunction function; + private Properties profilerProperties; + private RowKeyBuilder rowKeyBuilder; + private ColumnBuilder columnBuilder; + private FakeHBaseClient hbaseClient; + private HBaseClientFactory hBaseClientFactory; + + private static final JSONObject message = getMessage(); + private static final String entity = (String) message.get("ip_src_addr"); + private static final long timestamp = (Long) message.get("timestamp"); + private static final ProfileConfig profile = getProfile(); @Before public void setup() { profilerProperties = getProfilerProperties(); - - // create a mock table for HBase - String tableName = HBASE_TABLE_NAME.get(profilerProperties, String.class); - String columnFamily = HBASE_COLUMN_FAMILY.get(profilerProperties, String.class); - MockHBaseTableProvider.addToCache(tableName, columnFamily); + hbaseClient = new FakeHBaseClient(); + hbaseClient.deleteAll(); + hBaseClientFactory = (x, y, z) -> hbaseClient; + rowKeyBuilder = new SaltyRowKeyBuilder(); + columnBuilder = new ValueOnlyColumnBuilder(); + function = new HBaseWriterFunction(profilerProperties) Review comment: I altered the `HBaseWriterFunction` to use the Builder Pattern as you suggested. See fcdb697ed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services