incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: rev 22086 - incubator/depot/trunk/update/src/test/org/apache/depot/update/files
Date Thu, 24 Jun 2004 20:53:29 GMT
Author: ajack
Date: Thu Jun 24 13:53:28 2004
New Revision: 22086

Modified:
   incubator/depot/trunk/update/src/test/org/apache/depot/update/files/ArtifactAnalyzerTests.java
   incubator/depot/trunk/update/src/test/org/apache/depot/update/files/DefaultArtifactAnalyzerTests.java
Log:
It might compile, let's see how Gump feels about it...

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/files/ArtifactAnalyzerTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/files/ArtifactAnalyzerTests.java
(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/files/ArtifactAnalyzerTests.java
Thu Jun 24 13:53:28 2004
@@ -22,8 +22,10 @@
 
 import org.apache.depot.common.log.Logger;
 import org.apache.depot.common.util.debug.DebugUtils;
+import org.apache.depot.update.Artifact;
 import org.apache.depot.update.ArtifactInstance;
 import org.apache.depot.update.UpdateException;
+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.impl.ApacheVersion;
@@ -47,7 +49,7 @@
 		m_analyzer = new DefaultArtifactFilenameAnalyzer(VirtualResourceLocator.getTestVRL());
 	}
 
-	public void testResources() throws Exception {
+	public void testArtifacts() throws Exception {
 		List testPatterns = new ArrayList();
 		String filename1 = "mystuff-1.2.jar";
 		testPatterns.add(filename1);
@@ -56,17 +58,19 @@
 		List expectedResults = new ArrayList();
 		expectedResults.add(
 			new ArtifactInstance(
-				"mystuff",
-				new ApacheVersion("1.2"),
+				new Artifact("mystuff",
+						"mystuff",
 				ArtifactType.JAVA_BINARY,
-				"jar",
+				new ApacheVersion("1.2")),
+				new ArtifactLocator(
 				filename1,
-				VirtualResourceLocator.getTestVRL()));
+				"jar",
+				VirtualResourceLocator.getTestVRL())));
 
-		checkResourceList(testPatterns, expectedResults);
+		checkArtifactList(testPatterns, expectedResults);
 	}
 
-	public void testResources1() throws Exception {
+	public void testArtifacts1() throws Exception {
 		List testPatterns = new ArrayList();
 		String filename1 = "mystuff.jar";
 		testPatterns.add(filename1);
@@ -75,17 +79,19 @@
 		List expectedResults = new ArrayList();
 		expectedResults.add(
 			new ArtifactInstance(
-				"mystuff",
-				null,
-				ArtifactType.JAVA_BINARY,
-				"jar",
+					new Artifact(
+							"mystuff",
+							"mystuff",
+				ArtifactType.JAVA_BINARY,null),
+				new ArtifactLocator(
 				filename1,
-				VirtualResourceLocator.getTestVRL()));
+				"jar",
+				VirtualResourceLocator.getTestVRL())));
 
-		checkResourceList(testPatterns, expectedResults);
+		checkArtifactList(testPatterns, expectedResults);
 	}
 
-	public void testResources2() throws Exception {
+	public void testArtifacts2() throws Exception {
 		List testPatterns = new ArrayList();
 		
 		String filename1 = "mystuff-1.2.jar";
@@ -97,17 +103,20 @@
 		List expectedResults = new ArrayList();
 		expectedResults.add(
 			new ArtifactInstance(
+					new Artifact(
+							"mystuff",
 				"mystuff",
-				new ApacheVersion("1.2"),
 				ArtifactType.JAVA_BINARY,
-				"jar",
+				new ApacheVersion("1.2")),
+				new ArtifactLocator(
 				filename1,
-				VirtualResourceLocator.getTestVRL()));
+				"jar",
+				VirtualResourceLocator.getTestVRL())));
 
-		checkResourceList(testPatterns, expectedResults);
+		checkArtifactList(testPatterns, expectedResults);
 	}
 
-	public void testResources3() throws Exception {
+	public void testArtifacts3() throws Exception {
 		List testPatterns = new ArrayList();
 		String filename1 = "mystuff-1.2.jar";
 		testPatterns.add(filename1);
@@ -117,18 +126,21 @@
 		List expectedResults = new ArrayList();
 		expectedResults.add(
 			new ArtifactInstance(
+					new Artifact(
+							"mystuff",
 				"mystuff",
-				new ApacheVersion("1.2"),
 				ArtifactType.JAVA_BINARY,
-				"jar",
+				new ApacheVersion("1.2")),
+				new ArtifactLocator(
 				filename1,
-				VirtualResourceLocator.getTestVRL()));
+				"jar",
+				VirtualResourceLocator.getTestVRL())));
 		//expectedResults.add("mystuff-1.2.jar.md5");
 
-		checkResourceList(testPatterns, expectedResults);
+		checkArtifactList(testPatterns, expectedResults);
 	}
 	
-	public void testResources4() throws Exception {
+	public void testArtifacts4() throws Exception {
 			List testPatterns = new ArrayList();
 			String filename1 = "my-stuff.jar";
 			testPatterns.add(filename1);
@@ -137,28 +149,28 @@
 			List expectedResults = new ArrayList();
 			expectedResults.add(
 				new ArtifactInstance(
-					"my-stuff",
-					null,
-					ArtifactType.JAVA_BINARY,
+					new Artifact("my-group","my-stuff",
+					ArtifactType.JAVA_BINARY, null),
+					
+					new ArtifactLocator(filename1,
 					"jar",
-					filename1,
-					VirtualResourceLocator.getTestVRL()));
+					VirtualResourceLocator.getTestVRL())));
 
