Skip to content

Commit

Permalink
feat: add test case for #404
Browse files Browse the repository at this point in the history
  • Loading branch information
ssvaidyanathan committed Dec 7, 2023
1 parent cbec6a4 commit 8367444
Show file tree
Hide file tree
Showing 13 changed files with 1,991 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<APIProxy revision="1" name="BN001-xsd-resources">
<ConfigurationVersion minorVersion="0" majorVersion="4"/>
<CreatedAt>1489339923158</CreatedAt>
<CreatedBy>dino</CreatedBy>
<Description/>
<DisplayName>BN001-xsd-resources</DisplayName>
<LastModifiedAt>1489340418969</LastModifiedAt>
<LastModifiedBy>orgAdmin</LastModifiedBy>
<TargetEndpoints/>
</APIProxy>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<AssignMessage name='AM-CleanResponseHeaders'>
<Remove>
<Headers/>
</Remove>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<AssignMessage name="AM-InjectProxyVersionHeader">
<Set>
<Headers>
<Header name="apiproxy">{apiproxy.name} r{apiproxy.revision}</Header>
</Headers>
</Set>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<AssignMessage name='AM-Response-1'>

<AssignVariable>
<Name>t</Name>
<Template>{timeFormatUTCMs(propertyset.set1.timeformat,system.timestamp)}</Template>
</AssignVariable>

<AssignVariable>
<Name>d</Name>
<Template>{timeFormatUTCMs(propertyset.set1.dateformat,system.timestamp)}</Template>
</AssignVariable>

<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Set>
<Payload contentType='application/json'>{
"status" : "ok",
"time" : "{t}",
"date" : "{d}"
}</Payload>
<ReasonPhrase>OK</ReasonPhrase>
<StatusCode>200</StatusCode>
</Set>
<AssignTo>response</AssignTo>
</AssignMessage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Javascript name='JS-1' timeLimit='200' >
<Source>
function getProp(setname, shortpropname) {
try {
var name = 'propertyset.' + setname + '.' + shortpropname;
var c = String(context.getVariable(name));
return c;
}
catch (e) {
return String(e);
}
}
var keys = ['value1','value2','bailiwick','identifier']
keys.forEach(function(k) {getProp('set1',k);});
</Source>
</Javascript>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<MessageValidation name="MV-1">
<Source>message</Source>
<ResourceURL>xsd://ProduceService.xsd</ResourceURL>
</MessageValidation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<RaiseFault name='RF-UnknownRequest'>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<FaultResponse>
<Set>
<Payload contentType='application/json'>{
"error" : {
"code" : 404.01,
"message" : "that request was unknown; try a different request."
}
}
</Payload>
<StatusCode>404</StatusCode>
<ReasonPhrase>Not Found</ReasonPhrase>
</Set>
</FaultResponse>
</RaiseFault>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<ProxyEndpoint name="endpoint1">
<Description>Proxy Endpoint 1</Description>
<HTTPProxyConnection>
<BasePath>/BN001-propertiesset-demo1</BasePath>
<Properties/>
<VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>

<FaultRules/>
<DefaultFaultRule name="fault-rule">
<Step>
<Name>AM-InjectProxyVersionHeader</Name>
</Step>
<AlwaysEnforce>true</AlwaysEnforce>
</DefaultFaultRule>

<PreFlow name="PreFlow">
<Request>
<Step>
<Name>JS-1</Name>
</Step>
</Request>
<Response>
<Step>
<Name>AM-CleanResponseHeaders</Name>
</Step>
</Response>
</PreFlow>
<PostFlow name="PostFlow">
<Request>
</Request>
<Response>
<Step>
<Name>AM-InjectProxyVersionHeader</Name>
</Step>
</Response>
</PostFlow>
<PostClientFlow name="PostClientFlow">
<Request>
</Request>
<Response>
</Response>
</PostClientFlow>

<Flows>

<Flow name="flow1">
<Request>
<Step>
<Name>MV-1</Name>
</Step>
</Request>
<Response>
<Step>
<Name>AM-Response-1</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "POST")</Condition>
</Flow>

<Flow name="unknown request">
<Request>
<Step>
<Name>RF-UnknownRequest</Name>
</Step>
</Request>
<Response>
</Response>
</Flow>

</Flows>

<RouteRule name="NoRouteRule"/>

</ProxyEndpoint>
Empty file.
Loading

0 comments on commit 8367444

Please sign in to comment.