You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2016/04/29 16:04:51 UTC

svn commit: r1741634 [2/2] - in /sling/trunk/testing/junit/rules: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/testing/ src/main/java/org/apache/sling/testi...

Added: sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Action.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Action.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Action.java (added)
+++ sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Action.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,21 @@
+/*
+ * 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.sling.testing.junit.rules.util;
+
+public interface Action {
+    void call() throws Throwable;
+}

Added: sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/IgnoreTestsConfig.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/IgnoreTestsConfig.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/IgnoreTestsConfig.java (added)
+++ sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/IgnoreTestsConfig.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,129 @@
+/*
+ * 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.sling.testing.junit.rules.util;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.testing.clients.Constants;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+public class IgnoreTestsConfig {
+
+    public static final String IGNORE_LIST_PROP = Constants.CONFIG_PROP_PREFIX + "ignorelist";
+    public static final String RUN_IGNORE_LIST_PROP = Constants.CONFIG_PROP_PREFIX + "ignorelist.run";
+
+    private final int numberOfIgnoreLists = 3;
+    private final boolean runIgnoreList;
+    private static IgnoreTestsConfig INSTANCE;
+    private Map<String, String> ignoreTokens = new HashMap<String, String>();
+
+
+    /**
+     * @return the singleton config object.
+     */
+    public static IgnoreTestsConfig get() {
+        if (INSTANCE == null) {
+            INSTANCE = new IgnoreTestsConfig();
+        }
+        return INSTANCE;
+    }
+
+    /**
+     * Recreate the singleton config object.
+     */
+    public static void reCreate() {
+        INSTANCE = new IgnoreTestsConfig();
+    }
+
+    private IgnoreTestsConfig() {
+        for (int i = 0; i <= numberOfIgnoreLists; i++) {
+            StringTokenizer st = new StringTokenizer(System.getProperty(IGNORE_LIST_PROP, ""), ",");
+            while (st.hasMoreElements()) {
+                String token = st.nextToken();
+                String[] pair = token.split(":");
+
+                // Split by ":" and get the ignore (partial) java FQDN and a reason
+                // Ex: org.apache.sling.tests.*:SLING-4242
+                //     org.apache.sling.tests.MyTest:SLING-555
+                String ignoreToken = (pair.length > 0) ? pair[0] : "";
+                String reason = (pair.length > 1) ? pair[1] : "";
+
+                // Add to ignore token map
+                ignoreTokens.put(ignoreToken.trim(), reason.trim());
+            }
+        }
+        this.runIgnoreList = System.getProperty(RUN_IGNORE_LIST_PROP) != null;
+    }
+
+    public Match match(String fqdn) {
+        if (null == fqdn || "".equals(fqdn)) {
+            throw new IllegalArgumentException("The ignore class/method String must not be null or empty");
+        }
+        String className = StringUtils.substringBefore(fqdn, "#");
+        Match match = matchToken(fqdn);
+        if (!match.isIgnored() && (fqdn.indexOf('#') > 0)) {
+            return matchToken(className);
+        } else {
+            return match;
+        }
+    }
+
+    private Match matchToken(String matchToken) {
+        if (!runIgnoreList ) {
+            // run the tests that are not in the ignorelist
+            for (String ignoreToken : ignoreTokens.keySet()) {
+                if (asteriskMatch(ignoreToken, matchToken)) {
+                    return new Match(true, ignoreTokens.get(ignoreToken));
+                }
+            }
+            return new Match(false);
+        } else {
+            // run only the ignore list, so reverse logic.
+            for (String ignoreToken : ignoreTokens.keySet()) {
+                if (asteriskMatch(ignoreToken, matchToken)) {
+                    return new Match(false, ignoreTokens.get(ignoreToken));
+                }
+            }
+            return new Match(true, "Running tests in ignorelist only");
+        }
+    }
+
+
+    private static String createRegexFromGlob(String glob) {
+        String out = "^";
+        for(int i = 0; i < glob.length(); ++i) {
+            final char c = glob.charAt(i);
+            switch(c) {
+                case '*': out += ".*"; break;
+                case '?': out += '.'; break;
+                case '.': out += "\\."; break;
+                case '\\': out += "\\\\"; break;
+                default: out += c;
+            }
+        }
+        out += '$';
+        return out;
+    }
+
+    public static boolean asteriskMatch(String pattern, String text) {
+        return text.matches(createRegexFromGlob(pattern));
+    }
+
+
+}

