Author: midon
Date: Tue Dec  2 16:33:03 2008
New Revision: 722702

URL: http://svn.apache.org/viewvc?rev=722702&view=rev
Log:
ODE-445: add a unit test

Added:
    ode/trunk/axis2/src/test/java/org/apache/ode/axis2/ODEServerTest.java

Added: ode/trunk/axis2/src/test/java/org/apache/ode/axis2/ODEServerTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/ODEServerTest.java?rev=722702&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/java/org/apache/ode/axis2/ODEServerTest.java 
(added)
+++ ode/trunk/axis2/src/test/java/org/apache/ode/axis2/ODEServerTest.java Tue 
Dec  2 16:33:03 2008
@@ -0,0 +1,48 @@
+package org.apache.ode.axis2;
+
+import junit.framework.TestCase;
+
+import javax.servlet.ServletException;
+import java.io.File;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ODEServerTest extends TestCase {
+
+    public void testNonExistingRootDir() {
+        String ghostDir = "/" + System.currentTimeMillis();
+        assertFalse("This test requires a non existing directory", new 
File(ghostDir).isDirectory());
+        System.setProperty("org.apache.ode.rootDir", ghostDir);
+        try {
+            new ODEServer().init((String) null, null);
+            fail("Should throw an IllegalArgumentException if the root dir 
does not exist");
+        } catch (IllegalArgumentException e) {
+            assertTrue(true);
+        } catch (ServletException se) {
+            fail("Should throw an IllegalArgumentException if the root dir 
does not exist");
+        }finally {
+            // reset to avoid side effects
+            System.getProperties().remove("org.apache.ode.rootDir");
+        }
+    }
+
+    public void testNonExistingConfigDir() {
+        String ghostDir = "/" + System.currentTimeMillis();
+        assertFalse("This test requires a non existing directory", new 
File(ghostDir).isDirectory());
+        System.setProperty("org.apache.ode.configDir", ghostDir);
+        try {
+            new ODEServer().init(System.getProperty("user.dir"), null);
+            fail("Should throw an IllegalArgumentException if the config dir 
does not exist");
+        } catch (IllegalArgumentException e) {
+            assertTrue(true);
+        } catch (ServletException se) {
+            fail("Should throw an IllegalArgumentException if the config dir 
does not exist");
+        }finally {
+            // reset to avoid side effects
+            System.getProperties().remove("org.apache.ode.configDir");
+        }
+    }
+}


Reply via email to