You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2008/01/08 15:26:24 UTC
svn commit: r610000 - in
/webservices/woden/branches/woden47/test/testcase/resolver: ./ schemaloc/
schemaloc/resources/
Author: jkaputin
Date: Tue Jan 8 06:26:22 2008
New Revision: 610000
URL: http://svn.apache.org/viewvc?rev=610000&view=rev
Log:
Merged WODEN-192 fix from trunk into woden47 branch.
Added:
webservices/woden/branches/woden47/test/testcase/resolver/
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java (with props)
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.jar (with props)
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl (with props)
webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd (with props)
Added: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java?rev=610000&view=auto
==============================================================================
--- webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java (added)
+++ webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java Tue Jan 8 06:26:22 2008
@@ -0,0 +1,102 @@
+package testcase.resolver.schemaloc;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.internal.resolver.DOMSchemaResolverAdapter;
+import org.apache.woden.internal.resolver.SchemaResolverAdapter;
+import org.apache.woden.internal.resolver.SimpleURIResolver;
+import org.xml.sax.InputSource;
+
+import testcase.extensions.foo.FooBindingExtensionsTest;
+
+public class SchemaLocationTest extends TestCase {
+
+ private SchemaResolverAdapter fResolver;
+ private String fSchemaTns = "http://example.com/data";
+ private String fWsdlJarPath = "testcase/resolver/schemaloc/resources/SchemaLocationTest.jar";
+ private String fWsdlFilePath = "testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl";
+ private String fWsdlFileName = "SchemaLocationTest.wsdl";
+ private String fSchemaFilePath = "testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd";
+ private String fSchemaFileName = "SchemaLocationTest.xsd";
+ private String fWsdlWebPath = "http://example.com/resources/SchemaLocationTest.wsdl";
+ private String fSchemaWebPath = "http://example.com/resources/SchemaLocationTest.xsd";
+
+ public static Test suite() {
+ return new TestSuite(SchemaLocationTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ fResolver = new DOMSchemaResolverAdapter(new SimpleURIResolver(), null);
+ }
+
+ public void testRelativePath_File() {
+ URL baseURL = getClass().getClassLoader().getResource(fWsdlFilePath);
+ String baseURI = baseURL.toString();
+ int i = baseURI.indexOf(fWsdlFileName);
+ String contextPath = baseURI.substring(0,i);
+ String expectedResult = contextPath + fSchemaFileName;
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, fSchemaFileName, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation relative file path not resolved correctly", expectedResult, actualResult);
+ }
+
+ public void testAbsolutePath_File() {
+ URL baseURL = getClass().getClassLoader().getResource(fWsdlFilePath);
+ String baseURI = baseURL.toString();
+ URL schemaURL = getClass().getClassLoader().getResource(fSchemaFilePath);
+ String absoluteSchemaPath = schemaURL.toString();
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, absoluteSchemaPath, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation absolute file path not resolved correctly", absoluteSchemaPath, actualResult);
+ }
+
+ public void testRelativePath_Jar() {
+ URL baseURL = getClass().getClassLoader().getResource(fWsdlJarPath);
+ String contextPath = "jar:" + baseURL.toString() + "!/META-INF/";
+ String baseURI = contextPath + fWsdlFileName;
+ String expectedResult = contextPath + fSchemaFileName;
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, fSchemaFileName, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation relative path not resolved correctly for jar file", expectedResult, actualResult);
+ }
+
+ public void testAbsolutePath_Jar() {
+ URL baseURL = getClass().getClassLoader().getResource(fWsdlJarPath);
+ String contextPath = "jar:" + baseURL.toString() + "!/META-INF/";
+ String baseURI = contextPath + fWsdlFileName;
+ String absoluteSchemaPath = contextPath + fSchemaFileName;
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, absoluteSchemaPath, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation absolute path not resolved correctly for jar file", absoluteSchemaPath, actualResult);
+ }
+
+ public void testRelativePath_Web() {
+ String baseURI = fWsdlWebPath;
+ int i = baseURI.indexOf(fWsdlFileName);
+ String contextPath = baseURI.substring(0,i);
+ String expectedResult = contextPath + fSchemaFileName;
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, fSchemaFileName, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation relative web path not resolved correctly", expectedResult, actualResult);
+ }
+
+ public void testAbsolutePath_Web() {
+ String baseURI = fWsdlWebPath;
+ String absoluteSchemaPath = fSchemaWebPath;
+
+ InputSource is = fResolver.resolveEntity(fSchemaTns, absoluteSchemaPath, baseURI);
+ String actualResult = is.getSystemId();
+ assertEquals("schemaLocation absolute web path not resolved correctly", absoluteSchemaPath, actualResult);
+ }
+
+}
Propchange: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/SchemaLocationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.jar
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.jar?rev=610000&view=auto
==============================================================================
Binary file - no diff available.
Propchange: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl?rev=610000&view=auto
==============================================================================
--- webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl (added)
+++ webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl Tue Jan 8 06:26:22 2008
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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.
+-->
+<description xmlns="http://www.w3.org/ns/wsdl"
+ targetNamespace="http://ws.apache.woden"
+ xmlns:tns="http://ws.apache.woden"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <documentation>
+ Used by SchemaLocationTest to test the behaviour of the SchemaResolverAdapter class.
+ </documentation>
+
+ <types>
+ <xs:schema targetNamespace="http://example.com/inline">
+ <xs:import namespace="http://example.com/data" schemaLocation="dummy" />
+ </xs:schema>
+ </types>
+
+</description>
\ No newline at end of file
Propchange: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd
URL: http://svn.apache.org/viewvc/webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd?rev=610000&view=auto
==============================================================================
--- webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd (added)
+++ webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd Tue Jan 8 06:26:22 2008
@@ -0,0 +1,27 @@
+<!--
+ !
+ ! 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.
+ !-->
+<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
+ targetNamespace="http://example.com/data">
+ <xs:element name="aardvaark">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="population" minOccurs='1' maxOccurs='unbounded'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
Propchange: webservices/woden/branches/woden47/test/testcase/resolver/schemaloc/resources/SchemaLocationTest.xsd
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org