-			checkResourceList(testPatterns, expectedResults);
+			checkArtifactList(testPatterns, expectedResults);
 		}
 
 	
-	private void checkResourceList(List patterns, List resources)
+	private void checkArtifactList(List patterns, List resources)
 		throws UpdateException {
-		List extractedResources = m_analyzer.determineResources(patterns);
+		List extractedArtifacts = m_analyzer.determineArtifacts(patterns);
 
 
-		assertNotNull("Resources", extractedResources);
+		assertNotNull("Artifacts", extractedArtifacts);
 
-		DebugUtils.dump(extractedResources);
+		DebugUtils.dump(extractedArtifacts);
 		DebugUtils.dump(resources);		
 		
-		assertEquals("Same Result List", resources, extractedResources);
+		assertEquals("Same Result List", resources, extractedArtifacts);
 	}
 
 	public static void main(String[] args) {

Modified: incubator/depot/trunk/update/src/test/org/apache/depot/update/files/DefaultArtifactAnalyzerTests.java
==============================================================================
--- incubator/depot/trunk/update/src/test/org/apache/depot/update/files/DefaultArtifactAnalyzerTests.java
(original)
+++ incubator/depot/trunk/update/src/test/org/apache/depot/update/files/DefaultArtifactAnalyzerTests.java
Thu Jun 24 13:53:28 2004
@@ -21,19 +21,22 @@
 import junit.framework.TestCase;
 
 import org.apache.depot.common.util.debug.DebugUtils;
-import org.apache.depot.update.UpdateException
-import org.apache.depot.update.aartifact.ArtifactTypetType;
-import org.apache.depot.upimpllArtifactInstancetance;
+import org.apache.depot.update.Artifact;
+import org.apache.depot.update.ArtifactInstance;
+import org.apache.depot.update.UpdateException;
+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.VersionImporter;
 
+
 /**
  * @author arb_jack
  */
 public class DefaultArtifactAnalyzerTests extends TestCase {
 
-	private DefaultResourceFilenameAnalyzer m_analyzer = null;
+	private DefaultArtifactFilenameAnalyzer m_analyzer = null;
 
 	//private VirtualResourceLocator m_http = null;
 	//private VirtualResourceLocator m_file = null;
@@ -43,7 +46,7 @@
 	}
 
 	public void setUp() throws Exception {
-		m_analyzer = new DefaultResourceFilenameAnalyzer(
+		m_analyzer = new DefaultArtifactFilenameAnalyzer(
 				VirtualResourceLocator.getTestVRL());
 	}
 
@@ -71,7 +74,7 @@
 		checkExtensionList(testPattern, testList);
 
 		//:TODO: Do we want UNKNOWN type?
-		checkResource(testPattern, createResource(testPattern, "mystuff",
+		checkArtifact(testPattern, createArtifact(testPattern, "mystuff",
 				"1.2", null, "fred"));
 	}
 
@@ -80,7 +83,7 @@
 		List testList = new ArrayList();
 		testList.add("fred");
 		checkExtensionList(testPattern, testList);
-		checkResource(testPattern, createResource(testPattern, "mystuff",
+		checkArtifact(testPattern, createArtifact(testPattern, "mystuff",
 				"1.2", "src", "fred"));
 	}
 
@@ -91,11 +94,11 @@
 		testList.add("Z");
 		checkExtensionList(testPattern, testList);
 		// :TODO: Is lower case ok?
-		checkResource(testPattern, createResource(testPattern, "mystuff",
+		checkArtifact(testPattern, createArtifact(testPattern, "mystuff",
 				"1.2", "src", "fred.z"));
 	}
 
-	private ArtifactInstance createResource(String filename, String name, String v,
+	private ArtifactInstance createArtifact(String filename, String name, String v,
 			String t, String e) throws UpdateException {
 		Version version = null;
 		if (null != v) {
@@ -105,31 +108,33 @@
 			}
 		}
 
-		ArtifactType resourceType = null;
+		ArtifactType artifactType = null;
 		if (null != t )
-			resourceType = ArtifactType.getFromString(t);
+			artifactType = ArtifactType.getFromString(t);
 		else
-			resourceType = ArtifactType.UNKNOWN;
+			artifactType = ArtifactType.UNKNOWN;
 		
 
-		return new ArtifactInstance(name, version, resourceType, e, filename,
-				new VirtualResourceLocator(new VirtualResourceLocator(
-						"http://www.apache.org/depot"), filename));
+		return new ArtifactInstance(new Artifact(name, name, artifactType, version), 
+				new ArtifactLocator(filename,e,
+						new VirtualResourceLocator(
+									new VirtualResourceLocator(
+						"http://www.apache.org/depot"), filename)));
 	}
 
-	private void checkResource(String pattern, ArtifactInstance expected)
+	private void checkArtifact(String pattern, ArtifactInstance expected)
 			throws UpdateException {
 
 		DebugUtils.printSeparator();
 		DebugUtils.dump(expected);
 
-		ArtifactInstance resource = m_analyzer.determineResource(pattern);
+		ArtifactInstance artifact = m_analyzer.determineArtifact(pattern);
 
-		assertNotNull("Determined something", resource);
+		assertNotNull("Determined something", artifact);
 
 		DebugUtils.printSeparator();
-		DebugUtils.dump(resource);
-		assertEquals("Same Resource", expected, resource);
+		DebugUtils.dump(artifact);
+		assertEquals("Same Artifact", expected, artifact);
 	}
 
 	private void checkExtensionList(String pattern, List extns) {

Mime
View raw message