Search in sources :

Example 91 with Project

use of org.apache.tools.ant.Project in project exist by eXist-db.

the class ServerTaskTest method backupRestore.

@Test
public void backupRestore() throws IOException {
    final Project project = buildFileRule.getProject();
    final Path backupDir = temporaryFolder.newFolder().toPath();
    project.setProperty(PROP_ANT_TEST_DATA_BACKUP_DIR, backupDir.toAbsolutePath().toString());
    buildFileRule.executeTarget("backup");
    buildFileRule.executeTarget("restore");
}
Also used : Path(java.nio.file.Path) Project(org.apache.tools.ant.Project) Test(org.junit.Test)

Example 92 with Project

use of org.apache.tools.ant.Project in project exist by eXist-db.

the class XmldbTaskTest method extract.

@Test
public void extract() throws IOException {
    final Path tmpFile = temporaryFolder.newFile().toPath();
    final Project project = buildFileRule.getProject();
    project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION, TEST_COLLECTION_NAME);
    project.setProperty(PROP_ANT_TEST_DATA_TEST_RESOURCE, TEST_RESOURCE_NAME);
    project.setProperty(PROP_ANT_TEST_DATA_TMP_FILE, tmpFile.toAbsolutePath().toString());
    buildFileRule.executeTarget("extract");
    assertTrue(Files.exists(tmpFile));
}
Also used : Path(java.nio.file.Path) Project(org.apache.tools.ant.Project) Test(org.junit.Test)

Example 93 with Project

use of org.apache.tools.ant.Project in project exist by eXist-db.

the class XmldbTaskTest method xpath.

@Test
public void xpath() {
    final Project project = buildFileRule.getProject();
    project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION, TEST_COLLECTION_NAME);
    buildFileRule.executeTarget("xpath");
    final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
    assertEquals("world", result.trim());
}
Also used : Project(org.apache.tools.ant.Project) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 94 with Project

use of org.apache.tools.ant.Project in project exist by eXist-db.

the class XmldbTaskTest method exists.

@Test
public void exists() {
    final Project project = buildFileRule.getProject();
    project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION, TEST_COLLECTION_NAME);
    project.setProperty(PROP_ANT_TEST_DATA_TEST_RESOURCE, TEST_RESOURCE_NAME);
    buildFileRule.executeTarget("exists");
    final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
    assertTrue(Boolean.parseBoolean(result));
}
Also used : Project(org.apache.tools.ant.Project) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 95 with Project

use of org.apache.tools.ant.Project in project exist by eXist-db.

the class XmldbTaskTest method list.

@Test
public void list() {
    final Project project = buildFileRule.getProject();
    project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION, TEST_COLLECTION_NAME);
    buildFileRule.executeTarget("list");
    final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
    assertThat(result, allOf(containsString(TEST_RESOURCE_NAME), containsString(BIN_TEST_RESOURCE_NAME)));
}
Also used : Project(org.apache.tools.ant.Project) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Aggregations

Project (org.apache.tools.ant.Project)331 File (java.io.File)125 Test (org.junit.Test)107 BuildException (org.apache.tools.ant.BuildException)66 Path (org.apache.tools.ant.types.Path)44 IOException (java.io.IOException)38 Before (org.junit.Before)36 FileSet (org.apache.tools.ant.types.FileSet)24 Commandline (org.apache.tools.ant.types.Commandline)22 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)16 Path (java.nio.file.Path)14 DefaultLogger (org.apache.tools.ant.DefaultLogger)14 Test (org.junit.jupiter.api.Test)14 Matchers.containsString (org.hamcrest.Matchers.containsString)13 ZipFile (java.util.zip.ZipFile)12 DirectoryScanner (org.apache.tools.ant.DirectoryScanner)12 Delete (org.apache.tools.ant.taskdefs.Delete)12 Properties (java.util.Properties)9 ProjectHelper (org.apache.tools.ant.ProjectHelper)9 ArrayList (java.util.ArrayList)8