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/05/03 07:22:42 UTC

svn commit: rev 10508 - in incubator/depot/trunk/update/src: java/org/apache/depot/update/ant java/org/apache/depot/update/query test/org/apache/depot/update/ant

Author: nickchalko
Date: Mon May  3 00:22:40 2004
New Revision: 10508

Added:
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/test1-export.build.xml
Modified:
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/AntUtils.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSet.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSetExportTask.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/RepositoryElement.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ResourceResult.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/CachedResourceSetTaskTest.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/build.xml
Log:
Export is now basically working, and the test pass.  But they will fail on other machines.
We need to deal with the test file's referece to the test-repo.

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/AntUtils.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/AntUtils.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/AntUtils.java	Mon May  3 00:22:40 2004
@@ -17,6 +17,10 @@
  */
 package org.apache.depot.update.ant;
 import java.io.File;
+import java.util.List;
+
+import org.apache.depot.update.query.ResourceResult;
+import org.apache.depot.update.resource.Resource;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 /**
@@ -112,5 +116,14 @@
 			throw new BuildException("The property depot.home must be set");
 		}
 		return depotHome;
+	}
+	/**
+	 * @param this
+	 * @return
+	 */
+	static Resource getFirstResource(ResourceResult res) {
+		List l = (List) res.get(0);
+		Resource resource = (Resource) l.get(0);
+		return resource;
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSet.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSet.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSet.java	Mon May  3 00:22:40 2004
@@ -18,9 +18,9 @@
 package org.apache.depot.update.ant;
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-
 import org.apache.depot.common.DepotException;
 import org.apache.depot.update.ResourceUpdater;
 import org.apache.depot.update.UpdateException;
@@ -59,7 +59,6 @@
 	private ResourceUpdater m_updater = null;
 	private boolean isAlwaysCheckRemote = false;
 	private boolean checkClassPath = true;
-
 	/**
 	 *  
 	 */
@@ -67,7 +66,6 @@
 		super();
 		this.project = project;
 	}
-
 	/**
 	 * @param resource
 	 * @return Resource
@@ -77,14 +75,12 @@
 		resourceList.add(resource);
 		return resource;
 	}
-
 	/**
 	 * @return Returns the id.
 	 */
 	public String getId() {
 		return id;
 	}
-
 	/**
 	 * @param id
 	 *            The id to set.
@@ -93,7 +89,6 @@
 		this.id = id;
 		project.addReference(id + ".fileset", fileSet);
 	}
-
 	/**
 	 * @return
 	 */
@@ -103,7 +98,6 @@
 		addResources(scanner);
 		return scanner;
 	}
-
 	/**
 	 * @param scanner
 	 */
@@ -113,7 +107,6 @@
 			add(scanner, r);
 		}
 	}
-
 	/**
 	 * @param scanner
 	 * @param r
@@ -134,11 +127,10 @@
 			throw new BuildException("Unable to find " + r);
 		}
 	}
-
 	/**
-	 * Find and download if needed a the best local cached copy of a file.
-	 * First check if a compitable file is available locally. If not down load
-	 * the best one available from the repository. And finally return the best
+	 * Find and download if needed a the best local cached copy of a file. First
+	 * check if a compitable file is available locally. If not down load the
+	 * best one available from the repository. And finally return the best
 	 * compatible file.
 	 * 
 	 * @param r
@@ -159,29 +151,28 @@
 		file = getCachedFile(r);
 		return file;
 	}
-
 	/**
 	 * @param r
 	 */
 	private void cacheFile(ResourceElement r) {
 		try {
-			ResourceResult res = query(r, r.getIRepository());
-			if (res.size() == 0) {
-				return;
-			} else if (res.size() == 1) {
-				downLoadRemoteResult(res);
-				return;
-			} else {
-				log("Found " + res.size() + " matches for " + r
-						+ " returning first", Project.MSG_VERBOSE);
-				downLoadRemoteResult(res);
-				return;
+			Resource resource = findBestRepoteResource(r);
+			if (resource != null) {
+				r.setDownloadedFrom(resource.getLocation().toExternalForm());
+				downLoadRemoteResult(resource);
 			}
+			return;
 		} catch (Exception e) {
 			throw new BuildException("Unable to get local copy of " + r, e);
 		}
 	}
-
+	/**
+	 * @param r
+	 * @return
+	 */
+	Resource findBestRepoteResource(ResourceElement r) {
+		return r.findBestRepoteResource();
+	}
 	/**
 	 * @param r
 	 */
@@ -202,7 +193,6 @@
 					e);
 		}
 	}
