Package org.gradle.api.file

Examples of org.gradle.api.file.RelativePath


        assertPathContains(path, false, "one", "two");
    }

    @Test
    public void appendPath() {
        RelativePath childPath = new RelativePath(false, "one", "two").append(new RelativePath(true, "three", "four"));
        assertPathContains(childPath, true, "one", "two", "three", "four");

        childPath = new RelativePath(false, "one", "two").append(new RelativePath(true));
        assertPathContains(childPath, true, "one", "two");

        childPath = new RelativePath(false, "one", "two").plus(new RelativePath(true, "three"));
        assertPathContains(childPath, true, "one", "two", "three");
    }
View Full Code Here


        assertPathContains(childPath, true, "one", "two", "three");
    }

    @Test
    public void appendNames() {
        RelativePath childPath = new RelativePath(false, "one", "two").append(true, "three", "four");
        assertPathContains(childPath, true, "one", "two", "three", "four");

        childPath = new RelativePath(false, "one", "two").append(true);
        assertPathContains(childPath, true, "one", "two");
    }
View Full Code Here

        assertPathContains(childPath, true, "one", "two");
    }

    @Test
    public void prependNames() {
        RelativePath childPath = new RelativePath(false, "one", "two").prepend("three", "four");
        assertPathContains(childPath, false, "three", "four", "one", "two");

        childPath = new RelativePath(false, "one", "two").prepend();
        assertPathContains(childPath, false, "one", "two");
    }
View Full Code Here

        assertPathContains(childPath, false, "one", "two");
    }

    @Test
    public void hasWellBehavedEqualsAndHashCode() {
        assertThat(new RelativePath(true), strictlyEqual(new RelativePath(true)));
        assertThat(new RelativePath(true, "one"), strictlyEqual(new RelativePath(true, "one")));
        assertThat(new RelativePath(false, "one", "two"), strictlyEqual(new RelativePath(false, "one", "two")));

        assertThat(new RelativePath(true, "one"), not(equalTo(new RelativePath(true, "two"))));
        assertThat(new RelativePath(true, "one"), not(equalTo(new RelativePath(true, "one", "two"))));
        assertThat(new RelativePath(true, "one"), not(equalTo(new RelativePath(false, "one"))));
    }
View Full Code Here

        assertThat(new RelativePath(true, "one"), not(equalTo(new RelativePath(false, "one"))));
    }

    @Test
    public void canParsePathIntoRelativePath() {
        RelativePath path;

        path = RelativePath.parse(true, "one");
        assertPathContains(path, true, "one");

        path = RelativePath.parse(true, "one/two");
View Full Code Here

        assertPathContains(path, true, "one", "two");
    }

    @Test
    public void canGetParentOfPath() {
        assertThat(new RelativePath(true, "a", "b").getParent(), equalTo(new RelativePath(false, "a")));
        assertThat(new RelativePath(false, "a", "b").getParent(), equalTo(new RelativePath(false, "a")));
        assertThat(new RelativePath(false, "a").getParent(), equalTo(new RelativePath(false)));
        assertThat(new RelativePath(false).getParent(), nullValue());
    }
View Full Code Here

        assertThat(new RelativePath(false).getParent(), nullValue());
    }

    @Test
    public void canReplaceLastName() {
        assertPathContains(new RelativePath(true, "old").replaceLastName("new"), true, "new");
        assertPathContains(new RelativePath(false, "old").replaceLastName("new"), false, "new");
        assertPathContains(new RelativePath(true, "a", "b", "old").replaceLastName("new"), true, "a", "b", "new");
    }
View Full Code Here

    @Test
    public void plainCopy() {
        FileCopyAction visitor = new FileCopyAction(TestFiles.resolver(destDir));
        visit(visitor,
                file(new RelativePath(true, "rootfile.txt"), new File(destDir, "rootfile.txt")),
                file(new RelativePath(true, "subdir", "anotherfile.txt"), new File(destDir, "subdir/anotherfile.txt"))
        );
    }
View Full Code Here

    @Test
    public void transformsLastSegmentOfPath() {
        context.checking(new Expectations() {{
            allowing(details).getRelativePath();
            will(returnValue(new RelativePath(true, "a", "b")));
            one(transformer).transform("b");
            will(returnValue("c"));
            one(details).setRelativePath(new RelativePath(true, "a", "c"));
        }});

        action.execute(details);
    }
View Full Code Here

        if (segment.contains("**")) {
            PatternSet patternSet = new PatternSet();
            patternSet.include(includePattern);
            patternSet.exclude(excludeSpec);
            DirectoryFileTree fileTree = new DirectoryFileTree(baseDir, patternSet);
            fileTree.visitFrom(visitor, file, new RelativePath(file.isFile(), relativePath.toArray(new String[relativePath.size()])));
        } else if (segment.contains("*") || segment.contains("?")) {
            PatternStep step = PatternStepFactory.getStep(segment, false);
            File[] children = file.listFiles();
            if (children == null) {
                if (!file.canRead()) {
View Full Code Here

TOP

Related Classes of org.gradle.api.file.RelativePath

Copyright © 2018 www.massapicom. 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.