[Carbon-dev] AppServer integration tests have been migrated to TestNG

Thilina Buddhika thilinab at wso2.com
Thu Dec 22 13:48:12 EST 2011


After couple of fixes, now we can start Carbon servers in Windows. But
there is an issue when shutting down the servers which is a blocker.

After trying various options with Runtime exec(), I tried using Apache
Commons Exec[1] which wraps the native Java API and provides a nice API.
Using this library, did not solve the issue either. By going through its
FAQ[2], I came across this issue in Windows which does not kill the child
processes when the parent process is killed. There is an open bug[3] in JDK
bug database related to this issue.

When we launch Carbon servers, it first spawns a command line process which
in turn spawns a JVM instance which runs Carbon. So when we issue the
process.kill(), it kills only the command line process leaving the Carbon
server untouched.

As a solution, we can follow a hybrid approach where we use the server
admin API to shutdown the Carbon server through a WS call + process.kill()
terminate the cmd process.

Thanks,
Thilina

[1] - http://commons.apache.org/exec/
[2] - http://commons.apache.org/exec/faq.html#killing-child-processes
[3] - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4770092



On Tue, Dec 20, 2011 at 9:57 AM, Thilina Buddhika <thilinab at wso2.com> wrote:

> In windows, when it calculates the Carbon home inside
> ServerUtils#setUpCarbonHome(String carbonServerZipFile), it gets the
> current directory as
> "core\integration\core\target\.\carbontmp\wso2carbon-core-3.2.0-SNAPSHOT".
>
> So it returns a non-existing path as the Carbon home after evaluating
> following expression.
>
> new File(".").getAbsolutePath() + File.separator + "carbontmp" +
>                 File.separator + extractedCarbonDir;
>
> Thanks,
> Thilina
>
> On Sun, Dec 18, 2011 at 1:39 AM, Senaka Fernando <senaka at wso2.com> wrote:
>
>> Hi Thilina,
>>
>> I believe that there is some issue in setting/deducing the deployment
>> folder. I felt so by seeing the following block.
>>
>> +++++++++++++++++++++++++
>> Running org.wso2.carbon.integration.core.TestRunner
>> Error while creating the deployment folder :
>> F:\wso2\trunk\core\integration\core\target\.\carbontmp\core/../../distribution/target/wso2carbon-core-3.2.0-SNAPSHOT\repository\deployment\server\axis2services
>> Importing Code Coverage Details...
>> Imported Code Coverage Details.
>> Error while creating the deployment folder :
>> F:\wso2\trunk\core\integration\core\target\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core/../../distribution/target/wso2carbon-core-3.2.0-SNAPSHOT\repository\deployment\server\axis2services
>> Importing Code Coverage Details...
>> Imported Code Coverage Details.
>> Error while creating the deployment folder :
>> F:\wso2\trunk\core\integration\core\target\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core/../../distribution/target/wso2carbon-core-3.2.0-SNAPSHOT\repository\deployment\server\axis2services
>> Importing Code Coverage Details...
>> Imported Code Coverage Details.
>> Importing Code Coverage Details...
>> Imported Code Coverage Details.
>> Error while creating the deployment folder :
>> F:\wso2\trunk\core\integration\core\target\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core/../../distribution/target/wso2carbon-core-3.2.0-SNAPSHOT\repository\deployment\server\axis2services
>> [2011-12-17 22:47:40,770]  INFO
>> {org.wso2.carbon.integration.core.SecurityVerificationTest} -  Copying
>> F:\wso2\trunk\core\integration\core\..\security-verifier\target\SecVerifier.aar
>> =>
>> F:\wso2\trunk\core\integration\core\target\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\.\carbontmp\core\..\..\distribution\target\wso2carbon-core-3.2.0-SNAPSHOT\repository\deployment\server\axis2services\SecVerifier.aar
>> Importing Code Coverage Details...
>> +++++++++++++++++++++++++
>>
>> Notice the way in which the same path got repeated.
>>
>> Thanks,
>> Senaka.
>>
>>
>> On Sat, Dec 17, 2011 at 11:04 PM, Thilina Buddhika <thilinab at wso2.com>wrote:
>>
>>> Hi Azeez,
>>>
>>> I tried running the integration tests for Carbon Core in trunk in
>>> Windows and it looks like it fails to start the Carbon server in Windows
>>> when running the tests.
>>>
>>> Please see the attached console output.
>>>
>>> Thanks,
>>> Thilina
>>>
>>>
>>> On Thu, Dec 15, 2011 at 6:00 PM, Afkham Azeez <azeez at wso2.com> wrote:
>>>
>>>> Converting the existing integration tests to TestNG is very simple. Can
>>>> people from other product teams please volunteer to do this? You can take a
>>>> look at the AS & Carbon integration tests to get an idea about how this
>>>> could be done.
>>>>
>>>>
>>>>
>>>> ---------- Forwarded message ----------
>>>> From: <azeez at wso2.com>
>>>> Date: Thu, Dec 15, 2011 at 5:31 PM
>>>> Subject: [Carbon-commits] [Carbon] svn commit r117810 - in
>>>> trunk/carbon/products/as/modules/integration: .
>>>> org.wso2.carbon.authentication.login.test
>>>> org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/test
>>>> org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/tests
>>>> samples samples/src src src/test/java/org/wso2/appserver/integration
>>>> src/test/java/org/wso2/appserver/integration/tests
>>>> src/test/java/org/wso2/appserver/sample/commodity
>>>> src/test/java/org/wso2/appserver/sample/helloworld
>>>> src/test/java/org/wso2/appserver/sample/jaxws
>>>> src/test/java/org/wso2/appserver/sample/json
>>>> src/test/java/org/wso2/appserver/sample/tests
>>>> src/test/java/org/wso2/appserver/test src/test/resources
>>>> To: carbon-commits at wso2.org
>>>>
>>>>
>>>> Author: azeez
>>>> Date: Thu Dec 15 04:01:23 2011
>>>> New Revision: 117810
>>>> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=117810
>>>>
>>>> Log:
>>>> Converted JUnit tests to TestNG. Bye bye JUnit!
>>>>
>>>>
>>>>
>>>> Added:
>>>>
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/tests/
>>>>      - copied from r117576,
>>>> /trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/test/
>>>>   trunk/carbon/products/as/modules/integration/src/
>>>>      - copied from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/ASTestServerManager.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/CommodityQuoteTestCase.java
>>>>      - copied, changed from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/commodity/quote/CommodityQuoteTest.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/HelloWorldSampleTestCase.java
>>>>      - copied, changed from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/helloworld/HelloWorldSampleTest.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JAXWSSampleTestCase.java
>>>>      - copied, changed from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/jaxws/JAXWSSampleTest.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JSONTestCase.java
>>>>      - copied, changed from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/json/JSONTest.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/LoginLogoutTestCase.java
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/sample/tests/
>>>>   trunk/carbon/products/as/modules/integration/src/test/resources/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/resources/log4j.properties
>>>> Removed:
>>>>
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/test/
>>>>
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/tests/LoginTest.java
>>>>   trunk/carbon/products/as/modules/integration/samples/src/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/sample/commodity/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/sample/helloworld/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/sample/jaxws/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/sample/json/
>>>>
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/test/
>>>> Modified:
>>>>
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/pom.xml
>>>>   trunk/carbon/products/as/modules/integration/pom.xml
>>>>   trunk/carbon/products/as/modules/integration/samples/pom.xml
>>>>
>>>> Modified:
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/pom.xml
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/pom.xml?rev=117810&r1=117809&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/pom.xml
>>>>      (original)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/pom.xml
>>>>      Thu Dec 15 04:01:23 2011
>>>> @@ -15,6 +15,20 @@
>>>>     <name>WSO2 AS - Login Test Module</name>
>>>>     <packaging>jar</packaging>
>>>>
>>>> +    <dependencies>
>>>> +        <dependency>
>>>> +            <groupId>org.wso2.carbon</groupId>
>>>> +
>>>>  <artifactId>org.wso2.carbon.integration.framework</artifactId>
>>>> +            <version>${carbon.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.testng</groupId>
>>>> +            <artifactId>testng</artifactId>
>>>> +            <version>6.1.1</version>
>>>> +            <!--<scope>test</scope>-->
>>>> +        </dependency>
>>>> +    </dependencies>
>>>> +
>>>>     <build>
>>>>         <plugins>
>>>>             <plugin>
>>>> @@ -22,7 +36,7 @@
>>>>                 <inherited>false</inherited>
>>>>                 <configuration>
>>>>                     <includes>
>>>> -                        <include>**/*Test.java</include>
>>>> +                        <include>**/*TestCase.java</include>
>>>>                     </includes>
>>>>                     <systemProperties>
>>>>                         <property>
>>>>
>>>> Deleted:
>>>> /trunk/carbon/products/as/modules/integration/org.wso2.carbon.authentication.login.test/src/test/java/org/wso2/carbon/authenticator/test/LoginTest.java
>>>> URL: http://wso2.org/svn/browse/wso2/None?pathrev=117576
>>>>
>>>> Modified: trunk/carbon/products/as/modules/integration/pom.xml
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/pom.xml?rev=117810&r1=117809&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> --- trunk/carbon/products/as/modules/integration/pom.xml
>>>>  (original)
>>>> +++ trunk/carbon/products/as/modules/integration/pom.xml        Thu Dec
>>>> 15 04:01:23 2011
>>>> @@ -13,29 +13,81 @@
>>>>     <modelVersion>4.0.0</modelVersion>
>>>>     <artifactId>integration</artifactId>
>>>>     <name>WSO2 AS - Integration Tests</name>
>>>> -    <packaging>pom</packaging>
>>>> +    <packaging>jar</packaging>
>>>>
>>>> -    <modules>
>>>> -        <module>org.wso2.carbon.authentication.login.test</module>
>>>> -        <module>samples</module>
>>>> -    </modules>
>>>> -
>>>> -  <build>
>>>> -    <plugins>
>>>> -      <plugin>
>>>> -        <artifactId>maven-clean-plugin</artifactId>
>>>> -        <version>2.4.1</version>
>>>> -        <executions>
>>>> -          <execution>
>>>> -            <id>auto-clean</id>
>>>> -            <phase>initialize</phase>
>>>> -            <goals>
>>>> -              <goal>clean</goal>
>>>> -            </goals>
>>>> -          </execution>
>>>> -        </executions>
>>>> -      </plugin>
>>>> -    </plugins>
>>>> -  </build>
>>>> +    <build>
>>>> +        <plugins>
>>>> +            <plugin>
>>>> +                <artifactId>maven-clean-plugin</artifactId>
>>>> +                <version>2.4.1</version>
>>>> +                <executions>
>>>> +                    <execution>
>>>> +                        <id>auto-clean</id>
>>>> +                        <phase>initialize</phase>
>>>> +                        <goals>
>>>> +                            <goal>clean</goal>
>>>> +                        </goals>
>>>> +                    </execution>
>>>> +                </executions>
>>>> +            </plugin>
>>>> +            <plugin>
>>>> +                <artifactId>maven-surefire-plugin</artifactId>
>>>> +                <inherited>false</inherited>
>>>> +                <configuration>
>>>> +                    <includes>
>>>> +                        <include>**/*TestServerManager.java</include>
>>>> +                        <include>**/*TestCase.java</include>
>>>> +                    </includes>
>>>> +                    <systemProperties>
>>>> +
>>>>  <maven.test.haltafterfailure>false</maven.test.haltafterfailure>
>>>> +                        <carbon.zip>
>>>> +
>>>>  ${basedir}/../distribution/product/target/wso2as-${pom.version}.zip
>>>> +                        </carbon.zip>
>>>> +
>>>>  <samples.dir>${basedir}/../samples/product</samples.dir>
>>>> +
>>>>  <extracted.dir>wso2appserver-${pom.version}</extracted.dir>
>>>> +                    </systemProperties>
>>>> +
>>>>  <workingDirectory>${basedir}/target</workingDirectory>
>>>> +                </configuration>
>>>> +            </plugin>
>>>> +            <plugin>
>>>> +                <groupId>org.apache.maven.plugins</groupId>
>>>> +                <artifactId>maven-jar-plugin</artifactId>
>>>> +                <executions>
>>>> +                    <execution>
>>>> +                        <goals>
>>>> +                            <goal>test-jar</goal>
>>>> +                        </goals>
>>>> +                    </execution>
>>>> +                </executions>
>>>> +            </plugin>
>>>> +        </plugins>
>>>> +    </build>
>>>>
>>>> +    <dependencies>
>>>> +        <dependency>
>>>> +            <groupId>org.wso2.carbon</groupId>
>>>> +
>>>>  <artifactId>org.wso2.carbon.integration.framework</artifactId>
>>>> +            <version>${carbon.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.testng</groupId>
>>>> +            <artifactId>testng</artifactId>
>>>> +            <version>6.1.1</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.apache.axis2.wso2</groupId>
>>>> +            <artifactId>axis2-client</artifactId>
>>>> +            <version>1.6.1.wso2v1</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.wso2.carbon</groupId>
>>>> +            <artifactId>org.wso2.carbon.addressing</artifactId>
>>>> +            <version>${carbon.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.codehaus.jettison.wso2</groupId>
>>>> +            <artifactId>jettison</artifactId>
>>>> +            <version>${version.jettison}</version>
>>>> +        </dependency>
>>>> +    </dependencies>
>>>>  </project>
>>>>
>>>> Modified: trunk/carbon/products/as/modules/integration/samples/pom.xml
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/samples/pom.xml?rev=117810&r1=117809&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> --- trunk/carbon/products/as/modules/integration/samples/pom.xml
>>>>  (original)
>>>> +++ trunk/carbon/products/as/modules/integration/samples/pom.xml
>>>>  Thu Dec 15 04:01:23 2011
>>>> @@ -22,25 +22,16 @@
>>>>                 <inherited>false</inherited>
>>>>                 <configuration>
>>>>                     <includes>
>>>> -                        <include>**/*Test.java</include>
>>>> +                        <include>**/*TestServerManager.java</include>
>>>> +                        <include>**/*TestCase.java</include>
>>>>                     </includes>
>>>>                     <systemProperties>
>>>> -                        <property>
>>>> -                            <name>maven.test.haltafterfailure</name>
>>>> -                            <value>false</value>
>>>> -                        </property>
>>>> -                        <property>
>>>> -                            <name>carbon.zip</name>
>>>> -
>>>>  <value>${basedir}/../../distribution/product/target/wso2as-${pom.version}.zip</value>
>>>> -                        </property>
>>>> -                        <property>
>>>> -                            <name>samples.dir</name>
>>>> -
>>>>  <value>${basedir}/../../samples/product</value>
>>>> -                        </property>
>>>> -                        <property>
>>>> -                            <name>extracted.dir</name>
>>>> -                            <value>wso2appserver-${pom.version}</value>
>>>> -                        </property>
>>>> +
>>>>  <maven.test.haltafterfailure>false</maven.test.haltafterfailure>
>>>> +                        <carbon.zip>
>>>> +
>>>>  ${basedir}/../../distribution/product/target/wso2as-${pom.version}.zip
>>>> +                        </carbon.zip>
>>>> +
>>>>  <samples.dir>${basedir}/../../samples/product</samples.dir>
>>>> +
>>>>  <extracted.dir>wso2appserver-${pom.version}</extracted.dir>
>>>>                     </systemProperties>
>>>>
>>>> <workingDirectory>${basedir}/target</workingDirectory>
>>>>                 </configuration>
>>>> @@ -62,6 +53,17 @@
>>>>     <dependencies>
>>>>         <dependency>
>>>>             <groupId>org.wso2.carbon</groupId>
>>>> +
>>>>  <artifactId>org.wso2.carbon.integration.framework</artifactId>
>>>> +            <version>${carbon.version}</version>
>>>> +        </dependency>
>>>> +        <dependency>
>>>> +            <groupId>org.testng</groupId>
>>>> +            <artifactId>testng</artifactId>
>>>> +            <version>6.1.1</version>
>>>> +            <!--<scope>test</scope>-->
>>>> +        </dependency>
>>>> +        <!--<dependency>
>>>> +            <groupId>org.wso2.carbon</groupId>
>>>>             <artifactId>org.wso2.carbon.integration.core</artifactId>
>>>>             <version>${carbon.version}</version>
>>>>             <classifier>tests</classifier>
>>>> @@ -72,7 +74,7 @@
>>>>                     <artifactId>servlet-api</artifactId>
>>>>                 </exclusion>
>>>>             </exclusions>
>>>> -        </dependency>
>>>> +        </dependency>-->
>>>>         <dependency>
>>>>             <groupId>org.apache.axis2.wso2</groupId>
>>>>             <artifactId>axis2-client</artifactId>
>>>>
>>>> Added:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/ASTestServerManager.java
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/ASTestServerManager.java?pathrev=117810
>>>>
>>>> ==============================================================================
>>>> --- (empty file)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/ASTestServerManager.java
>>>>    Thu Dec 15 04:01:23 2011
>>>> @@ -0,0 +1,99 @@
>>>> +/*
>>>> +*  Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All
>>>> Rights Reserved.
>>>> +*
>>>> +*  WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>> +
>>>> +import org.apache.commons.logging.Log;
>>>> +import org.apache.commons.logging.LogFactory;
>>>> +import org.testng.annotations.AfterGroups;
>>>> +import org.testng.annotations.BeforeGroups;
>>>> +import org.wso2.carbon.integration.framework.TestServerManager;
>>>> +import org.wso2.carbon.utils.FileManipulator;
>>>> +
>>>> +import java.io.File;
>>>> +import java.io.IOException;
>>>> +
>>>> +/**
>>>> + * Prepares the WSO2 AS for test runs, starts the server, and stops
>>>> the server after
>>>> + * test runs
>>>> + */
>>>> +public class ASTestServerManager extends TestServerManager {
>>>> +    private static final Log log =
>>>> LogFactory.getLog(ASTestServerManager.class);
>>>> +
>>>> +    @Override
>>>> +    @BeforeGroups(value = {"wso2.as"}, timeOut = 60000)
>>>> +    public String startServer() throws IOException {
>>>> +        String carbonHome = super.startServer();
>>>> +        System.setProperty("carbon.home", carbonHome);
>>>> +        return carbonHome;
>>>> +    }
>>>> +
>>>> +    @Override
>>>> +    @AfterGroups(groups = {"wso2.as"})
>>>> +    public void stopServer() throws Exception {
>>>> +        super.stopServer();
>>>> +    }
>>>> +
>>>> +    protected void copyArtifacts(String carbonHome) throws IOException
>>>> {
>>>> +
>>>> +        // CommodityQuote sample
>>>> +        String fileName = "CommodityQuoteService.aar";
>>>> +        copySampleFile(computeSourcePath("CommodityQuote", fileName),
>>>> +                       computeDestPath(carbonHome, "axis2services",
>>>> fileName));
>>>> +
>>>> +        // JSON Sample
>>>> +        fileName = "JSONService.aar";
>>>> +        copySampleFile(computeSourcePath("JSON", fileName),
>>>> +                       computeDestPath(carbonHome, "axis2services",
>>>> fileName));
>>>> +
>>>> +        // JAXWS Sample
>>>> +        fileName = "Calculator.jar";
>>>> +        copySampleFile(computeSourcePath("JAXWS", fileName),
>>>> +                       computeDestPath(carbonHome, "servicejars",
>>>> fileName));
>>>> +    }
>>>> +
>>>> +    private void copySampleFile(String sourcePath, String destPath) {
>>>> +        File sourceFile = new File(sourcePath);
>>>> +        File destFile = new File(destPath);
>>>> +        try {
>>>> +            FileManipulator.copyFile(sourceFile, destFile);
>>>> +        } catch (IOException e) {
>>>> +            log.error("Error while copying the HelloWorld sample into
>>>> AppServer", e);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    private String computeSourcePath(String sampleFolder, String
>>>> fileName) {
>>>> +        String samplesDir = System.getProperty("samples.dir");
>>>> +        return samplesDir + File.separator + sampleFolder +
>>>> File.separator
>>>> +               + "target" + File.separator + fileName;
>>>> +
>>>> +    }
>>>> +
>>>> +    private String computeDestPath(String carbonHome,
>>>> +                                   String deploymentFolder,
>>>> +                                   String fileName) {
>>>> +        // First create the deployment folder in the server if it
>>>> doesn't already exist
>>>> +        String deploymentPath = carbonHome + File.separator +
>>>> "repository" + File.separator
>>>> +                                + "deployment" + File.separator +
>>>> "server" + File.separator +
>>>> +                                deploymentFolder;
>>>> +        File depFile = new File(deploymentPath);
>>>> +        if (!depFile.exists() && !depFile.mkdir()) {
>>>> +            log.error("Error while creating the deployment folder : "
>>>> + deploymentPath);
>>>> +        }
>>>> +        return deploymentPath + File.separator + fileName;
>>>> +    }
>>>> +}
>>>>
>>>> Copied:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/CommodityQuoteTestCase.java
>>>> (from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/commodity/quote/CommodityQuoteTest.java)
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/CommodityQuoteTestCase.java?rev=117810&r1=117576&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/commodity/quote/CommodityQuoteTest.java
>>>>       (original)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/CommodityQuoteTestCase.java
>>>> Thu Dec 15 04:01:23 2011
>>>> @@ -1,68 +1,63 @@
>>>> -package org.wso2.appserver.sample.commodity.quote;
>>>> -
>>>> +/*
>>>> +*Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
>>>> +*
>>>> +*WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>>
>>>>  import org.apache.axiom.om.OMElement;
>>>>  import org.apache.axiom.om.impl.builder.StAXOMBuilder;
>>>> +import org.apache.axis2.AxisFault;
>>>>  import org.apache.axis2.addressing.EndpointReference;
>>>>  import org.apache.axis2.client.Options;
>>>>  import org.apache.axis2.client.ServiceClient;
>>>>  import org.apache.commons.logging.Log;
>>>>  import org.apache.commons.logging.LogFactory;
>>>> -import org.wso2.appserver.test.template.ASTestTemplate;
>>>> +import org.testng.annotations.Test;
>>>> +import org.wso2.carbon.integration.framework.ClientConnectionUtil;
>>>>
>>>>  import javax.xml.namespace.QName;
>>>>  import javax.xml.stream.XMLStreamException;
>>>>  import java.io.ByteArrayInputStream;
>>>>
>>>> -public class CommodityQuoteTest extends ASTestTemplate {
>>>> -
>>>> -    private static final Log log =
>>>> LogFactory.getLog(CommodityQuoteTest.class);
>>>> -
>>>> -    @Override
>>>> -    public void init() {
>>>> -
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runSuccessCase() {
>>>> -        try {
>>>> -            ServiceClient serviceClient = new ServiceClient();
>>>> -            Options options = new Options();
>>>> -            options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/CommodityQuote"));
>>>> -            options.setAction("urn:getQuote");
>>>> -            serviceClient.setOptions(options);
>>>> -
>>>> -            OMElement payload = createPayload();
>>>> -            assertNotNull(payload);
>>>> -            OMElement result = serviceClient.sendReceive(payload);
>>>> -            assertNotNull(result);
>>>> -            OMElement name =
>>>> result.getFirstElement().getFirstChildWithName(new QName("name"));
>>>> -            OMElement symbol =
>>>> result.getFirstElement().getFirstChildWithName(new QName("symbol"));
>>>> -            assertEquals("<name>mn</name>", name.toString().trim());
>>>> -            assertEquals("<symbol>Manganese</symbol>",
>>>> symbol.toString().trim());
>>>> -        } catch (Exception e) {
>>>> -            log.error("Error while invoking the CommodityQuote
>>>> service", e);
>>>> -            fail();
>>>> -        }
>>>> -    }
>>>> +public class CommodityQuoteTestCase {
>>>>
>>>> -    @Override
>>>> -    public void runFailureCase() {
>>>> -    }
>>>> +    private static final Log log =
>>>> LogFactory.getLog(CommodityQuoteTestCase.class);
>>>>
>>>> -    @Override
>>>> -    public void cleanup() {
>>>> +    @Test(groups = {"wso2.as"})
>>>> +    public void testGetQuoteRequest() throws AxisFault,
>>>> XMLStreamException {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        ServiceClient serviceClient = new ServiceClient();
>>>> +        Options options = new Options();
>>>> +        options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/CommodityQuote"));
>>>> +        options.setAction("urn:getQuote");
>>>> +        serviceClient.setOptions(options);
>>>> +
>>>> +        OMElement payload = createPayload();
>>>> +        assert payload != null : "Payload cannot be null";
>>>> +        OMElement result = serviceClient.sendReceive(payload);
>>>> +        assert result != null : "Result cannot be null";
>>>> +        OMElement name =
>>>> result.getFirstElement().getFirstChildWithName(new QName("name"));
>>>> +        OMElement symbol =
>>>> result.getFirstElement().getFirstChildWithName(new QName("symbol"));
>>>> +        assert "<name>mn</name>".equals(name.toString().trim());
>>>> +        assert
>>>> "<symbol>Manganese</symbol>".equals(symbol.toString().trim());
>>>>     }
>>>>
>>>> -    private OMElement createPayload() {
>>>> +    private OMElement createPayload() throws XMLStreamException {
>>>>         String request = "<ns1:getQuoteRequest xmlns:ns1=\"
>>>> http://www.wso2.org/types\">" +
>>>> -                "<symbol>mn</symbol></ns1:getQuoteRequest>";
>>>> -        try {
>>>> -            return new StAXOMBuilder(new ByteArrayInputStream(request
>>>> -                    .getBytes())).getDocumentElement();
>>>> -        } catch (XMLStreamException e) {
>>>> -            log.error("Error while creating payload", e);
>>>> -        }
>>>> -        return null;
>>>> +                         "<symbol>mn</symbol></ns1:getQuoteRequest>";
>>>> +        return new StAXOMBuilder(new
>>>> ByteArrayInputStream(request.getBytes())).getDocumentElement();
>>>>     }
>>>>  }
>>>>
>>>> Copied:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/HelloWorldSampleTestCase.java
>>>> (from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/helloworld/HelloWorldSampleTest.java)
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/HelloWorldSampleTestCase.java?rev=117810&r1=117576&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/helloworld/HelloWorldSampleTest.java
>>>>  (original)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/HelloWorldSampleTestCase.java
>>>>       Thu Dec 15 04:01:23 2011
>>>> @@ -1,64 +1,54 @@
>>>> -package org.wso2.appserver.sample.helloworld;
>>>> -
>>>> +/*
>>>> +*Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
>>>> +*
>>>> +*WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>>
>>>>  import org.apache.axiom.om.OMElement;
>>>>  import org.apache.axiom.om.impl.builder.StAXOMBuilder;
>>>> +import org.apache.axis2.AxisFault;
>>>>  import org.apache.axis2.addressing.EndpointReference;
>>>>  import org.apache.axis2.client.Options;
>>>>  import org.apache.axis2.client.ServiceClient;
>>>> -import org.apache.commons.logging.Log;
>>>> -import org.apache.commons.logging.LogFactory;
>>>> -import org.wso2.appserver.test.template.ASTestTemplate;
>>>> +import org.testng.annotations.Test;
>>>> +import org.wso2.carbon.integration.framework.ClientConnectionUtil;
>>>>
>>>>  import javax.xml.stream.XMLStreamException;
>>>>  import java.io.ByteArrayInputStream;
>>>>
>>>> -public class HelloWorldSampleTest extends ASTestTemplate {
>>>> -
>>>> -    private static final Log log =
>>>> LogFactory.getLog(HelloWorldSampleTest.class);
>>>> -
>>>> -    @Override
>>>> -    public void init() {
>>>> -
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runSuccessCase() {
>>>> -        try {
>>>> -            ServiceClient serviceClient = new ServiceClient();
>>>> -            Options options = new Options();
>>>> -            options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/HelloService"));
>>>> -            options.setAction("urn:greet");
>>>> -            serviceClient.setOptions(options);
>>>> -
>>>> -            OMElement result =
>>>> serviceClient.sendReceive(createPayload());
>>>> -            assertNotNull(result);
>>>> -            assertEquals("<ns:greetResponse xmlns:ns=\"
>>>> http://www.wso2.org/types\">" +
>>>> -                    "<return>Hello World, isuru
>>>> !!!</return></ns:greetResponse>",
>>>> -                    result.toString().trim());
>>>> -        } catch (Exception e) {
>>>> -            log.error("Error while invoking the HelloService", e);
>>>> -            fail();
>>>> -        }
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runFailureCase() {
>>>> -    }
>>>> +public class HelloWorldSampleTestCase {
>>>>
>>>> -    @Override
>>>> -    public void cleanup() {
>>>> +    @Test(groups = {"wso2.as"})
>>>> +    public void runSuccessCase() throws AxisFault, XMLStreamException {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        ServiceClient serviceClient = new ServiceClient();
>>>> +        Options options = new Options();
>>>> +        options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/HelloService"));
>>>> +        options.setAction("urn:greet");
>>>> +        serviceClient.setOptions(options);
>>>> +
>>>> +        OMElement result = serviceClient.sendReceive(createPayload());
>>>> +        assert result != null : "Result cannot be null";
>>>> +        assert "<ns:greetResponse xmlns:ns=\"
>>>> http://www.wso2.org/types\"><return>Hello World, isuru
>>>> !!!</return></ns:greetResponse>".
>>>> +                equals(result.toString().trim());
>>>>     }
>>>>
>>>> -    private OMElement createPayload() {
>>>> +    private OMElement createPayload() throws XMLStreamException {
>>>>         String request = "<p:greet xmlns:p=\"http://www.wso2.org/types\">"
>>>> +
>>>> -                "<name>isuru</name></p:greet>";
>>>> -        try {
>>>> -            return new StAXOMBuilder(new ByteArrayInputStream(request
>>>> -                    .getBytes())).getDocumentElement();
>>>> -        } catch (XMLStreamException e) {
>>>> -            log.error("Error while creating payload", e);
>>>> -        }
>>>> -        return null;
>>>> +                         "<name>isuru</name></p:greet>";
>>>> +        return new StAXOMBuilder(new
>>>> ByteArrayInputStream(request.getBytes())).getDocumentElement();
>>>>     }
>>>>  }
>>>>
>>>> Copied:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JAXWSSampleTestCase.java
>>>> (from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/jaxws/JAXWSSampleTest.java)
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JAXWSSampleTestCase.java?rev=117810&r1=117576&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/jaxws/JAXWSSampleTest.java
>>>>    (original)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JAXWSSampleTestCase.java
>>>>    Thu Dec 15 04:01:23 2011
>>>> @@ -1,64 +1,57 @@
>>>> -package org.wso2.appserver.sample.jaxws;
>>>> -
>>>> +/*
>>>> +*Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
>>>> +*
>>>> +*WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>>
>>>>  import org.apache.axiom.om.OMElement;
>>>>  import org.apache.axiom.om.impl.builder.StAXOMBuilder;
>>>> +import org.apache.axis2.AxisFault;
>>>>  import org.apache.axis2.addressing.EndpointReference;
>>>>  import org.apache.axis2.client.Options;
>>>>  import org.apache.axis2.client.ServiceClient;
>>>>  import org.apache.commons.logging.Log;
>>>>  import org.apache.commons.logging.LogFactory;
>>>> -import org.wso2.appserver.test.template.ASTestTemplate;
>>>> +import org.testng.annotations.Test;
>>>> +import org.wso2.carbon.integration.framework.ClientConnectionUtil;
>>>>
>>>>  import javax.xml.stream.XMLStreamException;
>>>>  import java.io.ByteArrayInputStream;
>>>>
>>>> -public class JAXWSSampleTest extends ASTestTemplate {
>>>> -
>>>> -    private static final Log log =
>>>> LogFactory.getLog(JAXWSSampleTest.class);
>>>> -
>>>> -    @Override
>>>> -    public void init() {
>>>> -
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runSuccessCase() {
>>>> -        try {
>>>> -            ServiceClient serviceClient = new ServiceClient();
>>>> -            Options options = new Options();
>>>> -            options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/" +
>>>> -                    "Calculator.CalculatorSOAP"));
>>>> -            options.setAction("urn:add");
>>>> -            serviceClient.setOptions(options);
>>>> -
>>>> -            OMElement result =
>>>> serviceClient.sendReceive(createPayload());
>>>> -            assertNotNull(result);
>>>> -            assertEquals("<addResponse xmlns=\"
>>>> http://calculator.jaxws.sample.appserver" +
>>>> -                    ".wso2.org\"><return>6</return></addResponse>",
>>>> result.toString().trim());
>>>> -        } catch (Exception e) {
>>>> -            log.error("Error while invoking JAX-WS sample", e);
>>>> -            fail();
>>>> -        }
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runFailureCase() {
>>>> -    }
>>>> +public class JAXWSSampleTestCase {
>>>>
>>>> -    @Override
>>>> -    public void cleanup() {
>>>> +    @Test(groups = {"wso2.as"})
>>>> +    public void runSuccessCase() throws AxisFault, XMLStreamException {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        ServiceClient serviceClient = new ServiceClient();
>>>> +        Options options = new Options();
>>>> +        options.setTo(new EndpointReference("
>>>> http://localhost:9763/services/" +
>>>> +
>>>>  "Calculator.CalculatorSOAP"));
>>>> +        options.setAction("urn:add");
>>>> +        serviceClient.setOptions(options);
>>>> +
>>>> +        OMElement result = serviceClient.sendReceive(createPayload());
>>>> +        assert result != null : "Result cannot be null";
>>>> +        assert "<addResponse xmlns=\"
>>>> http://calculator.jaxws.sample.appserver.wso2.org
>>>> \"><return>6</return></addResponse>".
>>>> +                equals(result.toString().trim());
>>>>     }
>>>>
>>>> -    private OMElement createPayload() {
>>>> +    private OMElement createPayload() throws XMLStreamException {
>>>>         String request = "<add xmlns=\"
>>>> http://calculator.jaxws.sample.appserver.wso2.org\">" +
>>>> -                "<value1>1</value1><value2>5</value2></add>";
>>>> -        try {
>>>> -            return new StAXOMBuilder(new ByteArrayInputStream(request
>>>> -                    .getBytes())).getDocumentElement();
>>>> -        } catch (XMLStreamException e) {
>>>> -            log.error("Error while creating payload", e);
>>>> -        }
>>>> -        return null;
>>>> +                         "<value1>1</value1><value2>5</value2></add>";
>>>> +        return new StAXOMBuilder(new
>>>> ByteArrayInputStream(request.getBytes())).getDocumentElement();
>>>>     }
>>>>  }
>>>> \ No newline at end of file
>>>>
>>>> Copied:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JSONTestCase.java
>>>> (from r117576,
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/json/JSONTest.java)
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JSONTestCase.java?rev=117810&r1=117576&r2=117810&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> /trunk/carbon/products/as/modules/integration/samples/src/test/java/org/wso2/appserver/sample/json/JSONTest.java
>>>>    (original)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/JSONTestCase.java
>>>>   Thu Dec 15 04:01:23 2011
>>>> @@ -1,8 +1,25 @@
>>>> -package org.wso2.appserver.sample.json;
>>>> -
>>>> +/*
>>>> +*Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
>>>> +*
>>>> +*WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>>
>>>>  import org.apache.axiom.om.OMElement;
>>>>  import org.apache.axiom.om.impl.builder.StAXOMBuilder;
>>>> +import org.apache.axis2.AxisFault;
>>>>  import org.apache.axis2.Constants;
>>>>  import org.apache.axis2.addressing.EndpointReference;
>>>>  import org.apache.axis2.client.Options;
>>>> @@ -11,72 +28,55 @@
>>>>  import org.apache.axis2.context.ConfigurationContextFactory;
>>>>  import org.apache.commons.logging.Log;
>>>>  import org.apache.commons.logging.LogFactory;
>>>> -import org.wso2.appserver.test.template.ASTestTemplate;
>>>> +import org.testng.annotations.Test;
>>>> +import org.wso2.carbon.integration.framework.ClientConnectionUtil;
>>>>
>>>>  import javax.xml.stream.XMLStreamException;
>>>>  import java.io.ByteArrayInputStream;
>>>>  import java.io.File;
>>>>
>>>> -public class JSONTest extends ASTestTemplate {
>>>> +public class JSONTestCase {
>>>>
>>>>     private static final String APPLICATION_JSON = "application/json";
>>>>     private static final String APPLICATION_JSON_BADGERFISH =
>>>> "application/json/badgerfish";
>>>>
>>>>     private static final String ECHO_STRING = "Hello JSON Service";
>>>>
>>>> -    private static final Log log = LogFactory.getLog(JSONTest.class);
>>>> -
>>>> -    @Override
>>>> -    public void init() {
>>>> -
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runSuccessCase() {
>>>> -        try {
>>>> -            EndpointReference targetEPR = new EndpointReference("
>>>> http://localhost:9763/" +
>>>> -                    "services/JSONService");
>>>> -
>>>> -            Options options = new Options();
>>>> -            options.setTo(targetEPR);
>>>> -
>>>> -            File configFile = new
>>>> File("repository/conf/axis2_client.xml");
>>>> -            ConfigurationContext clientConfigurationContext =
>>>> ConfigurationContextFactory
>>>> -                    .createConfigurationContextFromFileSystem(null,
>>>> -                            configFile.getAbsolutePath());
>>>> -            ServiceClient sender = new
>>>> ServiceClient(clientConfigurationContext, null);
>>>> -            sender.setOptions(options);
>>>> -            options.setTo(targetEPR);
>>>> -
>>>> -            // application/json case
>>>> -            String contentType = APPLICATION_JSON;
>>>> -            options.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>>> contentType);
>>>> -            OMElement echoPayload = getEchoPayload(contentType);
>>>> -            OMElement result = sender.sendReceive(echoPayload);
>>>> -            assertNotNull(result);
>>>> -            assertEquals(echoPayload.toString(),
>>>> result.toString().trim());
>>>> -
>>>> -            // application/json/badgerfish case
>>>> -            contentType = APPLICATION_JSON_BADGERFISH;
>>>> -            options.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>>> contentType);
>>>> -            echoPayload = getEchoPayload(contentType);
>>>> -            result = sender.sendReceive(echoPayload);
>>>> -            assertNotNull(result);
>>>> -            assertEquals(echoPayload.toString(),
>>>> result.toString().trim());
>>>> -        } catch (Exception e) {
>>>> -            log.error("Error while invoking JSON sample", e);
>>>> -            fail();
>>>> -        }
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void runFailureCase() {
>>>> -
>>>> -    }
>>>> -
>>>> -    @Override
>>>> -    public void cleanup() {
>>>> +    private static final Log log =
>>>> LogFactory.getLog(JSONTestCase.class);
>>>>
>>>> +    @Test(groups = {"wso2.as"})
>>>> +    public void runSuccessCase() throws AxisFault, XMLStreamException {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        EndpointReference targetEPR =
>>>> +                new EndpointReference("
>>>> http://localhost:9763/services/JSONService");
>>>> +
>>>> +        Options options = new Options();
>>>> +        options.setTo(targetEPR);
>>>> +
>>>> +        File configFile = new File("repository/conf/axis2_client.xml");
>>>> +        ConfigurationContext clientConfigurationContext =
>>>> +                ConfigurationContextFactory
>>>> +                        .createConfigurationContextFromFileSystem(null,
>>>> +
>>>>  configFile.getAbsolutePath());
>>>> +        ServiceClient sender = new
>>>> ServiceClient(clientConfigurationContext, null);
>>>> +        sender.setOptions(options);
>>>> +        options.setTo(targetEPR);
>>>> +
>>>> +        // application/json case
>>>> +        String contentType = APPLICATION_JSON;
>>>> +        options.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>>> contentType);
>>>> +        OMElement echoPayload = getEchoPayload(contentType);
>>>> +        OMElement result = sender.sendReceive(echoPayload);
>>>> +        assert result != null : "Result cannot be null";
>>>> +        assert echoPayload.toString().equals(result.toString().trim());
>>>> +
>>>> +        // application/json/badgerfish case
>>>> +        contentType = APPLICATION_JSON_BADGERFISH;
>>>> +        options.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>>> contentType);
>>>> +        echoPayload = getEchoPayload(contentType);
>>>> +        result = sender.sendReceive(echoPayload);
>>>> +        assert result != null : "Result cannot be null";
>>>> +        assert echoPayload.toString().equals(result.toString().trim());
>>>>     }
>>>>
>>>>     private static OMElement getEchoPayload(String contentType) throws
>>>> XMLStreamException {
>>>> @@ -86,7 +86,7 @@
>>>>         // can have namespaces within our payload
>>>>         if (APPLICATION_JSON_BADGERFISH.equals(contentType)) {
>>>>             payload = "<echo><ns:value xmlns:ns=\"
>>>> http://services.wsas.training.wso2.org\">" +
>>>> -                    ECHO_STRING + "</ns:value></echo>";
>>>> +                      ECHO_STRING + "</ns:value></echo>";
>>>>         }
>>>>
>>>>         // If you want to send JSON Arrays, use the following payload
>>>>
>>>> Added:
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/LoginLogoutTestCase.java
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/LoginLogoutTestCase.java?pathrev=117810
>>>>
>>>> ==============================================================================
>>>> --- (empty file)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/java/org/wso2/appserver/integration/tests/LoginLogoutTestCase.java
>>>>    Thu Dec 15 04:01:23 2011
>>>> @@ -0,0 +1,43 @@
>>>> +/*
>>>> +*Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights
>>>> Reserved.
>>>> +*
>>>> +*WSO2 Inc. 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.wso2.appserver.integration.tests;
>>>> +
>>>> +import org.testng.annotations.Test;
>>>> +import org.wso2.carbon.integration.framework.ClientConnectionUtil;
>>>> +import org.wso2.carbon.integration.framework.LoginLogoutUtil;
>>>> +
>>>> +/**
>>>> + * A test case which tests logging in & logging out of a Carbon core
>>>> server
>>>> + */
>>>> +public class LoginLogoutTestCase {
>>>> +
>>>> +    private LoginLogoutUtil util = new LoginLogoutUtil();
>>>> +
>>>> +    @Test(groups = {"wso2.as"})
>>>> +    public void login() throws Exception {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        util.login();
>>>> +    }
>>>> +
>>>> +    @Test(groups = {"wso2.as"}, dependsOnMethods = {"login"})
>>>> +    public void logout() throws Exception {
>>>> +        ClientConnectionUtil.waitForPort(9763);
>>>> +        util.logout();
>>>> +    }
>>>> +}
>>>> +
>>>>
>>>> Added:
>>>> trunk/carbon/products/as/modules/integration/src/test/resources/log4j.properties
>>>> URL:
>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/products/as/modules/integration/src/test/resources/log4j.properties?pathrev=117810
>>>>
>>>> ==============================================================================
>>>> --- (empty file)
>>>> +++
>>>> trunk/carbon/products/as/modules/integration/src/test/resources/log4j.properties
>>>>    Thu Dec 15 04:01:23 2011
>>>> @@ -0,0 +1,73 @@
>>>> +#
>>>> +# Copyright 2009 WSO2, Inc. (http://wso2.com)
>>>> +#
>>>> +# Licensed 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.
>>>> +#
>>>> +
>>>> +#
>>>> +# This is the log4j configuration file used by WSO2 Carbon
>>>> +#
>>>> +# IMPORTANT : Please do not remove or change the names of any
>>>> +# of the Appenders defined here. The layout pattern & log file
>>>> +# can be changed using the WSO2 Carbon Management Console, and those
>>>> +# settings will override the settings in this file.
>>>> +#
>>>> +
>>>> +log4j.rootLogger=INFO, CARBON_CONSOLE
>>>> +
>>>> +log4j.logger.org.apache.axis2.clustering=INFO, CARBON_CONSOLE
>>>> +log4j.logger.org.apache=INFO, CARBON_CONSOLE
>>>> +log4j.logger.org.apache.catalina=WARN
>>>> +log4j.logger.org.apache.tiles=WARN
>>>> +log4j.logger.org.apache.coyote=WARN
>>>> +log4j.logger.org.apache.solr=WARN
>>>> +log4j.logger.org.infinispan.factories=WARN
>>>> +log4j.logger.org.infinispan.jmx=WARN
>>>> +log4j.logger.org.jgroups=ERROR
>>>> +log4j.logger.org.wso2=INFO
>>>> +log4j.logger.org.apache.axis2.enterprise=FATAL, CARBON_CONSOLE
>>>> +log4j.logger.org.opensaml.xml=WARN, CARBON_CONSOLE
>>>> +log4j.logger.org.apache.directory.shared.ldap=WARN, CARBON_CONSOLE
>>>> +log4j.logger.org.apache.directory.server.ldap.handlers=WARN,
>>>> CARBON_CONSOLE
>>>> +#Following are to remove false error messages from startup (IS)
>>>> +log4j.logger.org.apache.directory.shared.ldap.entry.DefaultServerAttribute=FATAL,
>>>> CARBON_CONSOLE
>>>> +log4j.logger.org.apache.directory.server.core.DefaultDirectoryService=ERROR,
>>>> CARBON_CONSOLE
>>>> +log4j.logger.org.apache.directory.shared.ldap.ldif.LdifReader=ERROR,
>>>> CARBON_CONSOLE
>>>> +log4j.logger.org.apache.directory.server.ldap.LdapProtocolHandler=ERROR,
>>>> CARBON_CONSOLE
>>>> +
>>>> +log4j.additivity.org.apache.axis2.clustering=false
>>>> +
>>>> +# CARBON_CONSOLE is set to be a ConsoleAppender using a PatternLayout.
>>>> +log4j.appender.CARBON_CONSOLE=org.apache.log4j.ConsoleAppender
>>>> +log4j.appender.CARBON_CONSOLE.layout=org.apache.log4j.PatternLayout
>>>> +# ConversionPattern will be overridden by the configuration setting in
>>>> the DB
>>>> +log4j.appender.CARBON_CONSOLE.layout.ConversionPattern=[%d] %5p {%c} -
>>>> %x %m%n
>>>> +log4j.appender.CARBON_CONSOLE.threshold=DEBUG
>>>> +
>>>> +
>>>> +# CARBON_MEMORY is set to be a MemoryAppender using a PatternLayout.
>>>>
>>>> +log4j.appender.CARBON_MEMORY=org.wso2.carbon.logging.appenders.MemoryAppender
>>>> +log4j.appender.CARBON_MEMORY.layout=org.apache.log4j.PatternLayout
>>>> +log4j.appender.CARBON_MEMORY.bufferSize=200
>>>> +# ConversionPattern will be overridden by the configuration setting in
>>>> the DB
>>>> +#log4j.appender.CARBON_MEMORY.layout.ConversionPattern=[%d] %5p - %x
>>>> %m {%c}%n
>>>> +log4j.appender.CARBON_MEMORY.layout.ConversionPattern=[%d] %5p {%c} -
>>>> %x %m%n
>>>> +log4j.appender.CARBON_MEMORY.threshold=DEBUG
>>>> +
>>>> +# This file is used to override the default logger settings, and is
>>>> used to remove unwanted logs from Shindig appearing on the console.
>>>> +
>>>> +# Specification of Handler used by Console Logger
>>>> +handlers=java.util.logging.ConsoleHandler
>>>> +
>>>> +# Replacing default INFO level with SEVERE
>>>> +java.util.logging.ConsoleHandler.level=SEVERE
>>>> _______________________________________________
>>>> Carbon-commits mailing list
>>>> Carbon-commits at wso2.org
>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-commits
>>>>
>>>>
>>>>
>>>> --
>>>> *Afkham Azeez*
>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>> * <http://www.apache.org/>**
>>>> email: **azeez at wso2.com* <azeez at wso2.com>* cell: +94 77 3320919
>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>>> *
>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>>> *
>>>> *
>>>> *Lean . Enterprise . Middleware*
>>>>
>>>>
>>>> _______________________________________________
>>>> Carbon-dev mailing list
>>>> Carbon-dev at wso2.org
>>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Thilina Buddhika
>>> Associate Technical Lead
>>> WSO2 Inc. ; http://wso2.com
>>> lean . enterprise . middleware
>>>
>>> phone : +94 77 44 88 727
>>> blog : http://blog.thilinamb.com
>>>
>>> _______________________________________________
>>> Carbon-dev mailing list
>>> Carbon-dev at wso2.org
>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>
>>>
>>
>>
>> --
>> *Senaka Fernando*
>> Product Manager - WSO2 Governance Registry;
>> Associate Technical Lead; WSO2 Inc.; http://wso2.com
>> *
>> Member; Apache Software Foundation; http://apache.org
>>
>> E-mail: senaka AT wso2.com
>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>> Linked-In: http://linkedin.com/in/senakafernando
>>
>> *
>> Lean . Enterprise . Middleware
>>
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> Carbon-dev at wso2.org
>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>
>
> --
> Thilina Buddhika
> Associate Technical Lead
> WSO2 Inc. ; http://wso2.com
> lean . enterprise . middleware
>
> phone : +94 77 44 88 727
> blog : http://blog.thilinamb.com
>



-- 
Thilina Buddhika
Associate Technical Lead
WSO2 Inc. ; http://wso2.com
lean . enterprise . middleware

phone : +94 77 44 88 727
blog : http://blog.thilinamb.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/carbon-dev/attachments/20111223/29ad7604/attachment-0001.html>


More information about the Carbon-dev mailing list