Package org.gradle.util

Examples of org.gradle.util.TestFile$Snapshot


        destDir.assertHasDescendants("included.txt");
    }

    @Test
    public void doesNotDeleteDestDirectoryWhenNothingCopied() {
        TestFile destDir = tmpDir.createDir("dest");
        destDir.file("extra.txt").createFile();
        destDir.file("extra/extra.txt").createFile();

        visitor.startVisit(action(destDir));
        visitor.endVisit();

        destDir.assertHasDescendants();
    }
View Full Code Here


        }
    }

    @Test
    public void wrapsFailureToAddElement() {
        final TestFile tarFile = tmpDir.getDir().file("test.tar");

        context.checking(new Expectations(){{
            allowing(copyAction).getArchivePath();
            will(returnValue(tarFile));
View Full Code Here

        assertTrue(visitor.getDidWork());
    }

    @Test
    public void didWorkWhenFilesDeleted() {
        TestFile destDir = tmpDir.createDir("dest");
        destDir.file("extra.txt").createFile();

        visitor.startVisit(action(destDir));
        visitor.endVisit();

        assertTrue(visitor.getDidWork());
View Full Code Here

        wrapper = createTask(Wrapper.class);
        wrapperScriptGeneratorMock = context.mock(WrapperScriptGenerator.class);
        wrapper.setScriptDestinationPath("scriptDestination");
        wrapper.setGradleVersion("1.0");
        targetWrapperJarPath = "jarPath";
        expectedTargetWrapperJar = new TestFile(getProject().getProjectDir(),
                targetWrapperJarPath + "/" + Wrapper.WRAPPER_JAR);
        expectedTargetWrapperProperties = new File(getProject().getProjectDir(),
                targetWrapperJarPath + "/" + Wrapper.WRAPPER_PROPERTIES);
        new File(getProject().getProjectDir(), targetWrapperJarPath).mkdirs();
        distributionPath = "somepath";
View Full Code Here

                        targetWrapperJarPath + "/" + Wrapper.WRAPPER_PROPERTIES,
                        new File(getProject().getProjectDir(), wrapper.getScriptDestinationPath()));
            }
        });
        wrapper.execute();
        TestFile unjarDir = tmpDir.createDir("unjar");
        expectedTargetWrapperJar.unzipTo(unjarDir);
        unjarDir.file(GradleWrapperMain.class.getName().replace(".", "/") + ".class").assertIsFile();
        Properties properties = GUtil.loadProperties(expectedTargetWrapperProperties);
        assertEquals(properties.getProperty(Wrapper.URL_ROOT_PROPERTY), wrapper.getUrlRoot());
        assertEquals(properties.getProperty(Wrapper.DISTRIBUTION_BASE_PROPERTY), wrapper.getDistributionBase().toString());
        assertEquals(properties.getProperty(Wrapper.DISTRIBUTION_PATH_PROPERTY), wrapper.getDistributionPath());
        assertEquals(properties.getProperty(Wrapper.DISTRIBUTION_NAME_PROPERTY), wrapper.getArchiveName());
View Full Code Here

import java.io.IOException;

public class SettingsScriptErrorIntegrationTest extends AbstractIntegrationTest {
    @Test
    public void reportsSettingsScriptEvaluationFailsWithRuntimeException() throws IOException {
        TestFile buildFile = testFile("some build.gradle");
        TestFile settingsFile = testFile("some settings.gradle");
        settingsFile.writelns("", "", "throw new RuntimeException('<failure message>')");

        ExecutionFailure failure = usingBuildFile(buildFile).usingSettingsFile(settingsFile).withTasks("do-stuff")
                .runWithFailure();

        failure.assertHasFileName(String.format("Settings file '%s'", settingsFile));
View Full Code Here

    /**
     * Copies the given resource to the test directory.
     */
    public void maybeCopy(String resource) {
        TestFile dir = resources.findResource(resource);
        if (dir != null) {
            logger.debug("Copying test resource '{}' from {} to test directory.", resource, dir);
            dir.copyTo(getDir());
        } else {
            logger.debug("Test resource '{}' not found, skipping.", resource);
        }
    }
View Full Code Here

TOP

Related Classes of org.gradle.util.TestFile$Snapshot

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.