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


Java Parameter.setName方法代码示例

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


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

示例1: testValidate

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
/**
 * Test the code that validates the selector.
 */
@Test
public void testValidate() {
    ContainsSelector s = new ContainsSelector();
    try {
        s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
        fail("ContainsSelector did not check for required field 'text'");
    } catch (BuildException be1) {
        assertEquals("The text attribute is required", be1.getMessage());
    }

    s = new ContainsSelector();
    Parameter param = new Parameter();
    param.setName("garbage in");
    param.setValue("garbage out");
    Parameter[] params = {param};
    s.setParameters(params);
    try {
        s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
        fail("ContainsSelector did not check for valid parameter element");
    } catch (BuildException be2) {
        assertEquals("Invalid parameter garbage in", be2.getMessage());
    }

}
 
开发者ID:apache,项目名称:ant,代码行数:28,代码来源:ContainsSelectorTest.java

示例2: testValidate

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
/**
 * Test the code that validates the selector.
 */
@Test
public void testValidate() {
    FilenameSelector s = new FilenameSelector();
    try {
        s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
        fail("FilenameSelector did not check for required fields");
    } catch (BuildException be1) {
        assertEquals("The name or regex attribute is required", be1.getMessage());
    }

    s = new FilenameSelector();
    Parameter param = new Parameter();
    param.setName("garbage in");
    param.setValue("garbage out");
    Parameter[] params = {param};
    s.setParameters(params);
    try {
        s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
        fail("FilenameSelector did not check for valid parameter element");
    } catch (BuildException be2) {
        assertEquals("Invalid parameter garbage in", be2.getMessage());
    }

}
 
开发者ID:apache,项目名称:ant,代码行数:28,代码来源:FilenameSelectorTest.java