-
 	/**
 	 * @return
 	 */
@@ -218,7 +208,6 @@
 				"Local Repository Cache", true);
 		return repo;
 	}
-
 	/**
 	 * Should the cached set always look the remore repository for updates
 	 * 
@@ -227,7 +216,6 @@
 	public boolean isAlwaysCheckRemote() {
 		return isAlwaysCheckRemote;
 	}
-
 	/**
 	 * Should the cached set always look the remore repository for updates
 	 * 
@@ -237,52 +225,18 @@
 	public void setAlwaysCheckRemote(boolean isAlwaysCheckRemote) {
 		this.isAlwaysCheckRemote = isAlwaysCheckRemote;
 	}
-
 	/**
 	 * @param r
 	 * @param res
 	 * @return
 	 */
 	private File getFirstFile(ResourceResult res) throws Exception {
-		Resource resource = getFirstResource(res);
+		Resource resource = AntUtils.getFirstResource(res);
 		return resource.getLocation().getFile();
 	}
-
-	/**
-	 * @param res
-	 * @return
-	 */
-	private Resource getFirstResource(ResourceResult res) {
-		List l = (List) res.get(0);
-		Resource resource = (Resource) l.get(0);
-		return resource;
-	}
-
-	private ResourceResult query(ResourceElement r, IRepository repo) { //TODO
-		// experiment
-		log("Looking for " + r, Project.MSG_DEBUG);
-		try {
-			DefaultQueryEngine dqe = new DefaultQueryEngine();
-			ResourceQuery query = new ResourceQuery(r.getResourceGroup(), r
-					.getResourceSelector(), null, VersionComparator.REVERSE);
-			//TODO need to be a better way to sort by.
-			ResourceUpdaterContext context = new ResourceUpdaterContext();
-			context.setProtocolManager(new DefaultProtocolOperationsManager(
-					context));
-			RepositorySet repositorySet = RepositorySet.getRepositorySet(
-					getId(), true);
-			repositorySet.addRepository(repo);
-			RepositorySetWrapper rw = new RepositorySetWrapper(repositorySet,
-					context);
-			ResourceResult result = dqe.queryRepositories(rw, query);
-			return result;
-		} catch (VersionException e) {
-			throw new BuildException("Unable to process " + r, e);
-		} catch (UpdateException e) {
-			throw new BuildException("Unable to get " + r, e);
-		}
+	private ResourceResult query(ResourceElement r, IRepository repo) {
+		return r.query(repo);
 	}
-
 	/**
 	 * @return
 	 */
@@ -291,15 +245,18 @@
 				LOCAL_REPOSITORY_ID, ResolvedFile.resolve(getRepoDir()));
 		return repository;
 	}
-
 	/**
-	 * @param res
-	 * @throws RuperException
+	 * @param resource
+	 * @throws UpdateException
 	 */
