How to access attributes including headers, queryparams in Munit set Event processor. I am using Anypoint Studio 7.5 - mule4

How to access attributes including headers, queryparams in Munit set Event processor. I am using Anypoint Studio 7.5
I have tried with <munit:attributes value="#[{headers : {'token' :'value1'}}]" encoding="UTF-16" /> but it didn't worked.
<sub-flow name="setUserAndPass">
<choice doc:name="Choice" >
<when expression='attributes."headers"."authorization" != null'>
<ee:transform doc:name="Transform Message" >
<ee:message >
</ee:message>
<ee:variables >
<ee:set-variable variableName="userAndPass" ><![CDATA[%dw 2.0
import * from dw::core::Binaries
output text/json
var auth = attributes."headers"."authorization"
---
(fromBase64((auth splitBy(" "))[1] as Binary)) splitBy(":")]]></ee:set-variable>
</ee:variables>
</ee:transform>
<set-variable value='#[vars.userAndPass[0]]' doc:name="Set lvUSERNAME Variable" variableName="lvUSERNAME"/>
<set-variable value='#[vars.userAndPass[1]]' doc:name="Set lvPASSWORD variable" variableName="lvPASSWORD "/>
</when>
<otherwise >
<set-variable value='#[attributes."headers"."username"]' doc:name="Set lvUSERNAME Variable" variableName="lvUSERNAME" />
<set-variable value='#[attributes."headers"."password"]' doc:name="Set lvPASSWORD Variable" variableName="lvPASSWORD" />
</otherwise>
</choice>
</sub-flow>
Munit Flow:
<munit:test name="appname-test-suite-setUserAndPassTest" description="Test">
<munit:behavior >
<munit:set-event doc:name="Set Event">
<munit:attributes value="#[
{
headers : {'authorization': 'authvalue'}
}]" />
</munit:set-event>
</munit:behavior>
<munit:execution >
<flow-ref doc:name="Flow-ref to setUserAndPass" name="setUserAndPass"/>
</munit:execution>
<munit:validation >
<munit-tools:assert-equals doc:name="Assert equals" actual="#[vars.lvUSERNAME]" expected="usernamevalue"/>
</munit:validation>
</munit:test>

It should like this:
<munit:set-event doc:name="Set Event">
<munit:payload value="#['..']" encoding="UTF-16" />
<munit:attributes value="#[
{
headers : {'token': 'value1'},
queryParams : {'queryParam1': 'value2'}
}]" encoding="UTF-16" />
</munit:set-event>

Related

WSO2 : Transforming response xml

I would like to turn this xml response into something more easily readable.
<?xml version="1.0" encoding="ISO-8859-1"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<executeResponse xmlns="urn:GCE">
<BusinessViewServiceexecuteOut xmlns="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" xmlns:ns2="http://www.generixgroup.com/processus/configuration/scheduler" xmlns:ns3="http://www.generix.fr/technicalframework/business/service/common">
<xmlpres><?xml version = '1.0' encoding = 'UTF-8'?> <VueTable type="View" name="Table" habctr="true" total_business_row="2" nbline="400" confNbline="400" numpage="1" nbpage="1">
<JTblView name="JTblView" type="ViewObject" maxfetchsize="999" maxfetchsizeexceeded="false">
<JTblViewRow current="true" type="ViewRow" index="1" business_row_index="1">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>N</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Non</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Non</business_data>
</Lir>
</JTblViewRow>
<JTblViewRow type="ViewRow" index="2" business_row_index="2">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>O</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Oui</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Oui</business_data>
</Lir>
</JTblViewRow>
</JTblView>
</VueTable></xmlpres>
</BusinessViewServiceexecuteOut>
</executeResponse>
</soap:Body></soap:Envelope>
At least if I could extract what's in the value of "xmlpres", the better I could do:
<table><row><code></code><libelle></libelle/></row></table>
To then turn it into a json response but I can't see ... I just get all the output or in json stream but with everything , which is not usable.
Create an out-mediation sequence with the following content and attach it to the respective API and try out the scenario. This is to extract the xmlpres content and send that as the response to the client
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="out-sequence">
<!-- extract the xmlpres content and store as OM element -->
<property name="XMLBody"
expression="$body//soap:Body//generic:xmlpres"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gce="urn:GCE"
xmlns:generic="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" type="OM" />
<!-- pass the extracted property as response body -->
<enrich>
<source type="property" property="XMLBody" />
<target type="body" />
</enrich>
</sequence>
Hope this helps you to extract and send the response accordingly.

