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 <[email protected]> wrote:
> Hi,
>
> Can you share the test case code?
>
> On Fri, Sep 12, 2014 at 11:54 AM, Elilmatha Sivanesan <[email protected]>
> 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: +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
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev