Examples of RelativePath


Examples of org.gradle.api.file.RelativePath

        assertFalse(matcher.isSatisfiedBy(path));
    }

    @Test public void testWildcardInName() {
        Spec<RelativePath> matcher;
        RelativePath path;

        matcher = new NameOnlyPatternMatcher(true, true, "*.jsp");
        path = new RelativePath(true, "fred.jsp");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "fred.java");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

    public void initialRelativePathForFileIsSpecPathPlusFilePath() {
        FileCopyDetails copyDetails = expectActionExecutedWhenFileVisited();

        context.checking(new Expectations(){{
            allowing(spec).getDestPath();
            will(returnValue(new RelativePath(false, "spec")));
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(true, "file")));
        }});

        assertThat(copyDetails.getRelativePath(), equalTo(new RelativePath(true, "spec", "file")));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

    public void relativePathForDirIsSpecPathPlusFilePath() {
        FileVisitDetails visitDetails = expectSpecAndDirVisited();

        context.checking(new Expectations(){{
            allowing(spec).getDestPath();
            will(returnValue(new RelativePath(false, "spec")));
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(false, "dir")));
        }});

        assertThat(visitDetails.getRelativePath(), equalTo(new RelativePath(false, "spec", "dir")));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

    @Test
    public void copyActionCanChangeFileDestinationPath() {
        FileCopyDetails copyDetails = expectActionExecutedWhenFileVisited();

        RelativePath newPath = new RelativePath(true, "new");
        copyDetails.setRelativePath(newPath);
        assertThat(copyDetails.getRelativePath(), equalTo(newPath));

        copyDetails.setPath("/a/b");
        assertThat(copyDetails.getRelativePath(), equalTo(new RelativePath(true, "a", "b")));

        copyDetails.setName("new name");
        assertThat(copyDetails.getRelativePath(), equalTo(new RelativePath(true, "a", "new name")));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

        DefaultPatternMatcher matcher = new DefaultPatternMatcher(true, true);
        List<PatternStep> steps = matcher.getStepsForTest();
        assertEquals(0, steps.size());

        // both empty
        RelativePath path = new RelativePath(true);
        assertTrue(matcher.isSatisfiedBy(path));

        // empty matcher, non-empty path
        path = new RelativePath(true, "a");
        assertFalse(matcher.isSatisfiedBy(path));

        // non-empty matcher, empty path
        matcher = new DefaultPatternMatcher(true, true, "a");
        path = new RelativePath(true);
        assertFalse(matcher.isSatisfiedBy(path));

    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

    }

    @Test public void testLiterals() {
        matcher = new DefaultPatternMatcher(true, true, "a");
        path = new RelativePath(true, "a");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "b");
        assertFalse(matcher.isSatisfiedBy(path));
       
        matcher = new DefaultPatternMatcher(true, true, "a", "b");
        path = new RelativePath(true, "a", "b");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "c");
        assertFalse(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "b", "c");
        assertFalse(matcher.isSatisfiedBy(path));

        // short path
        path = new RelativePath(true, "a");
        assertFalse(matcher.isSatisfiedBy(path));

        // long path
        path = new RelativePath(true, "a", "b", "c");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

        assertFalse(matcher.isSatisfiedBy(path));
    }

    @Test public void testPartials() {
        matcher = new DefaultPatternMatcher(true, true, "a", "b", "c");
        path = new RelativePath(false, "a", "b");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "b");
        assertFalse(matcher.isSatisfiedBy(path));

        matcher = new DefaultPatternMatcher(false, true, "a", "b", "c");
        path = new RelativePath(false, "a", "b");
        assertFalse(matcher.isSatisfiedBy(path));

    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

    }

    @Test public void testWildCards() {
        matcher = new DefaultPatternMatcher(true, true, "*");
        path = new RelativePath(true, "anything");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "anything", "b");
        assertFalse(matcher.isSatisfiedBy(path));

        matcher = new DefaultPatternMatcher(true, true, "any??ing");
        path = new RelativePath(true, "anything");
        assertTrue(matcher.isSatisfiedBy(path));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

        assertTrue(matcher.isSatisfiedBy(path));
    }

    @Test public void testGreedy() {
        matcher = new DefaultPatternMatcher(true, true, "a","**");
        path = new RelativePath(true, "a", "b", "c");
        assertTrue(matcher.isSatisfiedBy(path));

        //leading greedy
        matcher = new DefaultPatternMatcher(true, true, "**", "c");
        path = new RelativePath(true, "a", "b", "c");
        assertTrue(matcher.isSatisfiedBy(path));
       
        path = new RelativePath(true, "a", "b", "d");
        assertFalse(matcher.isSatisfiedBy(path));

        // inner greedy
        matcher = new DefaultPatternMatcher(true, true, "a", "**", "c");
        path = new RelativePath(true, "a", "b", "c");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "aa", "bb", "c");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(false, "a", "aa", "bb", "d");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "aa", "bb", "d");
        assertFalse(matcher.isSatisfiedBy(path));

        // fake trail
        matcher = new DefaultPatternMatcher(true, true, "a", "**", "c", "d");
        path = new RelativePath(true, "a", "b", "c", "e", "c", "d");
        assertTrue(matcher.isSatisfiedBy(path));
       
        // multiple greedies
        matcher = new DefaultPatternMatcher(true, true, "a", "**", "c", "**", "e");
        path = new RelativePath(true, "a", "b", "c", "d", "e");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "b", "bb", "c", "d", "e");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "q", "bb", "c", "d", "c", "d", "e");
        assertTrue(matcher.isSatisfiedBy(path));

        // Missing greedy
        matcher = new DefaultPatternMatcher(true, true, "a", "**", "c");
        path = new RelativePath(true, "a", "c");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "a", "d");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here

Examples of org.gradle.api.file.RelativePath

        assertFalse(matcher.isSatisfiedBy(path));
    }

    @Test public void testTypical() {
        matcher = new DefaultPatternMatcher(true, true, "**", "CVS", "*");
        path = new RelativePath(true, "CVS", "Repository");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "org", "gradle", "CVS", "Entries");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "org", "gradle", "CVS", "foo", "bar", "Entries");
        assertFalse(matcher.isSatisfiedBy(path));

        matcher = new DefaultPatternMatcher(true, true, "src", "main", "**");
        path = new RelativePath(true, "src", "main", "groovy", "org");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "src", "test", "groovy", "org");
        assertFalse(matcher.isSatisfiedBy(path));

        matcher = new DefaultPatternMatcher(true, true, "**", "test", "**");
        // below fails, trailing ** not ignored
        path = new RelativePath(true, "src", "main", "test");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "src", "test", "main");
        assertTrue(matcher.isSatisfiedBy(path));

        path = new RelativePath(true, "src", "main", "fred");
        assertFalse(matcher.isSatisfiedBy(path));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.