Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Data Flow
Data Ingestion
Ingestion Workflow
Commits
91277895
Commit
91277895
authored
Aug 23, 2021
by
Aalekh Jain
Browse files
Added method to create and delete system workflow in testbase
Minor refactoring
parent
fb9869d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
testing/workflow-test-core/src/main/java/org/opengroup/osdu/workflow/util/v3/TestBase.java
View file @
91277895
...
...
@@ -17,6 +17,7 @@
package
org.opengroup.osdu.workflow.util.v3
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.sun.jersey.api.client.ClientResponse
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -34,6 +35,7 @@ import java.util.concurrent.Callable;
import
java.util.concurrent.TimeUnit
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
opengroup
.
osdu
.
workflow
.
consts
.
TestConstants
.
CREATE_SYSTEM_WORKFLOW_URL
;
import
static
org
.
opengroup
.
osdu
.
workflow
.
consts
.
TestConstants
.
CREATE_WORKFLOW_RUN_URL
;
import
static
org
.
opengroup
.
osdu
.
workflow
.
consts
.
TestConstants
.
CREATE_WORKFLOW_URL
;
import
static
org
.
opengroup
.
osdu
.
workflow
.
consts
.
TestConstants
.
CREATE_WORKFLOW_WORKFLOW_NAME
;
...
...
@@ -71,6 +73,18 @@ public abstract class TestBase {
return
response
.
getEntity
(
String
.
class
);
}
protected
String
createSystemWorkflow
()
throws
Exception
{
ClientResponse
response
=
client
.
send
(
HttpMethod
.
POST
,
CREATE_SYSTEM_WORKFLOW_URL
,
buildCreateWorkflowValidPayload
(),
headers
,
client
.
getAccessToken
()
);
assertEquals
(
HttpStatus
.
OK
.
value
(),
response
.
getStatus
());
return
response
.
getEntity
(
String
.
class
);
}
protected
String
createWorkflowRun
()
throws
Exception
{
ClientResponse
response
=
client
.
send
(
HttpMethod
.
POST
,
...
...
@@ -98,6 +112,12 @@ public abstract class TestBase {
sendDeleteRequest
(
url
);
}
protected
void
deleteTestSystemWorkflows
(
String
workflowName
)
throws
Exception
{
String
url
=
CREATE_SYSTEM_WORKFLOW_URL
+
"/"
+
workflowName
;
sendDeleteRequest
(
url
);
}
protected
void
waitForWorkflowRunsToComplete
(
List
<
Map
<
String
,
String
>>
createdWorkflowRuns
,
Set
<
String
>
completedWorkflowRunIds
)
throws
Exception
{
for
(
Map
<
String
,
String
>
createdWorkflow:
createdWorkflowRuns
)
{
...
...
@@ -188,4 +208,8 @@ public abstract class TestBase {
log
.
info
(
"Completed integration test at {}"
,
integrationTestEndTime
);
}
}
protected
Map
<
String
,
String
>
getWorkflowInfoFromCreateWorkflowResponseBody
(
String
responseBody
)
throws
JsonProcessingException
{
return
new
ObjectMapper
().
readValue
(
responseBody
,
HashMap
.
class
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment