Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.Reference


        IvyTask task = new IvyTask() {
            public void doExecute() throws BuildException {
            }
        };
        task.setProject(p);
        task.setSettingsRef(new Reference("mySettings"));
        Ivy ivy = task.getIvyInstance();
        assertNotNull(ivy);
        IvySettings settings = ivy.getSettings();
        assertNotNull(settings);
View Full Code Here


            }
        };
        task.setProject(project);
        task.init();

        Reference ref = new Reference(configure.getSettingsId());
        // ref.setProject(project);
        task.setSettingsRef(ref);
        return task.getIvyInstance();
    }
View Full Code Here

        project.getReference("ref");
        prCtrl.setReturnValue(set1, 2);
       
       
        EnvSet set2 = new EnvSet();
        set2.setRefid(new Reference(null, "ref"));
        prCtrl.replay();
       
        try {
            set2.addEnv(new EnvironmentVariable("spam", "eggs"));
            fail("Expected BuildException");
View Full Code Here

        project.getReference("ref");
        prCtrl.setReturnValue(new Object(), 2);
       
       
        EnvSet set = new EnvSet();
        set.setRefid(new Reference(null, "ref"));
        prCtrl.replay();
       
        try {
            set.getVariables(project);
            fail("Expected BuildException");
View Full Code Here

        EnvSet set1 = new EnvSet();
        EnvironmentVariable var = new EnvironmentVariable("foo", "bar");
        set1.addEnv(var);

        EnvSet set2 = new EnvSet();
        set2.setRefid(new Reference(null, "ref"));
        try {
            set2.addConfiguredEnvset(set1);
            fail("Expected BuildException");
        } catch (BuildException be) {
            // reference mustn't have child elements
View Full Code Here

    @Test
    public void testEmptyElementWithReference() {
        ResourceList rl = new ResourceList();
        rl.setEncoding("foo");
        try {
            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
            fail("Can add reference to ResourceList with encoding attribute set.");
        } catch (BuildException be) {
            assertEquals("You must not specify more than one attribute when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
        try {
            rl.setEncoding("foo");
            fail("Can set encoding in ResourceList that is a reference");
        } catch (BuildException be) {
            assertEquals("You must not specify more than one attribute when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.add(new FileResource(buildRule.getProject(), "."));
        try {
            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
            fail("Can add reference to ResourceList with nested resource collection.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
        try {
            rl.add(new FileResource(buildRule.getProject(), "."));
            fail("Can add reference to ResourceList with nested resource collection.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.addFilterChain(new FilterChain());
        try {
            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
            fail("Can add reference to ResourceList with nested filter chain.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
                         be.getMessage());
        }

        rl = new ResourceList();
        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
        try {
            rl.addFilterChain(new FilterChain());
            fail("Can add reference to ResourceList with nested filter chain.");
        } catch (BuildException be) {
            assertEquals("You must not specify nested elements when using refid",
View Full Code Here

    @Test
    public void testCircularReference() throws Exception {
        ResourceList rl1 = new ResourceList();
        rl1.setProject(buildRule.getProject());
        rl1.setRefid(new Reference(buildRule.getProject(), "foo"));

        ResourceList rl2 = new ResourceList();
        rl2.setProject(buildRule.getProject());
        buildRule.getProject().addReference("foo", rl2);
View Full Code Here

    public void testEmptyElementIfIsReferenceAdditionalAttributes() {
        MultiRootFileSet f = new MultiRootFileSet();
        f.setProject(getProject());
        f.setBaseDirs("a");
        try {
            f.setRefid(new Reference(getProject(), "dummyref"));
            fail("Can add reference to multirootfileset "
                 + " with elements from setBasedirs");
        } catch (BuildException be) {
            assertEquals("You must not specify more than one attribute "
                         + "when using refid", be.getMessage());
        }
        f = new MultiRootFileSet();
        f.addConfiguredBaseDir(new FileResource(new File(".")));
        try {
            f.setRefid(new Reference(getProject(), "dummyref"));
            fail("Can add reference to multirootfileset"
                 + " with elements from addConfiguredBaseDir");
        } catch (BuildException be) {
            assertEquals("You must not specify more than one attribute "
                         + "when using refid", be.getMessage());
        }

        f = new MultiRootFileSet();
        f.setRefid(new Reference(getProject(), "dummyref"));
        try {
            f.setBaseDirs("a");
            fail("Can set basedirs in multirootfileset"
                 + " that is a reference.");
        } catch (BuildException be) {
View Full Code Here

        IvyTask task = new IvyTask() {
            public void doExecute() throws BuildException {
            }
        };
        task.setProject(p);
        task.setSettingsRef(new Reference(p, "mySettings"));
        Ivy ivy = task.getIvyInstance();
        assertNotNull(ivy);
        IvySettings settings = ivy.getSettings();
        assertNotNull(settings);
View Full Code Here

            return getRef().getClasspath();
        }
        if (classpath == null) {
            if (getClasspathref() != null) {
                final Path ref = new Path(getProject());
                ref.setRefid(new Reference(getProject(), getClasspathref()));
                return ref;
            }
        } else if (StringUtils.isNotBlank(getClasspathref())) {
            throw new BuildException("Only one of classpathref|classpath is permitted.");
        }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.Reference

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.