Search in sources :

Example 1 with ProjectHelper2

use of org.apache.tools.ant.helper.ProjectHelper2 in project ant by apache.

the class ProjectHelperRepositoryTest method testFind.

@Test
public void testFind() {
    ProjectHelperRepository repo = ProjectHelperRepository.getInstance();
    repo.registerProjectHelper(SomeHelper.class);
    Resource r = new FileResource(new File("test.xml"));
    ProjectHelper helper = repo.getProjectHelperForBuildFile(r);
    assertTrue(helper instanceof ProjectHelper2);
    helper = repo.getProjectHelperForAntlib(r);
    assertTrue(helper instanceof ProjectHelper2);
    r = new FileResource(new File("test.myext"));
    helper = repo.getProjectHelperForBuildFile(r);
    assertTrue(helper instanceof SomeHelper);
    helper = repo.getProjectHelperForAntlib(r);
    assertTrue(helper instanceof SomeHelper);
    r = new StringResource("test.myext");
    helper = repo.getProjectHelperForBuildFile(r);
    assertTrue(helper instanceof ProjectHelper2);
    helper = repo.getProjectHelperForAntlib(r);
    assertTrue(helper instanceof ProjectHelper2);
    r = new StringResource("test.other");
    helper = repo.getProjectHelperForBuildFile(r);
    assertTrue(helper instanceof ProjectHelper2);
    helper = repo.getProjectHelperForAntlib(r);
    assertTrue(helper instanceof ProjectHelper2);
}
Also used : ProjectHelper2(org.apache.tools.ant.helper.ProjectHelper2) StringResource(org.apache.tools.ant.types.resources.StringResource) Resource(org.apache.tools.ant.types.Resource) StringResource(org.apache.tools.ant.types.resources.StringResource) FileResource(org.apache.tools.ant.types.resources.FileResource) FileResource(org.apache.tools.ant.types.resources.FileResource) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 ProjectHelper2 (org.apache.tools.ant.helper.ProjectHelper2)1 Resource (org.apache.tools.ant.types.Resource)1 FileResource (org.apache.tools.ant.types.resources.FileResource)1 StringResource (org.apache.tools.ant.types.resources.StringResource)1 Test (org.junit.Test)1