Can we create Munit for on Error propagate in mule 4?

Does on Error Propagate Munit should fail or pass?
Scenario:
When I get db connectivity error, it triggers email with error notification. Flow reference to Error email flow. Flow reference is placed in On Error Propagate.
I have mocked database with Error, DB CONNECTIVITY in error tab and wrap flow Ref in Try block. My tests are failing.
Test suite should fail with error message or pass with green colour in Munit tests?
<munit:test name="implementation-suiteTest" doc:id="804123309-0b27-4e5a-beb3-5372b91eafc3" expectedErrorType="DB:QUERY_EXECUTION">
<munit:behavior >
<munit:set-event doc:name="Set Event" doc:id="5d0290f4-9855-42ba-b434-a4322457819c">
<munit:payload value="#[output application/java --- readUrl('classpath://insertdatabaseFlowtest\mock_payload.dwl')]" />
</munit:set-event>
<munit-tools:mock-when doc:name="Mock " doc:id="d8493233-303b-4765-89b4-9ae19bdffa1f" processor="db:bulk-insert">
<munit-tools:with-attributes>
<munit-tools:with-attribute whereValue="b645fb60-7b08-4939-894d-a476ee58b325" attributeName="doc:id" />
</munit-tools:with-attributes>
<munit-tools:then-return >
<munit-tools:payload value="#[output application/java --- readUrl('classpath://insertdatatodatabaseFlowtest\mock_payload1.dwl')]" />
<munit-tools:error typeId="DB CONNECTIVITY" />
</munit-tools:then-return>
</munit-tools:mock-when>
<munit-tools:mock-when doc:name="Send Email" doc:id="c9cb74e7-9b56-4634-a272-d954d4ab8fb2" processor="email:send">
<munit-tools:with-attributes >
<munit-tools:with-attribute whereValue="3f8bda1c-2e22-43d8-8e0a-3da9a6653dd7" attributeName="doc:id" />
</munit-tools:with-attributes>
<munit-tools:then-return >
<munit-tools:payload value="#[output application/java --- readUrl('classpath://insertdatatodatabaseFlowtest\mock_payload2.dwl')]" />
</munit-tools:then-return>
</munit-tools:mock-when>
</munit:behavior>
<munit:execution>
<try doc:name="Try" doc:id="e73eae0a-25fb-46bb-b0e9-e845bb7310e0" >
<flow-ref doc:name="Flow-ref " doc:id="8582675c-3203-4f70-8988-370e82cd5249" name="insert-dataFlow" />
<error-handler >
<on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="7999aa4b-4959-4c64-98c4-284f883c5778" >
<logger level="INFO" doc:name="Logger" doc:id="6018dc63-a176-41aa-9ca3-be39264c9e0f" />
</on-error-continue>
</error-handler>
</try>
</munit:execution>
<munit:validation>
<munit-tools:assert-that doc:name="Assert that" doc:id="6b255b30-e43a-4001-a62d-e6374a9d16f0" expression="#[payload]" is="#[MunitTools::containsString('Error Email Sent')]"/>
</munit:validation>
</munit:test>
Thanks

Sabre PassengerDetailsRQ not return the ID attribute in ItineraryRef

