Hi Borice, Currently we do have such integration tests in here, https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/products/as/5.1.0/modules/integration/<https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/products/as/5.1.0/modules/integration/src/test/java/org/wso2/appserver/integration/tests/TenantWebappDeploymentTestCase.java> If you have done any improvements please consider donating this work back WSO2. :)
thanks, On Mon, Mar 25, 2013 at 6:27 AM, borice <[email protected]> wrote: > Thank you, Harsha! It worked. > > For whoever else might need this information, see below for an example. > > -Boris > > Example: if using Maven, just add: > > <dependency> > <groupId>org.wso2.carbon</groupId> > <artifactId>org.wso2.carbon.webapp.mgt.stub</artifactId> > <version>4.0.1</version> > </dependency> > > then the following code snippet can be used to obtain an instance of > WebappAdminStub to access the needed functionality: > > // wso2Url is the WSO2 services EPR, for example: > https://localhost:9443/services/ > String authAdminEPR = wso2Url + "AuthenticationAdmin"; > String remoteAddress = NetworkUtils.getLocalHostname(); > > ConfigurationContext configContext = > ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, > null); > AuthenticationAdminStub adminStub = new > AuthenticationAdminStub(configContext, authAdminEPR); > > adminStub._getServiceClient().getOptions().setManageSession(true); > if (!adminStub.login(wso2User, wso2Password, remoteAddress)) > throw new AuthenticationException("Invalid username and/or > password"); > > String authCookie = (String) > > adminStub._getServiceClient().getServiceContext().getProperty(HTTPConstants.COOKIE_STRING); > > String webappAdminEPR = wso2Url + "WebappAdmin"; > WebappAdminStub webappAdminStub = new > WebappAdminStub(configContext, webappAdminEPR); > Options option = > webappAdminStub._getServiceClient().getOptions(); > option.setManageSession(true); > option.setProperty(HTTPConstants.COOKIE_STRING, authCookie); > > // now webappAdminStub can be used, as needed > > > > > -- > View this message in context: > http://wso2-oxygen-tank.10903.n7.nabble.com/AS-programmatic-webapp-deployment-tp76821p76823.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 > -- Supun Malinga, Software Engineer, WSO2 Inc. http://wso2.com http://wso2.org email - [email protected] <[email protected]> mobile - 071 56 91 321
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
