• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ModifiedSelector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAlgoName

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * Extracts the real used algorithm name from the ModifiedSelector using
 * its toString() method.
 * @param classname  the classname from the algorithm to use
 * @return  the algorithm part from the toString() (without brackets)
 */
private String getAlgoName(String classname) {
    ModifiedSelector sel = new ModifiedSelector();
    sel.setProject(selectorRule.getProject());
    // add the test classes to its classpath
    sel.addClasspath(testclasses);
    sel.setAlgorithmClass(classname);
    // let the selector do its checks
    sel.validate();
    // extract the algorithm name (and config) from the selectors output
    String s1 = sel.toString();
    int posStart = s1.indexOf("algorithm=") + 10;
    int posEnd   = s1.indexOf(" comparator=");
    String algo  = s1.substring(posStart, posEnd);
    // '<' and '>' are only used if the algorithm has properties
    if (algo.startsWith("<")) {
        algo = algo.substring(1);
    }
    if (algo.endsWith(">")) {
        algo = algo.substring(0, algo.length() - 1);
    }
    // return the clean value
    return algo;
}
 
开发者ID:apache,项目名称:ant,代码行数:30,代码来源:ModifiedSelectorTest.java


示例2: testCreatePropertiesCacheViaModifiedSelector

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/** Checks whether a cache file is created. */
@Test
public void testCreatePropertiesCacheViaModifiedSelector() {
    File cachefile = new File(selectorRule.getProject().getBaseDir(), "cachefile.properties");

    // Configure the selector
    ModifiedSelector s = new ModifiedSelector();
    s.setDelayUpdate(false);
    s.addParam("cache.cachefile", cachefile);

    ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
    cacheName.setValue("propertyfile");
    s.setCache(cacheName);

    s.setUpdate(true);

    selectorRule.selectionString(s);

    // evaluate correctness
    assertTrue("Cache file is not created.", cachefile.exists());
    cachefile.delete();
}
 
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:ModifiedSelectorTest.java


示例3: testSeldirs

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * Tests whether the seldirs attribute is used.
 */
@Test
public void testSeldirs() {
    ModifiedSelector s = new ModifiedSelector();
    StringBuilder sbTrue  = new StringBuilder();
    StringBuilder sbFalse = new StringBuilder();
    for (File file : selectorRule.getFiles()) {
        if (file.isDirectory()) {
            sbTrue.append("T");
            sbFalse.append("F");
        } else {
            sbTrue.append("T");
            sbFalse.append("T");
        }
    }

    s.setSeldirs(true);
    performTests(s, sbTrue.toString());
    s.getCache().delete();

    s.setSeldirs(false);
    performTests(s, sbFalse.toString());
    s.getCache().delete();

    s.getCache().delete();
}
 
开发者ID:apache,项目名称:ant,代码行数:29,代码来源:ModifiedSelectorTest.java


