Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MuleSoft mock com set payload

Alex teles
January 09, 2017

MuleSoft mock com set payload

MuleSoft mock com set payload

Alex teles

January 09, 2017
Tweet

More Decks by Alex teles

Other Decks in Education

Transcript

  1. Nosso transform espera receber uma lista de json com (Nome,

    Descricao e Valor) então preciso passa essa estrutura com valores para testar.
  2.  Estrutura json [ { "Nome":"pao", "Descricao":"pao de queijo", "Valor":"1"

    }, { "Nome":"queijo", "Descricao":"queijo coalho", "Valor":"2" } ]
  3. No Set Payload no quadro value você tem que preenche

    com o json semelhante com a esperada
  4.  <?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="[  {  &quot;Nome&quot;:&quot;pao&quot;,  &quot;Descricao&quot;:&quot;pao de queijo&quot;,  &quot;Valor&quot;:&quot;1&quot;  },
  5.  {  &quot;Nome&quot;:&quot;queijo&quot;,  &quot;Descricao&quot;:&quot;queijo coalho&quot;,  &quot;Valor&quot;:&quot;2&quot; 

    }  ]" 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>