incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 36840 - in incubator/depot/trunk/update/src: java/org/apache/depot/update java/org/apache/depot/update/repository test/org/apache/depot/update test/org/apache/depot/update/artifact
Date Wed, 25 Aug 2004 06:00:42 GMT
Author: nickchalko
Date: Tue Aug 24 23:00:41 2004
New Revision: 36840

Modified:
   incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactInstance.java
   incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/ArtifactInstanceTest.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/artifact/ArtifactTests.java
Log:
Moved test code to the test dir.

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/Artifact.java	Tue Aug 24
23:00:41 2004
@@ -17,8 +17,6 @@
 package org.apache.depot.update;
 
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.depot.common.util.debug.DebugUtils;
 import org.apache.depot.common.util.debug.Dumpable;
@@ -27,7 +25,6 @@
 import org.apache.depot.update.util.identity.GenericIdentifier;
 import org.apache.depot.version.Version;
 import org.apache.depot.version.impl.ApacheVersion;
-import org.apache.depot.version.impl.TestApacheVersion;
 
 /**
  * An entity in a repository (e.g. junit-3.8.1.jar). An Artifact has (at least
@@ -284,44 +281,5 @@
 		Artifact anotherArtifact = new Artifact(this.m_group,
 				this.m_identifier, this.m_type, this.m_version);
 		return anotherArtifact;
-	}
-
-	//
-	//	-----------------------------------------------------------------
-	//
-	public static List getTestArtifactList(String group, int count) {
-		List ArtifactList = new ArrayList();
-
-		// Populate with some test Artifacts...
-		for (int i = 0; i < count; ++i) {
-			String name = group + Integer.toString(1 + i);
-			ArtifactList.add(Artifact.getTestArtifact(name,
-					TestApacheVersion.getTestVersion(1, i),
-					ArtifactType.JAVA_BINARY));
-			ArtifactList.add(Artifact.getTestArtifact(name,
-					TestApacheVersion.getTestVersion(1, i),
-					ArtifactType.SOURCE_CODE));
-
-			// :TODO: Add some randomness
-		}
-
-		return ArtifactList;
-	}
-
-	public static Artifact getTestArtifact() {
-		return getTestArtifact("test");
-	}
-
-	public static Artifact getTestArtifact(String name) {
-		return getTestArtifact(name, ArtifactType.JAVA_BINARY);
-	}
-
-	public static Artifact getTestArtifact(String name, ArtifactType type) {
-		return getTestArtifact(name, TestApacheVersion.getTestVersion(1, 1), type);
-	}
-
-	public static Artifact getTestArtifact(String name, Version version,
-			ArtifactType type) {
-		return new Artifact(name, name, type.toString(), version);
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactInstance.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactInstance.java	(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/ArtifactInstance.java	Tue
Aug 24 23:00:41 2004
@@ -17,22 +17,16 @@
 package org.apache.depot.update;
 
 import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.apache.depot.common.util.debug.DebugUtils;
 import org.apache.depot.common.util.debug.Dumpable;
 import org.apache.depot.update.artifact.ArtifactAttributeMap;
 import org.apache.depot.update.artifact.ArtifactLocator;
-import org.apache.depot.update.artifact.ArtifactType;
 import org.apache.depot.update.util.flag.Flag;
 import org.apache.depot.update.util.identity.GenericIdentifier;
-import org.apache.depot.update.util.net.VirtualResourceLocator;
 import org.apache.depot.update.util.reference.IReferenceable;
 import org.apache.depot.update.util.select.ISelectable;
-import org.apache.depot.version.Version;
 import org.apache.depot.version.impl.ApacheVersion;
-import org.apache.depot.version.impl.TestApacheVersion;
 
 /**
  * This defines a 'real world' file, e.g. junit-3.8.1.jar and has all the
@@ -218,51 +212,5 @@
 		ArtifactInstance aInstance = new ArtifactInstance((Artifact)this.m_artifact.clone(), 
 					(ArtifactLocator)this.m_locator.clone());
 		return aInstance;
-	}
-	//
-	//	-----------------------------------------------------------------
-	//
-	public static List getTestArtifactList(String group, int count) {
-		List resourceList = new ArrayList();
-
-		// Populate with some test resources...
-		for (int i = 0; i < count; ++i) {
-			String name = group + Integer.toString(1 + i);
-			resourceList.add(ArtifactInstance.getTestArtifactInstance(name,
-					TestApacheVersion.getTestVersion(1, i),
-					ArtifactType.JAVA_BINARY));
-			resourceList.add(ArtifactInstance.getTestArtifactInstance(name,
-					TestApacheVersion.getTestVersion(1, i),
-					ArtifactType.SOURCE_CODE));
-
-			// :TODO: Add some randomness
-		}
-
-		return resourceList;
-	}
-
-	public static ArtifactInstance getTestArtifactInstance() {
-		return getTestArtifactInstance("test");
-	}
-
-	public static ArtifactInstance getTestArtifactInstance(String name) {
-		return getTestArtifactInstance(name, ArtifactType.JAVA_BINARY);
-	}
-
-	public static ArtifactInstance getTestArtifactInstance(String name,
-			ArtifactType type) {
-		return getTestArtifactInstance(name, TestApacheVersion.getTestVersion(1, 1), type);
-	}
-
-	public static ArtifactInstance getTestArtifactInstance(String name,
-			Version version, ArtifactType type) {
-		return getTestArtifactInstance(name,version,type,".test");
-	}
-	public static ArtifactInstance getTestArtifactInstance(String name,
-			Version version, ArtifactType type, String extn) {
-		return new ArtifactInstance(
-				new Artifact("test", name, type, version), 
-				new ArtifactLocator(name,extn,
-						new VirtualResourceLocator("http://somewhere/" + name)));
 	}
 }

Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
(original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/repository/MockRepository.java
Tue Aug 24 23:00:41 2004
@@ -20,6 +20,7 @@
 import java.util.List;
 
 import org.apache.depot.update.ArtifactInstance;
+import org.apache.depot.update.ArtifactInstanceTest;
 import org.apache.depot.update.Repository;
 import org.apache.depot.update.artifact.ArtifactGroup;
 import org.apache.depot.update.artifact.ArtifactLocator;
@@ -60,7 +61,7 @@
 
 		folderForGroup(group);
 
-		List instanceList = ArtifactInstance.getTestArtifactList(group.getName(), 10);
+		List instanceList = ArtifactInstanceTest.getTestArtifactList(group.getName(), 10);
 
 		results = SelectionHelper.select(instanceList, selector);
 

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/ArtifactInstanceTest.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/ArtifactInstanceTest.java
(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/ArtifactInstanceTest.java
Tue Aug 24 23:00:41 2004
@@ -6,10 +6,16 @@
  */
 package org.apache.depot.update;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import junit.framework.TestCase;
 
 import org.apache.depot.update.artifact.ArtifactLocator;
