ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1196750 - in /webservices/commons/trunk/modules/axiom: ./ modules/axiom-samples/ modules/axiom-samples/src/ modules/axiom-samples/src/test/ modules/axiom-samples/src/test/java/ modules/axiom-samples/src/test/java/org/ modules/axiom-samples...
Date Wed, 02 Nov 2011 18:37:02 GMT
Author: veithen
Date: Wed Nov  2 18:37:01 2011
New Revision: 1196750

URL: http://svn.apache.org/viewvc?rev=1196750&view=rev
Log:
Started to compile a set of quick start samples.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java
  (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/schema.xsd
    webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml
  (with props)
    webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/pom.xml

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-samples/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov  2 18:37:01 2011
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings

Added: webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml?rev=1196750&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml Wed Nov  2 18:37:01
2011
@@ -0,0 +1,60 @@
+<?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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.ws.commons.axiom</groupId>
+        <artifactId>axiom-parent</artifactId>
+        <version>1.2.13-SNAPSHOT</version>
+        <relativePath>../axiom-parent/pom.xml</relativePath>
+    </parent>
+    <artifactId>axiom-samples</artifactId>
+    <name>Axiom Samples</name>
+    <description>
+        Contains the sample code published on the Web site. The purpose of this project
+        is to validate that every published sample executes correctly.
+    </description>
+    <!-- This needs to be set explicitly because the project structure implies that the
Maven calculated defaults are wrong -->
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom/modules/axiom-samples</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom/modules/axiom-samples</developerConnection>
+        <url>http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-samples</url>
+    </scm>
+    <!-- This also needs to be set explicitly because the Maven calculated URL would point
to nowhere -->
+    <url>http://ws.apache.org/axiom/</url>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axiom-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axiom-impl</artifactId>
+            <version>${project.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-samples/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java?rev=1196750&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java
Wed Nov  2 18:37:01 2011
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.samples;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPModelBuilder;
+
+public class ValidateSample extends TestCase {
+    // START SNIPPET: main
+    public void validate(InputStream in, URL schemaUrl) throws Exception {
+        SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(in, "UTF-8");
+        SOAPEnvelope envelope = builder.getSOAPEnvelope();
+        OMElement bodyContent = envelope.getBody().getFirstElement();
+        SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = schemaFactory.newSchema(schemaUrl);
+        Validator validator = schema.newValidator();
+        validator.validate(bodyContent.getSAXSource(true));
+    }
+    // END SNIPPET: main
+    
+    public void test() throws Exception {
+        validate(getClass().getResourceAsStream("soap-request.xml"), getClass().getResource("schema.xsd"));
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/schema.xsd
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/schema.xsd?rev=1196750&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/schema.xsd
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/schema.xsd
Wed Nov  2 18:37:01 2011
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:tns="http://example.org/quote"
+           elementFormDefault="qualified"
+           targetNamespace="http://example.org/quote">
+    <xs:element name="getQuote">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="symbol" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
\ No newline at end of file

Added: webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml?rev=1196750&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml
Wed Nov  2 18:37:01 2011
@@ -0,0 +1,7 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q="http://example.org/quote">
+   <soapenv:Body>
+      <q:getQuote>
+         <q:symbol>MSFT</q:symbol>
+      </q:getQuote>
+   </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-samples/src/test/resources/org/apache/axiom/samples/soap-request.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/pom.xml?rev=1196750&r1=1196749&r2=1196750&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/pom.xml Wed Nov  2 18:37:01 2011
@@ -528,5 +528,6 @@
         <module>modules/axiom-osgi-tests</module>
         <module>modules/axiom-integration</module>
         <module>modules/axiom-all</module>
+        <module>modules/axiom-samples</module>
     </modules>
 </project>

Added: webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt?rev=1196750&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt (added)
+++ webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt Wed Nov  2
18:37:01 2011
@@ -0,0 +1,30 @@
+~~ 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.
+
+     ---------------------
+      Quick Start Samples
+     ---------------------
+
+Schema validation using javax.xml.validation
+
+  This sample demonstrates how to validate a part of an Axiom tree (actually the body of
a SOAP message)
+  using the <<<javax.xml.validation>>> API:
+
+%{snippet|id=main|file=modules/axiom-samples/src/test/java/org/apache/axiom/samples/ValidateSample.java}
+
+  It leverages the fact that Axiom is capable of constructing a <<<SAXSource>>>
from an <<<OMDocument>>>
+  or <<<OMElement>>>.

Propchange: webservices/commons/trunk/modules/axiom/src/site/apt/quickstart-samples.apt
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message