Skip to content

Commit 5629071

Browse files
authored
fix(abap-inq):init transport config for scp systems (#3068)
1 parent d08273c commit 5629071

File tree

7 files changed

+6
-26
lines changed

7 files changed

+6
-26
lines changed

.changeset/spicy-kids-develop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sap-ux/abap-deploy-config-inquirer': patch
3+
---
4+
5+
make backend call for scp systems when initialising transport config

packages/abap-deploy-config-inquirer/src/prompts/conditions.ts

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export async function showUsernameQuestion(backendTarget?: BackendTarget): Promi
109109
warning
110110
} = await initTransportConfig({
111111
backendTarget: backendTarget,
112-
scp: PromptState.abapDeployConfig.scp,
113112
url: PromptState.abapDeployConfig.url,
114113
client: PromptState.abapDeployConfig.client,
115114
destination: PromptState.abapDeployConfig.destination,

packages/abap-deploy-config-inquirer/src/prompts/validators.ts

-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ export async function validateCredentials(
295295
warning
296296
} = await initTransportConfig({
297297
backendTarget: backendTarget,
298-
scp: PromptState.abapDeployConfig.scp,
299298
url: PromptState.abapDeployConfig.url,
300299
client: PromptState.abapDeployConfig.client,
301300
credentials: {

packages/abap-deploy-config-inquirer/src/service-provider-utils/transport-config.ts

-7
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,15 @@ class DefaultTransportConfig implements TransportConfig {
216216
*
217217
* @param transportConfigOptions - transport configuration options
218218
* @param transportConfigOptions.backendTarget - backend target from prompt options
219-
* @param transportConfigOptions.scp - scp
220219
* @param transportConfigOptions.credentials - user credentials
221220
* @returns transport configuration instance
222221
*/
223222
export async function getTransportConfigInstance({
224223
backendTarget,
225-
scp,
226224
credentials
227225
}: {
228226
backendTarget?: BackendTarget;
229-
scp?: boolean;
230227
credentials?: Credentials;
231228
}): Promise<InitTransportConfigResult> {
232-
if (scp) {
233-
return { transportConfig: new DummyTransportConfig() };
234-
}
235-
236229
return new DefaultTransportConfig().init({ backendTarget, credentials });
237230
}

packages/abap-deploy-config-inquirer/src/utils.ts

-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export function isSameSystem(abapSystem?: SystemConfig, url?: string, client?: s
9292
*
9393
* @param transportConfigParams - transport configuration parameters
9494
* @param transportConfigParams.backendTarget - backend target from prompt options
95-
* @param transportConfigParams.scp - scp
9695
* @param transportConfigParams.url - url
9796
* @param transportConfigParams.client - client
9897
* @param transportConfigParams.destination - destination
@@ -102,14 +101,12 @@ export function isSameSystem(abapSystem?: SystemConfig, url?: string, client?: s
102101
*/
103102
export async function initTransportConfig({
104103
backendTarget,
105-
scp,
106104
url,
107105
destination,
108106
credentials,
109107
errorHandler
110108
}: {
111109
backendTarget?: BackendTarget;
112-
scp?: boolean;
113110
url?: string;
114111
client?: string;
115112
destination?: string;
@@ -124,7 +121,6 @@ export async function initTransportConfig({
124121
try {
125122
result = await getTransportConfigInstance({
126123
backendTarget,
127-
scp,
128124
credentials
129125
});
130126
} catch (e) {

packages/abap-deploy-config-inquirer/test/service-provider-utils/transport-config.test.ts

-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('getTransportConfigInstance', () => {
1414
it('should return the dummy instance of TransportConfig', async () => {
1515
const transportConfigResult = await getTransportConfigInstance({
1616
backendTarget: undefined,
17-
scp: true,
1817
credentials: {}
1918
});
2019
expect(transportConfigResult.transportConfig?.getPackage()).toBe(undefined);
@@ -41,7 +40,6 @@ describe('getTransportConfigInstance', () => {
4140

4241
const transportConfigResult = await getTransportConfigInstance({
4342
backendTarget: undefined,
44-
scp: false,
4543
credentials: {}
4644
});
4745

@@ -69,7 +67,6 @@ describe('getTransportConfigInstance', () => {
6967

7068
const transportConfigResult = await getTransportConfigInstance({
7169
backendTarget: undefined,
72-
scp: false,
7370
credentials: {}
7471
});
7572

@@ -87,7 +84,6 @@ describe('getTransportConfigInstance', () => {
8784

8885
const transportConfigResult2 = await getTransportConfigInstance({
8986
backendTarget: undefined,
90-
scp: false,
9187
credentials: {}
9288
});
9389

@@ -112,7 +108,6 @@ describe('getTransportConfigInstance', () => {
112108

113109
const transportConfigResult = await getTransportConfigInstance({
114110
backendTarget: undefined,
115-
scp: false,
116111
credentials: {}
117112
});
118113

@@ -137,7 +132,6 @@ describe('getTransportConfigInstance', () => {
137132

138133
const transportConfigResult = await getTransportConfigInstance({
139134
backendTarget: undefined,
140-
scp: false,
141135
credentials: {}
142136
});
143137
expect(transportConfigResult.transportConfigNeedsCreds).toBe(true);
@@ -156,7 +150,6 @@ describe('getTransportConfigInstance', () => {
156150

157151
const transportConfigResultWithoutHeaders = await getTransportConfigInstance({
158152
backendTarget: undefined,
159-
scp: false,
160153
credentials: {}
161154
});
162155
expect(transportConfigResultWithoutHeaders.transportConfigNeedsCreds).toBe(false);
@@ -175,7 +168,6 @@ describe('getTransportConfigInstance', () => {
175168

176169
const transportConfigResult2 = await getTransportConfigInstance({
177170
backendTarget: undefined,
178-
scp: false,
179171
credentials: {}
180172
});
181173
expect(transportConfigResult2.transportConfigNeedsCreds).toBe(false);

packages/abap-deploy-config-inquirer/test/utils.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,21 @@ describe('Test utils', () => {
120120
});
121121
const initTransportConfigResult = await initTransportConfig({
122122
backendTarget: undefined,
123-
scp: false,
124123
url: 'https://mocktarget.url',
125124
client: '100',
126125
errorHandler: jest.fn()
127126
});
128127

129128
expect(mockGetTransportConfigInstance).toBeCalledWith({
130129
backendTarget: undefined,
131-
scp: false,
132130
credentials: undefined
133131
});
134132
expect(initTransportConfigResult.transportConfigNeedsCreds).toBe(true);
135133
});
136134

137135
it('should log error when transport config initialisation fails', async () => {
138136
const errorHandler = jest.fn();
139-
const result = await initTransportConfig({ backendTarget: undefined, scp: false, errorHandler });
137+
const result = await initTransportConfig({ backendTarget: undefined, errorHandler });
140138
expect(result).toStrictEqual({});
141139

142140
const loggerSpy = jest.spyOn(LoggerHelper.logger, 'debug');
@@ -145,15 +143,13 @@ describe('Test utils', () => {
145143
mockGetTransportConfigInstance.mockRejectedValueOnce(errorObj);
146144
const initTransportConfigResult = await initTransportConfig({
147145
backendTarget: undefined,
148-
scp: false,
149146
url: 'https://mocktarget.url',
150147
client: '100',
151148
errorHandler
152149
});
153150

154151
expect(mockGetTransportConfigInstance).toBeCalledWith({
155152
backendTarget: undefined,
156-
scp: false,
157153
credentials: undefined
158154
});
159155
expect(initTransportConfigResult.error).toStrictEqual(errorObj);

0 commit comments

Comments
 (0)