+import org.apache.depot.update.artifact.ArtifactType;
 import org.apache.depot.update.util.net.VirtualResourceLocator;
+import org.apache.depot.version.Version;
+import org.apache.depot.version.impl.TestApacheVersion;
 
 /**
  * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
@@ -64,6 +70,54 @@
 	}
 
 	public void testGetLocator() {
+	}
+
+	//
+	//	-----------------------------------------------------------------
+	//
+	public static List getTestArtifactList(String group, int count) {
+		List resourceList = new ArrayList();
+	
+		// Populate with some test resources...
+		for (int i = 0; i < count; ++i) {
+			String name = group + Integer.toString(1 + i);
+			resourceList.add(ArtifactInstanceTest.getTestArtifactInstance(name,
+					TestApacheVersion.getTestVersion(1, i),
+					ArtifactType.JAVA_BINARY));
+			resourceList.add(ArtifactInstanceTest.getTestArtifactInstance(name,
+					TestApacheVersion.getTestVersion(1, i),
+					ArtifactType.SOURCE_CODE));
+	
+			// :TODO: Add some randomness
+		}
+	
+		return resourceList;
+	}
+
+	public static ArtifactInstance getTestArtifactInstance() {
+		return getTestArtifactInstance("test");
+	}
+
+	public static ArtifactInstance getTestArtifactInstance(String name) {
+		return getTestArtifactInstance(name, ArtifactType.JAVA_BINARY);
+	}
+
+	public static ArtifactInstance getTestArtifactInstance(String name,
+			ArtifactType type) {
+		return getTestArtifactInstance(name, TestApacheVersion.getTestVersion(1, 1), type);
+	}
+
+	public static ArtifactInstance getTestArtifactInstance(String name,
+			Version version, ArtifactType type) {
+		return getTestArtifactInstance(name,version,type,".test");
+	}
+
+	public static ArtifactInstance getTestArtifactInstance(String name,
+			Version version, ArtifactType type, String extn) {
+		return new ArtifactInstance(
+				new Artifact("test", name, type, version), 
+				new ArtifactLocator(name,extn,
+						new VirtualResourceLocator("http://somewhere/" + name)));
 	}
 
 }

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/artifact/ArtifactTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/artifact/ArtifactTests.java
(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/artifact/ArtifactTests.java
Tue Aug 24 23:00:41 2004
@@ -16,10 +16,16 @@
 
 package org.apache.depot.update.artifact;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import junit.framework.TestCase;
 
 import org.apache.depot.common.log.Logger;
+import org.apache.depot.update.Artifact;
 import org.apache.depot.update.ArtifactInstance;
+import org.apache.depot.version.Version;
+import org.apache.depot.version.impl.TestApacheVersion;
 
 /**
  * @author arb_jack
@@ -80,5 +86,44 @@
 
 	public static void main(String[] args) {
 		junit.textui.TestRunner.run(ArtifactTests.class);
+	}
+
+	//
+	//	-----------------------------------------------------------------
+	//
+	public static List getTestArtifactList(String group, int count) {
+		List ArtifactList = new ArrayList();
+	
+		// Populate with some test Artifacts...
+		for (int i = 0; i < count; ++i) {
+			String name = group + Integer.toString(1 + i);
+			ArtifactList.add(ArtifactTests.getTestArtifact(name,
+					TestApacheVersion.getTestVersion(1, i),
+					ArtifactType.JAVA_BINARY));
+			ArtifactList.add(ArtifactTests.getTestArtifact(name,
+					TestApacheVersion.getTestVersion(1, i),
+					ArtifactType.SOURCE_CODE));
+	
+			// :TODO: Add some randomness
+		}
+	
+		return ArtifactList;
+	}
+
+	public static Artifact getTestArtifact() {
+		return getTestArtifact("test");
+	}
+
+	public static Artifact getTestArtifact(String name) {
+		return getTestArtifact(name, ArtifactType.JAVA_BINARY);
+	}
+
+	public static Artifact getTestArtifact(String name, ArtifactType type) {
+		return getTestArtifact(name, TestApacheVersion.getTestVersion(1, 1), type);
+	}
+
+	public static Artifact getTestArtifact(String name, Version version,
+			ArtifactType type) {
+		return new Artifact(name, name, type.toString(), version);
 	}
 }

Mime
View raw message