Hi all, > My issue is that I could not find a way to include the special characters > into the XML element name as follows; > <$SYSTEM:SOAP_SERVICE_TEST>value</$SYSTEM:SOAP_SERVICE_TEST> > I'd made an oversight and confused the dollar notation [that's supposed to be] included in the configuration file with how environment variables are saved in the system. Therefore, there's no need to include special characters in the XML element. It's just <SOAP_SERVICE_TEST>value<SOAP_SERVICE_TEST>
Thanks and regards On Sun, Feb 13, 2022 at 12:14 AM Nuwan Jayawardene <nsga...@gmail.com> wrote: > Hi all, > After trying different external libraries [1 > <https://github.com/stefanbirkner/system-rules#:~:text=System%20Rules%20is%20a%20collection,the%20possibilities%20of%20Java%208.> > ][2 <https://github.com/stefanbirkner/system-lambda>] and Junit > extensions [3 <https://junit-pioneer.org/>] to varying degrees of > success, I eventually settled on using the <environmentVariables> > configuration in the pom.xml as suggested in Nadeeshan's response. > The environment variable I'm passing is* $SYSTEM:SOAP_SERVICE_TEST*, and > as you might notice, includes special characters, specifically the *$* > and *:*. > > My issue is that I could not find a way to include the special characters > into the XML element name as follows; > <$SYSTEM:SOAP_SERVICE_TEST>value</$SYSTEM:SOAP_SERVICE_TEST> > > Would appreciate some thoughts on how to resolve this. > Kind regards > > > > On Sun, Sep 12, 2021 at 2:57 PM Nadeeshaan Gunasinghe < > nadeeshaangunasin...@gmail.com> wrote: > >> Hi Nuwan, >> >> If you are looking for a way for setting the environment variables for >> the tests (please correct me if I haven't understood correctly), you can >> set it up in your maven configurations. If that's what you are looking for, >> please try [1]. >> >> [1] >> https://stackoverflow.com/questions/11078863/how-to-set-env-variables-for-maven-to-run-test-correctly >> >> Cheers, >> >> *Nadeeshaan Gunasinghe* >> Technical Lead, WSO2 Inc. http://wso2.com >> +94770596754 | nadeesh...@wso2.com | Skype: nadeeshaan.gunasinghe >> <https://mail.google.com/mail/u/1/#> >> <http://www.facebook.com/nadeeshaan.gunasinghe> >> <http://lk.linkedin.com/in/nadeeshaan> <http://twitter.com/Nadeeshaan> >> <http://nadeeshaan.blogspot.com/> >> >> >> On Sun, Sep 12, 2021 at 2:45 PM Nuwan Jayawardene <nsga...@gmail.com> >> wrote: >> >>> Hi all, >>> I've been working on writing unit tests for a feature that extracts a >>> prefixed variable from a synapse.xml config during runtime and populates it >>> with a preset environment variable. It's similar in functionality to what's >>> mentioned here: >>> https://docs.wso2.com/display/EI660/Injecting+Parameters+as+Environment+Variables >>> . >>> >>> I'm reaching out to verify if there's a way to set environment variables >>> in-memory with Java so that it is picked up when the unit test is being run. >>> I found an answer here: https://stackoverflow.com/a/7201825/7838048, >>> however unfortunately it doesn't seem to work as it retrieves a null value >>> when the code is debugged. >>> >>> Would appreciate some thoughts on this. >>> Kind regards >>> -- >>> *Nuwan Jayawardene* >>> Assistant Lecturer, Informatics Institute of Technology (IIT). >>> Research Assistant, University of Moratuwa >>> >>> https://www.linkedin.com/m/in/nuwanjaya >>> >>> >>> > > -- > *Nuwan Jayawardene* > Assistant Lecturer, Informatics Institute of Technology (IIT). > Research Assistant, University of Moratuwa > > https://www.linkedin.com/m/in/nuwanjaya > > -- *Nuwan Jayawardene* Assistant Lecturer, Informatics Institute of Technology (IIT). Research Assistant, University of Moratuwa https://www.linkedin.com/m/in/nuwanjaya