Package org.gradle.api.file

Examples of org.gradle.api.file.FileVisitDetails


    private void maybeVisit(RelativePath path) {
        if (path == null || path.getParent() == null || !visitedDirs.add(path)) {
            return;
        }
        maybeVisit(path.getParent());
        FileVisitDetails dir = pendingDirs.remove(path);
        if (dir == null) {
            dir = new FileVisitDetailsImpl(path);
        }
        getVisitor().visitDir(dir);
    }
View Full Code Here


        assertThat(copyDetails.getRelativePath(), equalTo(new RelativePath(true, "spec", "file")));
    }
   
    @Test
    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

        assertThat(mappedDetails.getSize(), equalTo(15L));
    }

    @Test
    public void wrappedFileElementDelegatesToSourceForRemainingMethods() {
        final FileVisitDetails mappedDetails = expectSpecAndFileVisited();
        final File file = new File("file");

        context.checking(new Expectations() {{
            one(details).getFile();
            will(returnValue(file));
        }});

        assertThat(mappedDetails.getFile(), sameInstance(file));
    }
View Full Code Here

        }});
        return action;
    }

    private FileVisitDetails file(final RelativePath relativePath) {
        final FileVisitDetails details = context.mock(FileVisitDetails.class, relativePath.getPathString());
        context.checking(new Expectations(){{
            allowing(details).getRelativePath();
            will(returnValue(relativePath));
        }});
        return details;
View Full Code Here

        }});
        return details;
    }

    private FileVisitDetails file(final RelativePath relativePath, final File targetFile) {
        final FileVisitDetails details = file(relativePath);
        context.checking(new Expectations(){{
            one(details).copyTo(targetFile);
        }});
        return details;
    }
View Full Code Here

            public void describeTo(Description description) {
                description.appendText("stop visiting");
            }

            public Object invoke(Invocation invocation) throws Throwable {
                FileVisitDetails details = (FileVisitDetails) invocation.getParameter(0);
                details.stopVisiting();
                return null;
            }
        };
    }
View Full Code Here

    // test excludes, includes

    private Matcher<FileVisitDetails> file(final MockFile file) {
        return new BaseMatcher<FileVisitDetails>() {
            public boolean matches(Object o) {
                FileVisitDetails details = (FileVisitDetails) o;
                return details.getFile().equals(file.getMock()) && details.getRelativePath().equals(file.getRelativePath());
            }

            public void describeTo(Description description) {
                description.appendText("details match file ").appendValue(file.getMock()).appendText(" with path ")
                        .appendValue(file.getRelativePath());
View Full Code Here

            assertThat(e.getCause(), sameInstance(failure));
        }
    }

    private FileVisitDetails file(final String path) {
        final FileVisitDetails details = context.mock(FileVisitDetails.class, path);

        context.checking(new Expectations() {{
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(true, path)));
View Full Code Here

        return details;
    }

    private FileVisitDetails dir(final String path) {
        final FileVisitDetails details = context.mock(FileVisitDetails.class, path);

        context.checking(new Expectations() {{
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(false, path)));
View Full Code Here

        return details;
    }

    private FileVisitDetails brokenFile(final String path, final Throwable failure) {
        final FileVisitDetails details = context.mock(FileVisitDetails.class, String.format("[%s]", path));

        context.checking(new Expectations() {{
            allowing(details).getRelativePath();
            will(returnValue(RelativePath.parse(true, path)));
View Full Code Here

TOP

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

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.