-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2280 from zowe/addressSpaceApps
[v3] TSO app message transmission/reception
- Loading branch information
Showing
48 changed files
with
2,550 additions
and
188 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
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
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
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
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
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
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
22 changes: 22 additions & 0 deletions
22
packages/cli/__tests__/zostso/__unit__/receive/Receive.definition.unit.test.ts
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,22 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { ICommandDefinition } from "@zowe/imperative"; | ||
|
||
describe("zos-tso receive group definition", () => { | ||
it("should not have changed", () => { | ||
const definition: ICommandDefinition = require("../../../../src/zostso/receive/Receive.definition").ReceiveCommand; | ||
expect(definition).toBeDefined(); | ||
expect(definition.children.length).toBe(1); | ||
delete definition.children; | ||
expect(definition).toMatchSnapshot(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
.../cli/__tests__/zostso/__unit__/receive/__snapshots__/Receive.definition.unit.test.ts.snap
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,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`zos-tso receive group definition should not have changed 1`] = ` | ||
Object { | ||
"aliases": Array [ | ||
"r", | ||
], | ||
"description": "Receive message from TSO address space app", | ||
"name": "receive", | ||
"summary": "Receive message from TSO address space app", | ||
"type": "group", | ||
} | ||
`; |
65 changes: 65 additions & 0 deletions
65
packages/cli/__tests__/zostso/__unit__/receive/app/ReceiveASApp.handler.unit.test.ts
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,65 @@ | ||
/* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; | ||
import { AddressSpaceApps } from "@zowe/zos-tso-for-zowe-sdk"; | ||
import * as ReceiveASAppHandler from "../../../../../src/zostso/receive/app/ReceiveASApp.handler"; | ||
import * as ReceiveASAppDefinition from "../../../../../src/zostso/receive/app/ReceiveASApp.definition"; | ||
import { IHandlerParameters } from "@zowe/imperative"; | ||
import { mockHandlerParameters } from "@zowe/cli-test-utils"; | ||
import { UNIT_TEST_ZOSMF_PROF_OPTS } from "../../../../../../../__tests__/__src__/TestConstants"; | ||
|
||
const DEFAULT_PARAMETERS: IHandlerParameters = mockHandlerParameters({ | ||
arguments: UNIT_TEST_ZOSMF_PROF_OPTS, | ||
positionals: ["zos-tso","r","app"], | ||
definition: ReceiveASAppDefinition.ReceiveASApp | ||
}); | ||
const MOCK_RECEIVE_RESPONSE: any = { | ||
version: undefined, | ||
reused: false, | ||
timeout: false, | ||
servletKey: "ZOWEUSER-122-aabyaaaj", | ||
queueID: null, | ||
tsoData: [ | ||
{ | ||
"TSO MESSAGE": { VERSION: "0100", DATA: "Processing started." }, | ||
}, | ||
{ | ||
"TSO MESSAGE": { VERSION: "0100", DATA: "READY" }, | ||
}, | ||
], | ||
}; | ||
|
||
describe("receive TSO app handler behavior", () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it("should properly receive and parse data from receive TSO response", async () => { | ||
jest.spyOn(ZosmfRestClient, "getExpectJSON").mockResolvedValueOnce( | ||
MOCK_RECEIVE_RESPONSE | ||
); | ||
const receiveSpy = jest.spyOn(AddressSpaceApps,"receive"); | ||
const handler = new ReceiveASAppHandler.default(); | ||
const params = Object.assign({}, ...[DEFAULT_PARAMETERS]); | ||
let error = undefined; | ||
params.arguments = {...params.arguments,account: "izuacct", appKey: "test2", servletKey: "ZOWEUSER-122-aabyaaaj", runUntilReady: true}; | ||
try{ | ||
await handler.process(params); | ||
} | ||
catch(e) | ||
{ | ||
error = e; | ||
} | ||
expect(error).toBeUndefined(); | ||
expect(receiveSpy).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
30 changes: 30 additions & 0 deletions
30
..._tests__/zostso/__unit__/receive/app/__snapshots__/ReceiveASApp.handler.unit.test.ts.snap
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,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 1`] = ` | ||
" | ||
" | ||
`; | ||
|
||
exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 2`] = `"Processing started."`; | ||
|
||
exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 3`] = `"READY"`; | ||
|
||
exports[`receive TSO app handler behavior should properly receive and parse data from receive TSO response 4`] = ` | ||
Object { | ||
"queueID": null, | ||
"reused": false, | ||
"servletKey": "ZOWEUSER-122-aabyaaaj", | ||
"timeout": false, | ||
"tsoData": Array [ | ||
Object { | ||
"DATA": "Processing started.", | ||
"VERSION": "0100", | ||
}, | ||
Object { | ||
"DATA": "READY", | ||
"VERSION": "0100", | ||
}, | ||
], | ||
"version": undefined, | ||
} | ||
`; |
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
Oops, something went wrong.