/*
 * 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.camel.component.hbase;

import java.util.LinkedList;
import java.util.List;

import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.hbase.filters.ModelAwareColumnMatchingFilter;
import org.apache.camel.impl.JndiRegistry;
import org.apache.hadoop.hbase.filter.Filter;
import org.junit.Test;

public class CamelHBaseFilterTest extends CamelHBaseTestSupport {

    List<Filter> filters = new LinkedList<>();

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();
        filters.add(new ModelAwareColumnMatchingFilter().getFilteredList()); //not used, filters need to be rethink
        jndi.bind("myFilters", filters);
        return jndi;
    }

    @Test
    public void testPutMultiRowsAndScanWithFilters() throws Exception {
        if (systemReady) {
            putMultipleRows();
            ProducerTemplate template = context.createProducerTemplate();
            Endpoint endpoint = context.getEndpoint("direct:scan");

            Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
            exchange.getIn().setHeader(HBaseAttribute.HBASE_FAMILY.asHeader(), family[0]);
            exchange.getIn().setHeader(HBaseAttribute.HBASE_QUALIFIER.asHeader(), column[0][0]);
            exchange.getIn().setHeader(HBaseAttribute.HBASE_VALUE.asHeader(), body[0][0][0]);
            Exchange resp = template.send(endpoint, exchange);
            Message out = resp.getOut();
            assertTrue("two first keys returned",
                out.getHeaders().containsValue(body[0][0][0])
                    && out.getHeaders().containsValue(body[1][0][0])
                    && !out.getHeaders().containsValue(body[2][0][0]));
        }
    }

    /**
     * Factory method which derived classes can use to create a {@link org.apache.camel.builder.RouteBuilder}
     * to define the routes for testing
     */
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:start")
                    .to("hbase://" + PERSON_TABLE);
                from("direct:scan")
                    .to("hbase://" + PERSON_TABLE + "?operation=" + HBaseConstants.SCAN + "&maxResults=2");
            }
        };
    }
}

@@ -892,16 +892,56 @@
 .List;%0A%0A
+import org.apache.camel.BindToRegistry;%0A
 import o
@@ -966,16 +966,16 @@
 dpoint;%0A
-
 import o
@@ -1246,51 +1246,8 @@
 er;%0A
-import org.apache.camel.impl.JndiRegistry;%0A
 impo
@@ -1387,177 +1387,140 @@
     
-List%3CFilter%3E filters = new LinkedList%3C%3E();%0A%0A    @Override%0A    protected JndiRegistry createRegistry() throws Exception %7B%0A        JndiRegistry jndi = super.createRegistry
+@BindToRegistry(%22myFilters%22)%0A    public List%3CFilter%3E addFilters() throws Exception %7B%0A        List%3CFilter%3E filters = new LinkedList%3C%3E
 ();%0A
@@ -1647,60 +1647,22 @@
     
-jndi.bind(%22myFilters%22, filters);%0A        return jndi
+return filters
 ;%0A  

Use BindToRegistry annotation where possible