You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2007/03/12 23:49:21 UTC
svn commit: r517441 - in /cocoon/trunk/core/cocoon-core/src/test:
java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java
resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest
Author: joerg
Date: Mon Mar 12 15:49:21 2007
New Revision: 517441
URL: http://svn.apache.org/viewvc?view=rev&rev=517441
Log:
COCOON-2022: fix URI handling in ZipSource
Added:
cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java (with props)
cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest
Added: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java?view=auto&rev=517441
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java (added)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java Mon Mar 12 15:49:21 2007
@@ -0,0 +1,31 @@
+package org.apache.cocoon.components.source.impl;
+
+import org.apache.avalon.framework.service.ServiceException;
+
+import org.apache.cocoon.core.container.ContainerTestCase;
+
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceResolver;
+
+public class ZipSourceTestCase extends ContainerTestCase {
+
+ public void testURIHandling() throws Exception {
+ String zipSourceUri = "zip:file://test.zip!/test.xml";
+ Source zipSource;
+ SourceResolver resolver = null;
+ try {
+ resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);
+ zipSource = resolver.resolveURI(zipSourceUri);
+ } catch (ServiceException se) {
+ throw new SourceException("SourceResolver is not available.", se);
+ } finally {
+ getManager().release(resolver);
+ }
+ assertTrue("Resolved Source is not an instance of ZipSource.",
+ zipSource instanceof ZipSource);
+ assertEquals("Scheme/protocol is wrong.", "zip", zipSource.getScheme());
+ assertEquals("Uri is wrong.", zipSourceUri, zipSource.getURI());
+ }
+
+}
Propchange: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/components/source/impl/ZipSourceTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest?view=auto&rev=517441
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest (added)
+++ cocoon/trunk/core/cocoon-core/src/test/resources/org/apache/cocoon/components/source/impl/ZipSourceTestCase.xtest Mon Mar 12 15:49:21 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" ?>
+<!--
+ 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.
+-->
+<testcase>
+ <roles>
+ <role name="org.apache.excalibur.source.SourceFactorySelector"
+ shorthand="source-factories"
+ default-class="org.apache.cocoon.core.container.DefaultServiceSelector"/>
+
+ <role name="org.apache.excalibur.source.SourceResolver"
+ shorthand="source-resolver"
+ default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
+ </roles>
+
+ <components>
+ <source-factories>
+ <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
+ <component-instance class="org.apache.cocoon.components.source.impl.ZipSourceFactory" name="zip"/>
+ <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
+ </source-factories>
+
+ <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
+ </components>
+
+</testcase>