-	private void downLoadRemoteResult(ResourceResult res)
-			throws UpdateException {
-		Resource resource = getFirstResource(res);
+	private void downLoadRemoteResult(Resource resource) throws UpdateException {
 		ResourceUpdater ru = new ResourceUpdater();
 		ru.downloadResource(resource, getLocalRepository());
+	}
+	/**
+	 * @return Returns the unmodifiableList of resources.
+	 */
+	List getResourceList() {
+		return Collections.unmodifiableList(resourceList);
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSetExportTask.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSetExportTask.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/CachedResourceSetExportTask.java	Mon May  3 00:22:40 2004
@@ -16,9 +16,14 @@
  * ========================================================================
  */
 package org.apache.depot.update.ant;
-
 import java.io.File;
-
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 /**
  * Export a cached resource set to xml file. <code>
@@ -33,7 +38,6 @@
 public class CachedResourceSetExportTask extends Task {
 	private String refid;
 	private File toFile;
-	
 	/**
 	 * The refid of the cachedset to export.
 	 * 
@@ -53,6 +57,7 @@
 	}
 	/**
 	 * The file to export the Cached set to
+	 * 
 	 * @return Returns the toFile.
 	 */
 	public File getToFile() {
@@ -61,9 +66,41 @@
 	/**
 	 * The file to export the Cached set to
 	 * 
-	 * @param toFile The toFile to set.
+	 * @param toFile
+	 *            The toFile to set.
 	 */
 	public void setToFile(File toFile) {
 		this.toFile = toFile;
+	}
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.tools.ant.Task#execute()
+	 */
+	public void execute() throws BuildException {
+		try {
+			CachedResourceSet cachedResourceSet = (CachedResourceSet) getProject()
+					.getReference(getRefid());
+			// TODO use real XML stuff
+			// njc Feeling lazy tonight
+			Writer writer = new FileWriter(getToFile());
+			PrintWriter out = new PrintWriter(writer);
+			List resourceList = cachedResourceSet.getResourceList();
+			out.println("<chachedresourceset id=\"" + getRefid() + "\">");
+			for (Iterator i = resourceList.iterator(); i.hasNext();) {
+				ResourceElement resource = (ResourceElement) i.next();
+				out.println("<resource" + " name=\"" + resource.getName()
+						+ "\"" + " version=\"" + resource.getVersion() + "\""
+						+ " href=\"" + resource.getDownloadedFrom() + "\"" + ""
+						+ "/>");
+				log(resource + "  from  " + resource.getDownloadedFrom());
+			}
+			out.println("</chachedresourceset >");
+			out.close();
+			writer.close();
+		} catch (Exception e) {
+			throw new BuildException("Error exporting cached resource set "
+					+ getRefid(), e);
+		}
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/RepositoryElement.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/RepositoryElement.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/RepositoryElement.java	Mon May  3 00:22:40 2004
@@ -26,6 +26,7 @@
  *  @version $Revision: $
  */
 public class RepositoryElement extends DataType {
+	
 
 	private URL url;
 	private boolean remote;
@@ -36,6 +37,7 @@
 	 */
 	public boolean isRemote() {
 		return remote;
+		
 	}
 	/**
 	 * @param remote The remote to set.

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ant/ResourceElement.java	Mon May  3 00:22:40 2004
@@ -1,27 +1,37 @@
-/* ========================================================================
+/*
+ * ========================================================================
  * Copyright 2004 The Apache Software Foundation
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
  * http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
  * ========================================================================
  */
 package org.apache.depot.update.ant;
 import java.io.File;
-
+import java.util.List;
+import org.apache.depot.update.UpdateException;
+import org.apache.depot.update.impl.RepositorySetWrapper;
+import org.apache.depot.update.impl.ResourceUpdaterContext;
+import org.apache.depot.update.protocols.DefaultProtocolOperationsManager;
+import org.apache.depot.update.query.DefaultQueryEngine;
+import org.apache.depot.update.query.ResourceQuery;
+import org.apache.depot.update.query.ResourceResult;
 import org.apache.depot.update.repository.DefaultRepository;
 import org.apache.depot.update.repository.IRepository;
+import org.apache.depot.update.repository.RepositorySet;
 import org.apache.depot.update.resource.Resource;
 import org.apache.depot.update.resource.ResourceGroup;
 import org.apache.depot.update.resource.ResourceType;
+import org.apache.depot.update.resource.compare.VersionComparator;
 import org.apache.depot.update.resource.select.NameSelector;
 import org.apache.depot.update.resource.select.TypeSelector;
 import org.apache.depot.update.resource.select.VersionSelector;
@@ -32,16 +42,19 @@
 import org.apache.depot.version.Version;
 import org.apache.depot.version.VersionException;
 import org.apache.depot.version.impl.VersionImporter;
+import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
 /**
  * @version $Revision: $
  */
-public class ResourceElement {
+public class ResourceElement extends DataType {
 	private String group;
 	private String name;
 	private String version;
 	private String repository;
 	private String ext;
+	private String downloadedFrom;
 	private final Project project;
 	/**
 	 * @return Returns the name.
@@ -88,7 +101,8 @@
 	public String getExt() {
 		return ext;
 	}
-	/**	 *            The ext to set.
+	/**
+	 * * The ext to set.
 	 */
 	public void setExt(String ext) {
 		this.ext = ext;
@@ -174,21 +188,78 @@
 	 */
 	public ResourceElement(Project project) {
 		super();
-		this.project=project;
+		this.project = project;
 	}
-	
-	
-	public ISelector getResourceSelector() throws VersionException{
+	public ISelector getResourceSelector() throws VersionException {
 		AndSelector set = new AndSelector();
-
 		set.addSelector(new NameSelector(name));
-		
 		set.addSelector(new TypeSelector(getResourceType()));
-		
 		if (null != version) {
-			set.addSelector(new VersionSelector(VersionImporter.importVersion(version)));
+			set.addSelector(new VersionSelector(VersionImporter
+					.importVersion(version)));
+		}
+		return (ISelector) set;
+	}
+	/**
+	 * @return
+	 */
+	public String getDownloadedFrom() {
+		if (downloadedFrom == null) {
+			Resource resource = findBestRepoteResource();
+			if (resource != null) {
+			downloadedFrom=resource.getLocation().toExternalForm();
+			}
+		}
+		return downloadedFrom;
+	}
+	/**
+	 * @param downloadedFrom
+	 *            The downloadedFrom to set.
+	 */
+	void setDownloadedFrom(String downloadedFrom) {
+		this.downloadedFrom = downloadedFrom;
+	}
+	/**
+	 * @param this
+	 * @return
+	 */
+	Resource findBestRepoteResource() {
+		ResourceResult res = query(getIRepository());
+		Resource resource = null;
+		if (res.size() == 0) {
+			resource = null;
+		} else if (res.size() == 1) {
+			resource = AntUtils.getFirstResource(res);
+		} else {
+			getProject().log(
+					"Found " + res.size() + " matches for " + this
+							+ " returning first", Project.MSG_VERBOSE);
+			resource = AntUtils.getFirstResource(res);
+		}
+		return resource;
+	}
+	ResourceResult query(IRepository repo) { //TODO
+		// experiment
+		getProject().log("Looking for " + this, Project.MSG_DEBUG);
+		try {
+			DefaultQueryEngine dqe = new DefaultQueryEngine();
+			ResourceQuery query = new ResourceQuery(getResourceGroup(),
+					getResourceSelector(), null, VersionComparator.REVERSE);
+			//TODO need to be a better way to sort by.
+			ResourceUpdaterContext context = new ResourceUpdaterContext();
+			context.setProtocolManager(new DefaultProtocolOperationsManager(
+					context));
+			RepositorySet repositorySet = RepositorySet.getRepositorySet(repo
+					.getIdentifier().getId(), true);
+			repositorySet.addRepository(repo);
+			RepositorySetWrapper rw = new RepositorySetWrapper(repositorySet,
+					context);
+			ResourceResult result = dqe.queryRepositories(rw, query);
+			return result;
+		} catch (VersionException e) {
+			throw new BuildException("Unable to process " + this, e);
+		} catch (UpdateException e) {
+			throw new BuildException("Unable to get " + this, e);
 		}
-		
-		return (ISelector)set;
 	}
-}
+}
\ No newline at end of file

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ResourceResult.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ResourceResult.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/query/ResourceResult.java	Mon May  3 00:22:40 2004
@@ -19,10 +19,12 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.depot.common.util.debug.DebugUtils;
 import org.apache.depot.common.util.debug.Dumpable;
 import org.apache.depot.common.util.note.AnnotationScratchpad;
+import org.apache.depot.update.resource.Resource;
 
 /**
  * @author arb_jack
@@ -106,4 +108,5 @@
 		}
 
 	}
+
 }

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/CachedResourceSetTaskTest.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/CachedResourceSetTaskTest.java	(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/CachedResourceSetTaskTest.java	Mon May  3 00:22:40 2004
@@ -17,8 +17,16 @@
  */
 package org.apache.depot.update.ant;
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.depot.common.log.Logger;
 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>
@@ -44,7 +52,8 @@
 	public void test1() {
 		try {
 			executeTarget("test1");
-			File file = new File(SANDBOX + "/helloworld/jars/helloworld-1.1.jar");
+			File file = new File(SANDBOX
+					+ "/helloworld/jars/helloworld-1.1.jar");
 			assertTrue("Expected " + file + " to  exists", file.exists());
 		} finally {
 			System.out.println(getOutput());
@@ -53,7 +62,8 @@
 	public void test2() {
 		try {
 			executeTarget("test2");
-			File file = new File(SANDBOX + "/helloworld/jars/helloworld-1.2.jar");
+			File file = new File(SANDBOX
+					+ "/helloworld/jars/helloworld-1.2.jar");
 			assertTrue("Expected " + file + " to  exists", file.exists());
 		} finally {
 			System.out.println(getOutput());
@@ -68,17 +78,16 @@
 			System.out.println(getOutput());
 		}
 	}
-	
 	public void test4() {
 		try {
 			executeTarget("test4");
-			File file = new File(SANDBOX + "/helloworld/jars/helloworld-1.2.jar");
+			File file = new File(SANDBOX
+					+ "/helloworld/jars/helloworld-1.2.jar");
 			assertTrue("Expected " + file + " to  exists", file.exists());
 		} finally {
 			System.out.println(getOutput());
 		}
 	}
-	
 	public void testNotFound() {
 		try {
 			expectSpecificBuildException("testNotFound",
@@ -90,17 +99,21 @@
 	}
 	/**
 	 * Test the exporting of cached set test1.
-	 *
+	 *  
 	 */
-	public void testExport1() {
+	public void testExport1() throws FileNotFoundException, SAXException, IOException, ParserConfigurationException {
 		try {
 			executeTarget("testExport1");
-			File file = new File("build/test1-export.build.xml");
-			assertTrue("Expected " + file + " to  exists", file.exists());
+			File generatedFile = new File("build/test1-export.build.xml");
+			File expectedFile = new File(
+					"src/test/org/apache/depot/update/ant/test1-export.build.xml");
+			assertTrue("Expected " + generatedFile + " to  exists",
+					generatedFile.exists());
+			XMLAssert.assertXMLEqual( "Exported cached set test1", new FileReader(
+					generatedFile), new FileReader(expectedFile));
+			
 		} finally {
 			System.out.println(getOutput());
 		}
 	}
-	
-	
 }

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/build.xml
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/build.xml	(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/build.xml	Mon May  3 00:22:40 2004
@@ -18,87 +18,96 @@
 <project name="updateModule-test" basedir="../../../../../../../" default="test1">
 	<property name="localtest.dir" value="${basedir}/src/resources/test/repo" />
 
+
+
 	<property name="depot.home" value="${basedir}/build/depot-home" />
 	<property name="local.repository" value="${depot.home}/local-repository" />
 	<property name="sandbox.dir" value="build/test/sandbox" />
 
-	<typedef resource="depot-update-antlib.xml" />
-	<repository id="maven" url="http://www.ibiblio.org/maven/" remote="true" />
-	<repository id="localtest" url="file:///${localtest.dir}" remote="true" />
-	<target name="test1" depends="clean-jars">
-
-		<!-- this test should find the 1.1 jar already in place. -->
-		<copy toDir="${depot.home}/local-repository">
-			<fileset dir="${localtest.dir}">
-				<include name="**/*1.1*" />
-			</fileset>
-		</copy>
-		<cachedset id="test1">
-			<resource name="helloworld" ext="jar" version="1.1" repository="localtest" />
-		</cachedset>
-		<copy toDir="${sandbox.dir}">
-			<fileset refid="test1.fileset" />
-		</copy>
-	</target>
-	<target name="test2" depends="clean-jars">
-		<!-- Since the local repo is cleaned this test should return the 1.2 jar downloaded for localtest -->
-		<cachedset id="test2">
-			<resource name="helloworld" ext="jar" version="1.2" repository="localtest" />
-		</cachedset>
-		<copy toDir="${sandbox.dir}">
-			<fileset refid="test2.fileset" />
-		</copy>
-	</target>
-	<target name="test3" depends="clean-jars">
-
-		<!-- helloworld 1.3 does not exist this should fail. -->
-		<cachedset id="test3">
-			<resource name="helloworld" ext="jar" version="1.3" repository="localtest" />
-		</cachedset>
-		<copy toDir="${sandbox.dir}">
-			<fileset refid="test3.fileset" />
-		</copy>
-	</target>
-	<target name="test4" depends="clean-jars">
-
-		<!-- this test should find the 1.2 jar from localtest -->
-		<copy toDir="${depot.home}/local-repository">
-			<fileset dir="${localtest.dir}">
-				<include name="**/*1.1*" />
-			</fileset>
-		</copy>
-		<cachedset id="test4">
-			<resource name="helloworld" ext="jar" version="1.2" repository="localtest" />
-		</cachedset>
-		<copy toDir="${sandbox.dir}">
-			<fileset refid="test4.fileset" />
-		</copy>
-	</target>
+	<path id="update.classpath">
+		<fileset dir="lib">
+			<include name="*.jar" />
+		</fileset>
+			<pathelement location="build/depot-update/classes" />
+	</path>
+
+		<typedef resource="depot-update-antlib.xml" classpathref="update.classpath"/>
+		<repository id="maven" url="http://www.ibiblio.org/maven/" remote="true" />
+		<repository id="localtest" url="file:///${localtest.dir}" remote="true" />
+		<target name="test1" depends="clean-jars">
+
+			<!-- this test should find the 1.1 jar already in place. -->
+			<copy toDir="${depot.home}/local-repository">
+				<fileset dir="${localtest.dir}">
+					<include name="**/*1.1*" />
+				</fileset>
+			</copy>
+			<cachedset id="test1">
+				<resource name="helloworld" ext="jar" version="1.1" repository="localtest" />
+			</cachedset>
+			<copy toDir="${sandbox.dir}">
+				<fileset refid="test1.fileset" />
+			</copy>
+		</target>
+		<target name="test2" depends="clean-jars">
+			<!-- Since the local repo is cleaned this test should return the 1.2 jar downloaded for localtest -->
+			<cachedset id="test2">
+				<resource name="helloworld" ext="jar" version="1.2" repository="localtest" />
+			</cachedset>
+			<copy toDir="${sandbox.dir}">
+				<fileset refid="test2.fileset" />
+			</copy>
+		</target>
+		<target name="test3" depends="clean-jars">
+
+			<!-- helloworld 1.3 does not exist this should fail. -->
+			<cachedset id="test3">
+				<resource name="helloworld" ext="jar" version="1.3" repository="localtest" />
+			</cachedset>
+			<copy toDir="${sandbox.dir}">
+				<fileset refid="test3.fileset" />
+			</copy>
+		</target>
+		<target name="test4" depends="clean-jars">
+
+			<!-- this test should find the 1.2 jar from localtest -->
+			<copy toDir="${depot.home}/local-repository">
+				<fileset dir="${localtest.dir}">
+					<include name="**/*1.1*" />
+				</fileset>
+			</copy>
+			<cachedset id="test4">
+				<resource name="helloworld" ext="jar" version="1.2" repository="localtest" />
+			</cachedset>
+			<copy toDir="${sandbox.dir}">
+				<fileset refid="test4.fileset" />
+			</copy>
+		</target>
 
 
-	<target name="test99">
-		<!--cachedset id="foo">
+		<target name="test99">
+			<!--cachedset id="foo">
 			<project name="xalan" version="4" module="http://gump.apache.org/modules/xalan.xml" />
 		</cachedset-->
-	</target>
-	<target name="testNotFound">
-		<cachedset id="testNotFound">
-			<resource name="notfound" ext="jar" version="1.2" repository="localtest" />
-		</cachedset>
-		<!-- have to use the chaced set before it is used. -->
-		<copy toDir="${sandbox.dir}">
-			<fileset refid="testNotFound.fileset" />
-		</copy>
-	</target>
-
-
-	<target name="testExport1" depends="test1">
-		<delete file="build/test1-export.build.xml"/>
-		<cachedsetexport refid="test1" toFile="build/test1-export.build.xml" />
-	</target>
-
-	<target name="clean-jars">
-		<delete dir="${local.repository}" />
-		<delete dir="${sandbox.dir}" />
-	</target>
-</project>
+		</target>
+		<target name="testNotFound">
+			<cachedset id="testNotFound">
+				<resource name="notfound" ext="jar" version="1.2" repository="localtest" />
+			</cachedset>
+			<!-- have to use the chaced set before it is used. -->
+			<copy toDir="${sandbox.dir}">
+				<fileset refid="testNotFound.fileset" />
+			</copy>
+		</target>
+
+
+		<target name="testExport1" depends="test1">
+			<delete file="build/test1-export.build.xml" />
+			<cachedsetexport refid="test1" toFile="build/test1-export.build.xml" />
+		</target>
+
+		<target name="clean-jars">
+			<delete dir="${local.repository}" />
+			<delete dir="${sandbox.dir}" />
+		</target>
+	</project>

Added: incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/test1-export.build.xml
==============================================================================
--- (empty file)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ant/test1-export.build.xml	Mon May  3 00:22:40 2004
@@ -0,0 +1,5 @@
+<chachedresourceset id="test1">
+    <resource name="helloworld" 
+              version="1.1" 
+              href="file://C:/workspace/depot-update/src/resources/test/repo/helloworld/jars/helloworld-1.1.jar"/>
+</chachedresourceset >