|
| 1 | +/* |
| 2 | + * Copyright 2024 EPAM Systems |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
1 | 17 | package com.epam.reportportal.saucelabs.command;
|
2 | 18 |
|
3 | 19 |
|
4 | 20 | import static com.epam.reportportal.saucelabs.model.Constants.JOB_ID;
|
5 |
| -import static com.epam.reportportal.saucelabs.model.IntegrationParametersNames.ACCESS_TOKEN; |
6 |
| -import static com.epam.reportportal.saucelabs.model.IntegrationParametersNames.DATA_CENTER; |
7 |
| -import static com.epam.reportportal.saucelabs.model.IntegrationParametersNames.USERNAME; |
8 | 21 | import static org.junit.jupiter.api.Assertions.assertNotNull;
|
9 | 22 |
|
| 23 | +import com.epam.reportportal.rules.exception.ReportPortalException; |
10 | 24 | import com.epam.reportportal.saucelabs.client.RestClientBuilder;
|
11 |
| -import com.epam.ta.reportportal.entity.integration.Integration; |
12 |
| -import com.epam.ta.reportportal.entity.integration.IntegrationParams; |
13 | 25 | import java.util.HashMap;
|
14 | 26 | import java.util.Map;
|
15 | 27 | import org.jasypt.util.text.BasicTextEncryptor;
|
| 28 | +import org.junit.jupiter.api.Assertions; |
16 | 29 | import org.junit.jupiter.api.Test;
|
| 30 | +import org.junit.jupiter.api.condition.DisabledIf; |
17 | 31 |
|
18 |
| -public class GetVirtualDeviceJobCommandTest { |
| 32 | +public class GetVirtualDeviceJobCommandTest extends BaseCommandTest { |
19 | 33 |
|
20 |
| - private static final Map<String, Object> COMMAND_PARAMS = new HashMap<>(); |
21 |
| - private static final Map<String, Object> INTEGRATION_PARAMS = new HashMap<>(); |
| 34 | + @Test |
| 35 | + @DisabledIf("disabled") |
| 36 | + void getVirtualDeviceJob() { |
| 37 | + GetVirtualDeviceJobCommand command = new GetVirtualDeviceJobCommand( |
| 38 | + new RestClientBuilder(basicTextEncryptor)); |
| 39 | + Object response = command.executeCommand(INTEGRATION, VDC_COMMAND_PARAMS); |
22 | 40 |
|
23 |
| - static { |
24 |
| - INTEGRATION_PARAMS.put(USERNAME.getName(), ""); |
25 |
| - INTEGRATION_PARAMS.put(ACCESS_TOKEN.getName(), ""); |
26 |
| - INTEGRATION_PARAMS.put(DATA_CENTER.getName(), "EU"); |
| 41 | + assertNotNull(response); |
| 42 | + } |
27 | 43 |
|
28 |
| - COMMAND_PARAMS.put(JOB_ID, "03afb43944b849e1a9cf68989222037c"); |
| 44 | + @Test |
| 45 | + @DisabledIf("disabled") |
| 46 | + void getVirtualDeviceJobLogs() { |
| 47 | + GetLogsCommand command = new GetLogsCommand(new RestClientBuilder(basicTextEncryptor)); |
| 48 | + Object response = command.executeCommand(INTEGRATION, VDC_COMMAND_PARAMS); |
29 | 49 |
|
| 50 | + assertNotNull(response); |
30 | 51 | }
|
31 | 52 |
|
32 | 53 | @Test
|
33 |
| - void executeCommand() { |
34 |
| - BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor(); |
35 |
| - Integration integration = new Integration(); |
| 54 | + @DisabledIf("disabled") |
| 55 | + void getVirtualDeviceJobNotExists() { |
| 56 | + Map<String, Object> params = new HashMap<>(); |
| 57 | + params.put(JOB_ID, "not-exists-job-id"); |
36 | 58 |
|
37 |
| - integration.setParams(new IntegrationParams(INTEGRATION_PARAMS)); |
| 59 | + BasicTextEncryptor basicTextEncryptor = new BasicTextEncryptor(); |
38 | 60 |
|
39 |
| - GetVirtualDeviceJobCommand command = new GetVirtualDeviceJobCommand( |
40 |
| - new RestClientBuilder(basicTextEncryptor)); |
41 |
| - Object o = command.executeCommand(integration, COMMAND_PARAMS); |
| 61 | + GetLogsCommand command = new GetLogsCommand(new RestClientBuilder(basicTextEncryptor)); |
| 62 | + Assertions.assertThrows(ReportPortalException.class, |
| 63 | + () -> command.executeCommand(INTEGRATION, params)); |
42 | 64 |
|
43 |
| - assertNotNull(o); |
44 | 65 | }
|
45 | 66 | }
|
0 commit comments