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 [27/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/AntCallTriggerTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntCallTriggerTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntCallTriggerTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/AntCallTriggerTest.java Tue Jun 5 05:02:27 2007
@@ -36,54 +36,55 @@
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.input.InputHandler;
-
public class AntCallTriggerTest extends TestCase {
- public void test() throws Exception {
- assertFalse(new File("test/triggers/ant-call/A/out/foo.txt").exists());
- runAnt(new File("test/triggers/ant-call/A/build.xml"), "resolve");
- // should have unzipped foo.zip
- assertTrue(new File("test/triggers/ant-call/A/out/foo.txt").exists());
- }
-
- protected void tearDown() throws Exception {
- FileUtil.forceDelete(new File("test/triggers/ant-call/A/out"));
- FileUtil.forceDelete(new File("test/triggers/ant-call/cache"));
- }
-
- private void runAnt(File buildFile, String target) throws BuildException {
- runAnt(buildFile, target, Project.MSG_INFO);
- }
- private void runAnt(File buildFile, String target, int messageLevel) throws BuildException {
- Vector targets = new Vector();
- targets.add(target);
- runAnt(buildFile, targets, messageLevel);
- }
- private void runAnt(File buildFile, Vector targets, int messageLevel) throws BuildException {
- runBuild(buildFile, targets, messageLevel);
-
-// this exits the jvm at the end of the call
-// Main.main(new String[] {"-f", buildFile.getAbsolutePath(), target});
-
-// this does not set the good message level
-// Ant ant = new Ant();
-// Project project = new Project();
-// project.setBaseDir(buildFile.getParentFile());
-// project.init();
-//
-// ant.setProject(project);
-// ant.setTaskName("ant");
-//
-// ant.setAntfile(buildFile.getAbsolutePath());
-// ant.setInheritAll(false);
-// if (target != null) {
-// ant.setTarget(target);
-// }
-// ant.execute();
- }
-
- //////////////////////////////////////////////////////////////////////////////
- // miserable copy (updated to simple test cases) from ant Main class:
- // the only available way I found to easily run ant exits jvm at the end
+ public void test() throws Exception {
+ assertFalse(new File("test/triggers/ant-call/A/out/foo.txt").exists());
+ runAnt(new File("test/triggers/ant-call/A/build.xml"), "resolve");
+ // should have unzipped foo.zip
+ assertTrue(new File("test/triggers/ant-call/A/out/foo.txt").exists());
+ }
+
+ protected void tearDown() throws Exception {
+ FileUtil.forceDelete(new File("test/triggers/ant-call/A/out"));
+ FileUtil.forceDelete(new File("test/triggers/ant-call/cache"));
+ }
+
+ private void runAnt(File buildFile, String target) throws BuildException {
+ runAnt(buildFile, target, Project.MSG_INFO);
+ }
+
+ private void runAnt(File buildFile, String target, int messageLevel) throws BuildException {
+ Vector targets = new Vector();
+ targets.add(target);
+ runAnt(buildFile, targets, messageLevel);
+ }
+
+ private void runAnt(File buildFile, Vector targets, int messageLevel) throws BuildException {
+ runBuild(buildFile, targets, messageLevel);
+
+ // this exits the jvm at the end of the call
+ // Main.main(new String[] {"-f", buildFile.getAbsolutePath(), target});
+
+ // this does not set the good message level
+ // Ant ant = new Ant();
+ // Project project = new Project();
+ // project.setBaseDir(buildFile.getParentFile());
+ // project.init();
+ //
+ // ant.setProject(project);
+ // ant.setTaskName("ant");
+ //
+ // ant.setAntfile(buildFile.getAbsolutePath());
+ // ant.setInheritAll(false);
+ // if (target != null) {
+ // ant.setTarget(target);
+ // }
+ // ant.execute();
+ }
+
+ // ////////////////////////////////////////////////////////////////////////////
+ // miserable copy (updated to simple test cases) from ant Main class:
+ // the only available way I found to easily run ant exits jvm at the end
private void runBuild(File buildFile, Vector targets, int messageLevel) throws BuildException {
final Project project = new Project();
@@ -103,26 +104,22 @@
SecurityManager oldsm = null;
oldsm = System.getSecurityManager();
- //SecurityManager can not be installed here for backwards
- //compatibility reasons (PD). Needs to be loaded prior to
- //ant class if we are going to implement it.
- //System.setSecurityManager(new NoExitSecurityManager());
+ // SecurityManager can not be installed here for backwards
+ // compatibility reasons (PD). Needs to be loaded prior to
+ // ant class if we are going to implement it.
+ // System.setSecurityManager(new NoExitSecurityManager());
try {
- project.setDefaultInputStream(System.in);
+ project.setDefaultInputStream(System.in);
System.setIn(new DemuxInputStream(project));
System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
-
project.fireBuildStarted();
project.init();
project.setUserProperty("ant.version", Main.getAntVersion());
-
- project.setUserProperty("ant.file",
- buildFile.getAbsolutePath());
-
+ project.setUserProperty("ant.file", buildFile.getAbsolutePath());
ProjectHelper.configureProject(project, buildFile);
@@ -136,7 +133,7 @@
project.executeTargets(targets);
} finally {
// put back the original security manager
- //The following will never eval to true. (PD)
+ // The following will never eval to true. (PD)
if (oldsm != null) {
System.setSecurityManager(oldsm);
}
@@ -152,17 +149,16 @@
error = err;
throw err;
} finally {
- project.fireBuildFinished(error);
+ project.fireBuildFinished(error);
}
}
-
/**
- * Adds the listeners specified in the command line arguments,
- * along with the default listener, to the specified project.
- *
- * @param project The project to add listeners to.
- * Must not be <code>null</code>.
+ * Adds the listeners specified in the command line arguments, along with the default listener,
+ * to the specified project.
+ *
+ * @param project
+ * The project to add listeners to. Must not be <code>null</code>.
*/
protected void addBuildListeners(Project project, int level) {
@@ -173,33 +169,31 @@
/**
* Creates the InputHandler and adds it to the project.
- *
- * @param project the project instance.
- * @param inputHandlerClassname
- *
- * @exception BuildException if a specified InputHandler
- * implementation could not be loaded.
+ *
+ * @param project
+ * the project instance.
+ * @param inputHandlerClassname
+ * @exception BuildException
+ * if a specified InputHandler implementation could not be loaded.
*/
- private void addInputHandler(Project project, String inputHandlerClassname) throws BuildException {
+ private void addInputHandler(Project project, String inputHandlerClassname)
+ throws BuildException {
InputHandler handler = null;
if (inputHandlerClassname == null) {
handler = new DefaultInputHandler();
} else {
try {
- handler = (InputHandler)
- (Class.forName(inputHandlerClassname).newInstance());
+ handler = (InputHandler) (Class.forName(inputHandlerClassname).newInstance());
if (project != null) {
project.setProjectReference(handler);
}
} catch (ClassCastException e) {
- String msg = "The specified input handler class "
- + inputHandlerClassname
- + " does not implement the InputHandler interface";
+ String msg = "The specified input handler class " + inputHandlerClassname
+ + " does not implement the InputHandler interface";
throw new BuildException(msg);
} catch (Exception e) {
- String msg = "Unable to instantiate specified input handler "
- + "class " + inputHandlerClassname + " : "
- + e.getClass().getName();
+ String msg = "Unable to instantiate specified input handler " + "class "
+ + inputHandlerClassname + " : " + e.getClass().getName();
throw new BuildException(msg);
}
}
@@ -211,14 +205,13 @@
// in case the message could end up being written to no loggers (as the
// loggers could have failed to be created due to this failure)?
/**
- * Creates the default build logger for sending build events to the ant
- * log.
- *
+ * Creates the default build logger for sending build events to the ant log.
+ *
* @return the logger instance for this build.
*/
private BuildLogger createLogger(int level) {
BuildLogger logger = null;
- logger = new DefaultLogger();
+ logger = new DefaultLogger();
logger.setMessageOutputLevel(level);
logger.setOutputPrintStream(System.out);
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java Tue Jun 5 05:02:27 2007
@@ -27,9 +27,11 @@
public class IvyArtifactPropertyTest extends TestCase {
private File _cache;
+
private IvyArtifactProperty _prop;
+
private Project _project;
-
+
protected void setUp() throws Exception {
createCache();
_project = new Project();
@@ -44,7 +46,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -65,22 +67,22 @@
assertNotNull(val);
assertEquals("build/cache/mod1.2/mod1.2-2.0.jar", val);
}
-
+
public void testWithResolveId() throws Exception {
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- resolve.setResolveId("abc");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ resolve.setResolveId("abc");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
_prop.setName("[module].[artifact]-[revision]");
_prop.setValue("${cache.dir}/[module]/[artifact]-[revision].[type]");
_prop.setResolveId("abc");
@@ -92,14 +94,14 @@
}
public void testWithResolveIdWithoutResolve() throws Exception {
- try {
- _prop.setName("[module].[artifact]-[revision]");
- _prop.setValue("${cache.dir}/[module]/[artifact]-[revision].[type]");
- _prop.setResolveId("abc");
- _prop.execute();
- fail("Task should have failed because no resolve was performed!");
- } catch (BuildException e) {
- // this is expected!
- }
- }
+ try {
+ _prop.setName("[module].[artifact]-[revision]");
+ _prop.setValue("${cache.dir}/[module]/[artifact]-[revision].[type]");
+ _prop.setResolveId("abc");
+ _prop.execute();
+ fail("Task should have failed because no resolve was performed!");
+ } catch (BuildException e) {
+ // this is expected!
+ }
+ }
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java Tue Jun 5 05:02:27 2007
@@ -26,9 +26,11 @@
public class IvyArtifactReportTest extends TestCase {
private File _cache;
+
private IvyArtifactReport _prop;
+
private Project _project;
-
+
protected void setUp() throws Exception {
createCache();
_project = new Project();
@@ -43,7 +45,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -59,7 +61,7 @@
_prop.setTofile(new File("build/test-artifact-report.xml"));
_prop.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
_prop.execute();
-
+
assertTrue(new File("build/test-artifact-report.xml").exists());
}
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java Tue Jun 5 05:02:27 2007
@@ -29,65 +29,75 @@
public void testSimple() {
Project p = new Project();
-
+
IvyBuildList buildlist = new IvyBuildList();
buildlist.setProject(p);
-
+
FileSet fs = new FileSet();
fs.setDir(new File("test/buildlist"));
fs.setIncludes("**/build.xml");
buildlist.addFileset(fs);
-
+
buildlist.setReference("ordered.build.files");
-
+
buildlist.execute();
-
+
Object o = p.getReference("ordered.build.files");
assertNotNull(o);
assertTrue(o instanceof Path);
-
- Path path = (Path)o;
+
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(5, files.length);
-
- assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
- assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2]).getAbsolutePath());
- assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[3]).getAbsolutePath());
- assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[4]).getAbsolutePath());
+
+ assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[3])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[4])
+ .getAbsolutePath());
}
public void testReverse() {
Project p = new Project();
-
+
IvyBuildList buildlist = new IvyBuildList();
buildlist.setProject(p);
buildlist.setReverse(true);
-
+
FileSet fs = new FileSet();
fs.setDir(new File("test/buildlist"));
fs.setIncludes("**/build.xml");
buildlist.addFileset(fs);
-
+
buildlist.setReference("reverse.ordered.build.files");
-
+
buildlist.execute();
-
+
Object o = p.getReference("reverse.ordered.build.files");
assertNotNull(o);
assertTrue(o instanceof Path);
-
- Path path = (Path)o;
+
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(5, files.length);
-
- assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
- assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2]).getAbsolutePath());
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[3]).getAbsolutePath());
- assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[4]).getAbsolutePath());
+
+ assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[3])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[4])
+ .getAbsolutePath());
}
public void testWithRoot() {
@@ -110,13 +120,15 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(2, files.length); // A and D should be filtered out
- assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
}
public void testWithTwoRoots() {
@@ -139,14 +151,17 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(3, files.length); // A and D should be filtered out
- assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
- assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[2]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[2])
+ .getAbsolutePath());
}
public void testWithRootExclude() {
@@ -170,12 +185,13 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(1, files.length); // A, D and C should be filtered out
- assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
}
public void testWithLeaf() {
@@ -198,14 +214,17 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(3, files.length); // B should be filtered out
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
- assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[2]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[2])
+ .getAbsolutePath());
}
public void testWithTwoLeafs() {
@@ -228,15 +247,19 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(4, files.length); // B should be filtered out
- assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
- assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[2]).getAbsolutePath());
- assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[3]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[2])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[3])
+ .getAbsolutePath());
}
public void testWithLeafExclude() {
@@ -260,13 +283,15 @@
assertNotNull(o);
assertTrue(o instanceof Path);
- Path path = (Path)o;
+ Path path = (Path) o;
String[] files = path.list();
assertNotNull(files);
assertEquals(2, files.length); // B and C should be filtered out
- assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[0]).getAbsolutePath());
- assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[1]).getAbsolutePath());
+ assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[0])
+ .getAbsolutePath());
+ assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[1])
+ .getAbsolutePath());
}
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java Tue Jun 5 05:02:27 2007
@@ -26,8 +26,9 @@
public class IvyBuildNumberTest extends TestCase {
private File _cache;
+
private IvyBuildNumber _buildNumber;
-
+
protected void setUp() throws Exception {
createCache();
Project project = new Project();
@@ -41,7 +42,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -54,110 +55,110 @@
}
public void testDefault() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("newmod");
- _buildNumber.execute();
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("newmod");
+ _buildNumber.execute();
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testDefault2() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("newmod");
- _buildNumber.setDefault("1.0-dev-1");
- _buildNumber.execute();
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("1.0-dev-1", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("newmod");
+ _buildNumber.setDefault("1.0-dev-1");
+ _buildNumber.execute();
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("1.0-dev-1", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testDefault3() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("newmod");
- _buildNumber.setDefault("mydefault");
- _buildNumber.execute();
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("mydefault", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("newmod");
+ _buildNumber.setDefault("mydefault");
+ _buildNumber.execute();
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("mydefault", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testLatest() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.1");
- _buildNumber.execute();
- assertEquals("2.0", _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("2.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals("0", _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.1");
+ _buildNumber.execute();
+ assertEquals("2.0", _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("2.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals("0", _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testLatest2() throws Exception {
- _buildNumber.setOrganisation("orgbn");
- _buildNumber.setModule("buildnumber");
- _buildNumber.execute();
- assertEquals("test", _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("test.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("orgbn");
+ _buildNumber.setModule("buildnumber");
+ _buildNumber.execute();
+ assertEquals("test", _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("test.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testPrefix() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.1");
- _buildNumber.setPrefix("test");
- _buildNumber.execute();
- assertEquals("2.0", _buildNumber.getProject().getProperty("test.revision"));
- assertEquals("2.1", _buildNumber.getProject().getProperty("test.new.revision"));
- assertEquals("0", _buildNumber.getProject().getProperty("test.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("test.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.1");
+ _buildNumber.setPrefix("test");
+ _buildNumber.execute();
+ assertEquals("2.0", _buildNumber.getProject().getProperty("test.revision"));
+ assertEquals("2.1", _buildNumber.getProject().getProperty("test.new.revision"));
+ assertEquals("0", _buildNumber.getProject().getProperty("test.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("test.new.build.number"));
}
-
+
public void testBuildNumber() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.1");
- _buildNumber.setRevision("1.");
- _buildNumber.execute();
- assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("1.2", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("2", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.1");
+ _buildNumber.setRevision("1.");
+ _buildNumber.execute();
+ assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("1.2", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("2", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testBuildNumber2() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.5");
- _buildNumber.setRevision("1.");
- _buildNumber.execute();
- assertEquals("1.0.2", _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals("0", _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.5");
+ _buildNumber.setRevision("1.");
+ _buildNumber.execute();
+ assertEquals("1.0.2", _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals("0", _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testBuildNumber3() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.1");
- _buildNumber.setRevision("1.1");
- _buildNumber.execute();
- assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("1.1.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.1");
+ _buildNumber.setRevision("1.1");
+ _buildNumber.execute();
+ assertEquals("1.1", _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("1.1.1", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("1", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testBuildNumber4() throws Exception {
- _buildNumber.setOrganisation("org1");
- _buildNumber.setModule("mod1.1");
- _buildNumber.setRevision("3.");
- _buildNumber.execute();
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
- assertEquals("3.0", _buildNumber.getProject().getProperty("ivy.new.revision"));
- assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
- assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.build.number"));
+ _buildNumber.setOrganisation("org1");
+ _buildNumber.setModule("mod1.1");
+ _buildNumber.setRevision("3.");
+ _buildNumber.execute();
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.revision"));
+ assertEquals("3.0", _buildNumber.getProject().getProperty("ivy.new.revision"));
+ assertEquals(null, _buildNumber.getProject().getProperty("ivy.build.number"));
+ assertEquals("0", _buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java Tue Jun 5 05:02:27 2007
@@ -30,9 +30,11 @@
public class IvyCacheFilesetTest extends TestCase {
private File _cache;
+
private IvyCacheFileset _fileset;
+
private Project _project;
-
+
protected void setUp() throws Exception {
createCache();
_project = new Project();
@@ -47,7 +49,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -66,24 +68,27 @@
Object ref = _project.getReference("simple-setid");
assertNotNull(ref);
assertTrue(ref instanceof FileSet);
- FileSet fs = (FileSet)ref;
+ FileSet fs = (FileSet) ref;
DirectoryScanner directoryScanner = fs.getDirectoryScanner(_project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File("build/cache/"+directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File("build/cache/"
+ + directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ }
+
+ private File getArchiveFileInCache(String organisation, String module, String revision,
+ String artifact, String type, String ext) {
+ return TestHelper.getArchiveFileInCache(_fileset.getIvyInstance(), _cache, organisation,
+ module, revision, artifact, type, ext);
+ }
+
+ private File getArchiveFileInCache(String organisation, String module, String revision,
+ String artifact, String type, String ext, File cache) {
+ return TestHelper.getArchiveFileInCache(_fileset.getIvyInstance(), cache, organisation,
+ module, revision, artifact, type, ext);
}
-
- private File getArchiveFileInCache(String organisation, String module, String revision, String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(_fileset.getIvyInstance(), _cache,
- organisation, module, revision, artifact, type, ext);
- }
-
- private File getArchiveFileInCache(String organisation, String module, String revision, String artifact, String type, String ext, File cache) {
- return TestHelper.getArchiveFileInCache(_fileset.getIvyInstance(), cache,
- organisation, module, revision, artifact, type, ext);
- }
- public void testEmptyConf() throws Exception {
+ public void testEmptyConf() throws Exception {
_project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-108.xml");
_fileset.setSetid("emptyconf-setid");
_fileset.setConf("empty");
@@ -91,7 +96,7 @@
Object ref = _project.getReference("emptyconf-setid");
assertNotNull(ref);
assertTrue(ref instanceof FileSet);
- FileSet fs = (FileSet)ref;
+ FileSet fs = (FileSet) ref;
DirectoryScanner directoryScanner = fs.getDirectoryScanner(_project);
assertEquals(0, directoryScanner.getIncludedFiles().length);
}
@@ -117,30 +122,31 @@
fail("failure raised an exception with haltonfailure set to false");
}
}
-
+
public void testWithoutPreviousResolveAndNonDefaultCache() throws Exception {
- File cache2 = new File("build/cache2");
- cache2.mkdirs();
-
- try {
- _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
- _fileset.setSetid("simple-setid");
- _fileset.setCache(cache2);
- _fileset.execute();
- Object ref = _project.getReference("simple-setid");
- assertNotNull(ref);
- assertTrue(ref instanceof FileSet);
- FileSet fs = (FileSet)ref;
- DirectoryScanner directoryScanner = fs.getDirectoryScanner(_project);
- assertEquals(1, directoryScanner.getIncludedFiles().length);
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", cache2).getAbsolutePath(),
- new File("build/cache2/"+directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
- } finally {
+ File cache2 = new File("build/cache2");
+ cache2.mkdirs();
+
+ try {
+ _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
+ _fileset.setSetid("simple-setid");
+ _fileset.setCache(cache2);
+ _fileset.execute();
+ Object ref = _project.getReference("simple-setid");
+ assertNotNull(ref);
+ assertTrue(ref instanceof FileSet);
+ FileSet fs = (FileSet) ref;
+ DirectoryScanner directoryScanner = fs.getDirectoryScanner(_project);
+ assertEquals(1, directoryScanner.getIncludedFiles().length);
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar",
+ cache2).getAbsolutePath(), new File("build/cache2/"
+ + directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ } finally {
Delete del = new Delete();
del.setProject(new Project());
del.setDir(cache2);
del.execute();
- }
+ }
}
-
+
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java Tue Jun 5 05:02:27 2007
@@ -29,9 +29,11 @@
public class IvyCachePathTest extends TestCase {
private File _cache;
+
private IvyCachePath _path;
+
private Project _project;
-
+
protected void setUp() throws Exception {
createCache();
_project = new Project();
@@ -46,7 +48,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -65,62 +67,61 @@
Object ref = _project.getReference("simple-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(1, p.size());
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File(p.list()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
}
- public void testInline1() throws Exception {
- // we first resolve another ivy file
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
-
- // then we resolve a dependency directly
- _path.setOrganisation("org1");
- _path.setModule("mod1.2");
- _path.setRevision("2.0");
- _path.setInline(true);
+ public void testInline1() throws Exception {
+ // we first resolve another ivy file
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
+ assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
+
+ // then we resolve a dependency directly
+ _path.setOrganisation("org1");
+ _path.setModule("mod1.2");
+ _path.setRevision("2.0");
+ _path.setInline(true);
_path.setPathid("simple-pathid");
_path.execute();
Object ref = _project.getReference("simple-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(1, p.size());
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File(p.list()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
}
public void testInline2() throws Exception {
- // we first resolve a dependency directly
- _path.setOrganisation("org1");
- _path.setModule("mod1.2");
- _path.setRevision("2.0");
- _path.setInline(true);
+ // we first resolve a dependency directly
+ _path.setOrganisation("org1");
+ _path.setModule("mod1.2");
+ _path.setRevision("2.0");
+ _path.setInline(true);
_path.setPathid("simple-pathid");
_path.execute();
Object ref = _project.getReference("simple-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(1, p.size());
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File(p.list()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
// we then resolve another ivy file
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
- }
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+ assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
+ }
public void testEmptyConf() throws Exception {
_project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-108.xml");
@@ -130,7 +131,7 @@
Object ref = _project.getReference("emptyconf-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(0, p.size());
}
@@ -155,97 +156,98 @@
fail("failure raised an exception with haltonfailure set to false");
}
}
-
+
public void testWithResolveId() throws Exception {
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- resolve.setResolveId("withResolveId");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- _path.setResolveId("withResolveId");
- _path.setPathid("withresolveid-pathid");
- _path.execute();
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ resolve.setResolveId("withResolveId");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
+ _path.setResolveId("withResolveId");
+ _path.setPathid("withresolveid-pathid");
+ _path.execute();
Object ref = _project.getReference("withresolveid-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(1, p.size());
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File(p.list()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
}
public void testWithResolveIdWithoutResolve() throws Exception {
- Project project = new Project();
+ Project project = new Project();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- resolve.setResolveId("withResolveId");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- _path.setResolveId("withResolveId");
- _path.setPathid("withresolveid-pathid");
- _path.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- _path.execute();
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ resolve.setResolveId("withResolveId");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
+ _path.setResolveId("withResolveId");
+ _path.setPathid("withresolveid-pathid");
+ _path.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ _path.execute();
Object ref = _project.getReference("withresolveid-pathid");
assertNotNull(ref);
assertTrue(ref instanceof Path);
- Path p = (Path)ref;
+ Path p = (Path) ref;
assertEquals(1, p.size());
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").getAbsolutePath(),
- new File(p.list()[0]).getAbsolutePath());
+ assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
+ .getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
}
-
+
public void testWithResolveIdAndMissingConfs() throws Exception {
- Project project = new Project();
+ Project project = new Project();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
- resolve.setResolveId("testWithResolveIdAndMissingConfs");
- resolve.setConf("default");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
+ resolve.setResolveId("testWithResolveIdAndMissingConfs");
+ resolve.setConf("default");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
_project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
- _path.setResolveId("testWithResolveIdAndMissingConfs");
- _path.setPathid("withresolveid-pathid");
- _path.setConf("default,compile");
- _path.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
- _path.execute();
+ _path.setResolveId("testWithResolveIdAndMissingConfs");
+ _path.setPathid("withresolveid-pathid");
+ _path.setConf("default,compile");
+ _path.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
+ _path.execute();
}
- private File getArchiveFileInCache(String organisation, String module, String revision, String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(_path.getIvyInstance(), _cache,
- organisation, module, revision, artifact, type, ext);
- }
+ private File getArchiveFileInCache(String organisation, String module, String revision,
+ String artifact, String type, String ext) {
+ return TestHelper.getArchiveFileInCache(_path.getIvyInstance(), _cache, organisation,
+ module, revision, artifact, type, ext);
+ }
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java Tue Jun 5 05:02:27 2007
@@ -29,12 +29,12 @@
import org.apache.tools.ant.Project;
/**
- * Test the deprecated IvyConfigureTest and the underlying implementation
- * AntIvySettings. When IvyConfigure will be removed, this class should be renamed AntIvySettingsTest
+ * Test the deprecated IvyConfigureTest and the underlying implementation AntIvySettings. When
+ * IvyConfigure will be removed, this class should be renamed AntIvySettingsTest
*/
public class IvyConfigureTest extends TestCase {
private IvyConfigure _configure;
-
+
protected void setUp() throws Exception {
Project project = new Project();
project.setProperty("myproperty", "myvalue");
@@ -44,54 +44,59 @@
}
private Ivy getIvyInstance() {
- return IvyAntSettings.getDefaultInstance(_configure.getProject()).getConfiguredIvyInstance();
- }
+ return IvyAntSettings.getDefaultInstance(_configure.getProject())
+ .getConfiguredIvyInstance();
+ }
public void testDefault() throws Exception {
- // by default configure look in the current directory for an ivysettings.xml file...
- // but Ivy itself has one, and we don't want to use it
- _configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
+ // by default configure look in the current directory for an ivysettings.xml file...
+ // but Ivy itself has one, and we don't want to use it
+ _configure.getProject()
+ .setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
_configure.execute();
-
+
IvySettings settings = getIvyInstance().getSettings();
- assertNotNull(settings.getDefaultResolver());
-
+ assertNotNull(settings.getDefaultResolver());
+
DependencyResolver publicResolver = settings.getResolver("public");
- assertNotNull(publicResolver);
- assertTrue(publicResolver instanceof IBiblioResolver);
- IBiblioResolver ibiblio = (IBiblioResolver) publicResolver;
- assertTrue(ibiblio.isM2compatible());
+ assertNotNull(publicResolver);
+ assertTrue(publicResolver instanceof IBiblioResolver);
+ IBiblioResolver ibiblio = (IBiblioResolver) publicResolver;
+ assertTrue(ibiblio.isM2compatible());
}
public void testDefault14() throws Exception {
- // by default configure look in the current directory for an ivysettings.xml file...
- // but Ivy itself has one, and we don't want to use it
- _configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
- _configure.getProject().setProperty("ivy.14.compatible", "true");
+ // by default configure look in the current directory for an ivysettings.xml file...
+ // but Ivy itself has one, and we don't want to use it
+ _configure.getProject()
+ .setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
+ _configure.getProject().setProperty("ivy.14.compatible", "true");
_configure.execute();
-
+
IvySettings settings = getIvyInstance().getSettings();
- assertNotNull(settings.getDefaultResolver());
-
+ assertNotNull(settings.getDefaultResolver());
+
DependencyResolver publicResolver = settings.getResolver("public");
- assertTrue(publicResolver instanceof IvyRepResolver);
+ assertTrue(publicResolver instanceof IvyRepResolver);
}
-
- public void testFile() throws Exception {
+ public void testFile() throws Exception {
_configure.setFile(new File("test/repositories/ivysettings.xml"));
-
+
_configure.execute();
-
+
Ivy ivy = _configure.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"));
}
@@ -102,11 +107,11 @@
confDirUrl = confDirUrl.substring(0, confDirUrl.length() - 1);
}
_configure.setUrl(confUrl);
-
+
_configure.execute();
-
+
IvySettings settings = _configure.getIvyInstance().getSettings();
-
+
assertEquals(new File("build/cache"), settings.getDefaultCache());
assertEquals(confUrl, settings.getVariables().get("ivy.settings.url"));
assertEquals(confDirUrl, settings.getVariables().get("ivy.settings.dir"));
@@ -114,28 +119,31 @@
}
public void testAntProperties() throws Exception {
- String confUrl = IvyConfigureTest.class.getResource("ivysettings-test.xml").toExternalForm();
+ String confUrl = IvyConfigureTest.class.getResource("ivysettings-test.xml")
+ .toExternalForm();
_configure.setUrl(confUrl);
-
+
_configure.execute();
-
+
IvySettings settings = _configure.getIvyInstance().getSettings();
assertNotNull(settings);
-
+
assertEquals("myvalue", settings.getVariables().get("myproperty"));
assertEquals("myvalue", settings.getDefaultCache().getName());
}
public void testOverrideVariables() throws Exception {
- String confUrl = IvyConfigureTest.class.getResource("ivysettings-props.xml").toExternalForm();
+ String confUrl = IvyConfigureTest.class.getResource("ivysettings-props.xml")
+ .toExternalForm();
_configure.setUrl(confUrl);
-
+
_configure.execute();
-
+
IvySettings settings = _configure.getIvyInstance().getSettings();
assertNotNull(settings);
-
- assertEquals("lib/test/[artifact]-[revision].[ext]", settings.getVariables().get("ivy.retrieve.pattern"));
+
+ assertEquals("lib/test/[artifact]-[revision].[ext]", settings.getVariables().get(
+ "ivy.retrieve.pattern"));
}
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java Tue Jun 5 05:02:27 2007
@@ -28,7 +28,6 @@
import org.apache.ivy.util.FileUtil;
import org.apache.tools.ant.Project;
-
public class IvyConvertPomTest extends TestCase {
public void testSimple() throws Exception {
IvyConvertPom task = new IvyConvertPom();
@@ -38,14 +37,17 @@
destFile.deleteOnExit();
task.setIvyFile(destFile);
task.execute();
-
+
String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(destFile)));
- String expected = readEntirely("test-convertpom.xml").replaceAll("\r\n", "\n").replace('\r', '\n');
+ String expected = readEntirely("test-convertpom.xml").replaceAll("\r\n", "\n").replace(
+ '\r', '\n');
// do not work properly on all platform and depends on the file date
-// assertEquals(expected, wrote);
+ // assertEquals(expected, wrote);
}
private String readEntirely(String resource) throws IOException {
- return FileUtil.readEntirely(new BufferedReader(new InputStreamReader(IvyConvertPomTest.class.getResource(resource).openStream()))).replaceAll("\r\n", "\n").replace('\r', '\n');
+ return FileUtil.readEntirely(
+ new BufferedReader(new InputStreamReader(IvyConvertPomTest.class.getResource(resource)
+ .openStream()))).replaceAll("\r\n", "\n").replace('\r', '\n');
}
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java Tue Jun 5 05:02:27 2007
@@ -34,12 +34,13 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Delete;
-
public class IvyDeliverTest extends TestCase {
private File _cache;
+
private IvyDeliver _deliver;
+
private Project _project;
-
+
protected void setUp() throws Exception {
cleanTestDir();
cleanRep();
@@ -57,7 +58,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
cleanTestDir();
@@ -90,131 +91,146 @@
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"), dds[0]
+ .getDependencyRevisionId());
}
-
+
public void testWithResolveId() throws Exception {
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- resolve.setResolveId("withResolveId");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- _deliver.setResolveId("withResolveId");
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ resolve.setResolveId("withResolveId");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
+ _deliver.setResolveId("withResolveId");
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
+ .getDependencyRevisionId());
}
-
+
public void testWithResolveIdInAnotherBuild() throws Exception {
- // create a new build
+ // create a new build
Project other = new Project();
other.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
other.setProperty("build", "build/test/deliver");
// do a resolve in the new build
- IvyResolve resolve = new IvyResolve();
- resolve.setProject(other);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
- resolve.setResolveId("withResolveId");
- resolve.execute();
-
- // resolve another ivy file
- resolve = new IvyResolve();
- resolve.setProject(_project);
- resolve.setCache(_cache);
- resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
- resolve.execute();
-
- _deliver.setResolveId("withResolveId");
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(other);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
+ resolve.setResolveId("withResolveId");
+ resolve.execute();
+
+ // resolve another ivy file
+ resolve = new IvyResolve();
+ resolve.setProject(_project);
+ resolve.setCache(_cache);
+ resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-latest.xml"));
+ resolve.execute();
+
+ _deliver.setResolveId("withResolveId");
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
+ .getDependencyRevisionId());
}
public void testWithBranch() throws Exception {
- // test case for IVY-404
+ // test case for IVY-404
_project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-branch.xml");
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"), dds[0]
+ .getDependencyRevisionId());
}
public void testWithExtraAttributes() throws Exception {
- // test case for IVY-415
+ // test case for IVY-415
_project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-extra.xml");
IvyResolve res = new IvyResolve();
res.setValidate(false);
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.setValidate(false);
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), false);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), false);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
Map extraAtt = new HashMap();
extraAtt.put("myExtraAtt", "myValue");
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt), dds[0]
+ .getDependencyRevisionId());
}
public void testReplaceImportedConfigurations() throws Exception {
@@ -222,17 +238,20 @@
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(deliveredIvyFile)));
- assertTrue("import not replaced: import can still be found in file", deliveredFileContent.indexOf("import") == -1);
- assertTrue("import not replaced: conf1 cannot be found in file", deliveredFileContent.indexOf("conf1") != -1);
+ assertTrue(deliveredIvyFile.exists());
+ String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
+ deliveredIvyFile)));
+ assertTrue("import not replaced: import can still be found in file", deliveredFileContent
+ .indexOf("import") == -1);
+ assertTrue("import not replaced: conf1 cannot be found in file", deliveredFileContent
+ .indexOf("conf1") != -1);
}
public void testReplaceVariables() throws Exception {
@@ -240,19 +259,22 @@
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
res.getIvyInstance().getSettings().setVariable("myvar", "myvalue");
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(deliveredIvyFile)));
- assertTrue("variable not replaced: myvar can still be found in file", deliveredFileContent.indexOf("myvar") == -1);
- assertTrue("variable not replaced: myvalue cannot be found in file", deliveredFileContent.indexOf("myvalue") != -1);
+ assertTrue(deliveredIvyFile.exists());
+ String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
+ deliveredIvyFile)));
+ assertTrue("variable not replaced: myvar can still be found in file", deliveredFileContent
+ .indexOf("myvar") == -1);
+ assertTrue("variable not replaced: myvalue cannot be found in file", deliveredFileContent
+ .indexOf("myvalue") != -1);
}
public void testNoReplaceDynamicRev() throws Exception {
@@ -260,41 +282,50 @@
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.setReplacedynamicrev(false);
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"), dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"), dds[0]
+ .getDependencyRevisionId());
}
public void testDifferentRevisionsForSameModule() throws Exception {
- _project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-different-revisions.xml");
+ _project.setProperty("ivy.dep.file",
+ "test/java/org/apache/ivy/ant/ivy-different-revisions.xml");
IvyResolve res = new IvyResolve();
res.setProject(_project);
res.execute();
-
+
_deliver.setPubrevision("1.2");
_deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
_deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
- ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), deliveredIvyFile.toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "different-revs", "1.2"), md.getModuleRevisionId());
+ assertTrue(deliveredIvyFile.exists());
+ ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(), deliveredIvyFile.toURL(), true);
+ assertEquals(ModuleRevisionId.newInstance("apache", "different-revs", "1.2"), md
+ .getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(3, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0].getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), dds[1].getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"), dds[2].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
+ .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), dds[1]
+ .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"), dds[2]
+ .getDependencyRevisionId());
}
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyFindRevisionTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyFindRevisionTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyFindRevisionTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyFindRevisionTest.java Tue Jun 5 05:02:27 2007
@@ -26,8 +26,9 @@
public class IvyFindRevisionTest extends TestCase {
private File _cache;
+
private IvyFindRevision _findRevision;
-
+
protected void setUp() throws Exception {
createCache();
Project project = new Project();
@@ -41,7 +42,7 @@
_cache = new File("build/cache");
_cache.mkdirs();
}
-
+
protected void tearDown() throws Exception {
cleanCache();
}
@@ -54,28 +55,28 @@
}
public void testProperty() throws Exception {
- _findRevision.setOrganisation("org1");
- _findRevision.setModule("mod1.1");
- _findRevision.setRevision("1.0");
- _findRevision.setProperty("test.revision");
- _findRevision.execute();
- assertEquals("1.0", _findRevision.getProject().getProperty("test.revision"));
+ _findRevision.setOrganisation("org1");
+ _findRevision.setModule("mod1.1");
+ _findRevision.setRevision("1.0");
+ _findRevision.setProperty("test.revision");
+ _findRevision.execute();
+ assertEquals("1.0", _findRevision.getProject().getProperty("test.revision"));
}
-
+
public void testLatest() throws Exception {
- _findRevision.setOrganisation("org1");
- _findRevision.setModule("mod1.1");
- _findRevision.setRevision("latest.integration");
- _findRevision.execute();
- assertEquals("2.0", _findRevision.getProject().getProperty("ivy.revision"));
+ _findRevision.setOrganisation("org1");
+ _findRevision.setModule("mod1.1");
+ _findRevision.setRevision("latest.integration");
+ _findRevision.execute();
+ assertEquals("2.0", _findRevision.getProject().getProperty("ivy.revision"));
}
-
+
public void testLatestSubversion() throws Exception {
- _findRevision.setOrganisation("org1");
- _findRevision.setModule("mod1.1");
- _findRevision.setRevision("1.0+");
- _findRevision.execute();
- assertEquals("1.0.1", _findRevision.getProject().getProperty("ivy.revision"));
+ _findRevision.setOrganisation("org1");
+ _findRevision.setModule("mod1.1");
+ _findRevision.setRevision("1.0+");
+ _findRevision.execute();
+ assertEquals("1.0.1", _findRevision.getProject().getProperty("ivy.revision"));
}
-
+
}
Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java Tue Jun 5 05:02:27 2007
@@ -25,10 +25,11 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Delete;
-
public class IvyInstallTest extends TestCase {
private File _cache;
+
private IvyInstall _install;
+
private Project _project;
protected void setUp() throws Exception {
@@ -72,13 +73,13 @@
_install.setRevision("zzz");
_install.setFrom("test");
_install.setTo("1");
-
+
try {
_install.execute();
fail("unknown dependency, failure expected (haltunresolved=true)");
} catch (BuildException be) {
// success
- }
+ }
}
public void testDependencyNotFoundSuccess() {
@@ -88,11 +89,11 @@
_install.setFrom("test");
_install.setTo("1");
_install.setHaltonfailure(false);
-
+
try {
_install.execute();
} catch (BuildException be) {
fail("unknown dependency, failure unexepected (haltunresolved=false)");
- }
+ }
}
}