Package org.gradle.test.fixtures.file

Examples of org.gradle.test.fixtures.file.TestFile


    @Before
    public void setUp() {
        wrapper = createTask(Wrapper.class);
        wrapper.setGradleVersion("1.0");
        targetWrapperJarPath = "gradle/wrapper";
        expectedTargetWrapperJar = new TestFile(getProject().getProjectDir(),
                targetWrapperJarPath + "/gradle-wrapper.jar");
        expectedTargetWrapperProperties = new File(getProject().getProjectDir(),
                targetWrapperJarPath + "/gradle-wrapper.properties");
        new File(getProject().getProjectDir(), targetWrapperJarPath).mkdirs();
        wrapper.setDistributionPath("somepath");
View Full Code Here


        checkExecute();
    }

    private void checkExecute() throws IOException {
        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(WrapperExecutor.DISTRIBUTION_URL_PROPERTY), wrapper.getDistributionUrl());
        assertEquals(properties.getProperty(WrapperExecutor.DISTRIBUTION_BASE_PROPERTY), wrapper.getDistributionBase().toString());
        assertEquals(properties.getProperty(WrapperExecutor.DISTRIBUTION_PATH_PROPERTY), wrapper.getDistributionPath());
        assertEquals(properties.getProperty(WrapperExecutor.ZIP_STORE_BASE_PROPERTY), wrapper.getArchiveBase().toString());
View Full Code Here

    private TarCopyAction action;


    @Test
    public void createsTarFile() {
        final TestFile tarFile = initializeTarFile(tmpDir.getTestDirectory().file("test.tar"),
                new SimpleCompressor());
        tarAndUntarAndCheckFileContents(tarFile);
    }
View Full Code Here

    }

    private void tarAndUntarAndCheckFileContents(TestFile tarFile) {
        tar(file("dir/file1"), file("file2"));

        TestFile expandDir = tmpDir.getTestDirectory().file("expanded");
        tarFile.untarTo(expandDir);
        expandDir.file("dir/file1").assertContents(equalTo("contents of dir/file1"));
        expandDir.file("file2").assertContents(equalTo("contents of file2"));
    }
View Full Code Here

        expandDir.file("file2").assertContents(equalTo("contents of file2"));
    }

    @Test
    public void createsGzipCompressedTarFile() {
        final TestFile tarFile = initializeTarFile(tmpDir.getTestDirectory().file("test.tgz"),
                GzipArchiver.getCompressor());
        tarAndUntarAndCheckFileContents(tarFile);
    }
View Full Code Here

        tarAndUntarAndCheckFileContents(tarFile);
    }

    @Test
    public void createsBzip2CompressedTarFile() {
        final TestFile tarFile = initializeTarFile(tmpDir.getTestDirectory().file("test.tbz2"),
                Bzip2Archiver.getCompressor());
        tarAndUntarAndCheckFileContents(tarFile);
    }
View Full Code Here

        tarAndUntarAndCheckFileContents(tarFile);
    }

    @Test
    public void tarFileContainsExpectedPermissions() {
        final TestFile tarFile = initializeTarFile(tmpDir.getTestDirectory().file("test.tar"),
                new SimpleCompressor());

        tar(dir("dir"), file("file"));

        Map<String, Integer> expected = new HashMap<String, Integer>();
View Full Code Here

                expected);
    }

    @Test
    public void wrapsFailureToOpenOutputFile() {
        final TestFile tarFile = initializeTarFile(tmpDir.createDir("test.tar"),
                new SimpleCompressor());

        try {
            action.execute(new CopyActionProcessingStream() {
                public void process(CopyActionProcessingStreamAction action) {
View Full Code Here

        }
    }

    @Test
    public void wrapsFailureToAddElement() {
        final TestFile tarFile = initializeTarFile(tmpDir.getTestDirectory().file("test.tar"),
                new SimpleCompressor());

        Throwable failure = new RuntimeException("broken");
        try {
            visit(action, brokenFile("dir/file1", failure));
View Full Code Here

        assertSetContainsForAllTypes(tree, toList("subdir/file1.txt", "subdir2/file2.txt"));
    }

    @Test
    public void readsGzippedTarFile() {
        TestFile tgz = tmpDir.getTestDirectory().file("test.tgz");

        rootDir.file("subdir/file1.txt").write("content");
        rootDir.file("subdir2/file2.txt").write("content");
        rootDir.tgzTo(tgz);
View Full Code Here

TOP

Related Classes of org.gradle.test.fixtures.file.TestFile

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.