Browse Source

whitespace

master
Stefan Bodewig 8 years ago
parent
commit
ee47fa6e1a
41 changed files with 94 additions and 95 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/XmlLogger.java
  2. +3
    -3
      src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  4. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Antlib.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  7. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Expand.java
  8. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Replace.java
  10. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Rmic.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/condition/Http.java
  12. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  15. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  16. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java
  17. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java
  19. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
  20. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
  21. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  22. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  23. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  24. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java
  25. +1
    -1
      src/main/org/apache/tools/ant/types/AbstractFileSet.java
  26. +2
    -2
      src/main/org/apache/tools/ant/types/ZipScanner.java
  27. +1
    -1
      src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
  28. +2
    -2
      src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java
  29. +1
    -1
      src/main/org/apache/tools/ant/types/resources/Archives.java
  30. +1
    -1
      src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
  31. +1
    -1
      src/main/org/apache/tools/ant/types/resources/FileResource.java
  32. +1
    -1
      src/main/org/apache/tools/ant/types/resources/ResourceList.java
  33. +1
    -1
      src/main/org/apache/tools/ant/types/resources/Restrict.java
  34. +1
    -1
      src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
  35. +1
    -1
      src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java
  36. +1
    -1
      src/main/org/apache/tools/ant/types/resources/selectors/Name.java
  37. +2
    -2
      src/main/org/apache/tools/ant/types/selectors/AbstractSelectorContainer.java
  38. +1
    -1
      src/main/org/apache/tools/ant/types/selectors/TypeSelector.java
  39. +1
    -1
      src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
  40. +1
    -1
      src/main/org/apache/tools/ant/util/SourceFileScanner.java
  41. +41
    -41
      src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java

+ 1
- 1
src/main/org/apache/tools/ant/XmlLogger.java View File

