-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
b64563b
commit 06d27f3
Showing
4 changed files
with
225 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
digraph "mule" { | ||
edge ["dir"="forward"] | ||
graph ["rankdir"="LR","splines"="spline","pad"="1.0,0.5","dpi"="150","label"=<Test Diagram<br/>>,"labelloc"="t"] | ||
edge ["arrowhead"="vee","dir"="forward"] | ||
subgraph "cluster_legend" { | ||
edge ["dir"="forward"] | ||
graph ["label"=<<b>Legend</b>>,"style"="dashed"] | ||
"flow" ["fixedsize"="true","width"="1.0","height"="0.25","shape"="rectangle","color"="blue"] | ||
"sub-flow" ["fixedsize"="true","width"="1.0","height"="0.25","color"="black","shape"="ellipse"] | ||
"connector:operation" ["shape"="component"] | ||
"Unused sub/-flow" ["fixedsize"="true","width"="2.0","height"="0.25","color"="gray","style"="filled"] | ||
"Flow A" ["fixedsize"="true","width"="1.0","height"="0.25"] | ||
"sub-flow-1" ["fixedsize"="true","width"="1.25","height"="0.25"] | ||
"Flow C" ["fixedsize"="true","width"="1.0","height"="0.25"] | ||
"sub-flow-C1" ["fixedsize"="true","width"="1.25","height"="0.25"] | ||
"flow source" ["fixedsize"="true","width"="1.5","height"="0.25","shape"="hexagon","style"="filled","color"="cyan","sourceNode"="true"] | ||
"flow self-call" ["fixedsize"="true","width"="1.25","height"="0.25","shape"="rectangle","color"="blue"] | ||
"sub-flow self-call" ["fixedsize"="true","width"="2.0","height"="0.25","color"="black","shape"="ellipse"] | ||
"flow" -> "sub-flow" ["style"="invis"] | ||
"sub-flow" -> "Unused sub/-flow" ["style"="invis"] | ||
"Flow A" -> "sub-flow-1" ["style"="solid","label"="(1)","taillabel"="Call Sequence\n","labelangle"="-5.0","labeldistance"="8.0"] | ||
"Flow C" -> "sub-flow-C1" ["style"="dashed,bold","xlabel"="(1) Async","color"="lightblue3","taillabel"="Asynchronous call\n","labelangle"="-5.0","labeldistance"="8.0"] | ||
"flow source" -> "flow self-call" ["style"="invis"] | ||
"flow self-call" -> "flow self-call" | ||
"flow self-call" -> "sub-flow self-call" ["style"="invis"] | ||
"sub-flow self-call" -> "sub-flow self-call" | ||
} | ||
subgraph "cluster_legend-space" { | ||
edge ["dir"="none"] | ||
graph ["label"="","style"="invis"] | ||
"" ["shape"="none","width"="2.0","height"="1.0"] | ||
} | ||
subgraph "cluster_mule" { | ||
edge ["dir"="forward"] | ||
graph ["rankdir"="LR","splines"="spline","pad"="1.0,0.5","dpi"="150","label"=<Application graph<br/>>,"labelloc"="t","style"="invis"] | ||
edge ["arrowhead"="vee","dir"="forward"] | ||
"http:listener" ["shape"="hexagon","style"="filled","color"="cyan","sourceNode"="true","label"=<<b>http: listener</b><br/>/api/*<br/>>] | ||
"flow:test-api-main" ["label"=<<b>flow</b>: test-api-main>,"shape"="rectangle","color"="blue"] | ||
"apikittest-api-config" ["shape"="doublecircle","color"="cyan","style"="filled","label"=<<b>apikit</b><br/>test-api-config<br/>>] | ||
"flow:put:\users\(userId):test-api-config" ["label"=<<b>flow</b>: put:\users\(userId):test-api-config>,"shape"="rectangle","color"="blue"] | ||
"flow:get:\users:test-api-config" ["label"=<<b>flow</b>: get:\users:test-api-config>,"shape"="rectangle","color"="blue"] | ||
"sub-flow:test-sub-flow" ["label"=<<b>sub-flow</b>: test-sub-flow>,"color"="black","shape"="ellipse"] | ||
"http:listener" -> "flow:test-api-main" ["style"="bold"] | ||
"flow:test-api-main" -> "apikittest-api-config" ["style"="solid","label"="(1)"] | ||
"apikittest-api-config" -> "flow:put:\users\(userId):test-api-config" ["style"="solid"] | ||
"apikittest-api-config" -> "flow:get:\users:test-api-config" ["style"="solid"] | ||
"flow:get:\users:test-api-config" -> "sub-flow:test-sub-flow" ["style"="solid","label"="(1)"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd "> | ||
<http:listener-config name="test-api-httpListenerConfig"> | ||
<http:listener-connection host="0.0.0.0" port="8081" /> | ||
</http:listener-config> | ||
<apikit:config name="test-api-config" api="test-api.raml" outboundHeadersMapName="outboundHeaders" httpStatusVarName="httpStatus" /> | ||
<flow name="test-api-main"> | ||
<http:listener config-ref="test-api-httpListenerConfig" path="/api/*"> | ||
<http:response statusCode="#[vars.httpStatus default 200]"> | ||
<http:headers>#[vars.outboundHeaders default {}]</http:headers> | ||
</http:response> | ||
<http:error-response statusCode="#[vars.httpStatus default 500]"> | ||
<http:body>#[payload]</http:body> | ||
<http:headers>#[vars.outboundHeaders default {}]</http:headers> | ||
</http:error-response> | ||
</http:listener> | ||
<apikit:router config-ref="test-api-config" /> | ||
<error-handler> | ||
<on-error-propagate type="APIKIT:BAD_REQUEST"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Bad request"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">400</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
<on-error-propagate type="APIKIT:NOT_FOUND"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Resource not found"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">404</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
<on-error-propagate type="APIKIT:METHOD_NOT_ALLOWED"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Method not allowed"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">405</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
<on-error-propagate type="APIKIT:NOT_ACCEPTABLE"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Not acceptable"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">406</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
<on-error-propagate type="APIKIT:UNSUPPORTED_MEDIA_TYPE"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Unsupported media type"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">415</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
<on-error-propagate type="APIKIT:NOT_IMPLEMENTED"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> | ||
<ee:message> | ||
<ee:set-payload><![CDATA[%dw 2.0 | ||
output application/json | ||
--- | ||
{message: "Not Implemented"}]]></ee:set-payload> | ||
</ee:message> | ||
<ee:variables> | ||
<ee:set-variable variableName="httpStatus">501</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
</on-error-propagate> | ||
</error-handler> | ||
</flow> | ||
<flow name="put:\users\(userId):test-api-config"> | ||
<ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"> | ||
<ee:variables> | ||
<ee:set-variable variableName="userId">attributes.uriParams.'userId'</ee:set-variable> | ||
</ee:variables> | ||
</ee:transform> | ||
<logger level="INFO" message="put:\users\(userId):test-api-config" /> | ||
<!-- This does not reference any other flow --> | ||
</flow> | ||
<flow name="get:\users:test-api-config"> | ||
<logger level="INFO" message="get:\users:test-api-config" /> | ||
<flow-ref name="test-sub-flow"/> | ||
</flow> | ||
<sub-flow name="test-sub-flow"> | ||
<logger level="INFO" message="test-sub-flow" /> | ||
</sub-flow> | ||
</mule> |