Author: bago
Date: Wed Jan 17 06:59:11 2007
New Revision: 497033

URL: http://svn.apache.org/viewvc?view=rev&rev=497033
Log:
Removed rfc4408-tests YAML file because of to be verified (questionable) 
licensing issues (CC-BY-SA).
Updated the testsuite to provide a link to the downloadable testsuite.

Removed:
    
james/jspf/trunk/src/test/resources/org/apache/james/jspf/rfc4408-tests-2007.01.yml
Modified:
    james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java
    james/jspf/trunk/src/test/java/org/apache/james/jspf/RFC4408YamlTest.java

Modified: 
james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java?view=diff&rev=497033&r1=497032&r2=497033
==============================================================================
--- james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java 
(original)
+++ james/jspf/trunk/src/test/java/org/apache/james/jspf/AbstractYamlTest.java 
Wed Jan 17 06:59:11 2007
@@ -92,30 +92,34 @@
         //InputStream is = 
SPFYamlTest.class.getResourceAsStream("pyspf-tests.yml");
         InputStream is = SPFYamlTest.class.getResourceAsStream(filename);
         
-        Reader br = new BufferedReader(new InputStreamReader(is)) {
-    
-            public int read(char[] arg0) throws IOException {
-                int rl = super.read(arg0);
-                return rl;
-            }
-            
-        };
-        
-        YAMLFactory fact = new DefaultYAMLFactory();
+        if (is != null) {
+            Reader br = new BufferedReader(new InputStreamReader(is)) {
         
-        Constructor ctor = 
fact.createConstructor(fact.createComposer(fact.createParser(fact.createScanner(br)),fact.createResolver()));
-        int i = 1;
-        while(ctor.checkData()) {
-            Object o = ctor.getData();
-            if (o instanceof HashMap) {
-              HashMap m = (HashMap) o;
-              SPFYamlTestSuite ts = new SPFYamlTestSuite(m, i);
-              tests.add(ts);
+                public int read(char[] arg0) throws IOException {
+                    int rl = super.read(arg0);
+                    return rl;
+                }
+                
+            };
+            
+            YAMLFactory fact = new DefaultYAMLFactory();
+            
+            Constructor ctor = 
fact.createConstructor(fact.createComposer(fact.createParser(fact.createScanner(br)),fact.createResolver()));
+            int i = 1;
+            while(ctor.checkData()) {
+                Object o = ctor.getData();
+                if (o instanceof HashMap) {
+                  HashMap m = (HashMap) o;
+                  SPFYamlTestSuite ts = new SPFYamlTestSuite(m, i);
+                  tests.add(ts);
+                }
+                i++;
             }
-            i++;
+        
+            return tests;
+        } else {
+            throw new RuntimeException("Unable to load the file");
         }
-    
-        return tests;
     }
 
     protected void runTest() throws Throwable {

Modified: 
james/jspf/trunk/src/test/java/org/apache/james/jspf/RFC4408YamlTest.java
URL: 
http://svn.apache.org/viewvc/james/jspf/trunk/src/test/java/org/apache/james/jspf/RFC4408YamlTest.java?view=diff&rev=497033&r1=497032&r2=497033
==============================================================================
--- james/jspf/trunk/src/test/java/org/apache/james/jspf/RFC4408YamlTest.java 
(original)
+++ james/jspf/trunk/src/test/java/org/apache/james/jspf/RFC4408YamlTest.java 
Wed Jan 17 06:59:11 2007
@@ -32,7 +32,7 @@
 
 public class RFC4408YamlTest extends AbstractYamlTest {
 
-    private static final String YAMLFILE2 = "rfc4408-tests-2007.01.yml";
+    private static final String YAMLFILE2 = "rfc4408-tests.yml";
 
     /**
      * @param name
@@ -62,13 +62,23 @@
 
         public RFC4408Suite() throws IOException {
             super();
-            List tests = loadTests(YAMLFILE2);
-            Iterator i = tests.iterator();
-            while (i.hasNext()) {
-                SPFYamlTestSuite o = (SPFYamlTestSuite) i.next();
-                Iterator ttt = o.getTests().keySet().iterator();
-                while (ttt.hasNext()) {
-                    addTest(new RFC4408YamlTest(o,(String) ttt.next()));
+            try {
+                List tests = loadTests(YAMLFILE2);
+                Iterator i = tests.iterator();
+                while (i.hasNext()) {
+                    SPFYamlTestSuite o = (SPFYamlTestSuite) i.next();
+                    Iterator ttt = o.getTests().keySet().iterator();
+                    while (ttt.hasNext()) {
+                        addTest(new RFC4408YamlTest(o,(String) ttt.next()));
+                    }
+                }
+            } catch (RuntimeException e) {
+                if ("Unable to load the file".equals(e.getMessage())) {
+                    System.err.println("WARNING: RFC4408 tests disabled.");
+                    System.err.println("The RFC4408 test-suite is not bundled 
with jspf due to licensing issues.");
+                    System.err.println("You can download the yaml testsuite at 
the following url:");
+                    System.err.println("  
http://www.openspf.org/source/project/test-suite/";);
+                    System.err.println("and place an rfc4408-tests.yml file in 
the /src/test/resources/org/apache/james/jspf folder.");
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to