use of org.apache.tools.ant.types.resources.PropertyResource in project ant by apache.
the class PropertySet method iterator.
/**
* Fulfill the ResourceCollection interface.
* @return an Iterator of Resources.
* @since Ant 1.7
*/
@Override
public Iterator<Resource> iterator() {
if (isReference()) {
return getRef().iterator();
}
dieOnCircularReference();
Stream<Resource> result = getPropertyNames(getEffectiveProperties()).stream().map(name -> new PropertyResource(getProject(), name));
Optional<FileNameMapper> m = Optional.ofNullable(getMapper()).map(Mapper::getImplementation);
if (m.isPresent()) {
result = result.map(p -> new MappedResource(p, m.get()));
}
return result.iterator();
}
use of org.apache.tools.ant.types.resources.PropertyResource in project ant by apache.
the class ResourceOutputTest method testpropertyoutput2.
@Test
public void testpropertyoutput2() throws IOException {
project.setNewProperty("bar", "bar");
PropertyResource r = new PropertyResource(project, "bar");
try {
testoutput(r);
fail("should have caught ImmutableResourceException");
} catch (ImmutableResourceException e) {
// TODO assert exception message
}
assertEquals("bar", project.getProperty("bar"));
}
use of org.apache.tools.ant.types.resources.PropertyResource in project ant by apache.
the class ResourceOutputTest method testpropertyoutput1.
@Test
public void testpropertyoutput1() {
PropertyResource r = new PropertyResource(project, "bar");
testoutputbe(r);
assertEquals("foo", project.getProperty("bar"));
}
Aggregations