Skip to content

Commit a056f15

Browse files
committed
[javascript, tests, #962] Adjust tests to updated error handling
1 parent 64aab34 commit a056f15

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

examples/client-javascript-test-app/src/main/webapp/scripts/test/jolokia-simple-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
$(document).ready(function () {
1818

19-
let j4p = new Jolokia("/jolokia");
19+
let j4p = new Jolokia({ url: "/jolokia", ignoreErrors: true });
2020

2121
QUnit.module("Simplified requests");
2222

@@ -178,8 +178,8 @@ $(document).ready(function () {
178178
QUnit.test("search (sync with error)", async assert => {
179179
const done = assert.async();
180180
let value = await j4p.search("jolokia.it:type=*=a*", {
181-
error: function (resp) {
182-
assert.ok(resp.error != null, "Error occured");
181+
fetchError: function (resp) {
182+
assert.equal(resp.status, 400, "Error occurred");
183183
done();
184184
}, success: log
185185
});
@@ -236,7 +236,7 @@ $(document).ready(function () {
236236
const done = assert.async();
237237
let value = await j4p.list("java.lang/type=Bla", {
238238
error: function (resp) {
239-
assert.equal(resp.error_type, "java.lang.IllegalArgumentException", "java.lang.IllegalArgumentException");
239+
assert.equal(resp.error_type, "javax.management.InstanceNotFoundException", "javax.management.InstanceNotFoundException");
240240
done();
241241
}
242242
});

examples/client-javascript-test-app/src/main/webapp/scripts/test/jolokia-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
$(document).ready(function () {
1818

19-
let j4p = new Jolokia("/jolokia");
19+
let j4p = new Jolokia({ url: "/jolokia", ignoreErrors: true });
2020

2121
// Single requests
2222
const configs = [
@@ -205,7 +205,7 @@ $(document).ready(function () {
205205
j4p.request(
206206
[
207207
{ type: "version" },
208-
{ type: "exec", mbean: "Blub:type=Bla" },
208+
{ type: "exec", mbean: "Blub:type=Bla", operation: "any" },
209209
{ type: "read", mbean: "java.lang:type=Runtime", attribute: "Name" }
210210
],
211211
{
@@ -247,8 +247,10 @@ $(document).ready(function () {
247247
});
248248
QUnit.test("Simple request with Jolokia Error", async assert => {
249249
const done = assert.async();
250-
let resp = await j4p.request({ type: "READ", mbean: "bla" });
251-
assert.equal(resp["error_type"], "java.lang.IllegalArgumentException", "Illegal Argument");
250+
let resp = await j4p.request({ type: "READ", mbean: "bla" }).catch(e => {
251+
assert.equal(e.status, 400)
252+
return null
253+
});
252254
done()
253255
});
254256
QUnit.test("Simple request with HTTP Error", async assert => {

0 commit comments

Comments
 (0)