Hi Madhawa,

You can use ServerConfigurationManager.applyConfiguration(File
sourceFile, File targetFile, boolean backupConfigFile, boolean
restartServer) to do this task. If you pass  backupConfigFile as true
it will backup the configuration and using
restoreToLastConfiguration() method you can revert to the original
file.

Sample code is available at [1]. Instead of BeforeTest  you can add
the configurations in BeforeClass and instead of AfterTest you can
restore the configurations  at AfterClass.


[1]https://github.com/wso2/product-apim/blob/master/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/lifecycle/APIManagerConfigurationChangeTest.java


Thanks and Best Regards,

Saneth Dharmakeerthi
Senior Software Engineer
WSO2, Inc.
Mobile: +94772325511

On Sat, Jun 6, 2015 at 11:12 AM, Thusitha Thilina Dayaratne <
[email protected]> wrote:

> Hi Madhawa,
>
> I wrote a TestCase for ESB and in there we can set like below. Hope this
> will help you to get some idea :)
>
> private ServerConfigurationManager configManager;
>> @BeforeClass(alwaysRun = true)
>> public void setEnvironment() throws Exception {
>>     ...
>>     File customAxisConfig = new File(path_to_axis2.xml);
>>     configManager = new ServerConfigurationManager(
>> esbServer.getBackEndUrl());
>>     configManager.applyConfiguration(customAxisConfig);
>>     ...
>> }
>
>
> Thanks
> /Thusitha
>
> On Sat, Jun 6, 2015 at 8:43 AM, Madhawa Gunasekara <[email protected]>
> wrote:
>
>> Hi All,
>>
>> I am writing a test case for DSS 3.2.2 to test the
>> org.apache.axis2.json.JSONMessageFormatter (old json formatter) for some
>> queries, In default configurations DSS3.2.2 uses
>> org.apache.axis2.json.gson.JsonFormatter as json formatter.
>> Therefore I think, I need to replace the axis.xml in test scope. How can
>> I do it in DSS 3.2.2 ?
>>
>> Any help on this is highly appreciated.
>>
>> Thanks,
>> Madhawa
>>
>> --
>> *Madhawa Gunasekara*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 719411002 <+94+719411002>
>> blog: *http://madhawa-gunasekara.blogspot.com
>> <http://madhawa-gunasekara.blogspot.com>*
>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>> <http://lk.linkedin.com/in/mgunasekara>*
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thusitha Dayaratne
> Software Engineer
> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>
> Mobile  +94712756809
> Blog      alokayasoya.blogspot.com
> About    http://about.me/thusithathilina
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to