示例3: testModuleRejectedIfNotEager

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testModuleRejectedIfNotEager() throws Exception {
    File cfg = new File(new File(getWorkDir(), "config"), "Modules");
    cfg.mkdirs();
    assertTrue("Created", cfg.isDirectory());
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module");
    File aModule = generateJar("org.my.module", new String[0], m);
    
    File trackingFile = new File(cfg, "org-my-module.xml");
    try (FileWriter w = new FileWriter(trackingFile)) {
        w.write(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Module Status 1.0//EN\"\n" +
                        "                        \"http://www.netbeans.org/dtds/module-status-1_0.dtd\">\n" +
                        "<module name=\"org.my.module\">\n" +
                        "    <param name=\"autoload\">true</param>\n" +
                        "    <param name=\"eager\">false</param>\n" +
                        "    <param name=\"jar\">modules/org-openide-awt.jar</param>\n" +
                        "    <param name=\"reloadable\">false</param>\n" +
                        "    <param name=\"specversion\">7.4.0.1</param>\n" +
                        "</module>\n"
        );
    }

    Parameter p = new Parameter();
    p.setName("acceptEager");
    p.setValue("true");
    Parameter p2 = new Parameter();
    p2.setName("acceptAutoload");
    p2.setValue("false");
    selector.setParameters(new Parameter[] { p, p2 });
    
    assertFalse("module not accepted", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:ModuleStateSelectorTest.java

示例4: testModuleAcceptedIfEager

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testModuleAcceptedIfEager() throws Exception {
    File cfg = new File(new File(getWorkDir(), "config"), "Modules");
    cfg.mkdirs();
    assertTrue("Created", cfg.isDirectory());

    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module/1");
    File aModule = generateJar("org.my.module", new String[0], m);

    File trackingFile = new File(cfg, "org-my-module.xml");
    try (FileWriter w = new FileWriter(trackingFile)) {
        w.write(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "<!DOCTYPE module PUBLIC \"-//NetBeans//DTD Module Status 1.0//EN\"\n" +
                        "                        \"http://www.netbeans.org/dtds/module-status-1_0.dtd\">\n" +
                        "<module name=\"org.my.module\">\n" +
                        "    <param name=\"autoload\">false</param>\n" +
                        "    <param name=\"eager\">true</param>\n" +
                        "    <param name=\"jar\">modules/org-openide-awt.jar</param>\n" +
                        "    <param name=\"reloadable\">false</param>\n" +
                        "    <param name=\"specversion\">7.4.0.1</param>\n" +
                        "</module>\n"
        );
    }

    Parameter p = new Parameter();
    p.setName("acceptEager");
    p.setValue("true");
    Parameter p2 = new Parameter();
    p2.setName("acceptAutoload");
    p2.setValue("false");
    selector.setParameters(new Parameter[] { p, p2 });

    assertTrue("module accepted", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:ModuleStateSelectorTest.java

示例5: testCanExcludeAModule

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testCanExcludeAModule() throws Exception {
    Parameter p = new Parameter();
    p.setName("excludeModules");
    p.setValue("org.my.module");
    selector.setParameters(new Parameter[] { p });
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module");
    File aModule = generateJar(new String[0], m);
    assertFalse("Refused", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ModuleSelectorTest.java

示例6: testCanExcludeOSGiWithAttributes

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testCanExcludeOSGiWithAttributes() throws Exception {
    Parameter p = new Parameter();
    p.setName("excludeModules");
    p.setValue("org.eclipse.core.jobs");
    selector.setParameters(new Parameter[] { p });
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("Bundle-SymbolicName", "org.eclipse.core.jobs; singleton:=true");
    File aModule = generateJar(new String[0], m);
    assertFalse("Refused", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ModuleSelectorTest.java

示例7: testCanShowOnlyExcludedModules

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testCanShowOnlyExcludedModules() throws Exception {
    Parameter p = new Parameter();
    p.setName("excluded");
    p.setValue("true");
    Parameter p2 = new Parameter();
    p2.setName("excludeModules");
    p2.setValue("org.my.module");
    selector.setParameters(new Parameter[] { p, p2 });
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module");
    File aModule = generateJar(new String[0], m);
    assertTrue("Now we are accepting only excluded modules", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ModuleSelectorTest.java

示例8: testIsSelectedForNotAModuleIsStillFalseEvenWeAcceptOnlyExcludedModules

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testIsSelectedForNotAModuleIsStillFalseEvenWeAcceptOnlyExcludedModules() throws IOException {
    Parameter p = new Parameter();
    p.setName("excluded");
    p.setValue("true");
    Parameter p2 = new Parameter();
    p2.setName("excludeModules");
    p2.setValue("org.my.module");
    selector.setParameters(new Parameter[] { p, p2 });
    
    
    File noModule = generateJar(new String[0], createManifest ());
    assertFalse("Not acceptable", selector.isSelected(getWorkDir(), noModule.toString(), noModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ModuleSelectorTest.java

示例9: testCanExcludeACluster

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
public void testCanExcludeACluster() throws Exception {
    Parameter p = new Parameter();
    p.setName("includeClusters");
    p.setValue("nonexistent");
    selector.setParameters(new Parameter[] { p });
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module");
    File aModule = generateJar(new String[0], m);
    new File(getWorkDir(), "update_tracking").mkdir();
    assertFalse("Refused", selector.isSelected(getWorkDir().getParentFile(), aModule.toString(), aModule));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ModuleSelectorTest.java

示例10: testCreateArguments

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
@Test
public void testCreateArguments() {
    final Parameter parameter = new Parameter();
    parameter.setName("key");
    parameter.setValue("value");
    task.addParameter(parameter);

    final Map<String, String> expected = Collections.singletonMap("key",
            "value");
    assertEquals(expected, task.createArguments());
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:12,代码来源:OperatorClientTaskTest.java

示例11: addParam

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
/**
 * Support for nested &lt;param&gt; tags.
 * @param key the key of the parameter
 * @param value the value of the parameter
 */
public void addParam(String key, Object value) {
    Parameter par = new Parameter();
    par.setName(key);
    par.setValue(String.valueOf(value));
    configParameter.add(par);
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:ModifiedSelector.java

示例12: createParam

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
/**
 * Creates a configured parameter object.
 * @param name   name of the parameter
 * @param value  value of the parameter
 * @return the parameter object
 */
private Parameter createParam(String name, String value) {
    Parameter p = new Parameter();
    p.setName(name);
    p.setValue(value);
    return p;
}
 
开发者ID:apache,项目名称:ant,代码行数:13,代码来源:ModifiedSelectorTest.java

示例13: testCaseInsensitiveParameterParsing

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
private void testCaseInsensitiveParameterParsing(String name) {
    SizeSelector s = new SizeSelector();
    Parameter p = new Parameter();
    p.setName(name);
    p.setValue("foo");
    try {
        s.setParameters(new Parameter[] {p});
        fail("should have caused an exception");
    } catch (BuildException be) {
        assertEquals("foo is not a legal value for this attribute",
                     be.getMessage());
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:14,代码来源:SizeSelectorTest.java

示例14: doParsingOfUpdateTrackingFiles

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
private void doParsingOfUpdateTrackingFiles(int parents) throws Exception {
    File updateTracking = new File(getWorkDir(), "update-tracking");
    updateTracking.mkdirs();
    assertTrue("Created", updateTracking.isDirectory());
    
    Manifest m = createManifest ();
    m.getMainAttributes().putValue("OpenIDE-Module", "org.my.module");
    File aModule = generateJar(new String[0], m);
    
    File trackingFile = new File(updateTracking, "org-my-module.xml");
    try (FileWriter w = new FileWriter(trackingFile)) {
        w.write(
                "<?xml version='1.0' encoding='UTF-8'?>\n" +
                        "<module codename='org.apache.tools.ant.module/3'>\n" +
                        "<module_version specification_version='3.22' origin='installer' last='true' install_time='1124194231878'>\n" +
                        "<file name='ant/bin/ant' crc='1536373800'/>\n" +
                        "<file name='ant/bin/ant.bat' crc='3245456472'/>\n" +
                        "<file name='ant/bin/ant.cmd' crc='3819623376'/>\n" +
                        "<file name='ant/bin/antRun' crc='2103827286'/>\n" +
                        "<file name='ant/bin/antRun.bat' crc='2739687679'/>\n" +
                        "<file name='ant/bin/antRun.pl' crc='3955456526'/>\n" +
                        "    </module_version>\n" +
                        "</module>\n"
        );
    }

    StringBuilder sb = new StringBuilder();
    sb.append(trackingFile.getPath());
    
    while (--parents > 0) {
        File x = new File(getWorkDir(), parents + ".xml");
        try (FileWriter xw = new FileWriter(x)) {
            xw.write(
                    "<?xml version='1.0' encoding='UTF-8'?>\n" +
                            "<module codename='" + x + "/3'>\n" +
                                    "<module_version specification_version='3.22' origin='installer' last='true' install_time='1124194231878'>\n" +
                                    "    </module_version>\n" +
                                    "</module>\n"
            );
        }
        
        sb.insert(0, File.pathSeparator);
        sb.insert(0, x.getPath());
    }
    
    Parameter p = new Parameter();
    p.setName("updateTrackingFiles");
    p.setValue(sb.toString());
    selector.setParameters(new Parameter[] { p });
    
    assertTrue("module accepted", selector.isSelected(getWorkDir(), aModule.toString(), aModule));
    assertTrue("its file as well", selector.isSelected(getWorkDir(), "ant/bin/ant.bat", new File(aModule.getParent(), "ant/bin/ant.bat")));
    assertTrue("also the tracking file is accepted", selector.isSelected(getWorkDir(), "update-tracking/" + trackingFile.getName(), trackingFile));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:ModuleSelectorTest.java

示例15: testSelectionBehaviour

import org.apache.tools.ant.types.Parameter; //导入方法依赖的package包/类
/**
 * Tests to make sure that the selector is selecting files correctly.
 */
@Test
public void testSelectionBehaviour() {
    SizeSelector s;
    String results;

    SizeSelector.ByteUnits kilo = new SizeSelector.ByteUnits();
    kilo.setValue("K");
    SizeSelector.ByteUnits kibi = new SizeSelector.ByteUnits();
    kibi.setValue("Ki");
    SizeSelector.ByteUnits tibi = new SizeSelector.ByteUnits();
    tibi.setValue("Ti");
    SizeSelector.SizeComparisons less = new SizeSelector.SizeComparisons();
    less.setValue("less");
    SizeSelector.SizeComparisons equal = new SizeSelector.SizeComparisons();
    equal.setValue("equal");
    SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
    more.setValue("more");

    s = new SizeSelector();
    s.setValue(10);
    s.setWhen(less);
    results = selectorRule.selectionString(s);
    assertEquals("TFFFFFFFFFFT", results);

    s = new SizeSelector();
    s.setValue(10);
    s.setWhen(more);
    results = selectorRule.selectionString(s);
    assertEquals("TTTTTTTTTTTT", results);

    s = new SizeSelector();
    s.setValue(32);
    s.setWhen(equal);
    results = selectorRule.selectionString(s);
    assertEquals("TFFFTFFFFFFT", results);

    s = new SizeSelector();
    s.setValue(7);
    s.setWhen(more);
    s.setUnits(kilo);
    results = selectorRule.selectionString(s);
    assertEquals("TFTFFTTTTTTT", results);

    s = new SizeSelector();
    s.setValue(7);
    s.setWhen(more);
    s.setUnits(kibi);
    results = selectorRule.selectionString(s);
    assertEquals("TFTFFFTTFTTT", results);

    s = new SizeSelector();
    s.setValue(99999);
    s.setWhen(more);
    s.setUnits(tibi);
    results = selectorRule.selectionString(s);
    assertEquals("TFFFFFFFFFFT", results);

    s = new SizeSelector();
    Parameter param1 = new Parameter();
    Parameter param2 = new Parameter();
    Parameter param3 = new Parameter();
    param1.setName("value");
    param1.setValue("20");
    param2.setName("units");
    param2.setValue("Ki");
    param3.setName("when");
    param3.setValue("more");
    Parameter[] params = {param1, param2, param3};
    s.setParameters(params);
    results = selectorRule.selectionString(s);
    assertEquals("TFFFFFFTFFTT", results);
}
 
开发者ID:apache,项目名称:ant,代码行数:76,代码来源:SizeSelectorTest.java


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