-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes issue with "undefined" proxies
- Loading branch information
1 parent
098da35
commit f6dc514
Showing
3 changed files
with
75 additions
and
5 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
20 changes: 20 additions & 0 deletions
20
test/fixtures/resources/newBundle/apiproxy/proxies/default.xml
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,20 @@ | ||
<ProxyEndpoint name="default"> | ||
<HTTPProxyConnection> | ||
<BasePath>/</BasePath> | ||
<Properties/> | ||
<VirtualHost>secure</VirtualHost> | ||
</HTTPProxyConnection> | ||
|
||
<PreFlow name="PreFlow"> | ||
<Request /> | ||
<Response /> | ||
</PreFlow> | ||
<PostFlow name="PostFlow"> | ||
<Request /> | ||
<Response /> | ||
</PostFlow> | ||
<RouteRule name="no-route"> | ||
<!-- this is ok --> | ||
</RouteRule> | ||
|
||
</ProxyEndpoint> |
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,42 @@ | ||
const assert = require("assert"), | ||
path = require("path"), | ||
Bundle = require("../../lib/package/Bundle.js"); | ||
|
||
describe("addMessage", function() { | ||
it("Should add a message for 'undefined' proxies", function() { | ||
const proxyPath = path.resolve(__dirname, '../fixtures/resources/newBundle/apiproxy'); | ||
const configuration = { | ||
debug: true, | ||
source: { | ||
type: "filesystem", | ||
path: proxyPath, | ||
bundleType: "apiproxy" | ||
}, | ||
profile: 'apigee', | ||
excluded: {}, | ||
setExitCode: false, | ||
output: () => {} // suppress output | ||
}; | ||
|
||
const message = "This is a test"; | ||
const plugin = { | ||
ruleId: "TR001", | ||
severity: 1, //warning | ||
nodeType: "Bundle" | ||
}; | ||
|
||
let bundle = new Bundle(configuration); | ||
bundle.addMessage({ | ||
plugin, | ||
message: message | ||
}); | ||
|
||
bundle.getReport(report => { | ||
let bundleResult = report.find(element => element.filePath === proxyPath); | ||
assert.notEqual(bundleResult, null); | ||
assert.equal(bundleResult.warningCount, 1); | ||
let m = bundleResult.messages.find(element => element.message === message); | ||
assert.equal(m.ruleId, plugin.ruleId); | ||
}); | ||
}); | ||
}); |