Added: sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Match.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Match.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Match.java (added)
+++ sling/trunk/testing/junit/rules/src/main/java/org/apache/sling/testing/junit/rules/util/Match.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,40 @@
+/*
+ * 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.sling.testing.junit.rules.util;
+
+public class Match {
+    private final boolean matched;
+    private final String reason;
+
+    public Match(boolean matched, String reason) {
+        this.matched = matched;
+        this.reason = reason;
+    }
+
+    public Match(boolean matched) {
+        this.matched = matched;
+        reason = "";
+    }
+
+    public boolean isIgnored() {
+        return matched;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/RunOnceRuleTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/RunOnceRuleTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/RunOnceRuleTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/RunOnceRuleTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,63 @@
+/*
+ * 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.sling.testing.junit.rules.util;
+
+import org.apache.sling.testing.junit.rules.RunOnceRule;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RunOnceRuleTest {
+    private static final Logger LOG = LoggerFactory.getLogger(RunOnceRule.class);
+    public static int count = 0;
+    
+    @Rule
+    public RunOnceRule roc = new RunOnceRule(new TestRule() {
+        @Override
+        public Statement apply(Statement base, Description description) {
+            count ++;
+            LOG.debug("Run {} times", count);
+            return base;
+        }
+    });
+    
+    @Test
+    public void test1() {
+        Assert.assertEquals("Should have run only once", 1, count);
+    }
+
+    @Test
+    public void test2() {
+        Assert.assertEquals("Should have run only once", 1, count);
+    }
+
+    @Test
+    public void test3() {
+        Assert.assertEquals("Should have run only once", 1, count);
+    }
+
+    @Test
+    public void test4() {
+        Assert.assertEquals("Should have run only once", 1, count);
+    }
+    
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/UniquePathsTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/UniquePathsTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/UniquePathsTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/UniquePathsTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,76 @@
+/*
+ * 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.sling.testing.junit.rules.util;
+
+import org.apache.sling.testing.clients.util.UniquePaths;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.util.concurrent.atomic.AtomicLong;
+
+import static org.junit.Assert.assertEquals;
+
+public class UniquePathsTest {
+
+    @Before
+    public void setup() throws Exception {
+        // Set known startTime and counter values for tests
+        {
+            final Field f = UniquePaths.class.getDeclaredField("startTime");
+            f.setAccessible(true);
+            f.set(UniquePaths.class, 1234L);
+        }
+        {
+            final Field f = UniquePaths.class.getDeclaredField("counter");
+            f.setAccessible(true);
+            f.set(UniquePaths.class, new AtomicLong(9362L));
+        }
+    }
+    
+    @Test
+    public void testNoUPattern() {
+        assertEquals("/tmp/UniquePathsTest_1234_9363", UniquePaths.get(this, "/tmp/"));
+        assertEquals("/bar/UniquePathsTest_1234_9364", UniquePaths.get(this, "/bar/"));
+    }
+    
+    @Test
+    public void testSingleUPattern() {
+        assertEquals("/tmp/UniquePathsTest_1234_9363/foo", UniquePaths.get(this, "/tmp/_UNIQ_/foo"));
+    }
+    
+    @Test
+    public void testMultipleUPattern() {
+        assertEquals(
+                "/tmp/UniquePathsTest_1234_9363/foo/UniquePathsTest_1234_9363.html", 
+                UniquePaths.get(this, "/tmp/_UNIQ_/foo/_UNIQ_.html"));
+    }
+    
+    @Test
+    public void testNullPattern() {
+        assertEquals(
+                "UniquePathsTest_1234_9363", 
+                UniquePaths.get(this, null));
+    }
+    
+    @Test
+    public void testNoPattern() {
+        assertEquals(
+                "UniquePathsTest_1234_9363", 
+                UniquePaths.get(this));
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleAsteriskMatchTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleAsteriskMatchTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleAsteriskMatchTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleAsteriskMatchTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,66 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+@RunWith(Parameterized.class)
+public class FilterRuleAsteriskMatchTest {
+
+
+
+    private final String pattern;
+    private final String text;
+    private final boolean match;
+
+    public FilterRuleAsteriskMatchTest(String pattern, String text, boolean match) {
+        this.pattern = pattern;
+        this.text = text;
+        this.match = match;
+    }
+
+    @Parameterized.Parameters
+    public static Collection<Object[]> data() {
+        return Arrays.asList(new Object[][] {
+                {"a.b.c", "a.b.c", true},
+                {"a.b.c.*", "a.b.c.d", true},
+                {"*.c", "a.b.c", true},
+                {"*", "a.b.c.MyTest", true},
+                {"*.MyTest", "a.b.c.MyTest", true},
+                {"a.b.*.c", "a.b.x.y.c", true},
+                {"a.b.*.c.*", "a.b.x.y.c.MyTest", true},
+
+                {"a.b.*.c", "a.b.x.y.c.NotMyTest", false},
+                {"*.MyTest", "a.b.c.NotMyTest", false},
+                {"*.c", "a.b.c.d", false},
+                {"a.b.c", "x", false},
+                {"", "x", false},
+        });
+    }
+
+    @Test
+    public void testAsteriskMatch() {
+        Assert.assertEquals(this.match, IgnoreTestsConfig.asteriskMatch(this.pattern, this.text));
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleDefaultTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleDefaultTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleDefaultTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleDefaultTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,67 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.category.FailingTest;
+import org.apache.sling.testing.junit.rules.category.SlowRunningTest;
+import org.junit.*;
+import org.junit.experimental.categories.Category;
+
+@IgnoreIfProperty(name = "test.filterrule.a", value = "x")
+public class FilterRuleDefaultTest {
+    @ClassRule
+    public static FilterRule testFilterRuleClass = new FilterRule().addDefaultIgnoreCategories(FailingTest.class);
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule().addDefaultIgnoreCategories(FailingTest.class);
+
+    @BeforeClass
+    public static void beforeClass() {
+        System.out.println("BeforeClass");
+        System.clearProperty(FilterRule.CATEGORY_PROPERTY);
+        System.clearProperty(FilterRule.INCLUDE_CATEGORY_PROPERTY);
+    }
+
+    @Before
+    public void before() {
+        System.out.println("Before");
+    }
+
+    @After
+    public void after() {
+        System.out.println("After");
+    }
+
+    @Test
+    public void testWithoutShouldRun() {
+        // Should pass
+    }
+
+    @Test
+    @Category(SlowRunningTest.class)
+    public void testSingleShouldRun() {
+        // Should pass
+    }
+
+    @Test
+    @Category(FailingTest.class)
+    public void testSingleShouldSkip() {
+        Assert.fail("Test should be Ignored");
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryIgnoreIfTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryIgnoreIfTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryIgnoreIfTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryIgnoreIfTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,117 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.annotation.Issue;
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.category.FailingTest;
+import org.apache.sling.testing.junit.rules.category.SlowRunningTest;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+public class FilterRuleExcludeCategoryIgnoreIfTest {
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule();
+
+    @Rule
+    public TestName name = new TestName();
+
+    static {
+        System.setProperty(FilterRule.CATEGORY_PROPERTY, "Issue,SlowRunningTest");
+        System.setProperty("test.filterrule.a", "a");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with just
+     * the @IgnoreIf Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    public void testIgnoreIfOnly() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with
+     * @IgnoreIf and @Category which is excluded Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(Issue.class)
+    public void testIgnoreIfPropExistsandExcludedCategoryExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with
+     * @IgnoreIf and @Category which is excluded Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(SlowRunningTest.class)
+    public void testIgnoreIfPropExistsandExcludedCategoryExists_2() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with
+     * @IgnoreIf and @Category which is not excluded Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(FailingTest.class)
+    public void testIgnoreIfPropExixtsandExcludedCategoryNotExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with
+     * @Category which is excluded Result: The test is skipped
+     */
+    @Test
+    @Category(Issue.class)
+    public void testExcludedCategoryExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is annotated with
+     * @Category which is not excluded Result: The test is not skipped
+     */
+    @Test
+    @Category(FailingTest.class)
+    public void testExcludedCategoryNotExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is not annotated with
+     * @Category & @IgnoreIf Result: The test is not skipped
+     */
+    @Test
+    public void testNoAnnotationsExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleExcludeCategoryTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,104 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.annotation.Issue;
+import org.apache.sling.testing.junit.rules.category.FailingTest;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+public class FilterRuleExcludeCategoryTest {
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule();
+
+    @Rule
+    public TestName name = new TestName();
+
+    static {
+        System.setProperty(FilterRule.CATEGORY_PROPERTY, "Issue");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    /*
+     * System prop is set for excluding a category only Setup: a test is annotated with just the @IgnoreIf Result: The
+     * test is executed
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    public void testIgnoreIfOnly() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for excluding a category only Setup: a test is annotated with @IgnoreIf and @Category which
+     * is excluded Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(Issue.class)
+    public void testIgnoreIfPropExistsandExcludedCategoryExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for excluding a category only Setup: a test is annotated with @IgnoreIf and @Category which
+     * is not excluded Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(FailingTest.class)
+    public void testIgnoreIfPropExixtsandExcludedCategoryNotExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for excluding a category only Setup: a test is annotated with @Category which is excluded
+     * Result: The test is skipped
+     */
+    @Test
+    @Category(Issue.class)
+    public void testExcludedCategoryExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for excluding a category only Setup: a test is annotated with @Category which is not
+     * excluded Result: The test is executed
+     */
+    @Test
+    @Category(FailingTest.class)
+    public void testExcludedCategoryNotExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is not annotated with
+     * @Category & @IgnoreIf Result: The test is skipped
+     */
+    @Test
+    public void testNoAnnotationsExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistSkipTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistSkipTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistSkipTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistSkipTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,47 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.*;
+
+// TODO use ParallelComputer in junit and make these classes into one test?
+public class FilterRuleIgnorelistSkipTest {
+
+    @ClassRule
+    public static FilterRule classRule = new FilterRule();
+    @Rule
+    public FilterRule methodRule = new FilterRule();
+
+    static {
+        System.clearProperty(IgnoreTestsConfig.IGNORE_LIST_PROP);
+        System.setProperty(IgnoreTestsConfig.IGNORE_LIST_PROP, "*.notmypackage.*, *.FilterRuleIgnorelistSkipTest#shouldSkip:WTF-9999");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    @AfterClass
+    public static void clearIgnoreList() {
+        System.clearProperty(IgnoreTestsConfig.IGNORE_LIST_PROP);
+    }
+
+    @Test
+    public void shouldSkip() {
+        Assert.fail("Test should be skipped");
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIgnorelistTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,51 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.*;
+
+public class FilterRuleIgnorelistTest {
+
+    @ClassRule
+    public static FilterRule classRule = new FilterRule();
+    @Rule
+    public FilterRule methodRule = new FilterRule();
+
+    static {
+        System.clearProperty(IgnoreTestsConfig.IGNORE_LIST_PROP);
+        System.setProperty(IgnoreTestsConfig.IGNORE_LIST_PROP, "*.FilterRuleIgnorelistTest#shouldSkip:WTF-9999, *.notmypackage.*");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    @AfterClass
+    public static void clearIgnoreList() {
+        System.clearProperty(IgnoreTestsConfig.IGNORE_LIST_PROP);
+    }
+
+    @Test
+    public void shouldSkip() {
+        Assert.fail("Test should be skipped");
+    }
+
+    @Test
+    public void shouldPass() {
+
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryIgnoreIfTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryIgnoreIfTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryIgnoreIfTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryIgnoreIfTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,106 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.annotation.Issue;
+import org.apache.sling.testing.junit.rules.category.FailingTest;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+public class FilterRuleIncludeCategoryIgnoreIfTest {
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule();
+
+    @Rule
+    public TestName name = new TestName();
+
+    static {
+        System.setProperty(FilterRule.CATEGORY_PROPERTY, "Issue");
+        System.setProperty(FilterRule.INCLUDE_CATEGORY_PROPERTY, "");
+        System.setProperty("test.filterrule.a", "a");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is annotated with just the
+     * @IgnoreIf Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    public void testIgnoreIfOnly() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is annotated with @IgnoreIf
+     * and @Category which is included Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(Issue.class)
+    public void testIgnoreIfPropExistsandIncludedCategoryExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is annotated with @IgnoreIf
+     * and @Category which is not included Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(FailingTest.class)
+    public void testIgnoreIfPropExixtsandIncludedCategoryNotExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is annotated with @Category
+     * which is not included Result: The test is skipped
+     */
+    @Test
+    @Category(FailingTest.class)
+    public void testIncludedCategoryNotExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is annotated with @Category
+     * which is included Result: The test is executed
+     */
+    @Test
+    @Category(Issue.class)
+    public void testIncludedCategoryExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for ignoring tests and for including a category Setup: a test is not annotated with
+     * @Category & @IgnoreIf Result: The test is skipped
+     */
+    @Test
+    public void testNoAnnotationsExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleIncludeCategoryTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,117 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.annotation.Issue;
+import org.apache.sling.testing.junit.rules.category.FailingTest;
+import org.apache.sling.testing.junit.rules.category.SlowRunningTest;
+import org.apache.sling.testing.junit.rules.util.IgnoreTestsConfig;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+public class FilterRuleIncludeCategoryTest {
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule();
+
+    @Rule
+    public TestName name = new TestName();
+
+    static {
+        System.setProperty(FilterRule.CATEGORY_PROPERTY, "Issue,SlowRunningTest");
+        System.setProperty(FilterRule.INCLUDE_CATEGORY_PROPERTY, "");
+        IgnoreTestsConfig.reCreate();
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with just the @IgnoreIf Result: The
+     * test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    public void testIgnoreIfOnly() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with @IgnoreIf and @Category which
+     * is included Result: The test is executed
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(Issue.class)
+    public void testIgnoreIfPropExistsandIncludedCategoryExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with @IgnoreIf and @Category which
+     * is included Result: The test is executed
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(SlowRunningTest.class)
+    public void testIgnoreIfPropExistsandIncludedCategoryExists_2() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with @IgnoreIf and @Category which
+     * is not included Result: The test is skipped
+     */
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    @Category(FailingTest.class)
+    public void testIgnoreIfPropExixtsandIncludedCategoryNotExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with @Category which is not
+     * included Result: The test is skipped
+     */
+    @Test
+    @Category(FailingTest.class)
+    public void testIncludedCategoryNotExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    /*
+     * System prop is set for including a category only Setup: a test is annotated with @Category which is included
+     * Result: The test is executed
+     */
+    @Test
+    @Category(Issue.class)
+    public void testIncludedCategoryExists() {
+        Assert.assertTrue("Test should be Run", true);
+    }
+
+    /*
+     * System prop is set for ignoring tests and also for excluding a category Setup: a test is not annotated with
+     * @Category & @IgnoreIf Result: The test is skipped
+     */
+    @Test
+    public void testNoAnnotationsExists() {
+        Assert.fail("Test should be Ignored");
+    }
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/filterrule/FilterRuleTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,116 @@
+/*
+ * 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.sling.testing.junit.rules.util.filterrule;
+
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperty;
+import org.apache.sling.testing.junit.rules.FilterRule;
+import org.apache.sling.testing.junit.rules.annotation.IgnoreIfProperties;
+import org.junit.*;
+
+@IgnoreIfProperty(name = "test.filterrule.a", value = "x")
+public class FilterRuleTest {
+    @ClassRule
+    public static FilterRule testFilterRuleClass = new FilterRule();
+
+    @Rule
+    public FilterRule testFilterRule = new FilterRule();
+
+    @BeforeClass
+    public static void beforeClass() {
+        System.out.println("BeforeClass");
+    }
+
+    @Before
+    public void before() {
+        System.out.println("Before");
+    }
+
+    @After
+    public void after() {
+        System.out.println("After");
+    }
+
+    static {
+        System.clearProperty(FilterRule.CATEGORY_PROPERTY);
+        System.clearProperty(FilterRule.INCLUDE_CATEGORY_PROPERTY);
+
+        System.setProperty("test.filterrule.a", "a");
+        System.setProperty("test.filterrule.b", "b");
+        System.setProperty("test.filterrule.c", "");
+    }
+
+    @Test
+    public void testWithoutShouldRun() {
+        // Should pass
+    }
+
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "x")
+    public void testSingleShouldRun() {
+        // Should pass
+    }
+
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.a", value = "a")
+    public void testSingleShouldSkip() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    @Test
+    @IgnoreIfProperty(name = "test.filterrule.c")
+    public void testSingleDefaultShouldSkip() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    @Test
+    @IgnoreIfProperties({@IgnoreIfProperty(name = "test.filterrule.a", value = "a"),
+            @IgnoreIfProperty(name = "test.filterrule.noexist")})
+    public void testMultipleShouldSkip() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    @Test
+    @IgnoreIfProperties({@IgnoreIfProperty(name = "test.filterrule.noexist1", value = "a"),
+            @IgnoreIfProperty(name = "test.filterrule.noexist2")})
+    public void testMultipleShouldPass() {
+        // Should pass
+    }
+
+    @Test
+    @IgnoreIfProperties({@IgnoreIfProperty(name = "test.filterrule.noexist1", value = "a"),
+            @IgnoreIfProperty(name = "test.filterrule.noexist2")})
+    @IgnoreIfProperty(name = "test.filterrule.noexist3")
+    public void testBothShouldPass() {
+        // Should pass
+    }
+
+    @Test
+    @IgnoreIfProperties({@IgnoreIfProperty(name = "test.filterrule.noexist1", value = "a"),
+            @IgnoreIfProperty(name = "test.filterrule.c")})
+    @IgnoreIfProperty(name = "test.filterrule.noexist3")
+    public void testBothShouldSkip1() {
+        Assert.fail("Test should be Ignored");
+    }
+
+    @Test
+    @IgnoreIfProperties({@IgnoreIfProperty(name = "test.filterrule.noexist1", value = "a"),
+            @IgnoreIfProperty(name = "test.filterrule.noexist2")})
+    @IgnoreIfProperty(name = "test.filterrule.b", value = "b")
+    public void testBothShouldSkip2() {
+        Assert.fail("Test should be Ignored");
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/DebugInstanceConfig.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/DebugInstanceConfig.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/DebugInstanceConfig.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/DebugInstanceConfig.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.sling.testing.junit.rules.util.instanceconfig;
+
+import org.apache.sling.testing.clients.util.config.InstanceConfig;
+import org.apache.sling.testing.clients.util.config.InstanceConfigException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DebugInstanceConfig implements InstanceConfig {
+    private static final Logger LOG = LoggerFactory.getLogger(DebugInstanceConfig.class);
+    private int value = 0;
+
+    @Override
+    public InstanceConfig save() throws InstanceConfigException {
+        this.value = 1;
+        LOG.debug("Saved 1");
+        return this;
+    }
+
+    @Override
+    public InstanceConfig restore() throws InstanceConfigException {
+        this.value = 2;
+        LOG.debug("Restored 2");
+        return this;
+    }
+
+
+    public int getValue() {
+        return value;
+    }
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/InstanceConfigRuleTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/InstanceConfigRuleTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/InstanceConfigRuleTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/instanceconfig/InstanceConfigRuleTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,48 @@
+/*
+ * 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.sling.testing.junit.rules.util.instanceconfig;
+
+import org.apache.sling.testing.junit.rules.InstanceConfigRule;
+import org.apache.sling.testing.junit.rules.util.Action;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+
+// TODO: Use a junit processor to test this
+public class InstanceConfigRuleTest {
+    public boolean actionCalled = false;
+    
+    class DebugAction implements Action {
+        @Override
+        public void call() throws Throwable {
+            actionCalled = true;
+        }
+    }
+    
+    DebugInstanceConfig dic = new DebugInstanceConfig();
+    
+    @Rule
+    public InstanceConfigRule myInstanceConfig = new InstanceConfigRule(dic).withAction(new DebugAction());
+    
+    @Test
+    public void myTest() {
+        Assert.assertEquals("Value should be the one set on save: 1", 1, dic.getValue());
+        Assert.assertTrue(actionCalled);
+    }
+
+
+}

Added: sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/poller/AbstractPollerTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/poller/AbstractPollerTest.java?rev=1741634&view=auto
==============================================================================
--- sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/poller/AbstractPollerTest.java (added)
+++ sling/trunk/testing/junit/rules/src/test/java/org/apache/sling/testing/junit/rules/util/poller/AbstractPollerTest.java Fri Apr 29 14:04:50 2016
@@ -0,0 +1,107 @@
+/*
+ * 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.sling.testing.junit.rules.util.poller;
+
+import org.apache.sling.testing.clients.util.poller.AbstractPoller;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AbstractPollerTest {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractPollerTest.class);
+
+    @Test
+    public void testCallAndWaitSuccess() throws InterruptedException {
+        AbstractPoller poller = new AbstractPoller(100, 5) {
+            int callNumber = 0;
+
+            @Override
+            public boolean call() {
+                return true;
+            }
+
+            @Override
+            public boolean condition() {
+                callNumber += 1;
+                LOG.debug("Call nr " + callNumber);
+                if (callNumber == 4) {
+                    return true;
+                }
+                return false;
+            }
+        };
+        Assert.assertTrue(poller.callAndWait());
+    }
+
+    @Test
+    public void testCallAndWaitFailure() throws InterruptedException {
+        AbstractPoller poller = new AbstractPoller(100, 5) {
+            @Override
+            public boolean call() {
+                return true;
+            }
+
+            @Override
+            public boolean condition() {
+                return false;
+            }
+        };
+        Assert.assertFalse(poller.callAndWait());
+    }
+
+    @Test
+    public void testCallUntilSuccess() throws InterruptedException {
+        AbstractPoller poller = new AbstractPoller(100, 5) {
+            int callNumber = 0;
+
+            @Override
+            public boolean call() {
+                callNumber += 1;
+                LOG.debug("Call nr " + callNumber);
+                return true;
+            }
+
+            @Override
+            public boolean condition() {
+                if (callNumber == 4) {
+                    return true;
+                }
+                return false;
+            }
+        };
+        Assert.assertTrue(poller.callUntilCondition());
+    }
+
+    @Test
+    public void testCallUntilFailure() throws InterruptedException {
+        AbstractPoller poller = new AbstractPoller(100, 5) {
+            @Override
+            public boolean call() {
+                return true;
+            }
+
+            @Override
+            public boolean condition() {
+                return false;
+            }
+        };
+        Assert.assertFalse(poller.callUntilCondition());
+    }
+
+
+}