Hi Sajini, Please refer [1] for sample integration test case for class mediator test. You can check whether the resource is added to the registry once class mediator is invoked.
[1] https://github.com/wso2-dev/product-esb/blob/master/modules/integration/tests-integration/tests-mediator-2/src/test/java/org/wso2/carbon/esb/mediator/test/classMediator/ClassMediationWithLoadOfPropertiesTestCase.java Thanks, Nuwanw On Tue, Jun 10, 2014 at 8:28 AM, Sajini De Silva <[email protected]> wrote: > Hi Krishantha, > > This is the synapse configuration I used to test the class mediator. > > <definitions xmlns="http://ws.apache.org/ns/synapse"> > <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry"> > <parameter name="cachableDuration">15000</parameter> > </registry> > > <sequence name="fault"> > <log level="full"> > <property name="MESSAGE" value="Executing default 'fault' > sequence"></property> > <property name="ERROR_CODE" > expression="get-property('ERROR_CODE')"></property> > <property name="ERROR_MESSAGE" > expression="get-property('ERROR_MESSAGE')"></property> > </log> > <drop></drop> > </sequence> > <sequence name="main"> > <class > name="org.wso2.carbon.cloud.monitor.agent.mediators.snmp.SNMPAdapter"> > <property name="port" value="161"></property> > <property name="metrics" > > value="memTotalSwap,memAvailReal,CpusRawIdle,CpuIdlePercentage,hrSystemProcesses"></property> > <property name="puppetDBPort" value="8080"></property> > <property name="communityString" value="public"></property> > <property name="puppetDBHost" value="54.85.22.228"></property> > </class> > <log></log> > </sequence> > <task name="Task1" > class="org.apache.synapse.startup.tasks.MessageInjector" > group="synapse.simple.quartz"> > <trigger interval="15000"></trigger> > <property name="message"> > <ns:WSO2_CLOUD_MON xmlns:ns="agent.monitor.cloud.wso2.org" > VERSION="1.0.0"> > <ns:HOSTS></ns:HOSTS> > </ns:WSO2_CLOUD_MON> > </property> > </task> > </definitions> > > I remote debug the mediator class and verify that messageContext body has > the necessary fields. > > Thank you, > Sajini. > > > On Mon, Jun 9, 2014 at 6:06 PM, Krishantha Samaraweera < > [email protected]> wrote: > >> Hi Sajini, >> >> I think best way to automate is to write an integration test for this. >> You need to make sure class mediator works on ESB runtime without any >> problem. >> >> Can you please explain the steps you manually followed to verify the >> mediator. Synapse config would be helpful. >> >> Thanks, >> Krishantha. >> >> >> On Mon, Jun 9, 2014 at 4:38 PM, Sajini De Silva <[email protected]> wrote: >> >>> Adding Krishantha to the thread. >>> >>> >>> On Mon, Jun 9, 2014 at 3:45 PM, Sajini De Silva <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> In my class mediator I access the ESB registry and read a file in the >>>> registry. Is there a way to conduct a unit test on the mediate method of >>>> this class mediator? >>>> >>>> Thank you, >>>> Sajini. >>>> -- >>>> Sajini De SIlva >>>> Software Engineer; WSO2 Inc.; http://wso2.com , >>>> Email: [email protected] >>>> Blog: http://sajinid.blogspot.com/ >>>> Git hub profile: https://github.com/sajinidesilva >>>> >>>> >>> >>> >>> -- >>> Sajini De SIlva >>> Software Engineer; WSO2 Inc.; http://wso2.com , >>> Email: [email protected] >>> Blog: http://sajinid.blogspot.com/ >>> Git hub profile: https://github.com/sajinidesilva >>> >>> >> >> >> -- >> Krishantha Samaraweera >> Senior Technical Lead - Test Automation >> Mobile: +94 77 7759918 >> WSO2, Inc.; http://wso2.com/ >> lean . enterprise . middlewear. >> > > > > -- > Sajini De SIlva > Software Engineer; WSO2 Inc.; http://wso2.com , > Email: [email protected] > Blog: http://sajinid.blogspot.com/ > Git hub profile: https://github.com/sajinidesilva > > > _______________________________________________ > 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
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
