generated from axonivy-market/market-product
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix AUTH.Client issue * Introduced new demo
- Loading branch information
1 parent
ba3af26
commit 370ea61
Showing
25 changed files
with
788 additions
and
33 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
3 changes: 2 additions & 1 deletion
3
ui-path-connector-demo/.settings/ch.ivyteam.ivy.designer.prefs
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_DATA_CLASS=com.axonivy.connector.uipath.ui.path.connector.demo.Data | ||
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_NAMESPACE=com.axonivy.connector.uipath.ui.path.connector.demo | ||
ch.ivyteam.ivy.project.preferences\:PRIMEFACES_VERSION=11 | ||
ch.ivyteam.ivy.project.preferences\:PROJECT_VERSION=100000 | ||
eclipse.preferences.version=1 | ||
eclipse.preferences.version=1 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
3 changes: 2 additions & 1 deletion
3
ui-path-connector-test/.settings/ch.ivyteam.ivy.designer.prefs
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_DATA_CLASS=com.axonivy.connector.uipath.test.Data | ||
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_NAMESPACE=com.axonivy.connector.uipath.test | ||
ch.ivyteam.ivy.project.preferences\:PRIMEFACES_VERSION=11 | ||
ch.ivyteam.ivy.project.preferences\:PROJECT_VERSION=100000 | ||
eclipse.preferences.version=1 | ||
eclipse.preferences.version=1 |
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
ui-path-connector-test/src/com/axonivy/connector/uipath/test/json/folders.json
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 @@ | ||
{ | ||
"@odata.context": "https://platform.uipath.com/odata/$metadata#Folders", | ||
"@odata.count": 1, | ||
"value": [ | ||
{ | ||
"Key": "1a374a79-9bdd-4055-a0cc-95488ae006a0", | ||
"DisplayName": "MyTest", | ||
"FullyQualifiedName": "MyTest", | ||
"FullyQualifiedNameOrderable": "MyTest", | ||
"Description": null, | ||
"FolderType": "Standard", | ||
"ProvisionType": "Automatic", | ||
"PermissionModel": "FineGrained", | ||
"ParentId": null, | ||
"ParentKey": null, | ||
"IsActive": true, | ||
"FeedType": "Processes", | ||
"ReservedOptions": null, | ||
"Id": 89973 | ||
} | ||
] | ||
} |
38 changes: 38 additions & 0 deletions
38
ui-path-connector-test/src/com/axonivy/connector/uipath/test/json/machines.json
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,38 @@ | ||
{ | ||
"@odata.context": "https://cloud.uipath.com/orchestrator_/odata/$metadata#Machines/UiPath.Server.Configuration.OData.ExtendedMachineDto", | ||
"@odata.count": 4, | ||
"value": [ | ||
{ | ||
"@odata.type": "#UiPath.Server.Configuration.OData.ExtendedMachineDto", | ||
"ServerlessLicensingModel": null, | ||
"LicenseKey": null, | ||
"Name": "My workspace machine", | ||
"Description": null, | ||
"Type": "Template", | ||
"Scope": "PersonalWorkspace", | ||
"NonProductionSlots": 0, | ||
"UnattendedSlots": 0, | ||
"HeadlessSlots": 0, | ||
"TestAutomationSlots": 0, | ||
"AutomationCloudSlots": 0, | ||
"AutomationCloudTestAutomationSlots": 0, | ||
"Key": "480f27b8-09c8-4476-b01b-db2d1bd0f5d5", | ||
"EndpointDetectionStatus": "NotAvailable", | ||
"AutomationType": "Any", | ||
"TargetFramework": "Any", | ||
"ClientSecret": null, | ||
"Id": 55490, | ||
"RobotVersions": [ | ||
{ | ||
"Count": 2, | ||
"Version": "24.10.1" | ||
} | ||
], | ||
"RobotUsers": [], | ||
"UpdatePolicy": null, | ||
"Tags": [], | ||
"MaintenanceWindow": null, | ||
"VpnSettings": null | ||
} | ||
] | ||
} |
81 changes: 81 additions & 0 deletions
81
ui-path-connector-test/src_test/com/axonivy/connector/uipath/test/UiPathTest.java
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,81 @@ | ||
package com.axonivy.connector.uipath.test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.axonivy.connector.uipath.TenantHeaderFeature; | ||
import com.axonivy.connector.uipath.ui.path.connector.UiPathJobData; | ||
import com.axonivy.connector.uipath.ui.path.connector.UiPathRpa; | ||
|
||
import ch.ivyteam.ivy.application.IApplication; | ||
import ch.ivyteam.ivy.bpm.engine.client.BpmClient; | ||
import ch.ivyteam.ivy.bpm.engine.client.ExecutionResult; | ||
import ch.ivyteam.ivy.bpm.engine.client.element.BpmElement; | ||
import ch.ivyteam.ivy.bpm.exec.client.IvyProcessTest; | ||
import ch.ivyteam.ivy.environment.AppFixture; | ||
import ch.ivyteam.ivy.rest.client.RestClient; | ||
import ch.ivyteam.ivy.rest.client.RestClients; | ||
import ch.ivyteam.ivy.rest.client.mapper.JsonFeature; | ||
import ch.ivyteam.ivy.rest.client.security.CsrfHeaderFeature; | ||
import ch.ivyteam.ivy.security.ISession; | ||
|
||
/** | ||
* Service functionality is mocked out here: {@link UiPathMock} | ||
*/ | ||
@IvyProcessTest(enableWebServer = true) | ||
public class UiPathTest { | ||
|
||
private static final String UI_PATH_REST_CLIENT = "UIPathRPA (UiPath.WebApi 18.0)"; | ||
private static final BpmElement UI_PATH_JOB_ALL_ACTIVE_JOBS_END = BpmElement.pid("190E93ECBBC86C6F-f1"); | ||
private static final BpmElement UI_PATH_JOB_START_JOB_END = BpmElement.pid("190E93ECBBC86C6F-f50"); | ||
private static final BpmElement UI_PATH_RPA_END = BpmElement.pid("175F58F3612E10B1-f15"); | ||
|
||
|
||
@BeforeAll | ||
static void beforeAll(AppFixture fixture, IApplication app) { | ||
fixture.config("RestClients." + UI_PATH_REST_CLIENT + ".Url", UiPathMock.URI); | ||
fixture.config("RestClients." + UI_PATH_REST_CLIENT + ".Features", ""); | ||
|
||
RestClients clients = RestClients.of(app); | ||
RestClient uiPathRpa = clients.find(UI_PATH_REST_CLIENT); | ||
var testClient = uiPathRpa.toBuilder() | ||
.features(List.of( // exclude oauth-feature | ||
JsonFeature.class.getName(), | ||
TenantHeaderFeature.class.getName(), | ||
CsrfHeaderFeature.class.getName())) | ||
.property("AUTH.clientId", "notMyId") | ||
.property("AUTH.userKey", "notMyKey") | ||
.property("AUTH.tenant", "notMyTenant") | ||
.property("PATH.tenant", "tenant") | ||
.property("PATH.organization", "organization") | ||
.toRestClient(); | ||
clients.set(testClient); | ||
} | ||
|
||
@Test | ||
public void rpaDemo(BpmClient bpmClient, ISession session) { | ||
ExecutionResult result = bpmClient.start() | ||
.process("uiPathDemo/robotGetOrders.ivp") | ||
.as().session(session) | ||
.execute(); | ||
UiPathRpa data = result.data().lastOnElement(UI_PATH_RPA_END); | ||
assertThat(data.getLicense()).isNotNull(); | ||
assertThat(data.getReleases()).isNotEmpty(); | ||
assertThat(data.getRobots()).isNotEmpty(); | ||
} | ||
|
||
@Test | ||
public void jobDemo(BpmClient bpmClient, ISession session) { | ||
ExecutionResult result = bpmClient.start().process("uiPathDemo/triggerAllActiveJobs.ivp").as().session(session) | ||
.execute(); | ||
UiPathJobData data = result.data().lastOnElement(UI_PATH_JOB_ALL_ACTIVE_JOBS_END); | ||
assertThat(data.getOrganizationunitId()).isNotNull(); | ||
data = result.data().lastOnElement(UI_PATH_JOB_START_JOB_END); | ||
assertThat(data.getMachines()).isNotEmpty(); | ||
assertThat(data.getStartInfo()).isNotNull(); | ||
} | ||
} |
Oops, something went wrong.