[ 
https://issues.apache.org/jira/browse/NIFI-4833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16371320#comment-16371320
 ] 

ASF GitHub Bot commented on NIFI-4833:
--------------------------------------

Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2478#discussion_r169621787
  
    --- Diff: 
nifi-nar-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/test/java/org/apache/nifi/hbase/TestScanHBase.java
 ---
    @@ -0,0 +1,375 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.nifi.hbase;
    +
    +import java.util.HashMap;
    +import java.util.List;
    +import java.util.Map;
    +
    +import org.apache.nifi.reporting.InitializationException;
    +import org.apache.nifi.util.MockFlowFile;
    +import org.apache.nifi.util.TestRunner;
    +import org.apache.nifi.util.TestRunners;
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +
    +public class TestScanHBase {
    +
    +    private ScanHBase proc;
    +    private MockHBaseClientService hBaseClientService;
    +    private TestRunner runner;
    +
    +    @Before
    +    public void setup() throws InitializationException {
    +        proc = new ScanHBase();
    +        runner = TestRunners.newTestRunner(proc);
    +
    +        hBaseClientService = new MockHBaseClientService();
    +        runner.addControllerService("hbaseClient", hBaseClientService);
    +        runner.enableControllerService(hBaseClientService);
    +        runner.setProperty(ScanHBase.HBASE_CLIENT_SERVICE, "hbaseClient");
    +    }
    +
    +    @Test
    +    public void testColumnsValidation() {
    +        runner.setProperty(ScanHBase.TABLE_NAME, "table1");
    +        runner.setProperty(ScanHBase.START_ROW, "row1");
    +        runner.setProperty(ScanHBase.END_ROW, "row1");
    +        runner.assertValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1:cq1");
    +        runner.assertValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1");
    +        runner.assertValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1:cq1,cf2:cq2,cf3:cq3");
    +        runner.assertValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1,cf2:cq1,cf3");
    +        runner.assertValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1 cf2,cf3");
    +        runner.assertNotValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1:,cf2,cf3");
    +        runner.assertNotValid();
    +
    +        runner.setProperty(ScanHBase.COLUMNS, "cf1:cq1,");
    +        runner.assertNotValid();
    +    }
    +
    +    @Test
    +    public void testNoIncomingFlowFile() {
    +        runner.setProperty(ScanHBase.TABLE_NAME, "table1");
    +        runner.setProperty(ScanHBase.START_ROW, "row1");
    +        runner.setProperty(ScanHBase.END_ROW, "row1");
    +
    +        runner.run();
    +        runner.assertTransferCount(ScanHBase.REL_FAILURE, 0);
    +        runner.assertTransferCount(ScanHBase.REL_SUCCESS, 0);
    +        runner.assertTransferCount(ScanHBase.REL_ORIGINAL, 0);
    +
    +        Assert.assertEquals(0, hBaseClientService.getNumScans());
    +    }
    +
    +    @Test
    +    public void testInvalidTableName() {
    +        runner.setProperty(ScanHBase.TABLE_NAME, "${hbase.table}");
    --- End diff --
    
    Without calling `setVariable` and `setValidateExpressionLanguage` (think 
that's its name) I'm not sure if this is going to do more than test the raw 
value in that field. Granted, that is an invalid name.


> NIFI-4833 Add ScanHBase processor
> ---------------------------------
>
>                 Key: NIFI-4833
>                 URL: https://issues.apache.org/jira/browse/NIFI-4833
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>            Reporter: Ed Berezitsky
>            Assignee: Ed Berezitsky
>            Priority: Major
>
> Add ScanHBase (new) processor to retrieve records from HBase tables.
> Today there are GetHBase and FetchHBaseRow. GetHBase can pull entire table or 
> only new rows after processor started; it also must be scheduled and doesn't 
> support incoming . FetchHBaseRow can pull rows with known rowkeys only.
> This processor could provide functionality similar to what could be reached 
> by using hbase shell, defining following properties:
> -scan based on range of row key IDs 
> -scan based on range of time stamps
> -limit number of records pulled
> -use filters
> -reverse rows



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to