Skip to content

Commit 3c7a8ba

Browse files
committed
add tsqueue and shared tsqueue to cics tree
Signed-off-by: Andrew Twydell <[email protected]>
1 parent cca2a76 commit 3c7a8ba

15 files changed

+398
-6
lines changed

packages/vsce/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to the "cics-extension-for-zowe" extension will be documented in this file.
44

5+
## Recent Changes
6+
7+
- Enhancement: Added TS Queues tree containing TS and Shared TS Queues. [#415](https://github.com/zowe/cics-for-zowe-client/issues/415)
8+
59
## `3.14.0`
610

711
- Bugfix: Show icons in CICS Resource Inspector on Windows [#460](https://github.com/zowe/cics-for-zowe-client/issues/460)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*
10+
*/
11+
12+
import { ISharedTSQueue } from "@zowe/cics-for-zowe-explorer-api";
13+
import { Resource } from "../../../src/resources";
14+
import { SharedTSQueueMeta } from "../../../src/doc";
15+
16+
jest.mock("../../../src/utils/profileManagement", () => ({
17+
ProfileManagement: {},
18+
}));
19+
20+
describe("Shared TS Queue Meta", () => {
21+
let tsQueueMock: Resource<ISharedTSQueue>;
22+
23+
beforeEach(() => {
24+
tsQueueMock = new Resource({
25+
eyu_cicsname: "MYREG",
26+
location: "MAIN",
27+
name: "MYQUEUE",
28+
poolname: "MYPOOL"
29+
});
30+
});
31+
32+
it("should build criteria", () => {
33+
const crit = SharedTSQueueMeta.buildCriteria(["a", "b"]);
34+
expect(crit).toEqual(`NAME=a OR NAME=b`);
35+
});
36+
it("should return label", () => {
37+
const label = SharedTSQueueMeta.getLabel(tsQueueMock);
38+
expect(label).toEqual(`MYQUEUE`);
39+
});
40+
it("should return context", () => {
41+
const context = SharedTSQueueMeta.getContext(tsQueueMock);
42+
expect(context).toEqual(`CICSSharedTSQueue.MYQUEUE`);
43+
});
44+
it("should return icon name", () => {
45+
const iconName = SharedTSQueueMeta.getIconName(tsQueueMock);
46+
expect(iconName).toEqual(`shared-tsqueue`);
47+
});
48+
it("should get name", () => {
49+
const name = SharedTSQueueMeta.getName(tsQueueMock);
50+
expect(name).toEqual("MYQUEUE");
51+
});
52+
53+
it("should return highlights", () => {
54+
const highlights = SharedTSQueueMeta.getHighlights(tsQueueMock);
55+
expect(highlights).toEqual([
56+
{
57+
key: "Location",
58+
value: "MAIN",
59+
},
60+
{
61+
key: "Pool Name",
62+
value: "MYPOOL",
63+
},
64+
]);
65+
});
66+
67+
it("should append criteria history", async () => {
68+
const criteria = "QUEUE";
69+
await SharedTSQueueMeta.appendCriteriaHistory(criteria);
70+
let history = SharedTSQueueMeta.getCriteriaHistory();
71+
expect(history).toEqual(["QUEUE"]);
72+
});
73+
74+
it("should get criteria history", async () => {
75+
const criteria = "QUEUE";
76+
await SharedTSQueueMeta.appendCriteriaHistory(criteria);
77+
let history = SharedTSQueueMeta.getCriteriaHistory();
78+
expect(history).toEqual(["QUEUE"]);
79+
});
80+
});
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*
10+
*/
11+
12+
import { ITSQueue } from "@zowe/cics-for-zowe-explorer-api";
13+
import { TSQueueMeta } from "../../../src/doc/meta/tsqueue.meta";
14+
import { Resource } from "../../../src/resources";
15+
16+
jest.mock("../../../src/utils/profileManagement", () => ({
17+
ProfileManagement: {},
18+
}));
19+
20+
describe("TS Queue Meta", () => {
21+
let tsQueueMock: Resource<ITSQueue>;
22+
23+
beforeEach(() => {
24+
tsQueueMock = new Resource({
25+
status: "ENABLED",
26+
eyu_cicsname: "MYREG",
27+
enablestatus: "ENABLED",
28+
location: "MAIN",
29+
name: "MYQUEUE",
30+
numitems: "2",
31+
});
32+
});
33+
34+
it("should build criteria", () => {
35+
const crit = TSQueueMeta.buildCriteria(["a", "b"]);
36+
expect(crit).toEqual(`NAME=a OR NAME=b`);
37+
});
38+
it("should return label", () => {
39+
const label = TSQueueMeta.getLabel(tsQueueMock);
40+
expect(label).toEqual(`MYQUEUE`);
41+
});
42+
it("should return context", () => {
43+
const context = TSQueueMeta.getContext(tsQueueMock);
44+
expect(context).toEqual(`CICSTSQueue.MYQUEUE`);
45+
});
46+
it("should return icon name", () => {
47+
const iconName = TSQueueMeta.getIconName(tsQueueMock);
48+
expect(iconName).toEqual(`tsqueue`);
49+
});
50+
it("should get name", () => {
51+
const name = TSQueueMeta.getName(tsQueueMock);
52+
expect(name).toEqual("MYQUEUE");
53+
});
54+
55+
it("should return highlights", () => {
56+
const highlights = TSQueueMeta.getHighlights(tsQueueMock);
57+
expect(highlights).toEqual([
58+
{
59+
key: "Location",
60+
value: "MAIN",
61+
},
62+
{
63+
key: "Number of Items",
64+
value: "2",
65+
},
66+
]);
67+
});
68+
69+
it("should append criteria history", async () => {
70+
const criteria = "QUEUE";
71+
await TSQueueMeta.appendCriteriaHistory(criteria);
72+
let history = TSQueueMeta.getCriteriaHistory();
73+
expect(history).toEqual(["QUEUE"]);
74+
});
75+
76+
it("should get criteria history", async () => {
77+
const criteria = "QUEUE";
78+
await TSQueueMeta.appendCriteriaHistory(criteria);
79+
let history = TSQueueMeta.getCriteriaHistory();
80+
expect(history).toEqual(["QUEUE"]);
81+
});
82+
});

packages/vsce/__tests__/__unit__/extending/CICSExtenderApiConfig.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ describe("CICS Extender Api Tests", () => {
2121
it("should return supported resources configuration", () => {
2222
const config: IExtensionAPI = CICSExtenderApiConfig.getAPI();
2323
expect(config).toHaveProperty('resources.supportedResources');
24-
expect(config.resources.supportedResources).toHaveLength(11);
24+
expect(config.resources.supportedResources).toHaveLength(13);
2525
});
2626
});

packages/vsce/__tests__/__unit__/extension.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("extension", () => {
5353
expect(Object.keys(returnedAPI.resources)).toHaveLength(1);
5454

5555
expect(returnedAPI.resources.supportedResources).toBeInstanceOf(Array);
56-
expect(returnedAPI.resources.supportedResources).toHaveLength(11);
56+
expect(returnedAPI.resources.supportedResources).toHaveLength(13);
5757
expect(returnedAPI.resources.supportedResources).toContain("CICSProgram");
5858
expect(returnedAPI.resources.supportedResources).toContain("CICSLocalFile");
5959
expect(returnedAPI.resources.supportedResources).toContain("CICSTask");
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 18 additions & 0 deletions
Loading
Lines changed: 18 additions & 0 deletions
Loading

packages/vsce/src/doc/meta/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { URIMapMeta } from "./urimap.meta";
2424
import { WebServiceMeta } from "./webservice.meta";
2525
import { JVMServerMeta } from "./JVMServer.meta";
2626
import { JVMEndpointMeta } from "./jvmEndpoints.meta";
27+
import { TSQueueMeta } from "./tsqueue.meta";
28+
import { SharedTSQueueMeta } from "./sharedTSqueue.meta";
2729
import { IResource } from "@zowe/cics-for-zowe-explorer-api";
2830

2931
export * from "./IResourceMeta";
@@ -39,6 +41,8 @@ export * from "./tcpip.meta";
3941
export * from "./transaction.meta";
4042
export * from "./urimap.meta";
4143
export * from "./webservice.meta";
44+
export * from "./tsqueue.meta";
45+
export * from "./sharedTSqueue.meta";
4246
export * from "./JVMServer.meta";
4347
export * from "./jvmEndpoints.meta";
4448

@@ -57,6 +61,8 @@ export function getMetas(): IResourceMeta<IResource>[] {
5761
URIMapMeta,
5862
WebServiceMeta,
5963
JVMServerMeta,
60-
JVMEndpointMeta
64+
JVMEndpointMeta,
65+
TSQueueMeta,
66+
SharedTSQueueMeta,
6167
];
6268
}

0 commit comments

Comments
 (0)