We've been using the ServerConfigurationManager to achieve this in MB. import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
ServerConfigurationManager serverManager = new ServerConfigurationManager(automationContext); serverManager.applyConfiguration(sourceFile, targetFile, backupConfigFile, restartServer); Thanks, Akalanka. On Mon, Apr 11, 2016 at 3:22 PM, Bhathiya Jayasekara <[email protected]> wrote: > Thanks Nuwan. Will try this. > > Thanks, > Bhathiya > > On Mon, Apr 11, 2016 at 3:21 PM, Nuwan Wimalasekara <[email protected]> > wrote: > >> Hi Bhathiya, >> >> You can start a new server instance using below code segment. >> >> AutomationContext regTestContext = new AutomationContext("AM", >> "AMTestServer", TestUserMode.SUPER_TENANT_ADMIN); >> >> Map < String, String > startupParameterMap = new HashMap < > (); >> startupParameterMap.put("-DportOffset", "230"); >> >> TestServerManager testServerManager = new TestServerManager(regTestContext, >> null, startupParameterMap) { >> >> public void configureServer() throws AutomationFrameworkException { >> >> try { >> File sourceFile = new >> File(TestConfigurationProvider.getResourceLocation() + "registry.xml"); >> >> //copying registry.xml file to conf folder >> FileManager.copyFile(sourceFile, this.getCarbonHome() + >> File.separator + "repository" + File.separator + "conf" + File.separator + >> "registry.xml"); >> } catch (IOException e) { >> throw new AutomationFrameworkException(e.getMessage(), e); >> } >> } >> }; >> >> testServerManager.startServer(); >> >> >> >> Thanks, >> Nuwanw >> >> On Mon, Apr 11, 2016 at 2:52 PM, Bhathiya Jayasekara <[email protected]> >> wrote: >> >>> Hi Automation team, >>> >>> In this[1] test, we have *CarbonTestServerManager *with >>> *MultipleServersManager *to spawn a new APIM server. Now I need to >>> apply a modified api-manager.xml file before starting this server. How can >>> I do that? Appreciate some help. >>> >>> public void setEnvironment() throws Exception { >>> // to start the server from a different port offset >>> serverPropertyMap.put("-DportOffset", "510"); >>> // start with OSGI component service >>> serverPropertyMap.put("-DosgiConsole", Integer.toString(telnetPort)); >>> AutomationContext autoCtx = new AutomationContext(); >>> CarbonTestServerManager server = >>> new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), >>> serverPropertyMap); >>> manager.startServers(server); >>> } >>> >>> >>> [1] >>> https://github.com/wso2/product-apim/blob/master/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/server/mgt/OSGIServerBundleStatusTestCase.java#L63 >>> >>> Thanks, >>> -- >>> *Bhathiya Jayasekara* >>> *Senior Software Engineer,* >>> *WSO2 inc., http://wso2.com <http://wso2.com>* >>> >>> *Phone: +94715478185 <%2B94715478185>* >>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj >>> <http://www.linkedin.com/in/bhathiyaj>* >>> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>* >>> *Blog: http://movingaheadblog.blogspot.com >>> <http://movingaheadblog.blogspot.com/>* >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Nuwan Wimalasekara >> Senior Software Engineer - Test Automation >> WSO2, Inc.: http://wso2.com >> lean. enterprise. middleware >> >> phone: +94 71 668 4620 >> >> >> >> > > > -- > *Bhathiya Jayasekara* > *Senior Software Engineer,* > *WSO2 inc., http://wso2.com <http://wso2.com>* > > *Phone: +94715478185 <%2B94715478185>* > *LinkedIn: http://www.linkedin.com/in/bhathiyaj > <http://www.linkedin.com/in/bhathiyaj>* > *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>* > *Blog: http://movingaheadblog.blogspot.com > <http://movingaheadblog.blogspot.com/>* > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Darshana Akalanka Pagoda Arachchi,* *Software Engineer, WSO2* *+94777118016*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
