// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion allEq(Map<String, ?> vals) {
//     List<Criterion> filters = new ArrayList<Criterion>(vals.size());
//     for(Entry<String, ?> entry : vals.entrySet()) {
//         filters.add(eq(entry.getKey(), entry.getValue()));
//     }
//     return and(filters);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion and(Collection<? extends Criterion> f) {
//     return new AndCriterion(f);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion anyEq(Map<String, ?> vals) {
//     List<Criterion> filters = new ArrayList<Criterion>(vals.size());
//     for(Entry<String, ?> entry : vals.entrySet()) {
//         filters.add(eq(entry.getKey(), entry.getValue()));
//     }
//     return or(filters);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion approx(String attr, Object val) {
//     return new ApproxCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion eq(String attr, Object val) {
//     return new EqCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion le(String attr, Object val) {
//     return new LeCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion like(String attr, Object val, LikeCriterion.MatchMode mode) {
//     return new LikeCriterion(attr, val, mode);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion ne(String attr, Object val) {
//     return not(eq(attr, val));
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion not(Criterion f) {
//     return new NotCriterion(f);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion raw(String f) {
//     return new RawCriterion(f);
// }


import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import java.util.LinkedHashMap;
import java.util.Map;
import static org.apache.camel.osgi.service.filter.Filters.allEq;
import static org.apache.camel.osgi.service.filter.Filters.and;
import static org.apache.camel.osgi.service.filter.Filters.anyEq;
import static org.apache.camel.osgi.service.filter.Filters.approx;
import static org.apache.camel.osgi.service.filter.Filters.eq;
import static org.apache.camel.osgi.service.filter.Filters.le;
import static org.apache.camel.osgi.service.filter.Filters.like;
import static org.apache.camel.osgi.service.filter.Filters.ne;
import static org.apache.camel.osgi.service.filter.Filters.not;
import static org.apache.camel.osgi.service.filter.Filters.raw;
import static org.hamcrest.CoreMatchers.equalTo;
/*
 * Licensed 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.osgi.service.filter;




public class FiltersTest {

    @Test
    public void testAllEq() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
        attrs.put("c", "d");

        Criterion criterion = allEq(attrs);
        assertThat(criterion.value(), equalTo("(&(a=b)(c=d))"));
        assertThat(criterion.filter(), notNullValue());
    }

    @Test
    public void testAnyEq() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
        attrs.put("c", "d");

        Criterion criterion = anyEq(attrs);
        assertThat(criterion.value(), equalTo("(|(a=b)(c=d))"));
        assertThat(criterion.filter(), notNullValue());
    }
    
    @Test
    public void testComplex() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion allEq(Map<String, ?> vals) {
//     List<Criterion> filters = new ArrayList<Criterion>(vals.size());
//     for(Entry<String, ?> entry : vals.entrySet()) {
//         filters.add(eq(entry.getKey(), entry.getValue()));
//     }
//     return and(filters);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion and(Collection<? extends Criterion> f) {
//     return new AndCriterion(f);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion anyEq(Map<String, ?> vals) {
//     List<Criterion> filters = new ArrayList<Criterion>(vals.size());
//     for(Entry<String, ?> entry : vals.entrySet()) {
//         filters.add(eq(entry.getKey(), entry.getValue()));
//     }
//     return or(filters);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion approx(String attr, Object val) {
//     return new ApproxCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion eq(String attr, Object val) {
//     return new EqCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion le(String attr, Object val) {
//     return new LeCriterion(attr, val);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion like(String attr, Object val, LikeCriterion.MatchMode mode) {
//     return new LikeCriterion(attr, val, mode);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion ne(String attr, Object val) {
//     return not(eq(attr, val));
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion not(Criterion f) {
//     return new NotCriterion(f);
// }
// 
// Path: component/src/main/java/org/apache/camel/osgi/service/filter/Filters.java
// public static Criterion raw(String f) {
//     return new RawCriterion(f);
// }


// Path: component/src/test/java/org/apache/camel/osgi/service/filter/FiltersTest.java
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import java.util.LinkedHashMap;
import java.util.Map;
import static org.apache.camel.osgi.service.filter.Filters.allEq;
import static org.apache.camel.osgi.service.filter.Filters.and;
import static org.apache.camel.osgi.service.filter.Filters.anyEq;
import static org.apache.camel.osgi.service.filter.Filters.approx;
import static org.apache.camel.osgi.service.filter.Filters.eq;
import static org.apache.camel.osgi.service.filter.Filters.le;
import static org.apache.camel.osgi.service.filter.Filters.like;
import static org.apache.camel.osgi.service.filter.Filters.ne;
import static org.apache.camel.osgi.service.filter.Filters.not;
import static org.apache.camel.osgi.service.filter.Filters.raw;
import static org.hamcrest.CoreMatchers.equalTo;

/*
 * Licensed 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.osgi.service.filter;




public class FiltersTest {

    @Test
    public void testAllEq() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
        attrs.put("c", "d");

        Criterion criterion = allEq(attrs);
        assertThat(criterion.value(), equalTo("(&(a=b)(c=d))"));
        assertThat(criterion.filter(), notNullValue());
    }

    @Test
    public void testAnyEq() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
        attrs.put("c", "d");

        Criterion criterion = anyEq(attrs);
        assertThat(criterion.value(), equalTo("(|(a=b)(c=d))"));
        assertThat(criterion.filter(), notNullValue());
    }
    
    @Test
    public void testComplex() throws Exception {
        Map<String, String> attrs = new LinkedHashMap<String, String>();
        attrs.put("a", "b");
        attrs.put("c", "d");