Author: veithen
Date: Sat May 19 14:49:51 2012
New Revision: 1340490

URL: http://svn.apache.org/viewvc?rev=1340490&view=rev
Log:
Added unit tests to test JiBX on the server side.

Added:
    axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
   (with props)
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java
   (with props)
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
   (with props)
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/
    
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java
   (with props)
Modified:
    axis/axis2/java/core/trunk/modules/jibx/pom.xml
    
axis/axis2/java/core/trunk/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl

Modified: axis/axis2/java/core/trunk/modules/jibx/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/pom.xml?rev=1340490&r1=1340489&r2=1340490&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jibx/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/jibx/pom.xml Sat May 19 14:49:51 2012
@@ -123,15 +123,23 @@
                             <tasks unless="maven.test.skip">
                                 <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                     <classpath refid="maven.test.classpath" />
-                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o ${project.build.directory}/gen -d jibx -uw 
-Ebindingfile test-resources/binding/library-binding.xml -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.unwrapped"; />
+                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o 
${project.build.directory}/gen/library-unwrapped -d jibx -uw -Ebindingfile 
test-resources/binding/library-binding.xml --noBuildXML -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.unwrapped.client";
 />
                                 </java>
                                 <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                     <classpath refid="maven.test.classpath" />
-                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o ${project.build.directory}/gen -d jibx 
-Ebindingfile test-resources/binding/library-binding.xml -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.wrapped"; />
+                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o 
${project.build.directory}/gen/library-unwrapped -d jibx -ss -ssi -sd -uw 
-Ebindingfile test-resources/binding/library-binding.xml --noBuildXML -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.unwrapped.service";
 />
                                 </java>
                                 <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                     <classpath refid="maven.test.classpath" />
-                                    <arg line="-uri 
test-resources/wsdl/customer-echo.wsdl -o ${project.build.directory}/gen -d 
jibx -Ebindingfile test-resources/binding/customer-binding.xml -ns2p 
http://ws.apache.org/axis2/jibx/customer/wsdl=org.apache.axis2.jibx.customer"; />
+                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o 
${project.build.directory}/gen/library-wrapped -d jibx -Ebindingfile 
test-resources/binding/library-binding.xml --noBuildXML -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.wrapped.client";
 />
+                                </java>
+                                <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                                    <classpath refid="maven.test.classpath" />
+                                    <arg line="-uri 
test-resources/wsdl/library.wsdl -o 
${project.build.directory}/gen/library-wrapped -d jibx -ss -ssi -sd 
-Ebindingfile test-resources/binding/library-binding.xml --noBuildXML -ns2p 
http://ws.sosnoski.com/library/wsdl=org.apache.axis2.jibx.library.wrapped.service";
 />
+                                </java>
+                                <java 
classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+                                    <classpath refid="maven.test.classpath" />
+                                    <arg line="-uri 
test-resources/wsdl/customer-echo.wsdl -o 
${project.build.directory}/gen/customer-echo -d jibx -Ebindingfile 
test-resources/binding/customer-binding.xml --noBuildXML -ns2p 
http://ws.apache.org/axis2/jibx/customer/wsdl=org.apache.axis2.jibx.customer"; />
                                 </java>
                             </tasks>
                         </configuration>
@@ -167,12 +175,57 @@
                         </goals>
                         <configuration>
                             <sources>
-                                
<source>${project.build.directory}/gen/src</source>
+                                
<source>${project.build.directory}/gen/library-unwrapped/src</source>
+                                
<source>${project.build.directory}/gen/library-wrapped/src</source>
+                                
<source>${project.build.directory}/gen/customer-echo/src</source>
                             </sources>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>library-unwrapped-repo</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            
<outputDirectory>${project.build.directory}/repo/library-unwrapped</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>test-resources/repo</directory>
+                                </resource>
+                                <resource>
+                                    
<directory>${project.build.directory}/gen/library-unwrapped/resources</directory>
+                                    
<targetPath>services/library.aar/META-INF</targetPath>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>library-wrapped-repo</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            
<outputDirectory>${project.build.directory}/repo/library-wrapped</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>test-resources/repo</directory>
+                                </resource>
+                                <resource>
+                                    
<directory>${project.build.directory}/gen/library-wrapped/resources</directory>
+                                    
<targetPath>services/library.aar/META-INF</targetPath>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>

Modified: 
axis/axis2/java/core/trunk/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl?rev=1340490&r1=1340489&r2=1340490&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
 Sat May 19 14:49:51 2012
@@ -854,7 +854,7 @@
             org.jibx.runtime.impl.UnmarshallingContext ctx = 
