You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by aj...@apache.org on 2004/05/03 16:06:52 UTC

svn commit: rev 10509 - in incubator/depot/trunk/version: . src/java/org/apache/depot/version/ant/environment src/java/org/apache/depot/version/context src/java/org/apache/depot/version/discovery/loading src/java/org/apache/depot/version/impl src/java/org/apache/depot/version/tool src/java/org/apache/depot/version/util/jar

Author: ajack
Date: Mon May  3 09:06:51 2004
New Revision: 10509

Modified:
   incubator/depot/trunk/version/build-ant-sample.xml
   incubator/depot/trunk/version/build-ant-test-optional-missing.xml
   incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/context/ExtensionRegistry.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/JarManifestVersionLoader.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/PackageVersionLoader.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/tool/VersionTool.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/util/jar/JarManifestHelper.java
Log:
Fixing tests, making less verbose.


Modified: incubator/depot/trunk/version/build-ant-sample.xml
==============================================================================
--- incubator/depot/trunk/version/build-ant-sample.xml	(original)
+++ incubator/depot/trunk/version/build-ant-sample.xml	Mon May  3 09:06:51 2004
@@ -27,7 +27,7 @@
 <project name="depot-version-ant-sample" default="gump" basedir=".">
 	
 	<!-- Use this for an optional dependency -->
-	<available file="depot-version-antlib.xml" property="version.available" />
+	<available resource="depot-version-antlib.xml" property="version.available" />
 	<target name="version-optional" if="version.available"
 			description="versioning">
 		<taskdef resource="depot-version-antlib.xml" />		

Modified: incubator/depot/trunk/version/build-ant-test-optional-missing.xml
==============================================================================
--- incubator/depot/trunk/version/build-ant-test-optional-missing.xml	(original)
+++ incubator/depot/trunk/version/build-ant-test-optional-missing.xml	Mon May  3 09:06:51 2004
@@ -25,7 +25,7 @@
 -->
 <project name="depot-version-ant-test-optional-missing" default="gump" basedir=".">
 	
-	<available file="depot-version-antlib.xml" property="version.available" />
+	<available resource="depot-version-antlib.xml" property="version.available" />
 	
 	<target name="version" if="version.available"
 			description="versioning">

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/ant/environment/EnvironmentTask.java	Mon May  3 09:06:51 2004
@@ -41,6 +41,7 @@
 import org.apache.depot.version.discovery.loading.VersionLoadContext;
 import org.apache.depot.version.extension.VirtualMachineExtension;
 import org.apache.depot.version.extension.VirtualMachineExtensionInformation;
+import org.apache.depot.version.util.IdentifierHelper;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.util.DOMElementWriter;
@@ -194,17 +195,24 @@
 			boolean evenNotOdd = true;
 			for (Iterator i = extensions.iterator();
 				i.hasNext();
-				evenNotOdd = !evenNotOdd) {
+				) {
 				Object entry = (Object) i.next();
 				if (entry instanceof VirtualMachineExtensionInformation) {
 					VirtualMachineExtensionInformation extensionInfo =
 						(VirtualMachineExtensionInformation) entry;
 					VirtualMachineExtension extension =
 						extensionInfo.getExtensionLoadContext().getExtension();
+					
+					//
+					// Perhaps allow these to show, if verbose.
+					//
+					if (IdentifierHelper.isPartOfJdk(extension.getName())) 
+						continue;
 
+					evenNotOdd = !evenNotOdd;
+					
 					logSeparator(Project.MSG_INFO,m_displayWidth, evenNotOdd);
 
-
 					logPair(
 						"Extension:",
 						extension.getName(),
@@ -233,10 +241,11 @@
 						' ');
 					}
 				}
-				else
+				else{
 					log(
 						entry.getClass().getName() + ":" + entry.toString(),
 						Project.MSG_INFO);
+					evenNotOdd = !evenNotOdd;}
 			}
 		}
 		else

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/context/ExtensionRegistry.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/context/ExtensionRegistry.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/context/ExtensionRegistry.java	Mon May  3 09:06:51 2004
@@ -14,7 +14,6 @@
  *  limitations under the License.
  */
 
-
 package org.apache.depot.version.context;
 
 import org.apache.depot.common.util.Registry;
