Hi Vijitha,

I have written a test case for mail transport .In that me too replacing
axis2.xml. This is my AfterClass method which is working fine for me .
I think you have to cleanup before restore to last configuration.

@AfterClass(alwaysRun = true)
    public void deleteService() throws Exception {
        try {
            super.cleanup();
        }catch (Exception e){
            log.error("Error while cleaning up "+e.getMessage(),e);
            throw new Exception("Error while cleaning up
"+e.getMessage(),e);
        }finally {
            if (serverConfigurationManager != null) {
                serverConfigurationManager.restoreToLastConfiguration();
            }
        }
    }

Thanks,
Iqbal

On Thu, Jan 22, 2015 at 7:20 AM, Vijitha Ekanayake <[email protected]>
wrote:

> Hi,
>
> I'm writing a test case automate the WSO2 ESB sample 264 [1]. In the test
> I replaces the axis2.xml files of ESB and backend axis2 server enable JMS
> transport Sender and Receiver. test case works fine except following
> exception printed out in the console when when it executing the
> *super.cleanup()* method. Can anybody help help me to figure it out what
> i have missed in the test case?
>
> *Test case Implementation*
>
>  private ServerConfigurationManager serverConfigurationManager;
>
> private ActiveMQServer activeMQServer = new ActiveMQServer();
>
>
>  @BeforeClass(alwaysRun = true)
>
> public void init() throws Exception {
>
> activeMQServer.startJMSBrokerAndConfigureESB();
>
> super.init();
>
> context = new AutomationContext("ESB", TestUserMode.SUPER_TENANT_ADMIN);
>
> serverConfigurationManager = new ServerConfigurationManager(context);
>
>
> File sourceFile = location of source axis2.xml
>
> File targetFile = actual axis2.xml location of esb
>
> File sourceAxis2ServerFile =  location of source axis2.ml of axis2 server
>
> File targetAxis2ServerFile = actual axis2.xml location of axis2 server
>
>
> serverConfigurationManager.applyConfigurationWithoutRestart(sourceFile,
> targetFile, true);
>
> serverConfigurationManager.applyConfigurationWithoutRestart(sourceAxis2ServerFile,
> targetAxis2ServerFile, true);
>
> loadSampleESBConfiguration(264);
>
> serverConfigurationManager.restartGracefully(getSessionCookie());
>
>  }
>
>
> @SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE})
>
> @Test(groups = {"wso2.esb"}, description = "Test JMS two way transport ",
> enabled = true)
>
> public void testJMSProxy() throws Exception {
>
> OMElement response =
> axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("StockQuoteProxy")
>
>         ,
> getBackEndServiceUrl(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE),
> "Sample264");
>
> Assert.assertTrue(response.toString().contains("Sample264"), "Invalid
> response message");
>
> }
>
>
>  @AfterClass(alwaysRun = true)
>
> public void close() throws Exception {
>
> serverConfigurationManager.restoreToLastConfiguration();
>
> activeMQServer.stopJMSBrokerRevertESBConfiguration();
>
> super.cleanup();
>
> }
>
>
> *following exception printed out in the console.*
>
>
>  *INFO
> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -
> [2015-01-22 06:54:01,943]  WARN - AuthenticationHandler Illegal access
> attempt at [2015-01-22 06:54:01,0943] from IP address 127.0.0.1 while
> trying to authenticate access to service ServiceAdmin*
>
> *INFO  [org.apache.commons.httpclient.auth.AuthChallengeProcessor] - basic
> authentication scheme selected*
>
> *INFO  [org.apache.commons.httpclient.HttpMethodDirector] - No credentials
> available for BASIC 'WSO2 Enterprise Service Bus'@localhost:9443*
>
> *INFO  [org.apache.axis2.transport.http.HTTPSender] - Unable to
> sendViaPost to url[https://localhost:9443/services/ServiceAdmin
> <https://localhost:9443/services/ServiceAdmin>]*
>
> *org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized*
>
> * at
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:330)*
>
> * at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:196)*
>
> * at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)*
>
> * at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)*
>
> * at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)*
>
> * at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)*
>
> * at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)*
>
> * at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)*
>
> * at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)*
>
> * at
> org.wso2.carbon.service.mgt.stub.ServiceAdminStub.listServices(ServiceAdminStub.java:8211)*
>
> * at
> org.wso2.esb.integration.common.clients.service.mgt.ServiceAdminClient.listServices(ServiceAdminClient.java:87)*
>
> * at
> org.wso2.esb.integration.common.clients.service.mgt.ServiceAdminClient.isServiceExists(ServiceAdminClient.java:126)*
>
> * at
> org.wso2.esb.integration.common.utils.ESBTestCaseUtils.deleteArtifact(ESBTestCaseUtils.java:1805)*
>
> * at
> org.wso2.esb.integration.common.utils.ESBIntegrationTest.cleanup(ESBIntegrationTest.java:106)*
>
> * at
> org.wso2.carbon.esb.samples.test.messaging.Sample264TestCase.close(Sample264TestCase.java:81)*
>
> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
>
> * at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)*
>
> * at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>
> * at java.lang.reflect.Method.invoke(Method.java:606)*
>
> * at
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)*
>
> * at
> org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)*
>
> * at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)*
>
> * at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)*
>
> * at
> org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:222)*
>
> * at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)*
>
> * at org.testng.TestRunner.runWorkers(TestRunner.java:1178)*
>
> * at org.testng.TestRunner.privateRun(TestRunner.java:757)*
>
> * at org.testng.TestRunner.run(TestRunner.java:608)*
>
> * at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)*
>
> * at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)*
>
> * at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)*
>
> * at org.testng.SuiteRunner.run(SuiteRunner.java:240)*
>
> * at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)*
>
> * at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)*
>
> * at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)*
>
> * at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)*
>
> * at org.testng.TestNG.run(TestNG.java:999)*
>
> * at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)*
>
> * at
> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)*
>
> * at
> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)*
>
> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
>
> * at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)*
>
> * at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>
> * at java.lang.reflect.Method.invoke(Method.java:606)*
>
> * at
> org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)*
>
> * at
> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)*
>
> * at
> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)*
>
> * at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)*
>
> * at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)*
>
> *FAILED CONFIGURATION: @AfterClass close*
>
> *org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized*
>
> * at
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:330)*
>
> * at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:196)*
>
> * at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)*
>
> * at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)*
>
> * at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)*
>
> * at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)*
>
> * at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)*
>
> * at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)*
>
> * at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)*
>
> * at
> org.wso2.carbon.service.mgt.stub.ServiceAdminStub.listServices(ServiceAdminStub.java:8211)*
>
> * at
> org.wso2.esb.integration.common.clients.service.mgt.ServiceAdminClient.listServices(ServiceAdminClient.java:87)*
>
> * at
> org.wso2.esb.integration.common.clients.service.mgt.ServiceAdminClient.isServiceExists(ServiceAdminClient.java:126)*
>
> * at
> org.wso2.esb.integration.common.utils.ESBTestCaseUtils.deleteArtifact(ESBTestCaseUtils.java:1805)*
>
> * at
> org.wso2.esb.integration.common.utils.ESBIntegrationTest.cleanup(ESBIntegrationTest.java:106)*
>
> * at
> org.wso2.carbon.esb.samples.test.messaging.Sample264TestCase.close(Sample264TestCase.java:81)*
>
> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
>
> * at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)*
>
> * at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>
> * at java.lang.reflect.Method.invoke(Method.java:606)*
>
> * at
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)*
>
> * at
> org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)*
>
> * at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)*
>
> * at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130)*
>
> * at
> org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:222)*
>
> * at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)*
>
> * at org.testng.TestRunner.runWorkers(TestRunner.java:1178)*
>
> * at org.testng.TestRunner.privateRun(TestRunner.java:757)*
>
> * at org.testng.TestRunner.run(TestRunner.java:608)*
>
> * at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)*
>
> * at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)*
>
> * at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)*
>
> * at org.testng.SuiteRunner.run(SuiteRunner.java:240)*
>
> * at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)*
>
> * at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)*
>
> * at org.testng.TestNG.runSuitesSequentially(TestNG.java:1158)*
>
> * at org.testng.TestNG.runSuitesLocally(TestNG.java:1083)*
>
> * at org.testng.TestNG.run(TestNG.java:999)*
>
> * at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)*
>
> * at
> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)*
>
> * at
> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)*
>
> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
>
> * at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)*
>
> * at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>
> * at java.lang.reflect.Method.invoke(Method.java:606)*
>
> * at
> org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)*
>
> * at
> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)*
>
> * at
> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)*
>
> * at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)*
>
> * at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)*
>
> [1].
> https://docs.wso2.com/display/ESB481/Sample+264%3A+Sending+Two-Way+Messages+Using+JMS+transport
>
> --
> Vijitha Ekanayake
> Software Engineer*, *WSO2, Inc.; http://wso2.com/
> Mobile : +94 777 24 73 39 | +94 718 74 44 08
> lean.enterprise.middleware
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Irham Iqbal
Software Engineer - Test Automation
 WSO2, Inc.: http://wso2.com
lean. enterprise. middleware
phone: +94 777888452
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to