当前位置: 首页>>代码示例>>Java>>正文


Java Reference类代码示例

本文整理汇总了Java中org.apache.tools.ant.types.Reference的典型用法代码示例。如果您正苦于以下问题:Java Reference类的具体用法?Java Reference怎么用?Java Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Reference类属于org.apache.tools.ant.types包,在下文中一共展示了Reference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSetClasspathRef1

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/** This test is created to satisfy pitest, it is hard to emulate Reference by Id. */
@Test
public void testSetClasspathRef1() {
    final CheckstyleAntTask antTask = new CheckstyleAntTask();
    final Project project = new Project();
    antTask.setClasspath(new Path(project, "firstPath"));
    antTask.setClasspathRef(new Reference(project, "idXX"));

    try {
        assertNotNull("Classpath should not be null",
                Whitebox.getInternalState(antTask, "classpath"));
        final Path classpath = (Path) Whitebox.getInternalState(antTask, "classpath");
        classpath.list();
        fail("Exception is expected");
    }
    catch (BuildException ex) {
        assertEquals("unexpected exception message",
                "Reference idXX not found.", ex.getMessage());
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:21,代码来源:CheckstyleAntTaskTest.java

示例2: testExtendsLinkerArgsViaReference

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Verify linkerarg's that appear in the base linker are effective when 
 * creating the command line for a linker that extends it, even if the 
 * linker is brought in through a reference.
 */
public void testExtendsLinkerArgsViaReference() {
  Project project = new Project();
  LinkerDef baseLinker = new LinkerDef();
  baseLinker.setProject(project);
  baseLinker.setId("base");
  project.addReference("base", baseLinker);
  LinkerArgument linkerArg = new LinkerArgument();
  linkerArg.setValue("/base");
  baseLinker.addConfiguredLinkerArg(linkerArg);

  LinkerDef extendedLinker = (LinkerDef) createExtendedProcessorDef(
      baseLinker);
  extendedLinker.setProject(project);
  extendedLinker.setId("extended");
  project.addReference("extended", extendedLinker);

  LinkerDef linkerRef = new LinkerDef();
  linkerRef.setProject(project);
  linkerRef.setRefid(new Reference(project, "extended"));
  String[] preArgs = getPreArguments(linkerRef);
  assertEquals(1, preArgs.length);
  assertEquals("/base", preArgs[0]);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:29,代码来源:TestLinkerDef.java

示例3: testCircularReference

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
@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);

    Union u = new Union();
    u.add(rl1);
    u.setProject(buildRule.getProject());

    rl2.add(u);

    try {
        rl2.size();
        fail("Can make ResourceList a Reference to itself.");
    } catch (BuildException be) {
        assertEquals("This data type contains a circular reference.",
                     be.getMessage());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:25,代码来源:ResourceListTest.java

示例4: loadCachePath

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Utilitary method to load cachepath
 * 
 * @param organisation
 *            organisation name
 * @param module
 *            module name
 * @param revision
 *            revision number
 * @param conf
 *            configuration name
 * @param ivyRef
 *            ivy instance reference
 */
protected void loadCachePath(String organisation, String module, String revision, String conf, Reference ivyRef) {
    log("Building classpath (" + getPathid() + ")" + " with " + organisation + "#" + module + ";" + revision + " conf=" + conf, Project.MSG_DEBUG);
    IvyCachePath pluginCachePath = new IvyCachePath();
    pluginCachePath.setOrganisation(organisation);
    pluginCachePath.setModule(module);
    pluginCachePath.setRevision(revision);
    pluginCachePath.setConf(conf);
    pluginCachePath.setPathid(getPathid());
    pluginCachePath.setLog(LogOptions.LOG_DOWNLOAD_ONLY);
    pluginCachePath.setInline(true);

    pluginCachePath.setSettingsRef(ivyRef);
    initTask(pluginCachePath).execute();

}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:30,代码来源:AbstractFindClassPathStrategy.java

示例5: testSetClasspathRef

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
@Test
public void testSetClasspathRef() {
    final CheckstyleAntTask antTask = new CheckstyleAntTask();
    antTask.setClasspathRef(new Reference(new Project(), "id"));

    assertNotNull("Classpath should not be null",
        Whitebox.getInternalState(antTask, "classpath"));
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:CheckstyleAntTaskTest.java

示例6: merge

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Returns a VersionInfo that reflects any inherited version information.
 * @return merged version information.
 */
public VersionInfo merge() {
    if (isReference()) {
        VersionInfo refVersion = (VersionInfo)
                            getCheckedRef(VersionInfo.class,
                "VersionInfo");
        return refVersion.merge();
    }
        Reference currentRef = this.getExtends();
        if (currentRef == null) {
                return this;
        }
        Vector stack = new Vector(5);
        stack.addElement(this);
        while (currentRef != null) {
        Object obj = currentRef.getReferencedObject(getProject());
        if (obj instanceof VersionInfo) {
                VersionInfo current = (VersionInfo) obj;
                if (current.isReference()) {
                current = (VersionInfo)
                                            current.getCheckedRef(VersionInfo.class,
                                "VersionInfo");
                }
                if (stack.contains(current)) {
                        throw this.circularReference();
                }
                stack.addElement(current);
                currentRef = current.getExtends();
        } else {
                throw new BuildException("Referenced element "
                + currentRef.getRefId() + " is not a versioninfo.");
        }
        }
        return new VersionInfo(stack);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:39,代码来源:VersionInfo.java

示例7: createExtendedProcessorDef

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Creates a processor initialized to be an extension of the base processor.
 *
 * @param baseProcessor
 *            base processor
 * @return extending processor
 */
protected final ProcessorDef createExtendedProcessorDef(
    final ProcessorDef baseProcessor) {
  Project project = new Project();
  baseProcessor.setProject(project);
  baseProcessor.setId("base");
  project.addReference("base", baseProcessor);
  ProcessorDef extendedLinker = create();
  extendedLinker.setProject(project);
  extendedLinker.setExtends(new Reference("base"));
  return extendedLinker;
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:19,代码来源:TestProcessorDef.java

示例8: testReferencedSettings

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
@Test
public void testReferencedSettings() throws MalformedURLException {
    Project p = TestHelper.newProject();
    p.setProperty("myproperty", "myvalue");

    IvyAntSettings antSettings = new IvyAntSettings();
    antSettings.setProject(p);
    // antSettings.setId("mySettings");
    antSettings.setFile(new File("test/repositories/ivysettings.xml"));
    p.addReference("mySettings", antSettings);

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

    assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
    assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
            .getVariables().getVariable("ivy.settings.file"));
    assertEquals(
        new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
        settings.getVariables().getVariable("ivy.settings.url"));
    assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables()
            .getVariable("ivy.settings.dir"));
    assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:33,代码来源:IvyTaskTest.java

示例9: getIvyInstance

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
private Ivy getIvyInstance() {
    IvyTask task = new IvyTask() {
        public void doExecute() throws BuildException {
        }
    };
    task.setProject(project);
    task.init();

    Reference ref = new Reference(task.getProject(), configure.getSettingsId());
    // ref.setProject(project);
    task.setSettingsRef(ref);
    return task.getIvyInstance();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:14,代码来源:IvyConfigureTest.java

示例10: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Makes this instance in effect a reference to another ResourceList
 * instance.
 *
 * @param r Reference
 */
@Override
public void setRefid(Reference r) throws BuildException {
    if (encoding != null) {
        throw tooManyAttributes();
    }
    if (!(filterChains.isEmpty() && textDocuments.isEmpty())) {
        throw noChildrenAllowed();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:ResourceList.java

示例11: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Overrides the base version.
 * @param r the Reference to set.
 */
@Override
public void setRefid(Reference r) {
    if (nested != null || mapper != null) {
        throw tooManyAttributes();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:MappedResourceCollection.java

示例12: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Overrides the super version.
 * @param r the Reference to set.
 */
@Override
public void setRefid(Reference r) {
    if (file != null || baseDir != null) {
        throw tooManyAttributes();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:FileResource.java

示例13: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Overrides the base version.
 * @param r the Reference to set.
 */
@Override
public void setRefid(Reference r) {
    if (resource != null) {
        throw noChildrenAllowed();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:ResourceDecorator.java

示例14: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Overrides the super version.
 * @param r the Reference to set.
 */
public synchronized void setRefid(Reference r) {
    //not using the accessor in this case to avoid side effects
    if (url != null || baseURL != null || relPath != null) {
        throw tooManyAttributes();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:URLResource.java

示例15: setRefid

import org.apache.tools.ant.types.Reference; //导入依赖的package包/类
/**
 * Overrides the base version.
 *
 * @param r the Reference to set.
 */
@Override
public void setRefid(final Reference r) {
    if (!(zips.getResourceCollections().isEmpty()
        && tars.getResourceCollections().isEmpty())) {
        throw tooManyAttributes();
    }
    super.setRefid(r);
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:Archives.java


注:本文中的org.apache.tools.ant.types.Reference类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。