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
40
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
86
Chamando um flow de dentro do Transform Message
alexteles10
0
68
MuleSoft Juntando duas ou mais Listas ordenadas
alexteles10
0
63
MuleSoft Como mockar resultado com transform mensager
alexteles10
0
35
Como excluir o conector do facebook Do anyponit
alexteles10
0
64
Baixando conectores que não são nativos
alexteles10
0
56
Editor do Anypoint
alexteles10
0
39
MuleSoft Como fazer um when dentro de um when
alexteles10
0
40
MuleSoft Property configuração
alexteles10
0
54
Other Decks in Education
See All in Education
Adobe Analytics入門講座【株式会社ニジボックス】
nbkouhou
0
23k
The Task is not the End: The Role of Task Repetition and Sequencing In Language Teaching
uranoken
0
210
Образцы вооружения и техники ВС РФ
obzr
0
110
情報処理工学問題集 /infoeng_practices
kfujita
0
150
Flinga
matleenalaakso
2
13k
1113
cbtlibrary
0
270
アニメに学ぶチームの多様性とコンピテンシー
terahide
0
280
Ch2_-_Partie_1.pdf
bernhardsvt
0
120
Nodiレクチャー 「CGと数学」講義資料 2024/11/19
masatatsu
1
250
Kindleストアで本を探すことの善悪 #Izumo Developers' Guild 第1回 LT大会
totodo713
0
150
Chapitre_1_-__L_atmosphère_et_la_vie_-_Partie_1.pdf
bernhardsvt
0
230
勉強する必要ある?
mineo_matsuya
2
2.3k
Featured
See All Featured
Fireside Chat
paigeccino
34
3.1k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
How GitHub (no longer) Works
holman
311
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Why Our Code Smells
bkeepers
PRO
335
57k
Automating Front-end Workflow
addyosmani
1366
200k
Faster Mobile Websites
deanohume
305
30k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Docker and Python
trallard
41
3.1k
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