|
From: <mwl...@us...> - 2007-07-25 18:18:09
|
Revision: 436
http://cishell.svn.sourceforge.net/cishell/?rev=436&view=rev
Author: mwlinnem
Date: 2007-07-25 11:18:02 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
Initial import. Separates out the commandline code from the core ConverterTester.
Added Paths:
-----------
trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/
trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF
trunk/testing/org.cishell.testing.convertertester.commandline/build.properties
trunk/testing/org.cishell.testing.convertertester.commandline/src/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/
trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java
Added: trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF (rev 0)
+++ trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF 2007-07-25 18:18:02 UTC (rev 436)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Converter Tester Command-Line
+Bundle-SymbolicName: org.cishell.testing.convertertester.commandline
+Bundle-Version: 0.0.1
+Bundle-ClassPath: .
+Bundle-Localization: plugin
+Import-Package: org.cishell.framework,
+ org.cishell.framework.algorithm,
+ org.cishell.framework.data,
+ org.cishell.service.conversion,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.component;version="1.0.0",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.service.metatype;version="1.1.0",
+ org.osgi.service.prefs;version="1.1.0"
+Bundle-Activator: org.cishell.testing.convertertester.commandline.Activator
+Require-Bundle: org.cishell.testing.convertertester.core.new
Added: trunk/testing/org.cishell.testing.convertertester.commandline/build.properties
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.commandline/build.properties (rev 0)
+++ trunk/testing/org.cishell.testing.convertertester.commandline/build.properties 2007-07-25 18:18:02 UTC (rev 436)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = build/
+bin.includes = META-INF/,\
+ .
Added: trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java (rev 0)
+++ trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java 2007-07-25 18:18:02 UTC (rev 436)
@@ -0,0 +1,91 @@
+package org.cishell.testing.convertertester.commandline;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Scanner;
+
+import org.cishell.framework.CIShellContext;
+import org.cishell.framework.LocalCIShellContext;
+import org.cishell.testing.convertertester.core.tester.ConverterTester;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+public class Activator implements BundleActivator{
+ private ConverterTester ct;
+ private BundleContext b;
+ private CIShellContext c;
+ private File configFile;
+
+ public static final String QUIT = "q";
+
+ public void start(BundleContext b){
+ this.b = b;
+ this.c = new LocalCIShellContext(b);
+
+ startCommandLine();
+ }
+
+
+
+ public void stop(BundleContext b){
+ System.out.println("Goodbye!");
+
+ b = null;
+ c = null;
+ configFile = null;
+ ct = null;
+ }
+
+ public void startCommandLine(){
+ Scanner in = new Scanner(System.in);
+ while(true) {
+ System.out.println("Welcome to NWB's Converter Tester");
+ System.out.println( "Please enter the name of a configuration " +
+ "file or\n a directory of configuration files (" + QUIT +
+ ") to quit): ");
+
+ String s = in.nextLine();
+ if(s.trim().equalsIgnoreCase(QUIT))
+ break;
+ try{
+ configFile = new File(s);
+ processConfigurationFile(configFile);
+ }
+ catch (NullPointerException ex){
+ System.out.println("Invalid file name");;
+ }
+ catch(FileNotFoundException fnfe){
+ System.out.println("Could not find the specified " +
+ "configuration file");
+ }
+ }
+ }
+
+ private void processConfigurationFile(File f)
+ throws FileNotFoundException {
+ System.out.println("Processing " + f.getName());
+ if(!f.isHidden() && (f.getName().charAt(0) != '.')){
+ if(f.isDirectory()){
+ File[] files = f.listFiles();
+ for (int ii = 0; ii < files.length; ii++) {
+ File ff = files[ii];
+ processConfigurationFile(ff);
+ }
+ }
+ else{
+ try{
+ ct = new ConverterTester(b, c, f);
+ System.out.println(ct);
+ ct.testFiles();
+ ct.printResults();
+ }catch(Exception ex){
+ System.out.println("Failed to create " +
+ "ConverterTester\n\n");
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|