Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
[#26] 'argument' in request property in ExecResult schema should be o…
Browse files Browse the repository at this point in the history
…ptional
  • Loading branch information
howardgao authored and gaohoward committed Nov 6, 2024
1 parent 8a32fd2 commit 646ea16
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/config/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,6 @@ components:
type: object
required:
- mbean
- arguments
- type
- operation
properties:
Expand Down
60 changes: 60 additions & 0 deletions src/utils/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,66 @@ describe('test api server apis', () => {
expect(JSON.stringify(value)).toEqual(JSON.stringify(jolokiaResp));
});

[
{
request: {
mbean:
'org.apache.activemq.artemis:broker="amq-broker",component=cluster-connections,name="my-cluster"',
type: 'exec',
operation: 'start()',
},
value: null,
timestamp: 1730878513,
status: 200,
},
];

it('test exec operation with no args', async () => {
const jolokiaResp = [
{
request: {
mbean:
'org.apache.activemq.artemis:broker="amq-broker",component=cluster-connections,name="my-cluster"',
type: 'exec',
operation: 'start()',
},
value: null,
timestamp: 1730878513,
status: 200,
},
];

mockJolokia
.post(apiUrlPrefix + '/', (body) => {
if (
body.length === 1 &&
body[0].type === 'exec' &&
body[0].mbean ===
'org.apache.activemq.artemis:broker="amq-broker",component=cluster-connections,name="my-cluster"' &&
body[0].operation === 'start()'
) {
return true;
}
return false;
})
.reply(200, JSON.stringify(jolokiaResp));

const resp = await doPost(
'/execClusterConnectionOperation?name=my-cluster',
JSON.stringify({
signature: {
name: 'start',
args: [],
},
}),
authToken,
);
expect(resp.ok).toBeTruthy();

const value = await resp.json();
expect(JSON.stringify(value)).toEqual(JSON.stringify(jolokiaResp));
});

it('test brokerComponents', async () => {
const result = [
'org.apache.activemq.artemis:address="ExpiryQueue",broker="amq-broker",component=addresses,queue="ExpiryQueue",routing-type="anycast",subcomponent=queues',
Expand Down

0 comments on commit 646ea16

Please sign in to comment.