本文整理汇总了Java中org.apache.tools.ant.types.PropertySet.setProject方法的典型用法代码示例。如果您正苦于以下问题:Java PropertySet.setProject方法的具体用法?Java PropertySet.setProject怎么用?Java PropertySet.setProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.types.PropertySet
的用法示例。
在下文中一共展示了PropertySet.setProject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesByDefault
import org.apache.tools.ant.types.PropertySet; //导入方法依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesByDefault()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", true, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "12345", "45678", "hello", "universe", "qwerty", "board"));
}
示例2: testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesForced
import org.apache.tools.ant.types.PropertySet; //导入方法依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesForced()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
task.setInheritAll(true);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", true, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "12345", "45678", "hello", "universe", "qwerty", "board"));
}
示例3: testSerialRun_SingleModule_WithPropertySets_PropertiesNotInherited
import org.apache.tools.ant.types.PropertySet; //导入方法依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_PropertiesNotInherited()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
task.setInheritAll(false);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", false, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "hello", "universe", "qwerty", "board"));
}
示例4: setPrefix
import org.apache.tools.ant.types.PropertySet; //导入方法依赖的package包/类
/**
* If the prefix is set, then only properties which start with this
* prefix string will be recorded. If regex is not set and if this
* is never set, or it is set to an empty string or <tt>null</tt>,
* then all properties will be recorded.
*
* <p>For example, if the attribute is set as:</p>
* <pre><echoproperties prefix="ant." /></pre>
* then the property "ant.home" will be recorded, but "ant-example"
* will not.
*
* @param prefix The new prefix value
*/
public void setPrefix(String prefix) {
if (prefix != null && prefix.length() != 0) {
this.prefix = prefix;
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendPrefix(prefix);
addPropertyset(ps);
}
}
示例5: setRegex
import org.apache.tools.ant.types.PropertySet; //导入方法依赖的package包/类
/**
* If the regex is set, then only properties whose names match it
* will be recorded. If prefix is not set and if this is never set,
* or it is set to an empty string or <tt>null</tt>, then all
* properties will be recorded.
*
* <p>For example, if the attribute is set as:</p>
* <pre><echoproperties prefix=".*ant.*" /></pre>
* then the properties "ant.home" and "user.variant" will be recorded,
* but "ant-example" will not.
*
* @param regex The new regex value
*
* @since Ant 1.7
*/
public void setRegex(String regex) {
if (!(regex == null || regex.isEmpty())) {
this.regex = regex;
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendRegex(regex);
addPropertyset(ps);
}
}