示例4: testValidateWrongCache

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/** Test correct use of cache names. */
@Test
public void testValidateWrongCache() {
    String name = "this-is-not-a-valid-cache-name";
    try {
        ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
        cacheName.setValue(name);
        fail("CacheSelector.CacheName accepted invalid value.");
    } catch (BuildException be) {
        assertEquals(name + " is not a legal value for this attribute",
                     be.getMessage());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:ModifiedSelectorTest.java


示例5: testValidateWrongAlgorithm

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/** Test correct use of cache names. */
@Test
public void testValidateWrongAlgorithm() {
    String name = "this-is-not-a-valid-algorithm-name";
    try {
        ModifiedSelector.AlgorithmName algoName
            = new ModifiedSelector.AlgorithmName();
        algoName.setValue(name);
        fail("CacheSelector.AlgorithmName accepted invalid value.");
    } catch (BuildException be) {
        assertEquals(name + " is not a legal value for this attribute",
                     be.getMessage());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:ModifiedSelectorTest.java


示例6: testValidateWrongComparator

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/** Test correct use of comparator names. */
@Test
public void testValidateWrongComparator() {
    String name = "this-is-not-a-valid-comparator-name";
    try {
        ModifiedSelector.ComparatorName compName
            = new ModifiedSelector.ComparatorName();
        compName.setValue(name);
        fail("ModifiedSelector.ComparatorName accepted invalid value.");
    } catch (BuildException be) {
        assertEquals(name + " is not a legal value for this attribute",
                     be.getMessage());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:15,代码来源:ModifiedSelectorTest.java


示例7: testEqualComparatorViaSelector

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
@Test
public void testEqualComparatorViaSelector() {
    ModifiedSelector s = new ModifiedSelector();
    ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
    compName.setValue("equal");
    s.setComparator(compName);
    try {
        performTests(s, "TTTTTTTTTTTT");
    } finally {
        s.getCache().delete();
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:ModifiedSelectorTest.java


示例8: testRuleComparatorViaSelector

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
@Test
@Ignore("not yet supported see note in selector")
public void testRuleComparatorViaSelector() {
    ModifiedSelector s = new ModifiedSelector();
    ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
    compName.setValue("rule");
    s.setComparator(compName);
    try {
        performTests(s, "TTTTTTTTTTTT");
    } finally {
        s.getCache().delete();
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:ModifiedSelectorTest.java


示例9: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
public void addModified(ModifiedSelector selector) {
    selectors.addModified(selector);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:PathFileSet.java


示例10: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
@Override public void addModified(ModifiedSelector selector) {
  usedMatchingTask = true;
  super.addModified(selector);
}
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:5,代码来源:Kawac.java


示例11: doDelayUpdateTest

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
public void doDelayUpdateTest(int kind) {
    // no check for 1<=kind<=3 - only internal use therefore check it
    // while development

    // readable form of parameter kind
    String[] kinds = {"task", "target", "build"};

    // setup the "Ant project"
    MockProject project = new MockProject();
    File base  = new File("base");
    File file1 = new File("file1");
    File file2 = new File("file2");

    // setup the selector
    ModifiedSelector sel = new ModifiedSelector();
    sel.setProject(project);
    sel.setUpdate(true);
    sel.setDelayUpdate(true);
    // sorry - otherwise we will get a ClassCastException because the MockCache
    // is loaded by two different classloader ...
    sel.setClassLoader(this.getClass().getClassLoader());
    sel.addClasspath(testclasses);

    sel.setAlgorithmClass("org.apache.tools.ant.types.selectors.MockAlgorithm");
    sel.setCacheClass("org.apache.tools.ant.types.selectors.MockCache");
    sel.configure();

    // get the cache, so we can check our things
    MockCache cache = (MockCache) sel.getCache();

    // the test
    assertFalse("Cache must not be saved before 1st selection.", cache.saved);
    sel.isSelected(base, "file1", file1);
    assertFalse("Cache must not be saved after 1st selection.", cache.saved);
    sel.isSelected(base, "file2", file2);
    assertFalse("Cache must not be saved after 2nd selection.", cache.saved);
    switch (kind) {
        case 1 :
            project.fireTaskFinished();
            break;
        case 2 :
            project.fireTargetFinished();
            break;
        case 3 :
            project.fireBuildFinished();
            break;
    }
    assertTrue("Cache must be saved after " + kinds[kind - 1] + "Finished-Event.", cache.saved);
    // MockCache doesn't create a file - therefore no cleanup needed
}
 
开发者ID:apache,项目名称:ant,代码行数:51,代码来源:ModifiedSelectorTest.java


示例12: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * Add the modified selector.
 * @param selector the <code>ModifiedSelector</code> to add.
 * @since ant 1.6
 */
@Override
public void addModified(ModifiedSelector selector) {
    appendSelector(selector);
}
 
开发者ID:apache,项目名称:ant,代码行数:10,代码来源:AbstractFileSet.java


示例13: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * add the modified selector
 * @param selector the selector to add
 * @since ant 1.6
 */
public void addModified(ModifiedSelector selector) {
    appendSelector(selector);
}
 
开发者ID:apache,项目名称:ant,代码行数:9,代码来源:AbstractSelectorContainer.java


示例14: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * add the modified selector
 * @param selector the selector to add
 * @since ant 1.6
 */
void addModified(ModifiedSelector selector);
 
开发者ID:apache,项目名称:ant,代码行数:7,代码来源:SelectorContainer.java


示例15: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * add the modified selector
 *
 * @param selector the selector to add
 * @since ant 1.6
 */
@Override
public void addModified(ModifiedSelector selector) {
    usedMatchingTask = true;
    super.addModified(selector);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:Delete.java


示例16: addModified

import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; //导入依赖的package包/类
/**
 * add the modified selector
 * @param selector the selector to add
 * @since ant 1.6
 */
@Override
public void addModified(ModifiedSelector selector) {
    fileset.addModified(selector);
}
 
开发者ID:apache,项目名称:ant,代码行数:10,代码来源:MatchingTask.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Responsibility类代码示例发布时间:2022-05-22
下一篇:
Java PermissionHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap