Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MuleSoft mock com set payload
Search
Alex teles
January 09, 2017
Education
0
37
MuleSoft mock com set payload
MuleSoft mock com set payload
Alex teles
January 09, 2017
Tweet
Share
More Decks by Alex teles
See All by Alex teles
Mulesoft configurando conexão com banco AS400 DB2
alexteles10
0
84
Chamando um flow de dentro do Transform Message
alexteles10
0
63
MuleSoft Juntando duas ou mais Listas ordenadas
alexteles10
0
60
MuleSoft Como mockar resultado com transform mensager
alexteles10
0
34
Como excluir o conector do facebook Do anyponit
alexteles10
0
62
Baixando conectores que não são nativos
alexteles10
0
53
Editor do Anypoint
alexteles10
0
38
MuleSoft Como fazer um when dentro de um when
alexteles10
0
38
MuleSoft Property configuração
alexteles10
0
50
Other Decks in Education
See All in Education
Слайды блока№1 к мини-курсу "Разговорные фразы" по "Минифразу Гуннемарка" арабского языка
jameela
0
210
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019538FNR)
signer
PRO
1
1.5k
ブラウザのフタを開けてHTTP体験しよう 20240608v1.0.0
fmlorg
0
130
Padlet opetuksessa
matleenalaakso
4
12k
week11_2024_.pdf
nonxxxizm
0
540
Amazon Connectを利用したCloudWatch Alarm電話通知
junghyeonjae
0
150
電子計算機のイロハ
kosugitti
1
1.5k
2024年度春学期 統計学 第8回 演習(1)問題に対する答案の書き方(講義前配付用) (2024. 5. 30)
akiraasano
PRO
0
120
Adobe Express
matleenalaakso
1
7.3k
construindo uma carreira com opensource
caarlos0
0
130
AWS認定試験 DEA受験記
nnydtmg
1
380
Epithelium Flashcards
ndevaul
0
840
Featured
See All Featured
Designing for humans not robots
tammielis
248
25k
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
Happy Clients
brianwarren
96
6.6k
Making Projects Easy
brettharned
113
5.8k
Faster Mobile Websites
deanohume
304
30k
The Cult of Friendly URLs
andyhume
76
5.9k
Music & Morning Musume
bryan
46
6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
47
2.8k
Testing 201, or: Great Expectations
jmmastey
35
6.9k
Robots, Beer and Maslow
schacon
PRO
157
8.1k
Six Lessons from altMBA
skipperchong
26
3.3k
Transcript
MuleSoft 2017
Hoje vamos falar de mock dados usando o Set
payload
Vamos criar um fluxo com da seguinte forma (Poll, set
Payload, Transform Message, log)
Mude a execução do Poll para minutos para não executa
a cada um segundo
Nosso transform espera receber uma lista de json com (Nome,
Descricao e Valor) então preciso passa essa estrutura com valores para testar.
Estrutura json [ { "Nome":"pao", "Descricao":"pao de queijo", "Valor":"1"
}, { "Nome":"queijo", "Descricao":"queijo coalho", "Valor":"2" } ]
No Set Payload no quadro value você tem que preenche
com o json semelhante com a esperada
Json setado no set payload e type MIME e Encoging
Rodando o projeto em modo Debug com break no Set
payload Payload vázio
Depois do set Payload o valor do set payload foi
atribuído ao payload
Resultado depois do transform uma lista conforme a saída setado
no transform
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring- beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> <flow name="mock-set-payloadFlow"> <poll doc:name="Poll"> <fixed-frequency-scheduler frequency="1000" timeUnit="MINUTES"/> <logger message="====Start=====" level="INFO" doc:name="Logger"/> </poll> <set-payload value="[ { "Nome":"pao", "Descricao":"pao de queijo", "Valor":"1" },
{ "Nome":"queijo", "Descricao":"queijo coalho", "Valor":"2"
} ]" encoding="UTF-8" mimeType="application/json" doc:name="Set Payload"/> <dw:transform-message metadata:id="a1c6eb81-1b6a-4655-b17f-2ee3d5afb0e0" doc:name="Transform Message"> <dw:input-payload doc:sample="input.json" mimeType="application/json"/> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- payload map ((payload01 , indexOfPayload01) -> { name: payload01.Nome, description: payload01.Descricao, value: payload01.Valor })]]></dw:set-payload> </dw:transform-message> <logger message="=====resultado======#[message.payloadAs(java.lang.String)]" level="INFO" doc:name="Logger"/> </flow> </mule>
FIM