mirror of https://github.com/apache/ant-ivy
Generics and other fixes in tests and tutorials
This commit is contained in:
parent
4c6450f458
commit
8b9f2d5177
32
ivy.xml
32
ivy.xml
|
|
@ -26,7 +26,7 @@
|
|||
Apache Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
|
||||
</description>
|
||||
</info>
|
||||
<configurations>
|
||||
<configurations defaultconfmapping="*->default">
|
||||
<conf name="core" description="only ivy jar, without any dependencies"/>
|
||||
<conf name="httpclient" extends="core" description="core + optional httpclient for better http handling"/>
|
||||
<conf name="oro" extends="core" description="to use optional glob matcher"/>
|
||||
|
|
@ -35,32 +35,32 @@
|
|||
<conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
|
||||
<conf name="ant" extends="core" description="core + ant jar provided as a dependency"/>
|
||||
<conf name="default" extends="core" description="full ivy with all dependencies"/>
|
||||
<conf name="test" description="dependencies used for junit testing ivy" visibility="private" />
|
||||
<conf name="source" description="ivy sources" />
|
||||
<conf name="test" description="dependencies used for junit testing ivy" visibility="private"/>
|
||||
<conf name="source" description="ivy sources"/>
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact name="ivy" type="jar" conf="core"/>
|
||||
<artifact name="ivy" type="source" ext="jar" conf="source"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant->default"/>
|
||||
<dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant"/>
|
||||
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="default,httpclient->runtime,master"/>
|
||||
<dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
|
||||
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default"/>
|
||||
<dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="oro" name="oro" rev="2.0.8" conf="default,oro"/>
|
||||
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs"/>
|
||||
<dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp"/>
|
||||
<dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default"/>
|
||||
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default"/>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
|
||||
<dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test->default"/>
|
||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test->default" transitive="false"/>
|
||||
<dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test->default" transitive="false"/>
|
||||
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test->default" transitive="false"/>
|
||||
<dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test->default" transitive="false"/>
|
||||
<dependency org="junit" name="junit" rev="4.12" conf="test"/>
|
||||
<dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test"/>
|
||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test" transitive="false"/>
|
||||
<dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test" transitive="false"/>
|
||||
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test" transitive="false"/>
|
||||
<dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test" transitive="false"/>
|
||||
|
||||
<!-- Global exclude for junit and hamcrest -->
|
||||
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ public class CCFilter implements IFilter {
|
|||
return values;
|
||||
}
|
||||
|
||||
List result = new ArrayList(Arrays.asList(values));
|
||||
List<String> result = new ArrayList<String>(Arrays.asList(values));
|
||||
CollectionUtils.filter(result, new Predicate() {
|
||||
public boolean evaluate(Object o) {
|
||||
return o != null && o.toString().startsWith(prefix);
|
||||
}
|
||||
});
|
||||
return (String[]) result.toArray(new String[result.size()]);
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ public class HMFilter implements IFilter {
|
|||
if (prefix == null) {
|
||||
return values;
|
||||
}
|
||||
List result = new ArrayList();
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
String string = values[i];
|
||||
if (string != null && string.startsWith(prefix)) {
|
||||
result.add(string);
|
||||
}
|
||||
}
|
||||
return (String[]) result.toArray(new String[result.size()]);
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import org.junit.Test;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public abstract class AbstractTestFilter {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public final class FindFile {
|
|||
private static Collection find(Collection files, final String name) {
|
||||
return CollectionUtils.select(files, new Predicate() {
|
||||
public boolean evaluate(Object o) {
|
||||
return ((File) o).getName().indexOf(name) != -1;
|
||||
return ((File) o).getName().contains(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public final class Main {
|
|||
String name = line.getOptionValue("name", "jar");
|
||||
Collection files = FindFile.find(dir, name);
|
||||
System.out.println("listing files in " + dir + " containing " + name);
|
||||
for (Iterator it = files.iterator(); it.hasNext();) {
|
||||
System.out.println("\t" + it.next() + "\n");
|
||||
for (Object file : files) {
|
||||
System.out.println("\t" + file + "\n");
|
||||
}
|
||||
} catch (ParseException exp) {
|
||||
// oops, something went wrong
|
||||
|
|
|
|||
|
|
@ -35,9 +35,8 @@ public final class ListFile {
|
|||
|
||||
private static Collection list(File file, Collection files) {
|
||||
if (file.isDirectory()) {
|
||||
File[] f = file.listFiles();
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
list(f[i], files);
|
||||
for (File f : file.listFiles()) {
|
||||
list(f, files);
|
||||
}
|
||||
} else {
|
||||
files.add(file);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ public final class FileSize {
|
|||
|
||||
public static long totalSize(Collection files) {
|
||||
long total = 0;
|
||||
for (Iterator it = files.iterator(); it.hasNext();) {
|
||||
File f = (File) it.next();
|
||||
total += f.length();
|
||||
for (Object file : files) {
|
||||
total += ((File) file).length();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,15 +86,13 @@ public class VfsResource implements Resource {
|
|||
*
|
||||
* @return A <code>ArrayList</code> of VFSResources
|
||||
*/
|
||||
public List getChildren() {
|
||||
public List<String> getChildren() {
|
||||
init();
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
try {
|
||||
if ((resourceImpl != null) && resourceImpl.exists()
|
||||
&& (resourceImpl.getType() == FileType.FOLDER)) {
|
||||
FileObject[] children = resourceImpl.getChildren();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
FileObject child = children[i];
|
||||
for (FileObject child : resourceImpl.getChildren()) {
|
||||
list.add(normalize(child.getName().getURI()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
|
|
@ -64,7 +65,7 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource;
|
|||
*/
|
||||
public class TestFixture {
|
||||
|
||||
private Collection mds = new ArrayList();
|
||||
private final Collection<ModuleDescriptor> mds = new ArrayList<ModuleDescriptor>();
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -95,8 +94,8 @@ public class TestHelper {
|
|||
* the3 mrids to test
|
||||
*/
|
||||
public static void assertModuleRevisionIds(String expectedMrids,
|
||||
Collection/* <ModuleRevisionId> */mrids) {
|
||||
Collection expected = parseMrids(expectedMrids);
|
||||
Collection<ModuleRevisionId> mrids) {
|
||||
Collection<ModuleRevisionId> expected = parseMrids(expectedMrids);
|
||||
assertEquals(expected, mrids);
|
||||
}
|
||||
|
||||
|
|
@ -108,11 +107,11 @@ public class TestHelper {
|
|||
* the text representation of the {@link ModuleRevisionId}
|
||||
* @return a collection of {@link ModuleRevisionId}
|
||||
*/
|
||||
public static Collection parseMrids(String mrids) {
|
||||
public static Collection<ModuleRevisionId> parseMrids(String mrids) {
|
||||
String[] m = mrids.split(",?\\s+");
|
||||
Collection c = new LinkedHashSet();
|
||||
for (int i = 0; i < m.length; i++) {
|
||||
c.add(ModuleRevisionId.parse(m[i]));
|
||||
Collection<ModuleRevisionId> c = new LinkedHashSet<ModuleRevisionId>();
|
||||
for (String s : m) {
|
||||
c.add(ModuleRevisionId.parse(s));
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
|
@ -126,8 +125,8 @@ public class TestHelper {
|
|||
* @return an array of {@link ModuleRevisionId}
|
||||
*/
|
||||
public static ModuleRevisionId[] parseMridsToArray(String mrids) {
|
||||
Collection parsedMrids = parseMrids(mrids);
|
||||
return (ModuleRevisionId[]) parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
|
||||
Collection<ModuleRevisionId> parsedMrids = parseMrids(mrids);
|
||||
return parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,9 +184,8 @@ public class TestHelper {
|
|||
ModuleRevisionId.parse(m.group(1)), new Date());
|
||||
String mrids = m.group(2);
|
||||
if (mrids != null) {
|
||||
Collection depMrids = parseMrids(mrids);
|
||||
for (Iterator iter = depMrids.iterator(); iter.hasNext();) {
|
||||
ModuleRevisionId dep = (ModuleRevisionId) iter.next();
|
||||
Collection<ModuleRevisionId> depMrids = parseMrids(mrids);
|
||||
for (ModuleRevisionId dep : depMrids) {
|
||||
md.addDependency(new DefaultDependencyDescriptor(dep, false));
|
||||
}
|
||||
}
|
||||
|
|
@ -204,11 +202,11 @@ public class TestHelper {
|
|||
* the text representation of the collection of module descriptors
|
||||
* @return the collection of module descriptors parsed
|
||||
*/
|
||||
public static Collection/* <ModuleDescriptor> */parseMicroIvyDescriptors(String microIvy) {
|
||||
public static Collection<ModuleDescriptor> parseMicroIvyDescriptors(String microIvy) {
|
||||
String[] mds = microIvy.split("\\s*;;\\s*");
|
||||
Collection r = new ArrayList();
|
||||
for (int i = 0; i < mds.length; i++) {
|
||||
r.add(parseMicroIvyDescriptor(mds[i]));
|
||||
Collection<ModuleDescriptor> r = new ArrayList<ModuleDescriptor>();
|
||||
for (String md : mds) {
|
||||
r.add(parseMicroIvyDescriptor(md));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
|
@ -223,13 +221,12 @@ public class TestHelper {
|
|||
* @throws IOException
|
||||
* if an IO problem occurs while filling the repository
|
||||
*/
|
||||
public static void fillRepository(DependencyResolver resolver,
|
||||
Collection/* <ModuleDescriptor> */mds) throws IOException {
|
||||
public static void fillRepository(DependencyResolver resolver, Collection<ModuleDescriptor> mds)
|
||||
throws IOException {
|
||||
File tmp = File.createTempFile("ivy", "tmp");
|
||||
try {
|
||||
for (Iterator iter = mds.iterator(); iter.hasNext();) {
|
||||
for (ModuleDescriptor md : mds) {
|
||||
boolean overwrite = false;
|
||||
ModuleDescriptor md = (ModuleDescriptor) iter.next();
|
||||
resolver.beginPublishTransaction(md.getModuleRevisionId(), overwrite);
|
||||
boolean published = false;
|
||||
try {
|
||||
|
|
@ -237,9 +234,8 @@ public class TestHelper {
|
|||
resolver.publish(md.getMetadataArtifact(), tmp, overwrite);
|
||||
tmp.delete();
|
||||
tmp.createNewFile();
|
||||
Artifact[] artifacts = md.getAllArtifacts();
|
||||
for (int i = 0; i < artifacts.length; i++) {
|
||||
resolver.publish(artifacts[i], tmp, overwrite);
|
||||
for (Artifact artifact : md.getAllArtifacts()) {
|
||||
resolver.publish(artifact, tmp, overwrite);
|
||||
}
|
||||
resolver.commitPublishTransaction();
|
||||
published = true;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class AntBuildResolverTest {
|
|||
resolve.setKeep(true);
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report = project.getReference("ivy.resolved.report");
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
assertEquals(MRID_MODULE1, report.getDependencies().get(0).getResolvedId());
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ public class AntBuildResolverTest {
|
|||
resolve.setKeep(true);
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report = project.getReference("ivy.resolved.report");
|
||||
assertEquals(2, report.getDependencies().size());
|
||||
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
|
||||
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
|
||||
|
|
@ -122,7 +122,7 @@ public class AntBuildResolverTest {
|
|||
resolve.setKeep(true);
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report = project.getReference("ivy.resolved.report");
|
||||
assertEquals(2, report.getDependencies().size());
|
||||
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
|
||||
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
|
||||
|
|
@ -143,7 +143,7 @@ public class AntBuildResolverTest {
|
|||
resolve.setKeep(true);
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report = project.getReference("ivy.resolved.report");
|
||||
assertEquals(2, report.getDependencies().size());
|
||||
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
|
||||
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
|
||||
|
|
@ -170,7 +170,7 @@ public class AntBuildResolverTest {
|
|||
cachePath.setPathid("test.cachepath.id");
|
||||
cachePath.execute();
|
||||
|
||||
Path path = (Path) project.getReference("test.cachepath.id");
|
||||
Path path = project.getReference("test.cachepath.id");
|
||||
assertEquals(2, path.size());
|
||||
assertEquals(
|
||||
new File("test/workspace/project1/target/dist/jars/project1.jar").getAbsolutePath(),
|
||||
|
|
@ -194,7 +194,7 @@ public class AntBuildResolverTest {
|
|||
cachePath.setPathid("test.cachepath.id");
|
||||
cachePath.execute();
|
||||
|
||||
Path path = (Path) project.getReference("test.cachepath.id");
|
||||
Path path = project.getReference("test.cachepath.id");
|
||||
assertEquals(2, path.size());
|
||||
assertEquals(new File("test/workspace/project1/target/classes").getAbsolutePath(),
|
||||
path.list()[0]);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
||||
|
|
@ -215,10 +216,10 @@ public class FixDepsTaskTest {
|
|||
toString(Arrays.asList(md2.getDependencies())));
|
||||
}
|
||||
|
||||
private List/* <String> */toString(List list) {
|
||||
List strings = new ArrayList(list.size());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
strings.add(list.get(i).toString());
|
||||
private List<String> toString(List<DependencyDescriptor> list) {
|
||||
List<String> strings = new ArrayList<String>(list.size());
|
||||
for (DependencyDescriptor dd : list) {
|
||||
strings.add(dd.toString());
|
||||
}
|
||||
return strings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ public class IvyBuildListTest {
|
|||
fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
|
||||
|
||||
buildlist.addFileset(fs);
|
||||
buildlist.setOnMissingDescriptor(new String("tail")); // IVY-805: new String instance
|
||||
buildlist.setOnMissingDescriptor("tail"); // IVY-805: new String instance
|
||||
|
||||
String[] files = getFiles(buildlist);
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ public class IvyBuildListTest {
|
|||
fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
|
||||
|
||||
buildlist.addFileset(fs);
|
||||
buildlist.setOnMissingDescriptor(new String("skip")); // IVY-805: new String instance
|
||||
buildlist.setOnMissingDescriptor("skip"); // IVY-805: new String instance
|
||||
|
||||
String[] files = getFiles(buildlist);
|
||||
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ public class IvyDeliverTest {
|
|||
md.getModuleRevisionId());
|
||||
DependencyDescriptor[] dds = md.getDependencies();
|
||||
assertEquals(1, dds.length);
|
||||
Map extraAtt = new HashMap();
|
||||
Map<String, String> extraAtt = new HashMap<String, String>();
|
||||
extraAtt.put("myExtraAtt", "myValue");
|
||||
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt),
|
||||
dds[0].getDependencyRevisionId());
|
||||
|
|
@ -423,8 +423,8 @@ public class IvyDeliverTest {
|
|||
|
||||
File list = new File("build/test/retrieve");
|
||||
String[] files = list.list();
|
||||
HashSet actualFileSet = new HashSet(Arrays.asList(files));
|
||||
HashSet expectedFileSet = new HashSet();
|
||||
HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
|
||||
HashSet<String> expectedFileSet = new HashSet<String>();
|
||||
for (DependencyDescriptor dd : dds) {
|
||||
String name = dd.getDependencyId().getName();
|
||||
String rev = dd.getDependencyRevisionId().getRevision();
|
||||
|
|
@ -470,8 +470,8 @@ public class IvyDeliverTest {
|
|||
|
||||
File list = new File("build/test/retrieve");
|
||||
String[] files = list.list();
|
||||
HashSet actualFileSet = new HashSet(Arrays.asList(files));
|
||||
HashSet expectedFileSet = new HashSet();
|
||||
HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
|
||||
HashSet<String> expectedFileSet = new HashSet<String>();
|
||||
for (DependencyDescriptor dd : dds) {
|
||||
String name = dd.getDependencyId().getName();
|
||||
String rev = dd.getDependencyRevisionId().getRevision();
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("default,compile");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
reportAfter);
|
||||
|
|
@ -91,12 +91,12 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("default");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
reportAfter);
|
||||
|
|
@ -110,12 +110,12 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
reportAfter);
|
||||
|
|
@ -129,12 +129,12 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("*");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
reportAfter);
|
||||
|
|
@ -148,14 +148,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("compile");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
|
||||
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
|
||||
task.setConf("*");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertNotSame("IvyPostResolveTask hasn't performed a resolve where it should have",
|
||||
reportBefore, reportAfter);
|
||||
|
|
@ -170,7 +170,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("compile");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
|
||||
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ public class IvyPostResolveTaskTest {
|
|||
task.setKeep(false); // don't keep the resolve results
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertSame("IvyPostResolveTask has kept the resolve report where it should have",
|
||||
reportBefore, reportAfter);
|
||||
|
|
@ -194,7 +194,7 @@ public class IvyPostResolveTaskTest {
|
|||
task.setConf("*"); // will trigger a resolve
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertNull("IvyPostResolveTask has kept the resolve report where it should have",
|
||||
reportAfter);
|
||||
|
|
@ -211,7 +211,7 @@ public class IvyPostResolveTaskTest {
|
|||
task.setConf("*"); // will trigger a resolve
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
|
||||
assertNotNull("IvyPostResolveTask has kept the resolve report where it should have",
|
||||
reportAfter);
|
||||
|
|
@ -227,8 +227,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setResolveId("testResolveId");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report1 = (ResolveReport) project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
ResolveReport report1 = project.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
// perform another resolve
|
||||
resolve = new IvyResolve();
|
||||
|
|
@ -237,14 +236,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.setResolveId("testResolveId");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = (ResolveReport) project
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
|
|
@ -262,7 +261,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setResolveId("testResolveId");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report1 = (ResolveReport) project
|
||||
ResolveReport report1 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
// perform another resolve
|
||||
|
|
@ -272,14 +271,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.setResolveId("testResolveId");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = (ResolveReport) project
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
|
|
@ -297,7 +296,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setResolveId("testResolveId");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report1 = (ResolveReport) project
|
||||
ResolveReport report1 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
// perform another resolve
|
||||
|
|
@ -307,14 +306,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("default");
|
||||
task.setResolveId("testResolveId");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = (ResolveReport) project
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
|
|
@ -332,7 +331,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setResolveId("testResolveId");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report1 = (ResolveReport) project
|
||||
ResolveReport report1 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
// perform another resolve
|
||||
|
|
@ -342,14 +341,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("*");
|
||||
task.setResolveId("testResolveId");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = (ResolveReport) project
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
|
||||
|
|
@ -367,7 +366,7 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setResolveId("testResolveId");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report1 = (ResolveReport) project
|
||||
ResolveReport report1 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
|
||||
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
|
|
@ -379,14 +378,14 @@ public class IvyPostResolveTaskTest {
|
|||
resolve.setConf("*");
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport reportBefore = project.getReference("ivy.resolved.report");
|
||||
|
||||
task.setConf("*");
|
||||
task.setResolveId("testResolveId");
|
||||
task.execute();
|
||||
|
||||
ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = (ResolveReport) project
|
||||
ResolveReport reportAfter = project.getReference("ivy.resolved.report");
|
||||
ResolveReport report2 = project
|
||||
.getReference("ivy.resolved.report.testResolveId");
|
||||
|
||||
assertNotSame("IvyPostResolveTask hasn't performed a resolve where it should have",
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class IvyResolveTest {
|
|||
resolve.setKeep(true);
|
||||
resolve.execute();
|
||||
|
||||
ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
|
||||
ResolveReport report = project.getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getArtifacts().size());
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ivy.Ivy;
|
||||
|
|
@ -66,9 +65,7 @@ public class IvyResourcesTest {
|
|||
|
||||
private List asList(IvyResources ivyResources) {
|
||||
List resources = new ArrayList();
|
||||
Iterator it = ivyResources.iterator();
|
||||
while (it.hasNext()) {
|
||||
Object r = it.next();
|
||||
for (Object r : ivyResources) {
|
||||
assertTrue(r instanceof FileResource);
|
||||
resources.add(((FileResource) r).getFile());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ModuleIdTest {
|
|||
ModuleId moduleId = new ModuleId(org, name);
|
||||
ModuleId moduleId2 = new ModuleId(null, name);
|
||||
|
||||
assertFalse(moduleId.equals(null));
|
||||
assertNotNull(moduleId);
|
||||
assertFalse(moduleId.equals(moduleId2));
|
||||
assertFalse(moduleId2.equals(moduleId));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.core.IvyContext;
|
||||
|
|
@ -247,8 +246,8 @@ public class PublishEventsTest {
|
|||
// set an error to be thrown during publication of the data file.
|
||||
this.publishError = new IOException("boom!");
|
||||
// we don't care which artifact is attempted; either will fail with an IOException.
|
||||
for (Iterator it = expectedPublications.values().iterator(); it.hasNext();) {
|
||||
((PublishTestCase) it.next()).expectedSuccess = false;
|
||||
for (Object o : expectedPublications.values()) {
|
||||
((PublishTestCase) o).expectedSuccess = false;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ public class SearchTest {
|
|||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
|
||||
|
||||
Map otherTokenValues = new HashMap();
|
||||
Map<String, Object> otherTokenValues = new HashMap<String, Object>();
|
||||
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
|
||||
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
|
||||
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
|
||||
|
||||
assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1"})),
|
||||
new HashSet(Arrays.asList(revs)));
|
||||
assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1"})),
|
||||
new HashSet<String>(Arrays.asList(revs)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -57,13 +57,13 @@ public class SearchTest {
|
|||
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
|
||||
((IBiblioResolver) ivy.getSettings().getResolver("m2")).setUseMavenMetadata(false);
|
||||
|
||||
Map otherTokenValues = new HashMap();
|
||||
Map<String, Object> otherTokenValues = new HashMap<String, Object>();
|
||||
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
|
||||
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
|
||||
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
|
||||
|
||||
assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1", "1.2"})), new HashSet(
|
||||
Arrays.asList(revs)));
|
||||
assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1", "1.2"})),
|
||||
new HashSet<String>(Arrays.asList(revs)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -72,7 +72,7 @@ public class SearchTest {
|
|||
ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
|
||||
IvySettings settings = ivy.getSettings();
|
||||
|
||||
Map extendedAttributes = new HashMap();
|
||||
Map<String, String> extendedAttributes = new HashMap<String, String>();
|
||||
extendedAttributes.put("e:att1", "extraatt");
|
||||
extendedAttributes.put("e:att2", "extraatt2");
|
||||
ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", "*",
|
||||
|
|
@ -85,12 +85,12 @@ public class SearchTest {
|
|||
ModuleRevisionId mrid = mrids[0];
|
||||
assertEquals("extraatt", mrid.getExtraAttribute("att1"));
|
||||
|
||||
Map extraAttributes = mrid.getExtraAttributes();
|
||||
Map<String, String> extraAttributes = mrid.getExtraAttributes();
|
||||
assertEquals(2, extraAttributes.size());
|
||||
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att1"));
|
||||
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att2"));
|
||||
|
||||
Map qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
|
||||
Map<String, String> qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
|
||||
assertEquals(2, qualifiedExtraAttributes.size());
|
||||
assertTrue(qualifiedExtraAttributes.toString(),
|
||||
qualifiedExtraAttributes.keySet().contains("e:att1"));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
||||
|
|
@ -83,9 +82,8 @@ public class SortTest {
|
|||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
List toSort = (List) it.next();
|
||||
Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (List<ModuleDescriptor> toSort : permutations) {
|
||||
assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
|
||||
}
|
||||
}
|
||||
|
|
@ -106,9 +104,8 @@ public class SortTest {
|
|||
{md2, md3, md4, md1}, {md3, md4, md1, md2}, {md4, md1, md2, md3},
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
List toSort = (List) it.next();
|
||||
Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (List<ModuleDescriptor> toSort : permutations) {
|
||||
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
|
||||
}
|
||||
}
|
||||
|
|
@ -124,9 +121,8 @@ public class SortTest {
|
|||
// {md3, md1, md2, md4}
|
||||
// we don't have this solution. The loops appear has one contiguous element.
|
||||
};
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
List toSort = (List) it.next();
|
||||
Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (List<ModuleDescriptor> toSort : permutations) {
|
||||
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +136,7 @@ public class SortTest {
|
|||
addDependency(md3, "md4", "rev4");
|
||||
addDependency(md4, "md1", "rev1");
|
||||
addDependency(md4, "md2", "rev2");
|
||||
List toSort = Arrays.asList(new Object[] {md1, md2, md3, md4});
|
||||
List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md1, md2, md3, md4});
|
||||
sortModuleDescriptors(toSort, nonMatchReporter);
|
||||
// If it ends, it's ok.
|
||||
}
|
||||
|
|
@ -188,7 +184,7 @@ public class SortTest {
|
|||
CircularDependencyReporterMock circularDepReportMock = new CircularDependencyReporterMock();
|
||||
settings.setCircularDependencyStrategy(circularDepReportMock);
|
||||
|
||||
List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
|
||||
List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
|
||||
sortModuleDescriptors(toSort, nonMatchReporter);
|
||||
|
||||
circularDepReportMock.validate();
|
||||
|
|
@ -210,9 +206,8 @@ public class SortTest {
|
|||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
List toSort = (List) it.next();
|
||||
Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (List<ModuleDescriptor> toSort : permutations) {
|
||||
assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
|
||||
}
|
||||
|
||||
|
|
@ -237,9 +232,8 @@ public class SortTest {
|
|||
DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
List toSort = (List) it.next();
|
||||
Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (List<ModuleDescriptor> toSort : permutations) {
|
||||
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
|
||||
}
|
||||
|
||||
|
|
@ -273,12 +267,12 @@ public class SortTest {
|
|||
}
|
||||
}
|
||||
NonMatchingVersionReporterMock nonMatchingVersionReporterMock = new NonMatchingVersionReporterMock();
|
||||
List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
|
||||
List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
|
||||
sortModuleDescriptors(toSort, nonMatchingVersionReporterMock);
|
||||
nonMatchingVersionReporterMock.validate();
|
||||
}
|
||||
|
||||
private List sortModuleDescriptors(List toSort,
|
||||
private List<ModuleDescriptor> sortModuleDescriptors(List<ModuleDescriptor> toSort,
|
||||
NonMatchingVersionReporter nonMatchingVersionReporter) {
|
||||
return sortEngine.sortModuleDescriptors(toSort,
|
||||
new SortOptions().setNonMatchingVersionReporter(nonMatchingVersionReporter));
|
||||
|
|
@ -299,16 +293,16 @@ public class SortTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Verifies that sorted in one of the list of listOfPossibleSort.
|
||||
* Verifies that sorted is one of the lists of listOfPossibleSort.
|
||||
*
|
||||
* @param listOfPossibleSort
|
||||
* array of possible sort result
|
||||
* @param sorted
|
||||
* actual sortedList to compare
|
||||
*/
|
||||
private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort, List sorted) {
|
||||
for (int i = 0; i < listOfPossibleSort.length; i++) {
|
||||
DefaultModuleDescriptor[] expectedList = listOfPossibleSort[i];
|
||||
private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort,
|
||||
List<ModuleDescriptor> sorted) {
|
||||
for (DefaultModuleDescriptor[] expectedList : listOfPossibleSort) {
|
||||
assertEquals(expectedList.length, sorted.size());
|
||||
boolean isExpected = true;
|
||||
for (int j = 0; j < expectedList.length; j++) {
|
||||
|
|
@ -328,7 +322,7 @@ public class SortTest {
|
|||
if (i > 0) {
|
||||
errorMessage.append(" , ");
|
||||
}
|
||||
errorMessage.append(((DefaultModuleDescriptor) sorted.get(i)).getModuleRevisionId());
|
||||
errorMessage.append(sorted.get(i).getModuleRevisionId());
|
||||
}
|
||||
errorMessage.append("}\nExpected : \n");
|
||||
for (int i = 0; i < listOfPossibleSort.length; i++) {
|
||||
|
|
@ -349,33 +343,34 @@ public class SortTest {
|
|||
}
|
||||
|
||||
/** Returns a collection of lists that contains the elements a,b,c and d */
|
||||
private Collection getAllLists(Object a, Object b, Object c, Object d) {
|
||||
private Collection<List<ModuleDescriptor>> getAllLists(ModuleDescriptor a, ModuleDescriptor b,
|
||||
ModuleDescriptor c, ModuleDescriptor d) {
|
||||
final int nbOfList = 24;
|
||||
ArrayList r = new ArrayList(nbOfList);
|
||||
r.add(Arrays.asList(new Object[] {a, b, c, d}));
|
||||
r.add(Arrays.asList(new Object[] {a, b, d, c}));
|
||||
r.add(Arrays.asList(new Object[] {a, c, b, d}));
|
||||
r.add(Arrays.asList(new Object[] {a, c, d, b}));
|
||||
r.add(Arrays.asList(new Object[] {a, d, b, c}));
|
||||
r.add(Arrays.asList(new Object[] {a, d, c, b}));
|
||||
r.add(Arrays.asList(new Object[] {b, a, c, d}));
|
||||
r.add(Arrays.asList(new Object[] {b, a, d, c}));
|
||||
r.add(Arrays.asList(new Object[] {b, c, a, d}));
|
||||
r.add(Arrays.asList(new Object[] {b, c, d, a}));
|
||||
r.add(Arrays.asList(new Object[] {b, d, a, c}));
|
||||
r.add(Arrays.asList(new Object[] {b, d, c, a}));
|
||||
r.add(Arrays.asList(new Object[] {c, b, a, d}));
|
||||
r.add(Arrays.asList(new Object[] {c, b, d, a}));
|
||||
r.add(Arrays.asList(new Object[] {c, a, b, d}));
|
||||
r.add(Arrays.asList(new Object[] {c, a, d, b}));
|
||||
r.add(Arrays.asList(new Object[] {c, d, b, a}));
|
||||
r.add(Arrays.asList(new Object[] {c, d, a, b}));
|
||||
r.add(Arrays.asList(new Object[] {d, b, c, a}));
|
||||
r.add(Arrays.asList(new Object[] {d, b, a, c}));
|
||||
r.add(Arrays.asList(new Object[] {d, c, b, a}));
|
||||
r.add(Arrays.asList(new Object[] {d, c, a, b}));
|
||||
r.add(Arrays.asList(new Object[] {d, a, b, c}));
|
||||
r.add(Arrays.asList(new Object[] {d, a, c, b}));
|
||||
Collection<List<ModuleDescriptor>> r = new ArrayList<List<ModuleDescriptor>>(nbOfList);
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, b, c, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, b, d, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, c, b, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, c, d, b}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, d, b, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {a, d, c, b}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, a, c, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, a, d, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, c, a, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, c, d, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, d, a, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {b, d, c, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, b, a, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, b, d, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, a, b, d}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, a, d, b}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, d, b, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {c, d, a, b}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, b, c, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, b, a, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, c, b, a}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, c, a, b}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, a, b, c}));
|
||||
r.add(Arrays.asList(new ModuleDescriptor[] {d, a, c, b}));
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ public class LatestConflictManagerTest {
|
|||
String[] confs = report.getConfigurations();
|
||||
while (dependencies.hasNext()) {
|
||||
IvyNode node = (IvyNode) dependencies.next();
|
||||
for (int i = 0; i < confs.length; i++) {
|
||||
String conf = confs[i];
|
||||
for (String conf : confs) {
|
||||
if (!node.isEvicted(conf)) {
|
||||
boolean flag1 = report.getConfigurationReport(conf).getDependency(
|
||||
node.getResolvedId()) != null;
|
||||
|
|
@ -85,9 +84,7 @@ public class LatestConflictManagerTest {
|
|||
ResolveReport report = ivy.resolve(
|
||||
LatestConflictManagerTest.class.getResource("ivy-383.xml"), getResolveOptions());
|
||||
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
|
||||
Iterator iter = defaultReport.getModuleRevisionIds().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
|
||||
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
|
||||
if (mrid.getName().equals("mod1.1")) {
|
||||
assertEquals("1.0", mrid.getRevision());
|
||||
} else if (mrid.getName().equals("mod1.2")) {
|
||||
|
|
@ -114,9 +111,7 @@ public class LatestConflictManagerTest {
|
|||
LatestConflictManagerTest.class.getResource("ivy-latest-time-1.xml"),
|
||||
getResolveOptions());
|
||||
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
|
||||
Iterator iter = defaultReport.getModuleRevisionIds().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
|
||||
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
|
||||
if (mrid.getName().equals("mod1.1")) {
|
||||
assertEquals("1.0", mrid.getRevision());
|
||||
} else if (mrid.getName().equals("mod1.2")) {
|
||||
|
|
@ -142,9 +137,7 @@ public class LatestConflictManagerTest {
|
|||
LatestConflictManagerTest.class.getResource("ivy-latest-time-2.xml"),
|
||||
getResolveOptions());
|
||||
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
|
||||
Iterator iter = defaultReport.getModuleRevisionIds().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
|
||||
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
|
||||
if (mrid.getName().equals("mod1.1")) {
|
||||
assertEquals("1.0", mrid.getRevision());
|
||||
} else if (mrid.getName().equals("mod1.2")) {
|
||||
|
|
@ -180,10 +173,7 @@ public class LatestConflictManagerTest {
|
|||
LatestConflictManagerTest.class.getResource("ivy-latest-time-transitivity.xml"),
|
||||
getResolveOptions());
|
||||
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
|
||||
Iterator iter = defaultReport.getModuleRevisionIds().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
|
||||
|
||||
for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
|
||||
if (mrid.getName().equals("A")) {
|
||||
assertEquals("A revision should be 1.0.0", "1.0.0", mrid.getRevision());
|
||||
} else if (mrid.getName().equals("D")) {
|
||||
|
|
|
|||
|
|
@ -52,20 +52,20 @@ public abstract class AbstractPatternMatcherTest {
|
|||
|
||||
// test some exact patterns for this matcher
|
||||
String[] expressions = getExactExpressions();
|
||||
for (int i = 0; i < expressions.length; i++) {
|
||||
matcher = patternMatcher.getMatcher(expressions[i]);
|
||||
assertTrue("Expression '" + expressions[i] + "' should be exact", matcher.isExact());
|
||||
for (String expression : expressions) {
|
||||
matcher = patternMatcher.getMatcher(expression);
|
||||
assertTrue("Expression '" + expression + "' should be exact", matcher.isExact());
|
||||
matcher.matches("The words aren't what they were.");
|
||||
assertTrue("Expression '" + expressions[i] + "' should be exact", matcher.isExact());
|
||||
assertTrue("Expression '" + expression + "' should be exact", matcher.isExact());
|
||||
}
|
||||
|
||||
// test some inexact patterns for this matcher
|
||||
expressions = getInexactExpressions();
|
||||
for (int i = 0; i < expressions.length; i++) {
|
||||
matcher = patternMatcher.getMatcher(expressions[i]);
|
||||
assertFalse("Expression '" + expressions[i] + "' should be inexact", matcher.isExact());
|
||||
for (String expression : expressions) {
|
||||
matcher = patternMatcher.getMatcher(expression);
|
||||
assertFalse("Expression '" + expression + "' should be inexact", matcher.isExact());
|
||||
matcher.matches("The words aren't what they were.");
|
||||
assertFalse("Expression '" + expressions[i] + "' should be inexact", matcher.isExact());
|
||||
assertFalse("Expression '" + expression + "' should be inexact", matcher.isExact());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -301,9 +301,8 @@ public class XmlModuleUpdaterTest {
|
|||
assertEquals("Number of published artifacts incorrect", 4, artifacts.length);
|
||||
|
||||
// test that the correct configuration has been removed
|
||||
for (int i = 0; i < artifacts.length; i++) {
|
||||
Artifact current = artifacts[i];
|
||||
List currentConfs = Arrays.asList(current.getConfigurations());
|
||||
for (Artifact current : artifacts) {
|
||||
List<String> currentConfs = Arrays.asList(current.getConfigurations());
|
||||
assertTrue("myconf2 hasn't been removed for artifact " + current.getName(),
|
||||
!currentConfs.contains("myconf2"));
|
||||
}
|
||||
|
|
@ -327,13 +326,14 @@ public class XmlModuleUpdaterTest {
|
|||
assertEquals("Number of dependencies is incorrect", 8, deps.length);
|
||||
|
||||
// check that none of the dependencies contains myconf2
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
String name = deps[i].getDependencyId().getName();
|
||||
for (DependencyDescriptor dep : deps) {
|
||||
String name = dep.getDependencyId().getName();
|
||||
assertFalse("Dependency " + name + " shouldn't have myconf2 as module configuration",
|
||||
Arrays.asList(deps[i].getModuleConfigurations()).contains("myconf2"));
|
||||
assertEquals("Dependency " + name
|
||||
+ " shouldn't have a dependency artifact for configuration myconf2", 0,
|
||||
deps[i].getDependencyArtifacts("myconf2").length);
|
||||
Arrays.asList(dep.getModuleConfigurations()).contains("myconf2"));
|
||||
assertEquals(
|
||||
"Dependency " + name
|
||||
+ " shouldn't have a dependency artifact for configuration myconf2",
|
||||
0, dep.getDependencyArtifacts("myconf2").length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.apache.ivy.plugins.repository.vfs;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
|
|
@ -80,9 +79,7 @@ public class VfsRepositoryTest {
|
|||
String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
|
||||
String destFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource);
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
|
||||
if (scratchDir.exists()) {
|
||||
FileUtil.forceDelete(scratchDir);
|
||||
}
|
||||
|
|
@ -110,10 +107,7 @@ public class VfsRepositoryTest {
|
|||
String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
|
||||
File destFile = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
|
||||
// remove existing scratch dir and populate it with an empty file
|
||||
// that we can overwrite. We do this so that we can test file sizes.
|
||||
// seeded file has length 0, while put file will have a length > 0
|
||||
|
|
@ -150,9 +144,7 @@ public class VfsRepositoryTest {
|
|||
destFile.getParentFile().mkdirs();
|
||||
destFile.createNewFile();
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
|
||||
repo.put(new File(srcFile), vfsURI.toString(), false);
|
||||
}
|
||||
}
|
||||
|
|
@ -167,9 +159,7 @@ public class VfsRepositoryTest {
|
|||
String testResource = VfsTestHelper.TEST_IVY_XML;
|
||||
String testFile = FileUtil.concat(scratchDir.getAbsolutePath(), testResource);
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
|
||||
if (scratchDir.exists()) {
|
||||
FileUtil.forceDelete(scratchDir);
|
||||
}
|
||||
|
|
@ -195,10 +185,7 @@ public class VfsRepositoryTest {
|
|||
String testResource = VfsTestHelper.TEST_IVY_XML;
|
||||
File testFile = new File(FileUtil.concat(scratchDir.getAbsolutePath(), testResource));
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
|
||||
// setup - remove existing scratch area and populate with a file to override
|
||||
if (scratchDir.exists()) {
|
||||
FileUtil.forceDelete(scratchDir);
|
||||
|
|
@ -227,10 +214,7 @@ public class VfsRepositoryTest {
|
|||
public void testGetResourceValidExist() throws Exception {
|
||||
String testResource = VfsTestHelper.TEST_IVY_XML;
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
|
||||
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
|
||||
try {
|
||||
assertNotNull(repo.getResource(vfsURI.toString()));
|
||||
} catch (IOException e) {
|
||||
|
|
@ -248,10 +232,7 @@ public class VfsRepositoryTest {
|
|||
public void testGetResourceValidNoExist() throws Exception {
|
||||
String testResource = VfsTestHelper.SCRATCH_DIR + "/nosuchfile.jar";
|
||||
|
||||
Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
|
||||
// make sure the declared resource does not exist
|
||||
if (scratchDir.exists()) {
|
||||
FileUtil.forceDelete(scratchDir);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import java.net.URI;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.After;
|
||||
|
|
@ -52,9 +51,7 @@ public class VfsResourceTest {
|
|||
*/
|
||||
@Test
|
||||
public void testCreateResourceThatExists() throws Exception {
|
||||
Iterator vfsURIs = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
|
||||
String resId = vfsURI.toString();
|
||||
VfsResource res = new VfsResource(resId, helper.fsManager);
|
||||
assertNotNull("Unexpected null value on VFS URI: " + resId, res);
|
||||
|
|
@ -93,9 +90,7 @@ public class VfsResourceTest {
|
|||
*/
|
||||
@Test
|
||||
public void testCreateResourceThatDoesntExist() throws Exception {
|
||||
Iterator vfsURIs = helper.createVFSUriSet("zzyyxx.zzyyxx").iterator();
|
||||
while (vfsURIs.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) vfsURIs.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet("zzyyxx.zzyyxx")) {
|
||||
String resId = vfsURI.toString();
|
||||
VfsResource res = new VfsResource(resId, helper.fsManager);
|
||||
assertNotNull("Unexpected null value on VFS URI: " + resId, res);
|
||||
|
|
@ -141,24 +136,19 @@ public class VfsResourceTest {
|
|||
@Test
|
||||
public void testListFolderChildren() throws Exception {
|
||||
final String testFolder = "2/mod10.1";
|
||||
final List expectedFiles = Arrays.asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml",
|
||||
"ivy-1.2.xml", "ivy-1.3.xml"});
|
||||
final List<String> expectedFiles = Arrays
|
||||
.asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml", "ivy-1.2.xml", "ivy-1.3.xml"});
|
||||
|
||||
Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
|
||||
while (baseVfsURIs.hasNext()) {
|
||||
VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();
|
||||
|
||||
List expected = new ArrayList();
|
||||
for (int i = 0; i < expectedFiles.size(); i++) {
|
||||
String resId = baseVfsURI.toString() + "/" + expectedFiles.get(i);
|
||||
for (VfsURI baseVfsURI : helper.createVFSUriSet(testFolder)) {
|
||||
List<String> expected = new ArrayList<String>();
|
||||
for (String expectedFile : expectedFiles) {
|
||||
String resId = baseVfsURI.toString() + "/" + expectedFile;
|
||||
expected.add(resId);
|
||||
}
|
||||
|
||||
List actual = new ArrayList();
|
||||
List<String> actual = new ArrayList<String>();
|
||||
VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
|
||||
Iterator children = res.getChildren().iterator();
|
||||
while (children.hasNext()) {
|
||||
String resId = (String) children.next();
|
||||
for (String resId : res.getChildren()) {
|
||||
// remove entries ending in .svn
|
||||
if (!resId.endsWith(".svn")) {
|
||||
actual.add(resId);
|
||||
|
|
@ -178,13 +168,11 @@ public class VfsResourceTest {
|
|||
*/
|
||||
@Test
|
||||
public void testListFileChildren() throws Exception {
|
||||
Iterator testSet = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
|
||||
while (testSet.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) testSet.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
|
||||
VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
|
||||
List results = res.getChildren();
|
||||
assertEquals("getChildren query on file provided results when it shouldn't have",
|
||||
0, results.size());
|
||||
List<String> results = res.getChildren();
|
||||
assertEquals("getChildren query on file provided results when it shouldn't have", 0,
|
||||
results.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,13 +182,11 @@ public class VfsResourceTest {
|
|||
*/
|
||||
@Test
|
||||
public void testListImaginary() throws Exception {
|
||||
Iterator testSet = helper.createVFSUriSet("idontexistzzxx").iterator();
|
||||
while (testSet.hasNext()) {
|
||||
VfsURI vfsURI = (VfsURI) testSet.next();
|
||||
for (VfsURI vfsURI : helper.createVFSUriSet("idontexistzzxx")) {
|
||||
VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
|
||||
List results = res.getChildren();
|
||||
assertEquals("getChildren query on file provided results when it shouldn't have",
|
||||
0, results.size());
|
||||
List<String> results = res.getChildren();
|
||||
assertEquals("getChildren query on file provided results when it shouldn't have", 0,
|
||||
results.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class VfsTestHelper {
|
|||
// setup and initialize VFS
|
||||
fsManager = new StandardFileSystemManager() {
|
||||
protected void configurePlugins() throws FileSystemException {
|
||||
// disable automatic loading potential unsupported extensions
|
||||
// disable automatic loading of potentially unsupported extensions
|
||||
}
|
||||
};
|
||||
fsManager.setConfiguration(getClass().getResource(VFS_CONF).toString());
|
||||
|
|
@ -75,10 +75,10 @@ public class VfsTestHelper {
|
|||
* name of the resource
|
||||
* @return <class>List</class> of well-formed VFS resource identifiers
|
||||
*/
|
||||
public List createVFSUriSet(String resource) {
|
||||
List set = new ArrayList();
|
||||
for (int i = 0; i < VfsURI.SUPPORTED_SCHEMES.length; i++) {
|
||||
set.add(VfsURI.vfsURIFactory(VfsURI.SUPPORTED_SCHEMES[i], resource, ivy));
|
||||
public List<VfsURI> createVFSUriSet(String resource) {
|
||||
List<VfsURI> set = new ArrayList<VfsURI>();
|
||||
for (String scheme : VfsURI.SUPPORTED_SCHEMES) {
|
||||
set.add(VfsURI.vfsURIFactory(scheme, resource, ivy));
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,8 +158,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
|
|||
assertNotNull(rmr);
|
||||
assertEquals("3", rmr.getResolver().getName());
|
||||
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
|
||||
for (int i = 0; i < resolvers.length; i++) {
|
||||
assertEquals(ddAsList, resolvers[i].askedDeps);
|
||||
for (MockResolver resolver : resolvers) {
|
||||
assertEquals(ddAsList, resolver.askedDeps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,8 +198,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
|
|||
assertNotNull(rmr);
|
||||
assertEquals("5", rmr.getResolver().getName());
|
||||
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
|
||||
for (int i = 0; i < resolvers.length; i++) {
|
||||
assertEquals(ddAsList, resolvers[i].askedDeps);
|
||||
for (MockResolver resolver : resolvers) {
|
||||
assertEquals(ddAsList, resolver.askedDeps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +282,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
|
|||
assertNotNull(rmr);
|
||||
assertEquals("5", rmr.getResolver().getName());
|
||||
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
|
||||
for (int i = 0; i < resolvers.length; i++) {
|
||||
assertEquals(ddAsList, resolvers[i].askedDeps);
|
||||
for (MockResolver resolver : resolvers) {
|
||||
assertEquals(ddAsList, resolver.askedDeps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,8 +375,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
|
|||
chain.setSettings(settings);
|
||||
MockResolver[] resolvers = new MockResolver[] {MockResolver.buildMockResolver(settings,
|
||||
"1", true, null)};
|
||||
for (int i = 0; i < resolvers.length; i++) {
|
||||
chain.add(resolvers[i]);
|
||||
for (MockResolver resolver : resolvers) {
|
||||
chain.add(resolver);
|
||||
}
|
||||
chain.getDependency(dd, data);
|
||||
// should not have asked any dependency, should have hit the cache
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
|
|||
Map[] valuesMaps = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
|
||||
otherTokenValues);
|
||||
Set vals = new HashSet();
|
||||
for (int i = 0; i < valuesMaps.length; i++) {
|
||||
vals.add(valuesMaps[i].get(IvyPatternHelper.MODULE_KEY));
|
||||
for (Map valuesMap : valuesMaps) {
|
||||
vals.add(valuesMap.get(IvyPatternHelper.MODULE_KEY));
|
||||
}
|
||||
values = (String[]) vals.toArray(new String[vals.size()]);
|
||||
assertEquals(1, values.length);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
package org.apache.ivy.util.url;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -40,23 +39,22 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveListing() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List files = lister.retrieveListing(
|
||||
List<URL> files = lister.retrieveListing(
|
||||
ApacheURLListerTest.class.getResource("apache-file-listing.html"), true, false);
|
||||
assertNotNull(files);
|
||||
assertTrue(files.size() > 0);
|
||||
for (Iterator iter = files.iterator(); iter.hasNext();) {
|
||||
URL file = (URL) iter.next();
|
||||
for (URL file : files) {
|
||||
assertTrue("found a non matching file: " + file,
|
||||
file.getPath().matches(".*/[^/]+\\.(jar|md5|sha1)"));
|
||||
}
|
||||
|
||||
// try a directory listing
|
||||
List dirs = lister.retrieveListing(
|
||||
List<URL> dirs = lister.retrieveListing(
|
||||
ApacheURLListerTest.class.getResource("apache-dir-listing.html"), false, true);
|
||||
assertNotNull(dirs);
|
||||
assertEquals(4, dirs.size());
|
||||
|
||||
List empty = lister.retrieveListing(
|
||||
List<URL> empty = lister.retrieveListing(
|
||||
ApacheURLListerTest.class.getResource("apache-dir-listing.html"), true, false);
|
||||
assertTrue(empty.isEmpty());
|
||||
}
|
||||
|
|
@ -70,7 +68,7 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveListingWithSpaces() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List files = lister.retrieveListing(
|
||||
List<URL> files = lister.retrieveListing(
|
||||
ApacheURLListerTest.class.getResource("listing-with-spaces.html"), true, false);
|
||||
assertNotNull(files);
|
||||
assertTrue(files.size() > 0);
|
||||
|
|
@ -80,7 +78,7 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveArtifactoryListing() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List files = lister.retrieveListing(
|
||||
List<URL> files = lister.retrieveListing(
|
||||
ApacheURLListerTest.class.getResource("artifactory-dir-listing.html"), true, true);
|
||||
assertNotNull(files);
|
||||
assertEquals(1, files.size());
|
||||
|
|
@ -90,7 +88,7 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveArchivaListing() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List d = lister.listDirectories(ApacheURLListerTest.class
|
||||
List<URL> d = lister.listDirectories(ApacheURLListerTest.class
|
||||
.getResource("archiva-listing.html"));
|
||||
assertNotNull(d);
|
||||
// archiva listing is not valid html at all currently (1.0, unclosed a tags),
|
||||
|
|
@ -102,7 +100,7 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveFixedArchivaListing() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List d = lister.listDirectories(ApacheURLListerTest.class
|
||||
List<URL> d = lister.listDirectories(ApacheURLListerTest.class
|
||||
.getResource("fixed-archiva-listing.html"));
|
||||
assertNotNull(d);
|
||||
assertEquals(3, d.size());
|
||||
|
|
@ -112,7 +110,7 @@ public class ApacheURLListerTest {
|
|||
public void testRetrieveMavenProxyListing() throws Exception {
|
||||
ApacheURLLister lister = new ApacheURLLister();
|
||||
|
||||
List d = lister.listDirectories(ApacheURLListerTest.class
|
||||
List<URL> d = lister.listDirectories(ApacheURLListerTest.class
|
||||
.getResource("maven-proxy-listing.html"));
|
||||
assertNotNull(d);
|
||||
assertEquals(3, d.size());
|
||||
|
|
|
|||
Loading…
Reference in New Issue