Hi,

This sets the trust store in client. Set it to your paths

System.setProperty("javax.net.ssl.trustStore",
"/home/waruna/Products/wso2is-4.7.0/repository/resources/security/wso2carbon.jks");
        System.setProperty("javax.net.ssl.trustStorePassword",
                "wso2carbon");
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");


On Fri, Sep 5, 2014 at 1:45 PM, Waruna Perera <[email protected]> wrote:

> HI,
>
>
> Can you try adding following code segment and try.
>
>
>
> On Fri, Sep 5, 2014 at 1:43 PM, Kasun Dissanayake <[email protected]> wrote:
>
>> Hi Waruna,
>>
>> @Test(groups = { "wso2.appmanager" }, description = "test SAML tokens
>> send to the backend")
>>     public void samlToBackendTestCase() throws Exception {
>>
>>         String appId = "";
>>         // publisher creates an app
>>         String username = userInfo.getUserName();
>>         String password = userInfo.getPassword();
>>         appmPublisher.login(username, password);
>>
>>         AppCreateRequest appRequest = new AppCreateRequest();
>>
>>         int port = 9988; // used to create a wiremonitor server and get
>> the
>>         // requst
>>         String webappUrl = "http://localhost:"; + port;
>>         String appName = "samltestapp";
>>         String version = "1.0.0";
>>
>>         appRequest.setOverview_webAppUrl(webappUrl);
>>         appRequest.setOverview_transports("https");
>>         appRequest.setOverview_name(appName);
>>         appRequest.setOverview_version(version);
>>         appRequest.setOverview_context("/" + appName);
>>         appRequest.setEntitlementPolicies("[]");
>>
>>         // for IS autoconfig to get SSO feature
>>         appRequest.setAutoConfig("on");
>>         appRequest.setProviders("wso2is-5.0.0");
>>         appRequest.setSso_ssoProvider("wso2is-5.0.0");
>>         appRequest.setSso_singleSignOn("Enabled");
>>         appRequest.setClaims("http://wso2.org/claims/role";);
>>         appRequest.setClaimPropertyCounter("1");
>>         appRequest.setSso_idpProviderUrl("https://localhost:9443/samlsso/
>> ");
>>
>>         log.info("Waiting for the test application to be
>> created......................");
>>         HttpResponse response = appmPublisher.createApp(appRequest);
>>         JSONObject jsonObject = new JSONObject(response.getData());
>>         appId = (String) jsonObject.get("id");
>>
>>
>>         try {
>>             Thread.sleep(4000);
>>         } catch (InterruptedException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>         log.info("Publishing the test
>> application......................");
>>         appmPublisher.publishApp(appId);
>>         try {
>>             Thread.sleep(10000);
>>         } catch (InterruptedException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>
>>         // client subscribe to that app
>>         log.info("Subscribe to the test
>> application......................");
>>         appmStore.login(username, password);
>> // try {
>> // Thread.sleep(5000);
>> // } catch (InterruptedException e) {
>> // // TODO Auto-generated catch block
>> // e.printStackTrace();
>> // }
>>
>>         SubscriptionRequest subscriptionRequest = new SubscriptionRequest(
>>                 appName, username, version);
>>         HttpResponse subscriptionResponse = appmStore
>>                 .subscribeForApplication(subscriptionRequest);
>>         Thread.sleep(20000);
>>         // Assert.assertTrue((Boolean)
>> subscriptionJsonObject.get("status"),
>>         // "Application is already subscribed");
>>
>>         // do the selenium login and app selection
>>         //FirefoxDriver driver = new FirefoxDriver();
>>         log.info("sso profiver--------------------------
>> +"+appRequest.getSso_ssoProvider());
>>         // wire monitor server to get the request from the appmanager
>>         WireMonitorServer server = new WireMonitorServer(port);
>>         server.start();
>>
>>
>>         driver = BrowserManager.getWebDriver();
>>         APPMStoreUIClient.login(driver, storeURLHttp, username, password);
>>         //String baseWindow = driver.getWindowHandle();
>>         //driver.manage().timeouts().pageLoadTimeout(30,
>> TimeUnit.SECONDS);
>>         //driver.manage().timeouts().implicitlyWait(4000,
>> TimeUnit.MILLISECONDS);
>>         try {
>>             Thread.sleep(5000);
>>         } catch (InterruptedException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>
>>         APPMStoreUIClient.selectApplication(driver, storeURLHttp, appId,
>>                 username, password);
>>         try {
>>             Thread.sleep(3000);
>>         } catch (InterruptedException e) {
>>             // TODO Auto-generated catch block
>>             e.printStackTrace();
>>         }
>>
>>         System.out.println("the backend sent saml message :
>> "+server.getCapturedMessage());
>>         boolean hasSAML = false;
>>         if (server.getCapturedMessage().contains("AppMgtSAML2Response")) {
>>             hasSAML = true;
>>         }
>>
>>         Assert.assertEquals(hasSAML, true,
>>                 "SAML token cannot be found in the request sent to the
>> backend");
>>         server = null;
>>         driver.close();
>>
>>     }
>>
>>
>> Cheers
>>
>>
>> On Fri, Sep 5, 2014 at 1:41 PM, Waruna Perera <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> Can you please share your test case code?
>>>
>>> Thanks
>>>
>>>
>>> On Fri, Sep 5, 2014 at 1:37 PM, Kasun Dissanayake <[email protected]>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm working on [1] and getting following error
>>>> [1] https://wso2.org/jira/browse/APPM-161
>>>>
>>>> samlToBackendTestCase(org.wso2.carbon.appmanager.tests.sample.SAMLtoBackendTest)
>>>>  Time elapsed: 51.699 sec  <<< FAILURE!
>>>> org.openqa.selenium.remote.UnreachableBrowserException: Error
>>>> communicating with the remote browser. It may have died.
>>>> Build info: version: '2.37.0', revision:
>>>> 'a7c61cbd68657e133ae96672cf995890bad2ee42', time: '2013-10-18 09:51:02'
>>>> System info: host: 'puppet.kasun.org', ip: '127.0.0.1', os.name:
>>>> 'Linux', os.arch: 'amd64', os.version: '3.13.0-35-generic', java.version:
>>>> '1.6.0_45'
>>>> Driver info: driver.version: RemoteWebDriver
>>>> at
>>>> org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
>>>> at
>>>> org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
>>>> at
>>>> org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
>>>> at
>>>> org.wso2.carbon.appmanager.tests.util.APPMStoreUIClient.selectApplication(APPMStoreUIClient.java:93)
>>>> at
>>>> org.wso2.carbon.appmanager.tests.sample.SAMLtoBackendTest.samlToBackendTestCase(SAMLtoBackendTest.java:141)
>>>> Caused by: org.apache.http.conn.HttpHostConnectException: Connection to
>>>> http://127.0.0.1:7056 refused
>>>> at
>>>> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
>>>> at
>>>> org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
>>>> at
>>>> org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
>>>> at
>>>> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
>>>> at
>>>> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
>>>> at
>>>> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
>>>> at
>>>> org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:337)
>>>> at
>>>> org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:298)
>>>> at
>>>> org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:145)
>>>> at
>>>> org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:366)
>>>> at
>>>> org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
>>>> ... 38 more
>>>> Caused by: java.net.ConnectException: Connection refused
>>>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
>>>> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
>>>> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
>>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>>> at java.net.Socket.connect(Socket.java:529)
>>>> at
>>>> org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
>>>> at
>>>> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
>>>> ... 48 more
>>>>
>>>>
>>>> Any idea ?
>>>>
>>>> --
>>>> Kasun Dissanayake
>>>> Software Engineer
>>>> WSO2 Inc.
>>>> Lean | Enterprise | Middleware
>>>> Tel - +94 77 086 2860
>>>> Skype - kasun.dissanayake4
>>>> LinkedIn - lk.linkedin.com/in/kasundis/
>>>>
>>>
>>>
>>>
>>> --
>>> Waruna Perera
>>> Senior Software Engineer - Test Automation
>>> Mobile: +94 77 3867037
>>> WSO2, Inc.; http://wso2.com/
>>> lean . enterprise . middlewear.
>>>
>>
>>
>>
>> --
>> Kasun Dissanayake
>> Software Engineer
>> WSO2 Inc.
>> Lean | Enterprise | Middleware
>> Tel - +94 77 086 2860
>> Skype - kasun.dissanayake4
>> LinkedIn - lk.linkedin.com/in/kasundis/
>>
>
>
>
> --
> Waruna Perera
> Senior Software Engineer - Test Automation
> Mobile: +94 77 3867037
> WSO2, Inc.; http://wso2.com/
> lean . enterprise . middlewear.
>



-- 
Waruna Perera
Senior Software Engineer - Test Automation
Mobile: +94 77 3867037
WSO2, Inc.; http://wso2.com/
lean . enterprise . middlewear.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to