You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sa...@apache.org on 2011/05/27 11:10:46 UTC
svn commit: r1128207 - in
/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test:
./ java/ java/org/ java/org/apache/ java/org/apache/axis2/
java/org/apache/axis2/maven2/ java/org/apache/axis2/maven2/aar/ resources/
resources/Addition...
Author: sagara
Date: Fri May 27 09:10:46 2011
New Revision: 1128207
URL: http://svn.apache.org/viewvc?rev=1128207&view=rev
Log:
Added Testcase to test AarMojo.
Added:
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AarMojoTest.java
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AbstractAarTest.java
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/AdditionalFile.txt
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-1.xml
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-2.xml
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/services.xml
axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/simple.wsdl
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AarMojoTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AarMojoTest.java?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AarMojoTest.java (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AarMojoTest.java Fri May 27 09:10:46 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.maven2.aar;
+
+import java.io.File;
+
+public class AarMojoTest extends AbstractAarTest {
+
+ public void testAarMojoGoal() throws Exception {
+
+ AarMojo mojo = (AarMojo) getAarMojoGoal("aar",
+ "target/test-classes/aar-plugin-config-1.xml");
+ mojo.execute();
+ String aarName = "target/axis2-aar-plugin-basic-test1.aar";
+ assertTrue(" Can not find " + aarName, new File(aarName).exists());
+ }
+
+ public void testAarMojoGoalConfiguration() throws Exception {
+
+ AarMojo mojo = (AarMojo) getAarMojoGoal("aar",
+ "target/test-classes/aar-plugin-config-2.xml");
+ mojo.execute();
+ String aarName = "target/axis2-aar-plugin-configuration-test1.aar";
+ assertTrue(" Can not find " + aarName, new File(aarName).exists());
+ }
+
+}
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AbstractAarTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AbstractAarTest.java?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AbstractAarTest.java (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/java/org/apache/axis2/maven2/aar/AbstractAarTest.java Fri May 27 09:10:46 2011
@@ -0,0 +1,68 @@
+/*
+ * 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.maven2.aar;
+
+import java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.ReaderFactory;
+
+public abstract class AbstractAarTest extends AbstractMojoTestCase {
+
+ public Mojo getAarMojoGoal(String goal, String testPom) throws Exception {
+
+ File pom = new File(getBasedir(), testPom);
+ MavenXpp3Reader pomReader = new MavenXpp3Reader();
+ MavenProject project = new MavenProject();
+ Model model = pomReader.read(ReaderFactory.newXmlReader(pom));
+ // Set project properties.
+ setVariableValueToObject(project, "model", model);
+ setVariableValueToObject(project, "file", pom);
+ Artifact artifact = new DefaultArtifact(model.getGroupId(),
+ model.getArtifactId(),
+ VersionRange.createFromVersionSpec("SNAPSHOT"), null, "aar",
+ null, (new DefaultArtifactHandlerStub("aar", null)));
+ artifact.setBaseVersion("SNAPSHOT");
+ artifact.setVersion("SNAPSHOT");
+ setVariableValueToObject(project, "artifact", artifact);
+ // Create and set Mojo properties.
+ Mojo mojo = lookupMojo(goal, pom);
+ setVariableValueToObject(mojo, "aarDirectory", new File(getBasedir(),
+ "target/aar"));
+ setVariableValueToObject(mojo, "aarName", model.getArtifactId());
+ setVariableValueToObject(mojo, "outputDirectory", "target");
+ setVariableValueToObject(mojo, "project", project);
+ // Use some classes only for testing.
+ setVariableValueToObject(mojo, "classesDirectory", new File(
+ getBasedir(), "target/classes"));
+ assertNotNull(mojo);
+ return mojo;
+
+ }
+
+}
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/AdditionalFile.txt
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/AdditionalFile.txt?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/AdditionalFile.txt (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/AdditionalDir/AdditionalFile.txt Fri May 27 09:10:46 2011
@@ -0,0 +1,18 @@
+<!--
+ ~ 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.
+ -->
\ No newline at end of file
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-1.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-1.xml?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-1.xml (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-1.xml Fri May 27 09:10:46 2011
@@ -0,0 +1,38 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-aar-plugin-basic-test1</artifactId>
+ <version>SNAPSHOT</version>
+ <name>Test 1 of the axis2-wsdl2code-maven-plugin</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-aar-maven-plugin</artifactId>
+ <version>SNAPSHOT</version>
+ <configuration/>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-2.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-2.xml?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-2.xml (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/aar-plugin-config-2.xml Fri May 27 09:10:46 2011
@@ -0,0 +1,47 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-aar-plugin-configuration-test1</artifactId>
+ <version>SNAPSHOT</version>
+ <name>Test 1 of the axis2-wsdl2code-maven-plugin</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-aar-maven-plugin</artifactId>
+ <version>SNAPSHOT</version>
+ <configuration>
+ <servicesXmlFile>target/test-classes/services.xml</servicesXmlFile>
+ <wsdlFile>target/test-classes/simple.wsdl</wsdlFile>
+ <wsdlFileName>SimpleService.wsdl</wsdlFileName>
+ <fileSets>
+ <fileSet>
+ <directory>target/test-classes/AdditionalDir</directory>
+ <outputDirectory>META-INF/docs</outputDirectory>
+ </fileSet>
+ </fileSets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/services.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/services.xml?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/services.xml (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/services.xml Fri May 27 09:10:46 2011
@@ -0,0 +1,27 @@
+<?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.
+ -->
+<serviceGroup>
+ <service name="SimpleService">
+ <parameter name="ServiceClass">sample.SimpleService</parameter>
+ <operation name="helloService">
+ <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
+ </operation>
+ </service>
+</serviceGroup>
Added: axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/simple.wsdl
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/simple.wsdl?rev=1128207&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/simple.wsdl (added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-aar-maven-plugin/src/test/resources/simple.wsdl Fri May 27 09:10:46 2011
@@ -0,0 +1,99 @@
+<?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.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://sample" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://sample">
+ <wsdl:documentation>SimpleService</wsdl:documentation>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://sample">
+ <xs:element name="helloService">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="msg" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloServiceResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloServiceRequest">
+ <wsdl:part name="parameters" element="ns:helloService"/>
+ </wsdl:message>
+ <wsdl:message name="helloServiceResponse">
+ <wsdl:part name="parameters" element="ns:helloServiceResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="SimpleServicePortType">
+ <wsdl:operation name="helloService">
+ <wsdl:input message="ns:helloServiceRequest" wsaw:Action="urn:helloService"/>
+ <wsdl:output message="ns:helloServiceResponse" wsaw:Action="urn:helloServiceResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SimpleServiceSoap11Binding" type="ns:SimpleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="helloService">
+ <soap:operation soapAction="urn:helloService" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SimpleServiceSoap12Binding" type="ns:SimpleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="helloService">
+ <soap12:operation soapAction="urn:helloService" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SimpleServiceHttpBinding" type="ns:SimpleServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="helloService">
+ <http:operation location="SimpleService/helloService"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="helloService"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="helloService"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SimpleService">
+ <wsdl:port name="SimpleServiceHttpSoap11Endpoint" binding="ns:SimpleServiceSoap11Binding">
+ <soap:address location="http://10.100.0.232:8080/axis2/services/SimpleService.SimpleServiceHttpSoap11Endpoint/"/>
+ </wsdl:port>
+ <wsdl:port name="SimpleServiceHttpSoap12Endpoint" binding="ns:SimpleServiceSoap12Binding">
+ <soap12:address location="http://10.100.0.232:8080/axis2/services/SimpleService.SimpleServiceHttpSoap12Endpoint/"/>
+ </wsdl:port>
+ <wsdl:port name="SimpleServiceHttpEndpoint" binding="ns:SimpleServiceHttpBinding">
+ <http:address location="http://10.100.0.232:8080/axis2/services/SimpleService.SimpleServiceHttpEndpoint/"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file