@@ -22,7 +21,7 @@
 import org.apache.depot.version.extension.VirtualMachineExtensionLoadContext;
 
 /**
-
+ *  
  */
 public class ExtensionRegistry extends Registry {
 
@@ -34,22 +33,19 @@
 	}
 
 	public Object registerExtension(VirtualMachineExtensionLoadContext context) {
-		return registerExtension(
-			new VirtualMachineExtensionInformation(context));
+		return registerExtension(new VirtualMachineExtensionInformation(context));
 	}
 
 	public Object registerExtension(VirtualMachineExtensionInformation extn) {
 
 		String key = extn.getExtensionLoadContext().getExtension().getName();
 
-		VirtualMachineExtensionInformation registered =
-			(VirtualMachineExtensionInformation) get(key);
+		VirtualMachineExtensionInformation registered = (VirtualMachineExtensionInformation) get(key);
 
 		if (null == registered) {
 			super.put(key, extn);
 			registered = extn;
-		}
-		else {
+		} else {
 			registered.merge(extn);
 		}
 

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/JarManifestVersionLoader.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/JarManifestVersionLoader.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/JarManifestVersionLoader.java	Mon May  3 09:06:51 2004
@@ -80,7 +80,7 @@
 
 					//					System.out.println("Extension: " + extension);
 
-					Logger.getLogger().info(
+					Logger.getLogger().verbose(
 						"Loading from Manifest Extension-List: " + extension);
 
 					VersionLoadContext context =

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/PackageVersionLoader.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/PackageVersionLoader.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/discovery/loading/PackageVersionLoader.java	Mon May  3 09:06:51 2004
@@ -77,7 +77,7 @@
 
 		if ((null != extn.getImplementationVersion())) {
 
-			Logger.getLogger().info("Loaded from Package: " + p.getName());
+			Logger.getLogger().verbose("Loaded from Package: " + p.getName());
 
 			VersionMarker versionMarker =
 				new ApacheVersionMarker(

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java	Mon May  3 09:06:51 2004
@@ -167,7 +167,6 @@
 			lastVersionException = vfe;
 		}
 
-
 		if (null == version) {
 
 			//
@@ -189,7 +188,6 @@
 				Logger.getLogger().debug("Default: ", vfe);
 				lastVersionException = vfe;
 			}
-
 		}
 		//
 		//  Try all other specifications...

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/tool/VersionTool.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/tool/VersionTool.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/tool/VersionTool.java	Mon May  3 09:06:51 2004
@@ -26,10 +26,9 @@
 import org.apache.depot.common.util.cli.ParseException;
 
 /**
- *
  * @author $Author: arb_jack $
  * @version $Revision: 1.8 $
- * 
+ *  
  */
 public class VersionTool {
 
@@ -54,7 +53,6 @@
 	private static final String BASE_SHORT = "b";
 	private static final String BASE_LONG = "base";
 
-
 	private static Option l_versionId;
 	private static Option l_env;
 	private static Option l_check;
@@ -64,18 +62,10 @@
 	private static Option l_base;
 	private static Options l_options;
 	static {
-		l_versionId =
-			new Option(
-				VERSION_ID_SHORT,
-				VERSION_ID_LONG,
-				true,
+		l_versionId = new Option(VERSION_ID_SHORT, VERSION_ID_LONG, true,
 				"version identifier");
 		l_env = new Option(ENV_SHORT, ENV_LONG, false, "display environment");
-		l_check =
-			new Option(
-				CHECK_SHORT,
-				CHECK_LONG,
-				false,
+		l_check = new Option(CHECK_SHORT, CHECK_LONG, false,
 				"display all constraints, and evaluate");
 		l_verbose = new Option(VERBOSE_SHORT, VERBOSE_LONG, false, "verbose");
 		l_debug = new Option(DEBUG_SHORT, DEBUG_LONG, false, "debug");
@@ -111,41 +101,40 @@
 			int level = LogConstants.INFO;
 			if (verbose || debug)
 				level = debug ? LogConstants.DEBUG : LogConstants.VERBOSE;
-			Logger logger =
-				Logger.pushContext(level, new StandardLogListener());
+			Logger logger = Logger.pushContext(level, new StandardLogListener());
 
-			if (verbose)
-				tool.setVerbose(true);
+			try {
+				if (verbose)
+					tool.setVerbose(true);
+
+				if (cmd.isSet(l_env)) {
+					tool.displayEnvironment();
+
+					String output = cmd.getOptionValue(l_output);
+					if (null != output) {
+						tool.writeEnvironment(output);
+					}
 
-			if (cmd.isSet(l_env)) {
-				tool.displayEnvironment();
+					String base = cmd.getOptionValue(l_base);
+					if (null != base) {
+						tool.compareEnvironment(base);
+					}
 
-				String output = cmd.getOptionValue(l_output);
-				if (null != output) {
-					tool.writeEnvironment(output);
-				}
-				
-				String base = cmd.getOptionValue(l_base);
-				if (null != base) {
-					tool.compareEnvironment(base);
+				} else if (cmd.isSet(l_check)) {
+					tool.checkEnvironment();
+				} else {
+					String[] ids = cmd.getOptionValues(l_versionId);
+					if (null != ids)
+						for (int i = 0; i < ids.length; i++) {
+							tool.displayVersion(ids[i]);
+						}
 				}
-				
-			}
-			else if (cmd.isSet(l_check)) {
-				tool.checkEnvironment();
-			}
-			else {
-				String[] ids = cmd.getOptionValues(l_versionId);
-				if (null != ids)
-					for (int i = 0; i < ids.length; i++) {
-						tool.displayVersion(ids[i]);
-					}
+			} finally {
+				Logger.popContext(logger);
 			}
-		}
-		catch (ParseException exp) {
+		} catch (ParseException exp) {
 			System.err.println("VersionTool Usage Error: " + exp.getMessage());
-		}
-		catch (Exception exc) {
+		} catch (Exception exc) {
 			exc.printStackTrace();
 		}
 	}

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/util/jar/JarManifestHelper.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/util/jar/JarManifestHelper.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/util/jar/JarManifestHelper.java	Mon May  3 09:06:51 2004
@@ -37,7 +37,7 @@
 	private static final String SPEC_VERSION = "Specification-Version";
 
 	private static final String IMPL_TITLE = "Implementation-Title";
-	private static final String IMPL_VENDOR_ID = "Implementation-Vendor-Id";
+	//private static final String IMPL_VENDOR_ID = "Implementation-Vendor-Id";
 	private static final String IMPL_VENDOR = "Implementation-Vendor";
 	private static final String IMPL_VERSION = "Implementation-Version";
 
@@ -81,7 +81,7 @@
 
 		String implementationTitle = attributes.getValue(IMPL_TITLE);
 		String implementationVendor = attributes.getValue(IMPL_VENDOR);
-		String implementationVendorId = attributes.getValue(IMPL_VENDOR_ID);
+		//String implementationVendorId = attributes.getValue(IMPL_VENDOR_ID);
 		String implementationVersion = attributes.getValue(IMPL_VERSION);
 
 		String comment = attributes.getValue(COMMENT);