Skip to content

Commit

Permalink
Convert to 11.4
Browse files Browse the repository at this point in the history
Fix test
Introduce new tests
  • Loading branch information
nqhoan-axonivy committed Jul 31, 2024
1 parent 8fae087 commit 6b7429e
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ public String getJobs() {
return json;
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("odata/Folders")
public String getFolders() {
return load("json/folders.json");
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("odata/Machines")
public String getMachines() {
return load("json/machines.json");
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("odata/Robots")
Expand Down
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
}
]
}
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
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import java.util.List;

import org.junit.jupiter.api.BeforeEach;
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;
Expand All @@ -25,14 +26,16 @@
/**
* Service functionality is mocked out here: {@link UiPathMock}
*/
@IvyProcessTest
public class TestUiPathRPA {
@IvyProcessTest(enableWebServer = true)
public class UiPathTest {

private static final BpmElement UI_PATH_END = BpmElement.pid("175F58F3612E10B1-f15");
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");

@BeforeEach
void beforeEach(AppFixture fixture, IApplication app) {
@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", "");

Expand All @@ -58,9 +61,20 @@ public void rpaDemo(BpmClient bpmClient, ISession session) {
.process("uiPathDemo/robotGetOrders.ivp")
.as().session(session)
.execute();
UiPathRpa data = result.data().lastOnElement(UI_PATH_END);
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();
}
}
31 changes: 20 additions & 11 deletions ui-path-connector/processes/uiPathRpa.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
},
"visual" : {
"at" : { "x" : 312, "y" : 64 },
"at" : { "x" : 256, "y" : 64 },
"size" : { "width" : 128 },
"description" : [
"Simple request against RPA Orchestration Platform provided by UIPath",
Expand All @@ -43,7 +43,7 @@
"icon" : "res:/webContent/icons/uipath.png"
},
"connect" : [
{ "id" : "f6", "to" : "f5" }
{ "id" : "f6", "to" : "f37" }
]
}, {
"id" : "f5",
Expand All @@ -55,7 +55,10 @@
"config" : {
"target" : {
"clientId" : "c700c640-4f76-4cbe-8724-dbc663d8bc0a",
"path" : "/odata/Jobs"
"path" : "/odata/Jobs",
"headers" : {
"X-Uipath-Organizationunitid" : "in.organizationunitId"
}
},
"response" : {
"entity" : {
Expand All @@ -68,12 +71,12 @@
}
},
"visual" : {
"at" : { "x" : 472, "y" : 64 },
"at" : { "x" : 464, "y" : 144 },
"size" : { "width" : 128 },
"icon" : "res:/webContent/icons/uipath.png"
},
"connect" : [
{ "id" : "f1", "to" : "f37" }
{ "id" : "f1", "to" : "f0" }
]
}, {
"id" : "f0",
Expand Down Expand Up @@ -113,7 +116,7 @@
]
},
"visual" : {
"at" : { "x" : 472, "y" : 224 },
"at" : { "x" : 464, "y" : 224 },
"size" : { "width" : 128 },
"icon" : "res:/webContent/icons/uipath.png"
},
Expand Down Expand Up @@ -145,6 +148,9 @@
"path" : "/odata/Releases",
"queryParams" : {
"$filter" : "\"contains(ProcessKey, 'order')\""
},
"headers" : {
"X-Uipath-Organizationunitid" : "in.organizationunitId"
}
},
"response" : {
Expand All @@ -158,7 +164,7 @@
}
},
"visual" : {
"at" : { "x" : 472, "y" : 304 },
"at" : { "x" : 464, "y" : 304 },
"size" : { "width" : 128 },
"icon" : "res:/webContent/icons/uipath.png"
},
Expand All @@ -176,7 +182,10 @@
"method" : "POST",
"target" : {
"clientId" : "c700c640-4f76-4cbe-8724-dbc663d8bc0a",
"path" : "/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs"
"path" : "/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs",
"headers" : {
"X-Uipath-Organizationunitid" : "in.organizationunitId"
}
},
"body" : {
"entity" : {
Expand Down Expand Up @@ -212,7 +221,7 @@
}
},
"visual" : {
"at" : { "x" : 472, "y" : 384 },
"at" : { "x" : 464, "y" : 384 },
"size" : { "width" : 128 },
"icon" : "res:/webContent/icons/uipath.png"
},
Expand Down Expand Up @@ -282,12 +291,12 @@
}
},
"visual" : {
"at" : { "x" : 472, "y" : 144 },
"at" : { "x" : 464, "y" : 64 },
"size" : { "width" : 128 },
"icon" : "res:/webContent/icons/uipath.png"
},
"connect" : [
{ "id" : "f2", "to" : "f0" }
{ "id" : "f2", "to" : "f5" }
]
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ private OrechstratorTenantFilter(String tenant)
public void filter(ClientRequestContext context) throws IOException
{
context.getHeaders().add("X-UIPATH-TenantName", tenant);
context.getHeaders().add("X-Uipath-Organizationunitid", tenant);
}
}

Expand Down

0 comments on commit 6b7429e

Please sign in to comment.