Java Code Examples for org.apache.tools.ant.Project#setBasedir()

The following examples show how to use org.apache.tools.ant.Project#setBasedir() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskModelTest.java    From testability-explorer with Apache License 2.0 5 votes vote down vote up
public void testGetClassPath() throws Exception {
  Project proj = new Project();
  Path p = new Path(proj);

  proj.setBasedir(".");
  p.setLocation(new File("src-test/com/google/ant"));

  model.addClasspath(p);
  Matcher matcher = Pattern.compile("src-test.com.google.ant").matcher(model.getClassPath());
  assertTrue(matcher.find());
}
 
Example 2
Source File: IvyTaskTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultSettings() throws MalformedURLException {
    Project p = TestHelper.newProject();
    p.setBasedir("test/repositories");
    p.setProperty("myproperty", "myvalue");
    IvyTask task = new IvyTask() {
        public void doExecute() throws BuildException {
        }
    };
    task.setProject(p);

    Ivy ivy = task.getIvyInstance();
    assertNotNull(ivy);
    IvySettings settings = ivy.getSettings();
    assertNotNull(settings);

    assertEquals(new File("test/repositories/build/cache").getAbsoluteFile(),
        settings.getDefaultCache());
    // The next test doesn't always works on windows (mix C: and c: drive)
    assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(),
        new File(settings.getVariables().getVariable("ivy.settings.file")).getAbsolutePath()
                .toUpperCase());
    assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm()
            .toUpperCase(), settings.getVariables().getVariable("ivy.settings.url")
            .toUpperCase());
    assertEquals(new File("test/repositories").getAbsolutePath().toUpperCase(), settings
            .getVariables().getVariable("ivy.settings.dir").toUpperCase());
    assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
}
 
Example 3
Source File: IvyTaskTest.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
@Test
public void testIvyVersionAsAntProperty() {
    Project p = TestHelper.newProject();
    p.setBasedir("test/repositories");
    IvyTask task = new IvyTask() {
        public void doExecute() throws BuildException {
        }
    };
    task.setProject(p);
    task.execute();

    assertNotNull(p.getProperty("ivy.version"));
}