I am trying to book an air segment using EnhancedAirBookRQ and PassengerDetailsRQ using development endpoint.
But in the response I did not get the ID it just sending the information like
<ItineraryRef AirExtras="false" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
but i should return like <ItineraryRef AirExtras="false" ID="DJEJWQ" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
Is there any reason for this? bellow is my request XML code.
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_4" version="3.4.0">
<PostProcessing >
<RedisplayReservation waitInterval="1000"/>
</PostProcessing>
<PreProcessing />
<SpecialReqDetails>
<SpecialServiceRQ>
<SpecialServiceInfo>
<AdvancePassenger SegmentNumber="A">
<Document ExpirationDate="2018-05-26" Number="1234567890" Type="P">
<IssueCountry>FR</IssueCountry>
<NationalityCountry>FR</NationalityCountry>
</Document>
<PersonName DateOfBirth="1980-12-02" Gender="M" NameNumber="1.1">
<GivenName>JAMES</GivenName>
<MiddleName>MALCOLM</MiddleName>
<Surname>GREEN</Surname>
</PersonName>
</AdvancePassenger>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ>
<AgencyInfo>
<Address>
<AddressLine>SABRE TRAVEL</AddressLine>
<CityName>SOUTHLAKE</CityName>
<CountryCode>US</CountryCode>
<PostalCode>76092</PostalCode>
<StateCountyProv StateCode="TX"/>
<StreetNmbr>3150 SABRE DRIVE</StreetNmbr>
<VendorPrefs>
<Airline Hosted="true"/>
</VendorPrefs>
</Address>
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="817-555-1212" PhoneUseType="H"/>
</ContactNumbers>
<PersonName NameNumber="1.1" NameReference="ABC123" PassengerType="ADT">
<GivenName>MALCOLM</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
Thanks

How to config bigbluebutton to work with external Red5 server

