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


Java Mapper.setType方法代码示例

本文整理汇总了Java中org.apache.tools.ant.types.Mapper.setType方法的典型用法代码示例。如果您正苦于以下问题:Java Mapper.setType方法的具体用法?Java Mapper.setType怎么用?Java Mapper.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.types.Mapper的用法示例。


在下文中一共展示了Mapper.setType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGlobMapperRelativePath

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testGlobMapperRelativePath() {
    DependSelector s = new DependSelector();
    File subdir = new File("selectortest/tar/bz2");
    s.setTargetdir(subdir);

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");

    String results = selectorRule.selectionString(s);
    assertEquals("FFTFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:DependSelectorTest.java

示例2: testRestrictedGlobMapper

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testRestrictedGlobMapper() {
    DependSelector s = new DependSelector();
    File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
    s.setTargetdir(subdir);

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");
    String results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:DependSelectorTest.java

示例3: testMirroredSelection

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testMirroredSelection() {
    DependSelector s = new DependSelector();
    s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));

    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");

    Mapper m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");
    String results = selectorRule.mirrorSelectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
    results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFTTF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:DependSelectorTest.java

示例4: execute

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
/**
 * Executes the task.
 *
 * @throws BuildException is there is a problem in the task execution.
 */
public void execute() throws BuildException {

    // first off, make sure that we've got a from and to extension
    if (fromExtension == null || toExtension == null || srcDir == null) {
        throw new BuildException("srcDir, fromExtension and toExtension "
            + "attributes must be set!");
    }

    log("DEPRECATED - The renameext task is deprecated.  Use move instead.",
        Project.MSG_WARN);
    log("Replace this with:", Project.MSG_INFO);
    log("<move todir=\"" + srcDir + "\" overwrite=\"" + replace + "\">",
        Project.MSG_INFO);
    log("  <fileset dir=\"" + srcDir + "\" />", Project.MSG_INFO);
    log("  <mapper type=\"glob\"", Project.MSG_INFO);
    log("          from=\"*" + fromExtension + "\"", Project.MSG_INFO);
    log("          to=\"*" + toExtension + "\" />", Project.MSG_INFO);
    log("</move>", Project.MSG_INFO);
    log("using the same patterns on <fileset> as you\'ve used here",
        Project.MSG_INFO);

    Move move = new Move();
    move.bindToOwner(this);
    move.setOwningTarget(getOwningTarget());
    move.setTaskName(getTaskName());
    move.setLocation(getLocation());
    move.setTodir(srcDir);
    move.setOverwrite(replace);

    fileset.setDir(srcDir);
    move.addFileset(fileset);

    Mapper me = move.createMapper();
    me.setType(globType);
    me.setFrom("*" + fromExtension);
    me.setTo("*" + toExtension);

    move.execute();
}
 
开发者ID:apache,项目名称:ant,代码行数:45,代码来源:RenameExtensions.java

示例5: testIdentityMapper

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testIdentityMapper() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType identity = new Mapper.MapperType();
    identity.setValue("identity");

    Mapper m = s.createMapper();
    m.setType(identity);

    String results = selectorRule.selectionString(s);
    assertEquals("FFFFFFFFFFFF", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:DependSelectorTest.java

示例6: testMergeMapper

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testMergeMapper() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType merge = new Mapper.MapperType();
    merge.setValue("merge");

    Mapper m = s.createMapper();
    m.setType(merge);
    m.setTo("asf-logo.gif.gz");

    String results = selectorRule.selectionString(s);
    assertEquals("TFFFFTTTFFF", results.substring(0,11));
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:DependSelectorTest.java

示例7: testMergeMapper2

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
@Test
public void testMergeMapper2() {
    DependSelector s = new DependSelector();
    s.setTargetdir(selectorRule.getBeddir());

    Mapper.MapperType merge = new Mapper.MapperType();
    merge.setValue("merge");

    Mapper m = s.createMapper();
    m.setType(merge);
    m.setTo("asf-logo.gif.bz2");
    String results = selectorRule.selectionString(s);
    assertEquals("TTFTTTTTTTTT", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:DependSelectorTest.java

示例8: testSelectionBehaviour

import org.apache.tools.ant.types.Mapper; //导入方法依赖的package包/类
/**
 * Tests to make sure that the selector is selecting files correctly.
 */
@Test
public void testSelectionBehaviour() {
    PresentSelector s;
    String results;
    Mapper m;
    Mapper.MapperType identity = new Mapper.MapperType();
    identity.setValue("identity");
    Mapper.MapperType glob = new Mapper.MapperType();
    glob.setValue("glob");
    Mapper.MapperType merge = new Mapper.MapperType();
    merge.setValue("merge");
    Mapper.MapperType flatten = new Mapper.MapperType();
    flatten.setValue("flatten");

    File beddir = selectorRule.getBeddir();

    s = new PresentSelector();
    s.setTargetdir(beddir);
    results = selectorRule.selectionString(s);
    assertEquals("TTTTTTTTTTTT", results);

    s = new PresentSelector();
    s.setTargetdir(beddir);
    m = s.createMapper();
    m.setType(identity);
    results = selectorRule.selectionString(s);
    assertEquals("TTTTTTTTTTTT", results);

    s = new PresentSelector();
    File subdir = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/expected");
    s.setTargetdir(subdir);
    m = s.createMapper();
    m.setType(flatten);
    results = selectorRule.selectionString(s);
    assertEquals("TTTTTTTTTTTF", results);

    s = new PresentSelector();
    s.setTargetdir(beddir);
    m = s.createMapper();
    m.setType(merge);
    m.setTo("asf-logo.gif.gz");
    results = selectorRule.selectionString(s);
    assertEquals("TTTTTTTTTTTT", results);

    s = new PresentSelector();
    subdir = new File(beddir, "tar/bz2");
    s.setTargetdir(subdir);
    m = s.createMapper();
    m.setType(glob);
    m.setFrom("*.bz2");
    m.setTo("*.tar.bz2");
    results = selectorRule.selectionString(s);
    assertEquals("FFTFFFFFFFFF", results);

    s = new PresentSelector();
    subdir = new File(selectorRule.getOutputDir(), "selectortest2");
    s.setTargetdir(subdir);
    results = selectorRule.selectionString(s);
    assertEquals("TTTFFTTTTTTT", results);
    results = selectorRule.selectionString(s);
    assertEquals("TTTFFTTTTTTT", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:66,代码来源:PresentSelectorTest.java


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