Author: veithen
Date: Sat Aug 26 14:18:38 2017
New Revision: 1806303

URL: http://svn.apache.org/viewvc?rev=1806303&view=rev
Log:
AXIS2-5793: Add a unit test for the Upload Service feature in the Admin console.

Added:
    axis/axis2/java/core/trunk/systests/echo/   (with props)
    axis/axis2/java/core/trunk/systests/echo/pom.xml   (with props)
    axis/axis2/java/core/trunk/systests/echo/services.xml   (with props)
    axis/axis2/java/core/trunk/systests/echo/src/
    axis/axis2/java/core/trunk/systests/echo/src/main/
    axis/axis2/java/core/trunk/systests/echo/src/main/java/
    axis/axis2/java/core/trunk/systests/echo/src/main/java/org/
    axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/
    axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/
    
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/
    
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java
   (with props)
Modified:
    axis/axis2/java/core/trunk/systests/pom.xml
    axis/axis2/java/core/trunk/systests/webapp-tests/pom.xml
    
axis/axis2/java/core/trunk/systests/webapp-tests/src/test/java/org/apache/axis2/webapp/AxisAdminServletITCase.java

Propchange: axis/axis2/java/core/trunk/systests/echo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 26 14:18:38 2017
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: axis/axis2/java/core/trunk/systests/echo/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/echo/pom.xml?rev=1806303&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/systests/echo/pom.xml (added)
+++ axis/axis2/java/core/trunk/systests/echo/pom.xml Sat Aug 26 14:18:38 2017
@@ -0,0 +1,50 @@
+<?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.
+  -->
+<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.axis2</groupId>
+        <artifactId>systests</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>echo</artifactId>
+    <packaging>aar</packaging>
+    <url>http://axis.apache.org/axis2/java/core/</url>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.axis2</groupId>
+                <artifactId>axis2-aar-maven-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <servicesXmlFile>services.xml</servicesXmlFile>
+                    <includeDependencies>false</includeDependencies>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>

Propchange: axis/axis2/java/core/trunk/systests/echo/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis2/java/core/trunk/systests/echo/services.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/echo/services.xml?rev=1806303&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/systests/echo/services.xml (added)
+++ axis/axis2/java/core/trunk/systests/echo/services.xml Sat Aug 26 14:18:38 
2017
@@ -0,0 +1,25 @@
+<!--
+  ~ 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.
+  -->
+
+<service name="Echo">
+    <parameter 
name="ServiceClass">org.apache.axis2.echo.EchoService</parameter>
+    <operation name="echo">
+        <messageReceiver 
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </operation>
+</service>
\ No newline at end of file

Propchange: axis/axis2/java/core/trunk/systests/echo/services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java?rev=1806303&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java
 (added)
+++ 
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java
 Sat Aug 26 14:18:38 2017
@@ -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.
+ */
+package org.apache.axis2.echo;
+
+import org.apache.axiom.om.OMElement;
+
+public class EchoService {
+    public OMElement echo(OMElement element) {
+        return element;
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/systests/echo/src/main/java/org/apache/axis2/echo/EchoService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/core/trunk/systests/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/pom.xml?rev=1806303&r1=1806302&r2=1806303&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/systests/pom.xml (original)
+++ axis/axis2/java/core/trunk/systests/pom.xml Sat Aug 26 14:18:38 2017
@@ -41,6 +41,7 @@
     </build>
     
     <modules>
+        <module>echo</module>
         <module>SOAP12TestServiceB</module>
         <module>SOAP12TestServiceC</module>
         <module>webapp-tests</module>

Modified: axis/axis2/java/core/trunk/systests/webapp-tests/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/webapp-tests/pom.xml?rev=1806303&r1=1806302&r2=1806303&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/systests/webapp-tests/pom.xml (original)
+++ axis/axis2/java/core/trunk/systests/webapp-tests/pom.xml Sat Aug 26 
14:18:38 2017
@@ -35,6 +35,13 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>echo</artifactId>
+            <version>${project.version}</version>
+            <type>aar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.google.truth</groupId>
             <artifactId>truth</artifactId>
             <scope>test</scope>
@@ -69,6 +76,7 @@
                 <artifactId>alta-maven-plugin</artifactId>
                 <executions>
                     <execution>
+                        <id>war-location</id>
                         <goals>
                             <goal>generate-properties</goal>
                         </goals>
@@ -84,6 +92,22 @@
                             </artifacts>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>aar-location</id>
+                        <goals>
+                            <goal>generate-test-resources</goal>
+                        </goals>
+                        <configuration>
+                            <name>echo-service-location.txt</name>
+                            <value>%file%</value>
+                            <dependencySet>
+                                <scope>test</scope>
+                                <includes>
+                                    <include>*:echo:aar:*</include>
+                                </includes>
+                            </dependencySet>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>

Modified: 
axis/axis2/java/core/trunk/systests/webapp-tests/src/test/java/org/apache/axis2/webapp/AxisAdminServletITCase.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/systests/webapp-tests/src/test/java/org/apache/axis2/webapp/AxisAdminServletITCase.java?rev=1806303&r1=1806302&r2=1806303&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/systests/webapp-tests/src/test/java/org/apache/axis2/webapp/AxisAdminServletITCase.java
 (original)
+++ 
axis/axis2/java/core/trunk/systests/webapp-tests/src/test/java/org/apache/axis2/webapp/AxisAdminServletITCase.java
 Sat Aug 26 14:18:38 2017
@@ -20,6 +20,7 @@ package org.apache.axis2.webapp;
 
 import static com.google.common.truth.Truth.assertThat;
 
+import org.apache.commons.io.IOUtils;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -59,6 +60,33 @@ public class AxisAdminServletITCase {
     }
 
     @Test
+    public void testUploadRemoveService() throws Exception {
+        tester.clickLinkWithText("Upload Service");
+        String echoServiceLocation = 
IOUtils.toString(AxisAdminServletITCase.class.getResource("/echo-service-location.txt"));
+        tester.setTextField("filename", echoServiceLocation);
+        tester.clickButtonWithText(" Upload ");
+        tester.assertMatch("File echo-.+\\.aar successfully uploaded");
+        int attempt = 0;
+        while (true) {
+            attempt++;
+            tester.clickLinkWithText("Available Services");
+            try {
+                tester.assertFormPresent("Echo");
+                break;
+            } catch (AssertionError ex) {
+                if (attempt < 30) {
+                    Thread.sleep(1000);
+                } else {
+                    throw ex;
+                } 
+            }
+        }
+        tester.setWorkingForm("Echo");
+        tester.submit();
+        tester.assertTextPresent("Service 'Echo' has been successfully 
removed.");
+    }
+
+    @Test
     public void testEditServiceParameters() {
         tester.clickLinkWithText("Edit Parameters");
         tester.selectOption("axisService", "Version");


Reply via email to