aboutsummaryrefslogtreecommitdiffstats
path: root/test/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2009-03-10 16:16:31 +0000
committerJeremias Maerki <jeremias@apache.org>2009-03-10 16:16:31 +0000
commit095587e4686e38529186856ba87f0553b0fa4981 (patch)
tree4157c69e9233f52720a0169aebc0d1ea0af64d20 /test/java
parent1914db175fda0d8776f686cf8409ddf4a5d6e5e6 (diff)
downloadxmlgraphics-fop-095587e4686e38529186856ba87f0553b0fa4981.tar.gz
xmlgraphics-fop-095587e4686e38529186856ba87f0553b0fa4981.zip
Restored ability to specify any URI base URI (URL), not just file URLs. For file URLs and file paths there's still a check whether the directory exists.
Enabled FontBaseBadTestCase. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@752153 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java')
-rw-r--r--test/java/org/apache/fop/config/FOURIResolverTestCase.java56
-rw-r--r--test/java/org/apache/fop/config/FontBaseBadTestCase.java11
2 files changed, 58 insertions, 9 deletions
diff --git a/test/java/org/apache/fop/config/FOURIResolverTestCase.java b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
new file mode 100644
index 000000000..e6f8db712
--- /dev/null
+++ b/test/java/org/apache/fop/config/FOURIResolverTestCase.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.config;
+
+import java.net.MalformedURLException;
+
+import junit.framework.TestCase;
+
+import org.apache.fop.apps.FOURIResolver;
+
+/**
+ * This tests some aspects of the {@link FOURIResolver} class.
+ */
+public class FOURIResolverTestCase extends TestCase {
+
+ /**
+ * Checks the {@link FOURIResolver#checkBaseURL(String)} method.
+ * @throws Exception if an error occurs
+ */
+ public void testCheckBaseURI() throws Exception {
+ FOURIResolver resolver = new FOURIResolver(true);
+ System.out.println(resolver.checkBaseURL("./test/config"));
+ System.out.println(resolver.checkBaseURL("file:test/config"));
+ System.out.println(resolver.checkBaseURL("fantasy:myconfig"));
+ try {
+ resolver.checkBaseURL("./doesnotexist");
+ fail("Expected an exception for a inexistent base directory");
+ } catch (MalformedURLException mfue) {
+ //expected
+ }
+ try {
+ resolver.checkBaseURL("file:doesnotexist");
+ fail("Expected an exception for a inexistent base URI");
+ } catch (MalformedURLException mfue) {
+ //expected
+ }
+ }
+
+}
diff --git a/test/java/org/apache/fop/config/FontBaseBadTestCase.java b/test/java/org/apache/fop/config/FontBaseBadTestCase.java
index b22d0f4f3..792acf59a 100644
--- a/test/java/org/apache/fop/config/FontBaseBadTestCase.java
+++ b/test/java/org/apache/fop/config/FontBaseBadTestCase.java
@@ -20,7 +20,7 @@
package org.apache.fop.config;
/*
- * this font base does not exist and a relative font path is used
+ * This font base does not exist and a relative font path is used.
*/
public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase {
@@ -28,14 +28,7 @@ public class FontBaseBadTestCase extends BaseDestructiveUserConfigTestCase {
super(name);
}
- public void testUserConfig() throws Exception {
- // Override this method from the super-class and do nothing as this test doesn't pass ATM
- // TODO re-enable later
- }
-
- /**
- * @see org.apache.fop.config.BaseUserConfigTestCase#getUserConfigFilename()
- */
+ /** {@inheritDoc} */
public String getUserConfigFilename() {
return "test_fontbase_bad.xconf";
}