getNewUnmarshalContext(param);
             return ctx.unmarshalElement(type);
         } catch (Exception e) {
-             throw new org.apache.axis2.AxisFault(e.getMessage());
+             throw org.apache.axis2.AxisFault.makeFault(e);
         }
     }
   </xsl:template>

Added: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java?rev=1340490&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
 Sat May 19 14:49:51 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.axis2.jibx.library.unwrapped;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jibx.UtilServer;
+import org.apache.axis2.jibx.library.unwrapped.client.LibraryStub;
+import org.apache.axis2.jibx.library.unwrapped.service.LibraryImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class LibraryTest {
+    @BeforeClass
+    public static void startServer() throws Exception {
+        UtilServer.start(System.getProperty("basedir", ".") + 
"/target/repo/library-unwrapped");
+        AxisService service = 
UtilServer.getConfigurationContext().getAxisConfiguration().getService("library");
+        
service.getParameter(Constants.SERVICE_CLASS).setValue(LibraryImpl.class.getName());
+    }
+    
+    @AfterClass
+    public static void stopServer() throws Exception {
+        UtilServer.stop();
+    }
+    
+    @Test
+    public void test() throws Exception {
+        LibraryStub stub = new 
LibraryStub("http://127.0.0.1:5555/axis2/services/library";);
+        stub.addBook("Paperback", "0618918248", new String[] { "Richard 
Dawkins" }, "The God Delusion");
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java?rev=1340490&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java
 Sat May 19 14:49:51 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.axis2.jibx.library.unwrapped.service;
+
+import org.apache.axis2.jibx.beans.Book;
+import org.apache.axis2.jibx.beans.Type;
+
+public class LibraryImpl implements LibrarySkeletonInterface {
+    public Type[] getTypes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Book getBook(String isbn) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void addBookInstance(Book book) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public Book[] getBooksByType(String type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean addBook(String type, String isbn, String[] author, String 
title) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/unwrapped/service/LibraryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java?rev=1340490&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
 Sat May 19 14:49:51 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.axis2.jibx.library.wrapped;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.jibx.UtilServer;
+import org.apache.axis2.jibx.beans.Book;
+import org.apache.axis2.jibx.library.wrapped.client.LibraryStub;
+import org.apache.axis2.jibx.library.wrapped.service.LibraryImpl;
+import org.apache.axis2.jibx.wrappers.AddBookRequest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class LibraryTest {
+    @BeforeClass
+    public static void startServer() throws Exception {
+        UtilServer.start(System.getProperty("basedir", ".") + 
"/target/repo/library-wrapped");
+        AxisService service = 
UtilServer.getConfigurationContext().getAxisConfiguration().getService("library");
+        
service.getParameter(Constants.SERVICE_CLASS).setValue(LibraryImpl.class.getName());
+    }
+    
+    @AfterClass
+    public static void stopServer() throws Exception {
+        UtilServer.stop();
+    }
+    
+    @Test
+    public void test() throws Exception {
+        LibraryStub stub = new 
LibraryStub("http://127.0.0.1:5555/axis2/services/library";);
+        stub.addBook(new AddBookRequest(new Book("Paperback", "0618918248", 
"The God Delusion", new String[] { "Richard Dawkins" })));
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java?rev=1340490&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java
 Sat May 19 14:49:51 2012
@@ -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.
+ */
+package org.apache.axis2.jibx.library.wrapped.service;
+
+import org.apache.axis2.jibx.wrappers.AddBookInstanceRequest;
+import org.apache.axis2.jibx.wrappers.AddBookInstanceResponse;
+import org.apache.axis2.jibx.wrappers.AddBookRequest;
+import org.apache.axis2.jibx.wrappers.AddBookResponse;
+import org.apache.axis2.jibx.wrappers.GetBookRequest;
+import org.apache.axis2.jibx.wrappers.GetBookResponse;
+import org.apache.axis2.jibx.wrappers.GetBooksByTypeRequest;
+import org.apache.axis2.jibx.wrappers.GetBooksByTypeResponse;
+import org.apache.axis2.jibx.wrappers.GetTypesRequest;
+import org.apache.axis2.jibx.wrappers.GetTypesResponse;
+
+public class LibraryImpl implements LibrarySkeletonInterface {
+    public GetTypesResponse getTypes(GetTypesRequest getTypes) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public GetBookResponse getBook(GetBookRequest getBook) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public AddBookInstanceResponse addBookInstance(AddBookInstanceRequest 
addBookInstance) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public GetBooksByTypeResponse getBooksByType(GetBooksByTypeRequest 
getBooksByType) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public AddBookResponse addBook(AddBookRequest addBook) {
+        return new AddBookResponse();
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/jibx/test/org/apache/axis2/jibx/library/wrapped/service/LibraryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to