You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by ni...@apache.org on 2004/07/28 06:44:01 UTC

svn commit: rev 30831 - incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache

Author: nickchalko
Date: Tue Jul 27 23:43:59 2004
New Revision: 30831

Added:
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/test2-export.build.xml
Modified:
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/CachedResourceSetTaskTest.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/build.xml
Log:
Added another export test

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/CachedResourceSetTaskTest.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/CachedResourceSetTaskTest.java	(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/CachedResourceSetTaskTest.java	Tue Jul 27 23:43:59 2004
@@ -16,6 +16,7 @@
  * ========================================================================
  */
 package org.apache.depot.update.ant.cache;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
@@ -27,6 +28,7 @@
 import org.apache.tools.ant.BuildFileTest;
 import org.custommonkey.xmlunit.XMLAssert;
 import org.xml.sax.SAXException;
+
 /**
  * @author <a href="http://incubator.apache.org/depot" >The Apache Incubator
  *         Depot Project </a>
@@ -34,6 +36,7 @@
  */
 public class CachedResourceSetTaskTest extends BuildFileTest {
 	private final String SANDBOX = "build/test/sandbox";
+
 	/**
 	 * Constructor for RuperDependTaskTest.
 	 * 
@@ -42,13 +45,16 @@
 	public CachedResourceSetTaskTest(String arg0) {
 		super(arg0);
 	}
+
 	public static void main(String[] args) {
 		junit.textui.TestRunner.run(CachedResourceSetTaskTest.class);
 	}
+
 	public void setUp() {
 		Logger.testInit();
 		configureProject("src/test/org/apache/depot/update/ant/cache/build.xml");
 	}
+
 	public void test1() {
 		try {
 			executeTarget("test1");
@@ -59,6 +65,7 @@
 			System.out.println(getOutput());
 		}
 	}
+
 	public void test2() {
 		try {
 			executeTarget("test2");
@@ -69,6 +76,7 @@
 			System.out.println(getOutput());
 		}
 	}
+
 	public void test3() {
 		try {
 			expectSpecificBuildException("test3",
@@ -78,6 +86,7 @@
 			System.out.println(getOutput());
 		}
 	}
+
 	public void test4() {
 		try {
 			executeTarget("test4");
@@ -88,6 +97,7 @@
 			System.out.println(getOutput());
 		}
 	}
+
 	public void testNotFound() {
 		try {
 			expectSpecificBuildException("testNotFound",
@@ -97,6 +107,7 @@
 			System.out.println(getOutput());
 		}
 	}
+
 	/**
 	 * Test the exporting of cached set test1.
 	 *  
@@ -118,4 +129,27 @@
 			System.out.println(getOutput());
 		}
 	}
+
+	/**
+	 * Test the exporting of cached set test1.
+	 *  
+	 */
+	public void testExport2() throws FileNotFoundException, SAXException,
+			IOException, ParserConfigurationException {
+		try {
+			executeTarget("testExport2");
+			File generatedFile = new File("build/test2-export.build.xml");
+			File expectedFile = new File(
+					"build/expected-test2-export.build.xml");
+			assertTrue("Expected " + generatedFile + " to  exists",
+					generatedFile.exists());
+			XMLAssert
+					.assertXMLEqual("Exported cached set test2",
+							new FileReader(expectedFile), new FileReader(
+									generatedFile));
+		} finally {
+			System.out.println(getOutput());
+		}
+	}
+
 }

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/build.xml
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/build.xml	(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/build.xml	Tue Jul 27 23:43:59 2004
@@ -113,6 +113,20 @@
 			</filterset>
 		</copy>
 		<cachedsetexport refid="test1" toFile="build/test1-export.build.xml" />
+	</target>
+	
+	<target name="testExport2" depends="test2">
+		<delete file="build/test2-export.build.xml" />
+		<path id="convert" location="${basedir}" />
+		<pathconvert property="converted" refid="convert" targetos="unix" />
+		<copy file="src/test/org/apache/depot/update/ant/cache/test2-export.build.xml" 
+			tofile="build/expected-test2-export.build.xml" 
+			overwrite="true">
+			<filterset>
+				<filter token="basedir" value="${converted}" />
+			</filterset>
+		</copy>
+		<cachedsetexport refid="test2" toFile="build/test2-export.build.xml" />
 	</target>
 
 	<target name="clean-jars">

Added: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/test2-export.build.xml
==============================================================================
--- (empty file)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/cache/test2-export.build.xml	Tue Jul 27 23:43:59 2004
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE cachedartifactset PUBLIC "-//APACHE//DTD CachedArtifact V0.1//EN" "http://incubator.apache.org/depot/dtd/cachedartifact-v01.dtd">
+<cachedartifactset id="test2">
+    <artifact name="helloworld" 
+              group="helloworld"
+              version="1.2" 
+              href="file://@basedir@/src/resources/test/repo/helloworld/jars/helloworld-1.2.jar"/>
+</cachedartifactset>