From high level architecture overview for bigbluebutton http://docs.bigbluebutton.org/overview/architecture.html I understand that red5 server communicates with client using rtmp or by tunning rtmp via nginx. And then red5 server communicate with FreeSwitch using redis (with fsesl-akka). It mean we are able to desploy red5 in separately server. The result should be 3 servers:
Server for nginx/tomcat7 to run client, bbb-web
Server for Red5 + redis which handle rtmp for module videoconf/sharing/call/audio
Server for Freeswitch
Currently, I am able to config module to use rtmp from separately Red5 server by changing client/conf/config.xml
<config>
<localeversion suppressWarning="false">0.9.0</localeversion>
<version>VERSION</version>
<help url="http://10.0.121.16/help.html"/>
<javaTest url="http://10.0.121.16/testjava.html"/>
<porttest host="10.0.121.16" application="video/portTest" timeout="10000"/>
<bwMon server="10.0.121.16" application="video/bwTest"/>
<application uri="rtmp://10.0.121.16/bigbluebutton" host="http://10.0.121.16/bigbluebutton/api/enter"/>
<language userSelectionEnabled="true" />
<skinning enabled="true" url="http://10.0.121.16/client/branding/css/BBBDefault.css.swf" />
<shortcutKeys showButton="true" />
<browserVersions chrome="CHROME_VERSION" firefox="FIREFOX_VERSION" flash="FLASH_VERSION" java="1.7.0_51" />
<layout showLogButton="false" defaultLayout="bbb.layout.name.defaultlayout"
showToolbar="true" showFooter="true" showMeetingName="true" showHelpButton="true"
showLogoutWindow="true" showLayoutTools="true" confirmLogout="true"
showRecordingNotification="true"/>
<meeting muteOnStart="false" />
<logging enabled="true" target="trace" level="info" format="{dateUTC} {time} :: {name} :: [{logLevel}] {message}" uri="http://10.0.121.16"/>
<lock disableCamForLockedUsers="false" disableMicForLockedUsers="false" disablePrivateChatForLockedUsers="false"
disablePublicChatForLockedUsers="false" lockLayoutForLockedUsers="false" lockOnJoin="true" lockOnJoinConfigurable="false"/>
<modules>
<module name="ChatModule" url="http://10.0.121.16/client/ChatModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="UsersModule"
privateEnabled="true"
fontSize="12"
position="top-right"
baseTabIndex="701"
colorPickerIsVisible="false"
maxMessageLength="1024"
/>
<module name="UsersModule" url="http://10.0.121.16/client/UsersModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
allowKickUser="true"
enableEmojiStatus="true"
enableSettingsButton="true"
baseTabIndex="301"
/>
<module name="DeskShareModule"
url="http://10.0.121.16/client/DeskShareModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/deskShare"
publishURI="10.0.121.16"
useTLS="false"
showButton="true"
autoStart="false"
autoFullScreen="false"
baseTabIndex="201"
/>
<module name="PhoneModule" url="http://10.0.121.16/client/PhoneModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/sip"
autoJoin="true"
listenOnlyMode="true"
presenterShareOnly="false"
skipCheck="false"
showButton="true"
enabledEchoCancel="true"
useWebRTCIfAvailable="true"
showPhoneOption="false"
echoTestApp="9196"
dependsOn="UsersModule"
/>
<module name="VideoconfModule" url="http://10.0.121.16/client/VideoconfModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/video"
dependson = "UsersModule"
baseTabIndex="401"
presenterShareOnly = "false"
controlsForPresenter = "false"
autoStart = "false"
skipCamSettingsCheck="false"
showButton = "true"
showCloseButton = "true"
publishWindowVisible = "true"
viewerWindowMaxed = "false"
viewerWindowLocation = "top"
smoothVideo="false"
applyConvolutionFilter="false"
convolutionFilter="-1, 0, -1, 0, 6, 0, -1, 0, -1"
filterBias="0"
filterDivisor="4"
displayAvatar = "false"
focusTalking = "false"
glowColor = "0x4A931D"
glowBlurSize = "30.0"
priorityRatio = "0.67"
/>
<module name="WhiteboardModule" url="http://10.0.121.16/client/WhiteboardModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
baseTabIndex="601"
whiteboardAccess="presenter"
keepToolbarVisible="false"
/>
<module name="PollingModule" url="http://10.0.121.16/client/PollingModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
/>
<module name="PresentModule" url="http://10.0.121.16/client/PresentModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
host="http://10.0.121.16"
showPresentWindow="true"
showWindowControls="true"
openExternalFileUploadDialog="false"
dependsOn="UsersModule"
baseTabIndex="501"
maxFileSize="30"
/>
<module name="LayoutModule" url="http://10.0.121.16/client/LayoutModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
layoutConfig="http://10.0.121.16/client/conf/layout.xml"
enableEdit="false"
/>
</modules>
</config>
Where 10.0.121.14 - run Red5 + redis. 10.0.121.16 run nginx + tomcat7. Any document/help/suggestion from expert for solve this issue?
Seperate Red5 servers can distribute video and deskshare modules, just need to get the archiving scripts to pull the .flv files from stream directory when processing. I would leave the basic red5 on bbb server to handle the rest of messaging with local redis store.
If you want to not have red5 on server all together, then you would need to enable the red5 server to have access to connect to redis. Be careful. downt think and password is set, so you dont want to expose this on public interface without using correct iptable rules.
regards,
Stephen
hostbbb.com

XML Parsing error in Flex

I am passing a XML document form the Java to Flex using Remote Object.
My XML is as follows
"
<root
<dept ID="1" Name="RND"
<Emp ID="1" Name="Aj"/>
</dept>
<dept ID="2" Name="ENG">
<Emp ID="1" Name="Aj"/>
</dept>
<dept ID="3" Name="MECH">
<Emp ID="1" Name="Aj"/>
</dept>
</root>
"
In Flex i am trying to access using below code
treeData = event.result as XML;
deptTree.dataProvider = treeData;
When i am trying to access the result object and i am getting the below exception
"
[RPC Fault faultString="org.w3c.dom.DOMException : INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. " faultCode="Server.Processing" faultDetail="null"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault()
at NetConnectionMessageResponder/statusHandler()
at mx.messaging::MessageResponder/status()
"
Please help me to resolve this issue.
Thanks in advance.
Aj
<root
<dept ID="1" Name="RND"
Close root tag:
<root>

Resources