You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC
svn commit: r544459 [29/36] - in /incubator/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver...
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java Tue Jun 5 05:02:27 2007
@@ -3,70 +3,77 @@
import java.io.File;
import java.net.MalformedURLException;
+import junit.framework.TestCase;
+
import org.apache.ivy.Ivy;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Reference;
-import junit.framework.TestCase;
-
public class IvyTaskTest extends TestCase {
- public void testDefaultSettings() throws MalformedURLException {
- Project p = new Project();
- p.setBasedir("test/repositories");
- //p.setProperty("ivy.settings.file" , "ivysettings.xml");
- p.setProperty("myproperty", "myvalue");
- IvyTask task = new IvyTask() {
- public void doExecute() throws BuildException {
- }
- };
- task.setProject(p);
-
+ public void testDefaultSettings() throws MalformedURLException {
+ Project p = new Project();
+ p.setBasedir("test/repositories");
+ // p.setProperty("ivy.settings.file" , "ivysettings.xml");
+ p.setProperty("myproperty", "myvalue");
+ IvyTask task = new IvyTask() {
+ public void doExecute() throws BuildException {
+ }
+ };
+ task.setProject(p);
+
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
- IvySettings settings = ivy.getSettings();
+ IvySettings settings = ivy.getSettings();
assertNotNull(settings);
-
+
assertEquals(new File("build/cache"), settings.getDefaultCache());
- //The next test doesn't always works on windows (mix C: and c: drive)
- assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(), new File((String)settings.getVariables().get("ivy.settings.file")).getAbsolutePath().toUpperCase());
- assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm().toUpperCase(), ((String)settings.getVariables().get("ivy.settings.url")).toUpperCase());
- assertEquals(new File("test/repositories").getAbsolutePath().toUpperCase(), ((String)settings.getVariables().get("ivy.settings.dir")).toUpperCase());
+ // The next test doesn't always works on windows (mix C: and c: drive)
+ assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath().toUpperCase(),
+ new File((String) settings.getVariables().get("ivy.settings.file")).getAbsolutePath()
+ .toUpperCase());
+ assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm()
+ .toUpperCase(), ((String) settings.getVariables().get("ivy.settings.url"))
+ .toUpperCase());
+ assertEquals(new File("test/repositories").getAbsolutePath().toUpperCase(),
+ ((String) settings.getVariables().get("ivy.settings.dir")).toUpperCase());
assertEquals("myvalue", settings.getVariables().get("myproperty"));
- }
+ }
+
+ public void testReferencedSettings() throws MalformedURLException {
+ Project p = new Project();
+ // p.setBasedir("test/repositories");
+ // p.setProperty("ivy.settings.file" , "ivysettings.xml");
+ p.setProperty("myproperty", "myvalue");
- public void testReferencedSettings() throws MalformedURLException {
- Project p = new Project();
- //p.setBasedir("test/repositories");
- //p.setProperty("ivy.settings.file" , "ivysettings.xml");
- p.setProperty("myproperty", "myvalue");
-
IvyAntSettings antSettings = new IvyAntSettings();
antSettings.setProject(p);
- //antSettings.setId("mySettings");
+ // antSettings.setId("mySettings");
antSettings.setFile(new File("test/repositories/ivysettings.xml"));
p.addReference("mySettings", antSettings);
-
- IvyTask task = new IvyTask() {
- public void doExecute() throws BuildException {
- }
- };
- task.setProject(p);
- task.setSettingsRef(new Reference(p,"mySettings"));
+
+ IvyTask task = new IvyTask() {
+ public void doExecute() throws BuildException {
+ }
+ };
+ task.setProject(p);
+ task.setSettingsRef(new Reference(p, "mySettings"));
Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
- IvySettings settings = ivy.getSettings();
+ IvySettings settings = ivy.getSettings();
assertNotNull(settings);
-
+
assertEquals(new File("build/cache"), settings.getDefaultCache());
- assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings.getVariables().get("ivy.settings.file"));
- assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm(), settings.getVariables().get("ivy.settings.url"));
- assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().get("ivy.settings.dir"));
+ assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
+ .getVariables().get("ivy.settings.file"));
+ assertEquals(new File("test/repositories/ivysettings.xml").toURL().toExternalForm(),
+ settings.getVariables().get("ivy.settings.url"));
+ assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().get(
+ "ivy.settings.dir"));
assertEquals("myvalue", settings.getVariables().get("myproperty"));
- }
-
+ }
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyVarTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyVarTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyVarTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyVarTest.java Tue Jun 5 05:02:27 2007
@@ -29,11 +29,11 @@
task.setName("mytest");
task.setValue("myvalue");
task.execute();
- Ivy ivy = task.getIvyInstance();
+ Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue", ivy.getVariable("mytest"));
}
-
+
public void testPrefix() {
IvyVar task = new IvyVar();
task.setProject(new Project());
@@ -41,17 +41,17 @@
task.setValue("myvalue");
task.setPrefix("myprefix");
task.execute();
- Ivy ivy = task.getIvyInstance();
+ Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue", ivy.getVariable("myprefix.mytest"));
}
-
+
public void testURL() {
IvyVar task = new IvyVar();
task.setProject(new Project());
task.setUrl(IvyVarTest.class.getResource("vartest.properties").toExternalForm());
task.execute();
- Ivy ivy = task.getIvyInstance();
+ Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue1", ivy.getVariable("mytest1"));
assertEquals("myvalue2", ivy.getVariable("mytest2"));
@@ -63,7 +63,7 @@
task.setUrl(IvyVarTest.class.getResource("vartest.properties").toExternalForm());
task.setPrefix("myprefix.");
task.execute();
- Ivy ivy = task.getIvyInstance();
+ Ivy ivy = task.getIvyInstance();
assertNotNull(ivy);
assertEquals("myvalue1", ivy.getVariable("myprefix.mytest1"));
assertEquals("myvalue2", ivy.getVariable("myprefix.mytest2"));
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java Tue Jun 5 05:02:27 2007
@@ -35,7 +35,6 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Delete;
-
/**
* Not a Junit test, performance depends on the machine on which the test is run...
*/
@@ -43,6 +42,7 @@
private final static String PATTERN = "build/test/perf/[module]/[artifact]-[revision].[ext]";
private final Ivy _ivy;
+
private File _cache;
public TestPerformance() throws Exception {
@@ -50,10 +50,10 @@
FileSystemResolver resolver = new FileSystemResolver();
resolver.setName("def");
resolver.setSettings(_ivy.getSettings());
-
+
resolver.addIvyPattern(PATTERN);
resolver.addArtifactPattern(PATTERN);
-
+
_ivy.getSettings().addResolver(resolver);
_ivy.getSettings().setDefaultResolver("def");
}
@@ -66,7 +66,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -85,27 +85,27 @@
del.execute();
}
-
- private void generateModules(int nbModules, int minDependencies, int maxDependencies, int minVersions, int maxVersions) throws IOException {
+ private void generateModules(int nbModules, int minDependencies, int maxDependencies,
+ int minVersions, int maxVersions) throws IOException {
int nb = 0;
int curDep = 1;
int varDeps = maxDependencies - minDependencies;
int varVersions = maxVersions - minVersions;
Random r = new Random(System.currentTimeMillis());
-
+
while (nb < nbModules) {
- int deps = minDependencies + r.nextInt(varDeps+1);
- int versions = minVersions + r.nextInt(varVersions+1);
-
+ int deps = minDependencies + r.nextInt(varDeps + 1);
+ int versions = minVersions + r.nextInt(varVersions + 1);
+
int prevCurDep = curDep;
for (int ver = 0; ver < versions; ver++) {
- DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("apache", "mod"+nb, "1."+ver),
- "integration", new Date());
-
+ DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId
+ .newInstance("apache", "mod" + nb, "1." + ver), "integration", new Date());
+
curDep = prevCurDep;
- for (int i = 0; i<deps && curDep < nbModules; i++) {
+ for (int i = 0; i < deps && curDep < nbModules; i++) {
int d;
- if (i%2 == 1) {
+ if (i % 2 == 1) {
d = nb + i;
if (d >= prevCurDep) {
d = curDep;
@@ -115,34 +115,42 @@
d = curDep;
curDep++;
}
- DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
- ModuleRevisionId.newInstance("apache", "mod"+d, "latest.integration"),
+ DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
+ md,
+ ModuleRevisionId.newInstance("apache", "mod" + d, "latest.integration"),
false, false, true);
dd.addDependencyConfiguration("default", "default");
md.addDependency(dd);
}
- XmlModuleDescriptorWriter.write(md, new File("build/test/perf/mod"+nb+"/ivy-1."+ver+".xml"));
- FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), new File("build/test/perf/mod"+nb+"/mod"+nb+"-1."+ver+".jar"), null);
+ XmlModuleDescriptorWriter.write(md, new File("build/test/perf/mod" + nb + "/ivy-1."
+ + ver + ".xml"));
+ FileUtil
+ .copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
+ new File("build/test/perf/mod" + nb + "/mod" + nb + "-1." + ver
+ + ".jar"), null);
}
nb++;
}
}
-
+
public void testPerfs() throws Exception {
generateModules(70, 2, 5, 2, 15);
-
+
long start = System.currentTimeMillis();
- ResolveReport report = _ivy.resolve(new File("build/test/perf/mod0/ivy-1.0.xml").toURL(), getResolveOptions(new String[] {"*"}).setRevision("1.0"));
+ ResolveReport report = _ivy.resolve(new File("build/test/perf/mod0/ivy-1.0.xml").toURL(),
+ getResolveOptions(new String[] {"*"}).setRevision("1.0"));
long end = System.currentTimeMillis();
- System.out.println("resolve "+report.getConfigurationReport("default").getNodesNumber()+" modules took "+(end - start)+" ms");
+ System.out.println("resolve " + report.getConfigurationReport("default").getNodesNumber()
+ + " modules took " + (end - start) + " ms");
cleanRepo();
}
-
+
private ResolveOptions getResolveOptions(String[] confs) {
- return new ResolveOptions().setConfs(confs).setCache(CacheManager.getInstance(_ivy.getSettings(), _cache));
- }
-
+ return new ResolveOptions().setConfs(confs).setCache(
+ CacheManager.getInstance(_ivy.getSettings(), _cache));
+ }
+
public static void main(String[] args) throws Exception {
TestPerformance t = new TestPerformance();
t.setUp();
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/cache/CacheManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/cache/CacheManagerTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/cache/CacheManagerTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/cache/CacheManagerTest.java Tue Jun 5 05:02:27 2007
@@ -21,12 +21,13 @@
import java.util.Date;
import junit.framework.TestCase;
-import org.apache.ivy.core.settings.IvySettings;
+
+import org.apache.ivy.Ivy;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.module.id.ModuleId;
-import org.apache.ivy.Ivy;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.settings.IvySettings;
import org.apache.tools.ant.util.FileUtils;
/**
@@ -34,7 +35,9 @@
*/
public class CacheManagerTest extends TestCase {
private CacheManager cacheManager;
+
private Artifact artifact;
+
private ArtifactOrigin origin;
protected void setUp() throws Exception {
@@ -63,7 +66,7 @@
assertNull(found);
}
- public void testUniqueness() {
+ public void testUniqueness() {
cacheManager.saveArtifactOrigin(artifact, origin);
artifact = createArtifact("org1", "module", "rev", "name", "type", "ext");
@@ -91,8 +94,8 @@
assertNull(found);
}
-
- protected Artifact createArtifact(String org, String module, String rev, String name, String type, String ext) {
+ protected Artifact createArtifact(String org, String module, String rev, String name,
+ String type, String ext) {
ModuleId mid = new ModuleId(org, module);
ModuleRevisionId mrid = new ModuleRevisionId(mid, rev);
return new DefaultArtifact(mrid, new Date(), name, type, ext);
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/event/IvyEventFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/event/IvyEventFilterTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/event/IvyEventFilterTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/event/IvyEventFilterTest.java Tue Jun 5 05:02:27 2007
@@ -30,71 +30,82 @@
import org.apache.ivy.core.report.ResolveReport;
public class IvyEventFilterTest extends TestCase {
- Ivy ivy = new Ivy();
- ModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo", "bar", "1.0"), "integration", new Date());
- ModuleDescriptor md2 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo2", "bar", "1.0"), "integration", new Date());
- ModuleDescriptor md3 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo3", "baz", "1.0"), "integration", new Date());
- ModuleDescriptor md4 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo", "baz", "1.0"), "integration", new Date());
-
- public void testSimple() {
- IvyEventFilter f = new IvyEventFilter("pre-resolve", null, null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertFalse(f.accept(new EndResolveEvent(md, new String[] {"default"}, new ResolveReport(md))));
- }
-
- public void testSimpleExpression() {
- IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
-
- f = new IvyEventFilter("pre-resolve", "module = bar", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
-
- f = new IvyEventFilter("pre-resolve", "organisation = foo, foo2", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
- }
-
- public void testAndExpression() {
- IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo AND module = bar", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
-
- f = new IvyEventFilter("pre-resolve", "organisation = foo,foo2 AND module = bar", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
- }
-
- public void testOrExpression() {
- IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo3 OR module = bar", null);
-
- assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
- }
-
- public void testNotExpression() {
- IvyEventFilter f = new IvyEventFilter("pre-resolve", "NOT organisation = foo", null);
-
- assertFalse(f.accept(new StartResolveEvent(md, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
- assertTrue(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
- assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
- }
+ Ivy ivy = new Ivy();
+
+ ModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo", "bar",
+ "1.0"), "integration", new Date());
+
+ ModuleDescriptor md2 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo2", "bar",
+ "1.0"), "integration", new Date());
+
+ ModuleDescriptor md3 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo3", "baz",
+ "1.0"), "integration", new Date());
+
+ ModuleDescriptor md4 = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo", "baz",
+ "1.0"), "integration", new Date());
+
+ public void testSimple() {
+ IvyEventFilter f = new IvyEventFilter("pre-resolve", null, null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertFalse(f.accept(new EndResolveEvent(md, new String[] {"default"},
+ new ResolveReport(md))));
+ }
+
+ public void testSimpleExpression() {
+ IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo", null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+
+ f = new IvyEventFilter("pre-resolve", "module = bar", null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+
+ f = new IvyEventFilter("pre-resolve", "organisation = foo, foo2", null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+ }
+
+ public void testAndExpression() {
+ IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo AND module = bar",
+ null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+
+ f = new IvyEventFilter("pre-resolve", "organisation = foo,foo2 AND module = bar", null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+ }
+
+ public void testOrExpression() {
+ IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo3 OR module = bar",
+ null);
+
+ assertTrue(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+ }
+
+ public void testNotExpression() {
+ IvyEventFilter f = new IvyEventFilter("pre-resolve", "NOT organisation = foo", null);
+
+ assertFalse(f.accept(new StartResolveEvent(md, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md2, new String[] {"default"})));
+ assertTrue(f.accept(new StartResolveEvent(md3, new String[] {"default"})));
+ assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
+ }
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java Tue Jun 5 05:02:27 2007
@@ -32,11 +32,11 @@
public void testSimple() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
-
- ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
- ivy.getSettings().getDefaultResolver().getName(),
- "install", true, true, true, null, _cache, PatternMatcher.EXACT);
-
+
+ ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), ivy.getSettings()
+ .getDefaultResolver().getName(), "install", true, true, true, null, _cache,
+ PatternMatcher.EXACT);
+
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
@@ -44,10 +44,10 @@
public void testSimpleWithoutDefaultResolver() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
-
- ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
- "test", "install", true, true, true, null, _cache, PatternMatcher.EXACT);
-
+
+ ivy.install(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), "test", "install", true,
+ true, true, null, _cache, PatternMatcher.EXACT);
+
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
@@ -55,14 +55,14 @@
public void testDependencies() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
-
- ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ivy.getSettings().getDefaultResolver().getName(),
- "install", true, true, true, null, _cache, PatternMatcher.EXACT);
-
+
+ ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
+ .getDefaultResolver().getName(), "install", true, true, true, null, _cache,
+ PatternMatcher.EXACT);
+
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
-
+
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
@@ -70,14 +70,14 @@
public void testNotTransitive() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
-
- ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ivy.getSettings().getDefaultResolver().getName(),
- "install", false, true, true, null, _cache, PatternMatcher.EXACT);
-
+
+ ivy.install(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), ivy.getSettings()
+ .getDefaultResolver().getName(), "install", false, true, true, null, _cache,
+ PatternMatcher.EXACT);
+
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
-
+
assertFalse(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertFalse(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
}
@@ -85,33 +85,31 @@
public void testRegexpMatcher() throws Exception {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
-
- ivy.install(ModuleRevisionId.newInstance("org1", ".*", ".*"),
- "1",
- "install", false, true, true, null, _cache, PatternMatcher.REGEXP);
-
+
+ ivy.install(ModuleRevisionId.newInstance("org1", ".*", ".*"), "1", "install", false, true,
+ true, null, _cache, PatternMatcher.REGEXP);
+
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.0.jar").exists());
-
+
assertTrue(new File("build/test/install/org1/mod1.1/ivy-1.1.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.1/mod1.1-1.1.jar").exists());
-
+
assertTrue(new File("build/test/install/org1/mod1.2/ivy-2.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
-
+
// mod1.3 is split because Ivy thinks there are two versions of the module:
// this is the normal behaviour in this case
assertTrue(new File("build/test/install/org1/mod1.3/ivy-B-3.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.3/ivy-A-3.0.xml").exists());
assertTrue(new File("build/test/install/org1/mod1.3/mod1.3-A-3.0.jar").exists());
assertTrue(new File("build/test/install/org1/mod1.3/mod1.3-B-3.0.jar").exists());
-
+
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
}
-
-
private File _cache;
+
protected void setUp() throws Exception {
createCache();
}
@@ -120,7 +118,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
cleanInstall();
@@ -132,6 +130,7 @@
del.setDir(_cache);
del.execute();
}
+
private void cleanInstall() {
Delete del = new Delete();
del.setProject(new Project());
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java Tue Jun 5 05:02:27 2007
@@ -22,39 +22,42 @@
public class DefaultDependencyDescriptorTest extends TestCase {
- public static void main(String[] args) {
- junit.textui.TestRunner.run(DefaultDependencyDescriptorTest.class);
- }
-
- /*
- * Test method for 'org.apache.ivy.DefaultDependencyDescriptor.replaceSelfFallbackPattern(String, String)'
- */
- public void testReplaceSelfFallbackPattern() {
- String replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@(default)", "compile");
- assertEquals("compile(default)", replacedConf);
-
- replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("default", "compile");
- assertNull( replacedConf);
-
- replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@", "runtime");
- assertEquals("runtime", "runtime");
-
- }
-
- /*
- * Test method for 'org.apache.ivy.DefaultDependencyDescriptor.replaceThisFallbackPattern(String, String)'
- */
- public void testReplaceThisFallbackPattern() {
- String replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#(default)", "compile");
- assertEquals("compile(default)", replacedConf);
-
- replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("default", "compile");
- assertNull( replacedConf);
-
- replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#", "runtime");
- assertEquals("runtime", "runtime");
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(DefaultDependencyDescriptorTest.class);
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.ivy.DefaultDependencyDescriptor.replaceSelfFallbackPattern(String, String)'
+ */
+ public void testReplaceSelfFallbackPattern() {
+ String replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@(default)",
+ "compile");
+ assertEquals("compile(default)", replacedConf);
+
+ replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("default", "compile");
+ assertNull(replacedConf);
+
+ replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@", "runtime");
+ assertEquals("runtime", "runtime");
+
+ }
+
+ /*
+ * Test method for
+ * 'org.apache.ivy.DefaultDependencyDescriptor.replaceThisFallbackPattern(String, String)'
+ */
+ public void testReplaceThisFallbackPattern() {
+ String replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#(default)",
+ "compile");
+ assertEquals("compile(default)", replacedConf);
- }
+ replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("default", "compile");
+ assertNull(replacedConf);
-}
+ replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#", "runtime");
+ assertEquals("runtime", "runtime");
+
+ }
+}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java Tue Jun 5 05:02:27 2007
@@ -28,15 +28,18 @@
testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", "revision"));
testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", ""));
testEncodeDecodeToString(ModuleRevisionId.newInstance("org.apache", "name-post", "1.0"));
- testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2"));
+ testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
+ "1.0-dev8/2"));
Map extraAttributes = new HashMap();
extraAttributes.put("extra", "extravalue");
extraAttributes.put("att/name", "att/value");
extraAttributes.put("att.name", "att.value");
extraAttributes.put("att<name", "att<value");
- testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2", extraAttributes));
+ testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
+ "1.0-dev8/2", extraAttributes));
extraAttributes.put("nullatt", null);
- testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2", extraAttributes));
+ testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
+ "1.0-dev8/2", extraAttributes));
}