@@ -177,7 +177,7 @@ public class XmlLogger implements BuildLogger {
}
String outFilename = getProperty(event, "XmlLogger.file", "log.xml");
String xslUri = getProperty(event, "ant.XmlLogger.stylesheet.uri", "log.xsl");
try (OutputStream stream =
outStream == null ? Files.newOutputStream(Paths.get(outFilename)) : outStream;
Writer out = new OutputStreamWriter(stream, "UTF8")) {


+ 3
- 3
src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java View File

@@ -62,13 +62,13 @@ public final class ChainReaderHelper {
public String readFully() throws IOException {
return ChainReaderHelper.this.readFully(this);
}
@Override
public void close() throws IOException {
cleanUpClassLoaders(cleanupLoaders);
super.close();
}
@Override
protected void finalize() throws Throwable {
try {
@@ -236,7 +236,7 @@ public final class ChainReaderHelper {
final List<Object> finalFilters =
filterChains.stream().map(FilterChain::getFilterReaders)
.flatMap(Collection::stream).collect(Collectors.toList());
if (!finalFilters.isEmpty()) {
boolean success = false;
try {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -422,7 +422,7 @@ public class Ant extends Task {
"%s task calling its own parent target.",
getTaskName());
}
final Map<String, Target> targetsMap = getProject().getTargets();

if (locals.stream().map(targetsMap::get)


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/AntStructure.java View File

@@ -214,7 +214,7 @@ public class AntStructure extends Task {
final Set<String> types) {
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
out.println("<!ENTITY % boolean \"(true|false|on|off|yes|no)\">");
out.println(tasks.stream().collect(
Collectors.joining(" | ", "<!ENTITY % tasks \"", "\">")));



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Antlib.java View File

@@ -159,7 +159,7 @@ public class Antlib extends Task implements TaskContainer {
@Override
public void execute() {
//TODO handle tasks added via #addTask()
for (Task task : tasks) {
UnknownElement ue = (UnknownElement) task;
setLocation(ue.getLocation());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -85,7 +85,7 @@ public class Delete extends MatchingTask {
SymbolicLinkUtils.getSymbolicLinkUtils();

private static class ReverseDirs implements ResourceCollection {
private Project project;
private File basedir;
private String[] dirs;


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -61,12 +61,12 @@ import org.apache.tools.zip.ZipFile;
*/
public class Expand extends Task {
public static final String NATIVE_ENCODING = "native-encoding";
/** Error message when more that one mapper is defined */
public static final String ERROR_MULTIPLE_MAPPERS = "Cannot define more than one mapper";
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
private static final int BUFFER_SIZE = 1024;
private File dest; //req
private File source; // req
@@ -185,7 +185,7 @@ public class Expand extends Task {
getLocation());
}
try (
ZipFile
ZipFile
zf = new ZipFile(srcF, encoding, scanForUnicodeExtraFields)){
boolean empty = true;
Enumeration<ZipEntry> e = zf.getEntries();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1907,7 +1907,7 @@ public class Javadoc extends Task {
if (doclet.getName() == null) {
throw new BuildException("The doclet name must be specified.",
getLocation());
}
}
toExecute.createArgument().setValue("-doclet");
toExecute.createArgument().setValue(doclet.getName());
if (doclet.getPath() != null) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Replace.java View File

@@ -626,7 +626,7 @@ public class Replace extends MatchingTask {
Properties props = new Properties();

try (
InputStream
InputStream
in = propertyResource.getInputStream()){
props.load(in);
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Rmic.java View File

@@ -91,7 +91,7 @@ public class Rmic extends MatchingTask {
/** rmic failed message */
public static final String ERROR_RMIC_FAILED
= "Rmic failed; see the compiler error output for details.";
/** unable to verify message */
public static final String ERROR_UNABLE_TO_VERIFY_CLASS = "Unable to verify class ";
/** could not be found message */


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/condition/Http.java View File

@@ -45,7 +45,7 @@ public class Http extends ProjectComponent implements Condition {
private boolean followRedirects = true;

private int errorsBeginAt = ERROR_BEGINS;
/**
* Set the url attribute
* @param url the url of the request


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java View File

@@ -532,8 +532,7 @@ public class EmailTask extends Task {

// identify which files should be attached
Vector<File> files = new Vector<>();

if (attachments != null) {
for (Resource r : attachments) {
files.add(r.as(FileProvider.class).getFile());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java View File

@@ -283,7 +283,7 @@ public class MimeMailer extends Mailer {

private static InternetAddress[] internetAddresses(final Vector<EmailAddress> list)
throws AddressException, UnsupportedEncodingException {
final int size = list.size();
final InternetAddress[] addrs = new InternetAddress[size];



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -306,7 +306,7 @@ public class ANTLR extends Task {
int err = run(commandline.getCommandline());
if (err != 0) {
throw new BuildException("ANTLR returned: " + err, getLocation());
}
}
String output = bos.toString();
if (output.indexOf("error:") > -1) {
throw new BuildException("ANTLR signaled an error: "


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java View File

@@ -786,7 +786,7 @@ public class NetRexxC extends MatchingTask {
String[] compileArgs =
Stream.concat(Stream.of(compileOptionsArray), compileList.stream())
.toArray(String[]::new);
// need to set java.class.path property and restore it later
// since the NetRexx compiler has no option for the classpath
String currentClassPath = System.getProperty("java.class.path");


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java View File

@@ -32,7 +32,7 @@ public interface ClassFileIterator extends Iterable<ClassFile> {
* @return the next class file in the iteration
*/
ClassFile getNextClassFile();
@Override
default Iterator<ClassFile> iterator() {

@@ -58,7 +58,7 @@ public interface ClassFileIterator extends Iterable<ClassFile> {
next = getNextClassFile();
}
}
};
}
}

+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java View File

@@ -245,7 +245,7 @@ public class Depend extends MatchingTask {
Difference diff = new Difference();
diff.add(destPath);
diff.add(dependClasspath);
Path p;
if (diff.isEmpty()) {
p = null;
@@ -762,10 +762,10 @@ public class Depend extends MatchingTask {
if (file.getName().endsWith(".class")) {
ClassFileInfo info = new ClassFileInfo();
info.absoluteFile = file;
String relativeName = file.getPath().substring(rootLength + 1,
file.getPath().length() - ".class".length());
info.className
= ClassFileUtils.convertSlashName(relativeName);
info.sourceFile = sourceFileKnownToExist =


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java View File

@@ -307,7 +307,7 @@ public class IPlanetEjbcTask extends Task {
private Path getClasspath() {
if (classpath == null) {
return new Path(getProject()).concatSystemClasspath("last");
}
}
return classpath.concatSystemClasspath("ignore");
}
}

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java View File

@@ -583,13 +583,13 @@ public class JonasDeploymentTool extends GenericDeploymentTool {
String genicClass; // GenIC class (3 are supported for various
// versions
// work around a bug of GenIC 2.5
// class name (search in the classpath provided for the ejbjar element)
genicClass = getGenicClassName(classpath);
if (genicClass == null) {
log("Cannot find GenIC class in classpath.", Project.MSG_ERR);
throw new BuildException("GenIC class not found, please check the classpath.");
}
}
log("Using '" + genicClass + "' GenIC class." , Project.MSG_VERBOSE);
genicTask.setClassname(genicClass);



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java View File

@@ -83,7 +83,7 @@ public final class ExtensionUtil {
final List<FileSet> libraries)
throws BuildException {
final List<Extension> extensions = new ArrayList<>();
for (FileSet fileSet : libraries) {
boolean includeImpl = true;
boolean includeURL = true;


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -364,14 +364,14 @@ public class Translate extends MatchingTask {
Locale locale = new Locale(bundleLanguage,
bundleCountry,
bundleVariant);
String language = locale.getLanguage().length() > 0
? "_" + locale.getLanguage() : "";
String country = locale.getCountry().length() > 0
? "_" + locale.getCountry() : "";
String variant = locale.getVariant().length() > 0
? "_" + locale.getVariant() : "";
processBundle(bundle + language + country + variant, BUNDLE_SPECIFIED_LANGUAGE_COUNTRY_VARIANT, false);
processBundle(bundle + language + country, BUNDLE_SPECIFIED_LANGUAGE_COUNTRY, false);
processBundle(bundle + language, BUNDLE_SPECIFIED_LANGUAGE, false);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -584,7 +584,7 @@ public class JDependTask extends Task {
getWorkingPath().ifPresent(path -> {
for (String filepath : path.list()) {
File f = new File(filepath);
// not necessary as JDepend would fail, but why loose
// some time?
if (!f.exists() || !f.isDirectory()) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -1672,7 +1672,7 @@ public class JUnitTask extends Task {
final int count = batchTests.size();
@SuppressWarnings("unchecked")
final Enumeration<JUnitTest>[] enums = new Enumeration[ count + 1];
for (int i = 0; i < count; i++) {
final BatchTest batchtest = batchTests.get(i);
enums[i] = batchtest.elements();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java View File

@@ -37,7 +37,7 @@ public final class SunNative2Ascii extends DefaultNative2Ascii {
public static final String IMPLEMENTATION_NAME = "sun";

private static final String SUN_TOOLS_NATIVE2ASCII_MAIN = "sun.tools.native2ascii.Main";
/** {@inheritDoc} */
@Override
protected void setup(Commandline cmd, Native2Ascii args)


+ 1
- 1
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -949,7 +949,7 @@ public abstract class AbstractFileSet extends DataType
if (isReference()) {
super.dieOnCircularReference(stk, p);
} else {
selectors.stream().filter(DataType.class::isInstance).forEach(fileSelector ->
selectors.stream().filter(DataType.class::isInstance).forEach(fileSelector ->
pushAndInvokeCircularReferenceCheck((DataType) fileSelector, stk, p)
);
for (PatternSet ps : additionalPatterns) {


+ 2
- 2
src/main/org/apache/tools/ant/types/ZipScanner.java View File

@@ -60,7 +60,7 @@ public class ZipScanner extends ArchiveScanner {
File srcFile = src.asOptional(FileProvider.class)
.map(FileProvider::getFile).orElseThrow(() -> new BuildException(
"Only file provider resources are supported"));
try (ZipFile zf = new ZipFile(srcFile, encoding)) {

Enumeration<ZipEntry> e = zf.getEntries();
@@ -87,4 +87,4 @@ public class ZipScanner extends ArchiveScanner {
throw new BuildException("Problem opening " + srcFile, ex);
}
}
}
}

+ 1
- 1
src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java View File

@@ -89,7 +89,7 @@ public class ClassfileSet extends FileSet {
super(s);
rootClasses.addAll(s.rootClasses);
}
/**
* Add a fileset to which contains a collection of root classes used to
* drive the search from classes.


+ 2
- 2
src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java View File

@@ -125,9 +125,9 @@ public class DependScanner extends DirectoryScanner {

Set<String> parentSet = Stream.of(parentScanner.getIncludedFiles())
.collect(Collectors.toSet());
Enumeration<String> e = analyzer.getClassDependencies();
while (e.hasMoreElements()) {
String classname = e.nextElement();
String filename =


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/Archives.java View File

@@ -190,7 +190,7 @@ public class Archives extends DataType
setChecked(true);
}
}
@Override
protected Archives getCheckedRef() {
return (Archives) super.getCheckedRef();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java View File

@@ -247,7 +247,7 @@ public abstract class BaseResourceCollectionContainer
return coll.stream().map(Object::toString)
.collect(Collectors.joining(File.pathSeparator));
}
@Override
protected BaseResourceCollectionContainer getCheckedRef() {
return (BaseResourceCollectionContainer) super.getCheckedRef();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/FileResource.java View File

@@ -406,7 +406,7 @@ public class FileResource extends Resource implements Touchable, FileProvider,
}
return fileResource;
}
@Override
protected FileResource getCheckedRef() {
return (FileResource) super.getCheckedRef();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/ResourceList.java View File

@@ -232,5 +232,5 @@ public class ResourceList extends DataType implements ResourceCollection {
}
return new FileResource(getProject(), expandedLine);
}
}

+ 1
- 1
src/main/org/apache/tools/ant/types/resources/Restrict.java View File

@@ -155,7 +155,7 @@ public class Restrict
setChecked(true);
}
}
@Override
protected Restrict getCheckedRef() {
return (Restrict) super.getCheckedRef();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java View File

@@ -118,7 +118,7 @@ s.
setChecked(true);
}
}
private static Comparator<Resource> composite(List<? extends Comparator<Resource>> foo) {
Comparator<Resource> result = null;
if (foo != null) {


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java View File

@@ -45,7 +45,7 @@ public class FileSystem extends ResourceComparator {
protected int resourceCompare(Resource foo, Resource bar) {
return compare(file(foo), file(bar));
}
private File file(Resource r) {
return r.asOptional(FileProvider.class)
.orElseThrow(() -> new ClassCastException(


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/selectors/Name.java View File

@@ -132,7 +132,7 @@ public class Name implements ResourceSelector {
private boolean matches(String name) {
if (pattern != null) {
return SelectorUtils.match(modify(pattern), modify(name), cs);
}
}
if (reg == null) {
reg = new RegularExpression();
reg.setPattern(regex);


+ 2
- 2
src/main/org/apache/tools/ant/types/selectors/AbstractSelectorContainer.java View File

@@ -359,10 +359,10 @@ public abstract class AbstractSelectorContainer extends DataType
throw new BuildException(e);
}
}
@Override
protected AbstractSelectorContainer getCheckedRef() {
return (AbstractSelectorContainer) super.getCheckedRef();
}
}

+ 1
- 1
src/main/org/apache/tools/ant/types/selectors/TypeSelector.java View File

@@ -32,7 +32,7 @@ public class TypeSelector extends BaseExtendSelector {

/** Key to used for parameterized custom selector */
public static final String TYPE_KEY = "type";
private String type = null;

/**


+ 1
- 1
src/main/org/apache/tools/ant/util/RegexpPatternMapper.java View File

@@ -81,7 +81,7 @@ public class RegexpPatternMapper implements FileNameMapper {
public void setFrom(String from) throws BuildException {
if (from == null) {
throw new BuildException("this mapper requires a 'from' attribute");
}
}
try {
reg.setPattern(from);
} catch (NoClassDefFoundError e) {


+ 1
- 1
src/main/org/apache/tools/ant/util/SourceFileScanner.java View File

@@ -97,7 +97,7 @@ public class SourceFileScanner implements ResourceFactory {
public String getName() {
return f;
}
}).toArray(Resource[]::new);
}).toArray(Resource[]::new);

// build the list of sources which are out of date with
// respect to the target


+ 41
- 41
src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java View File

@@ -34,36 +34,36 @@ import static org.junit.Assert.fail;
public class LazyResourceCollectionTest {

private class StringResourceCollection implements ResourceCollection {
List<StringResourceIterator> createdIterators = new ArrayList<>();
List<StringResourceIterator> createdIterators = new ArrayList<>();

@Override
@Override
public int size() {
return 3;
return 3;
}

@Override
@Override
public Iterator<Resource> iterator() {
StringResourceIterator it = new StringResourceIterator();
createdIterators.add(it);
return it;
}

@Override
@Override
public boolean isFilesystemOnly() {
return false;
}
}

private class StringResourceIterator implements Iterator<Resource> {
private class StringResourceIterator implements Iterator<Resource> {
int cursor = 0;

@Override
@Override
public void remove() {
throw new UnsupportedOperationException();
}

@Override
public StringResource next() {
@Override
public StringResource next() {
if (cursor < 3) {
cursor++;
return new StringResource("r" + cursor);
@@ -71,7 +71,7 @@ public class LazyResourceCollectionTest {
return null;
}

@Override
@Override
public boolean hasNext() {
return cursor < 3;
}
@@ -85,25 +85,25 @@ public class LazyResourceCollectionTest {

Iterator<Resource> it = lazyCollection.iterator();
assertOneCreatedIterator(collectionTest);
StringResourceIterator stringResourceIterator =
collectionTest.createdIterators.get(0);
StringResourceIterator stringResourceIterator =
collectionTest.createdIterators.get(0);
assertEquals("A resource was loaded without iterating", 1,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r1", it.next());
assertStringValue("r1", it.next());
assertOneCreatedIterator(collectionTest);
assertEquals("Iterating once load more than 1 resource", 2,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r2", it.next());
assertStringValue("r2", it.next());
assertOneCreatedIterator(collectionTest);
assertEquals("Iterating twice load more than 2 resources", 3,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r3", it.next());
assertStringValue("r3", it.next());
assertOneCreatedIterator(collectionTest);
assertEquals("Iterating 3 times load more than 3 resources", 3,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

try {
it.next();
@@ -131,37 +131,37 @@ public class LazyResourceCollectionTest {
Iterator<Resource> it2 = lazyCollection.iterator();
assertOneCreatedIterator(collectionTest);

StringResourceIterator stringResourceIterator =
collectionTest.createdIterators.get(0);
StringResourceIterator stringResourceIterator =
collectionTest.createdIterators.get(0);
assertEquals("A resource was loaded without iterating", 1,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r1", it1.next());
assertStringValue("r1", it1.next());
assertEquals("Iterating once load more than 1 resource", 2,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r1", it2.next());
assertStringValue("r1", it2.next());
assertEquals(
"The second iterator did not lookup in the cache for a resource", 2,
stringResourceIterator.cursor);
"The second iterator did not lookup in the cache for a resource", 2,
stringResourceIterator.cursor);

assertStringValue("r2", it2.next());
assertStringValue("r2", it2.next());
assertEquals("Iterating twice load more than 2 resources", 3,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r2", it1.next());
assertStringValue("r2", it1.next());
assertEquals(
"The first iterator did not lookup in the cache for a resource", 3,
stringResourceIterator.cursor);
"The first iterator did not lookup in the cache for a resource", 3,
stringResourceIterator.cursor);

assertStringValue("r3", it2.next());
assertStringValue("r3", it2.next());
assertEquals("Iterating 3 times load more than 3 resources", 3,
stringResourceIterator.cursor);
stringResourceIterator.cursor);

assertStringValue("r3", it1.next());
assertStringValue("r3", it1.next());
assertEquals(
"The first iterator did not lookup in the cache for a resource", 3,
stringResourceIterator.cursor);
"The first iterator did not lookup in the cache for a resource", 3,
stringResourceIterator.cursor);

try {
it1.next();
@@ -177,8 +177,8 @@ public class LazyResourceCollectionTest {
// ok
}
}
private void assertStringValue(String expected, Resource r) {
assertEquals(expected, r.as(StringResource.class).getValue());
}
private void assertStringValue(String expected, Resource r) {
assertEquals(expected, r.as(StringResource.class).getValue());
}
}

Loading…
Cancel
Save