use of org.apache.tools.ant.Project in project exist by eXist-db.
the class XmldbTaskTest method copy.
@Test
public void copy() {
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_TEST_RESOURCE2, TEST_RESOURCE2_NAME);
buildFileRule.executeTarget("copy");
final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
assertThat(result, allOf(containsString(TEST_RESOURCE_NAME), containsString(TEST_RESOURCE2_NAME)));
}
use of org.apache.tools.ant.Project in project exist by eXist-db.
the class XmldbTaskTest method extractCreateDirectories.
@Test
public void extractCreateDirectories() throws IOException {
final Path tmpDir = temporaryFolder.newFolder().toPath();
Files.createDirectories(tmpDir);
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_DIR, tmpDir.toAbsolutePath().toString());
buildFileRule.executeTarget("extractCreateDirectories");
assertTrue(Files.exists(tmpDir));
assertTrue(Files.exists(tmpDir.resolve(TEST_RESOURCE_NAME)));
assertTrue(Files.exists(tmpDir.resolve(OTHER_TEST_COLLECTION_NAME)));
assertTrue(Files.exists(tmpDir.resolve(OTHER_TEST_COLLECTION_NAME).resolve(OTHER_TEST_RESOURCE_NAME)));
}
use of org.apache.tools.ant.Project in project exist by eXist-db.
the class XmldbTaskTest method storeEmptyFile.
@Test
public void storeEmptyFile() 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_TMP_FILE, tmpFile.toAbsolutePath().toString());
project.setProperty(PROP_ANT_TEST_DATA_TMP_FILE_NAME, FileUtils.fileName(tmpFile));
buildFileRule.executeTarget("store");
final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
assertFalse(Boolean.parseBoolean(result));
}
use of org.apache.tools.ant.Project in project exist by eXist-db.
the class XmldbTaskTest method create.
@Test
public void create() {
final Project project = buildFileRule.getProject();
project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION, TEST_COLLECTION_NAME);
project.setProperty(PROP_ANT_TEST_DATA_TEST_COLLECTION2, TEST_COLLECTION2_NAME);
project.setProperty(PROP_ANT_TEST_DATA_TEST_RESOURCE, TEST_RESOURCE_NAME);
buildFileRule.executeTarget("create");
final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
assertThat(result, containsString(TEST_COLLECTION2_NAME));
}
use of org.apache.tools.ant.Project in project exist by eXist-db.
the class FileTaskTest method chmod.
@Test
public void chmod() throws XMLDBException {
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("chmod");
final String result = project.getProperty(PROP_ANT_TEST_DATA_RESULT);
assertThat(result, containsString(TEST_RESOURCE_NAME));
final Collection col = existEmbeddedServer.getRoot().getChildCollection(TEST_COLLECTION_NAME);
final EXistResource res = (EXistResource) col.getResource(TEST_RESOURCE_NAME);
assertEquals("---rwxrwx", res.getPermissions().toString());
}
Aggregations