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
55
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
100
Chamando um flow de dentro do Transform Message
alexteles10
0
78
MuleSoft Juntando duas ou mais Listas ordenadas
alexteles10
0
73
MuleSoft Como mockar resultado com transform mensager
alexteles10
0
46
Como excluir o conector do facebook Do anyponit
alexteles10
0
71
Baixando conectores que não são nativos
alexteles10
0
61
Editor do Anypoint
alexteles10
0
46
MuleSoft Como fazer um when dentro de um when
alexteles10
0
60
MuleSoft Property configuração
alexteles10
0
61
Other Decks in Education
See All in Education
Adobe Express
matleenalaakso
2
8.2k
0203
cbtlibrary
0
140
Use Cases and Course Review - Lecture 8 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.4k
Information Architectures - Lecture 2 - Next Generation User Interfaces (4018166FNR)
signer
PRO
1
1.9k
バージョン管理とは / 01-a-vcs
kaityo256
PRO
1
200
HCI Research Methods - Lecture 7 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.4k
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
signer
PRO
1
2.9k
The Next Big Step Toward Nuclear Disarmament
hide2kano
0
290
Introduction - Lecture 1 - Next Generation User Interfaces (4018166FNR)
signer
PRO
2
4.5k
1202
cbtlibrary
0
220
Railsチュートリアル × 反転学習の事例紹介
yasslab
PRO
3
170k
Web Search and SEO - Lecture 10 - Web Technologies (1019888BNR)
signer
PRO
2
3.1k
Featured
See All Featured
Docker and Python
trallard
47
3.8k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Six Lessons from altMBA
skipperchong
29
4.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
Google's AI Overviews - The New Search
badams
0
930
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
240
The Curious Case for Waylosing
cassininazir
0
270
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