Hi,

AFAIK you're supposed to use the Integration Base at [1] to extend and
design your test cases for ESB Connectors.

Thanks.

[1] https://github.com/wso2-dev/esb-connectors/tree/master/integration-base

On Fri, Sep 12, 2014 at 12:52 PM, Elilmatha Sivanesan [via WSO2 Oxygen
Tank] <[email protected]> wrote:

> public class eventbriteConnectorIntegrationTest extends ESBIntegrationTest
> {
>
>
>     private MediationLibraryUploaderStub mediationLibUploadStub = null;
>
>     private MediationLibraryAdminServiceStub adminServiceStub = null;
>
>
>     private Map<String, String> esbRequestHeadersMap = new HashMap<String,
> String>();
>
>     private Map<String, String> apiRequestHeadersMap = new HashMap<String,
> String>();
>
>     private Map<String, String> headersMap = new HashMap<String, String>();
>
>         //
>         Properties eventbriteConnectorProperties=null;
>
>         private static final String CONNECTOR_NAME = "event_brite";
>
>         private ProxyServiceAdminClient proxyAdmin;
>
>         private String pathToProxiesDirectory = null;
>
>         private String pathToRequestsDirectory = null;
>         private String eventbriteConnectorFileName=null;
>
>         @BeforeClass(alwaysRun = true)
>         public void setEnvironment() throws Exception {
>
>             super.init();
>
>             ConfigurationContextProvider configurationContextProvider =
> ConfigurationContextProvider.getInstance();
>             ConfigurationContext cc =
> configurationContextProvider.getConfigurationContext();
>              mediationLibUploadStub = new MediationLibraryUploaderStub(cc,
> esbServer.getBackEndUrl() + "MediationLibraryUploader");
>             AuthenticateStub.authenticateStub("admin", "admin",
> mediationLibUploadStub);
>
>              adminServiceStub = new MediationLibraryAdminServiceStub(cc,
> esbServer.getBackEndUrl() + "MediationLibraryAdminService");
>
>             AuthenticateStub.authenticateStub("admin", "admin",
> adminServiceStub);
>
>             String repoLocation = null;
>             if 
> (System.getProperty("os.name").toLowerCase().contains("windows"))
> {
>                 repoLocation =
> System.getProperty("connector_repo").replace("/", "\\");
>             } else {
>                 repoLocation =
> System.getProperty("connector_repo").replace("/", "/");
>             }
>             proxyAdmin = new
> ProxyServiceAdminClient(esbServer.getBackEndUrl(),
> esbServer.getSessionCookie());
>
>             String eventbriteConnectorFileName = CONNECTOR_NAME + ".zip";
>             ConnectorIntegrationUtil.uploadConnector(repoLocation,
> mediationLibUploadStub, eventbriteConnectorFileName);
>             log.info("Sleeping for " + 10000 / 1000 + " seconds while
> waiting for synapse import");
>             Thread.sleep(10000);
>             adminServiceStub.updateStatus("{org.wso2.carbon.connector}" +
> CONNECTOR_NAME, CONNECTOR_NAME,
>                     "org.wso2.carbon.connector", "enabled");
>
>             Properties eventbriteConnectorProperties =
> ConnectorIntegrationUtil.getConnectorConfigProperties(CONNECTOR_NAME);
>
>             pathToProxiesDirectory = repoLocation +
> eventbriteConnectorProperties.getProperty("proxyDirectoryRelativePath");
>             pathToRequestsDirectory = repoLocation +
> eventbriteConnectorProperties.getProperty("requestDirectoryRelativePath");
>         }
>
>
>
>     @Override
>     protected void cleanup() {
>         axis2Client.destroy();
>     }
>
>
>     /**
>      * Negative test case for getAnAlbumMetadata method.
>      */
>
>    @Test(groups = { "wso2.esb" }, description =
> "event_brite{getuserdetails} integration test with negative case.")
>     public void testgetuserdetails() throws Exception {
>         String jsonRequestFilePath = pathToRequestsDirectory  +
> "getuserdetails.txt";
>         String methodName = "getuserdetails";
>
>         final String jsonString =
> ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath);
>         final String proxyFilePath = "file:///" +  pathToProxiesDirectory
>  + methodName + ".xml";
>         proxyAdmin.addProxyService(new DataHandler(new
> URL(proxyFilePath)));
>        System.out.println(jsonString);
>         //JSONObject jsonResponse;
>        //String modifiedJsonString = String.format(jsonString,
>                //eventbriteConnectorProperties.getProperty("userId"));
>
>
>
>         JSONObject jsonResponse;
>         try {
>             jsonResponse =
> ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName),
> jsonString);
>
> System.out.println("------------*************@@@@@@@@@@@@@@@*************-----------");
>             //System.out.println(jsonResponse);
>
>             Assert.assertTrue(jsonResponse.has("emails"));
>
>         } finally {
>
>             proxyAdmin.deleteProxy(methodName);
>         }
>
>     }
>
>
>
>
>
>
>
>
>
>
>
> On Fri, Sep 12, 2014 at 12:03 PM, Waruna Perera <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=102858&i=0>> wrote:
>
>> Hi,
>>
>> Can you share the test case code?
>>
>> On Fri, Sep 12, 2014 at 11:54 AM, Elilmatha Sivanesan <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=102858&i=1>> wrote:
>>
>>>
>>> When we run our test case we get this error
>>> What can be the reasons
>>>
>>> [2014-09-12 11:44:23,552] ERROR
>>> {org.wso2.carbon.automation.core.PlatformTestManager} -  On Test failure..
>>> [2014-09-12 11:44:23,552] ERROR
>>> {org.wso2.carbon.automation.core.PlatformTestManager} -
>>>  java.net.SocketException: Unexpected end of file from server
>>> [2014-09-12 11:44:23,552]  INFO
>>> {org.wso2.carbon.automation.core.PlatformTestManager} -
>>>  --------------Tests Failed
>>> org.wso2.carbon.connector.integration.test.event_brite.eventbriteConnectorIntegrationTest.testgetuserdetails--------
>>> FAILED: testgetuserdetails
>>>         event_brite{getuserdetails} integration test with negative case.
>>> java.net.SocketException: Unexpected end of file from server
>>> at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:718)
>>> at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
>>> at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:715)
>>> at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579)
>>> at
>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322)
>>> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
>>> at
>>> java.net.HttpURLConnection.getResponseMessage(HttpURLConnection.java:534)
>>> at
>>> org.wso2.carbon.connector.integration.test.common.ConnectorIntegrationUtil.sendRequest(ConnectorIntegrationUtil.java:140)
>>> at
>>> org.wso2.carbon.connector.integration.test.event_brite.eventbriteConnectorIntegrationTest.testgetuserdetails(eventbriteConnectorIntegrationTest.java:118)
>>> 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.invokeMethod(Invoker.java:673)
>>> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:842)
>>> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1166)
>>> at
>>> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
>>> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
>>> 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)
>>> --
>>> *S.Elilmatha*
>>> Associative Software Engineer,
>>>
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> Mobile 0779842221.
>>>
>>>
>>
>>
>> --
>> Waruna Perera
>> Senior Software Engineer - Test Automation
>> Mobile: <a href="tel:%2B94%2077%203867037" value="+94773867037"
>> target="_blank">+94 77 3867037
>> WSO2, Inc.; http://wso2.com/
>> lean . enterprise . middlewear.
>>
>
>
>
> --
> *S.Elilmatha*
> Associative Software Engineer,
>
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> Mobile 0779842221.
>
>
> _______________________________________________
> Dev mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=102858&i=2>
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://wso2-oxygen-tank.10903.n7.nabble.com/Test-case-error-on-esb-connectors-tp102853p102858.html
>  To start a new topic under WSO2 Development, email
> [email protected]
> To unsubscribe from WSO2 Development, click here
> <http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3&code=cmFzYWRlODhAZ21haWwuY29tfDN8LTEwNDAzODU2MTk=>
> .
> NAML
> <http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Au revoir!
Ramindu Deshapriya.

Member - Sahana Software Foundation http://sahanafoundation.org
http://rdeshapriya.com

<http://www.facebook.com/rdeshapriya>   <http://twitter.com/#%21/rami_desh>
<https://plus.google.com/113801459480978566130>
<http://www.linkedin.com/profile/view?id=84017607&trk=tab_pro>
<http://rdeshapriya.com>   <http://lmakuthan.blogspot.com>




--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Test-case-error-on-esb-connectors-tp102853p102859.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to