-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a68883
commit da59a8d
Showing
11 changed files
with
195 additions
and
1 deletion.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
temporal-sdk/src/main/java/io/temporal/client/WorkflowExecutionDescription.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,41 @@ | ||
/* | ||
* Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved. | ||
* | ||
* Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Modifications copyright (C) 2017 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this material except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.temporal.client; | ||
|
||
import io.temporal.api.workflowservice.v1.DescribeWorkflowExecutionResponse; | ||
import io.temporal.common.converter.DataConverter; | ||
import javax.annotation.Nonnull; | ||
|
||
/** Contains information about a workflow execution. */ | ||
public class WorkflowExecutionDescription extends WorkflowExecutionMetadata { | ||
private final @Nonnull DescribeWorkflowExecutionResponse response; | ||
|
||
public WorkflowExecutionDescription( | ||
@Nonnull DescribeWorkflowExecutionResponse response, @Nonnull DataConverter dataConverter) { | ||
super(response.getWorkflowExecutionInfo(), dataConverter); | ||
this.response = response; | ||
} | ||
|
||
/** Returns the raw response from the Temporal service. */ | ||
public DescribeWorkflowExecutionResponse getRawDescription() { | ||
return response; | ||
} | ||
} |
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
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
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
56 changes: 56 additions & 0 deletions
56
temporal-sdk/src/test/java/io/temporal/workflow/WorkflowDescribe.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,56 @@ | ||
/* | ||
* Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved. | ||
* | ||
* Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Modifications copyright (C) 2017 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this material except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.temporal.workflow; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import io.temporal.client.WorkflowExecutionDescription; | ||
import io.temporal.client.WorkflowStub; | ||
import io.temporal.testing.internal.SDKTestWorkflowRule; | ||
import io.temporal.workflow.shared.TestWorkflows.TestWorkflow1; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
public class WorkflowDescribe { | ||
|
||
@Rule | ||
public SDKTestWorkflowRule testWorkflowRule = | ||
SDKTestWorkflowRule.newBuilder().setWorkflowTypes(TestInitWorkflow.class).build(); | ||
|
||
@Test | ||
public void testWorkflowDescribe() { | ||
TestWorkflow1 workflowStub = | ||
testWorkflowRule.newWorkflowStubTimeoutOptions(TestWorkflow1.class); | ||
String result = workflowStub.execute(testWorkflowRule.getTaskQueue()); | ||
assertEquals(testWorkflowRule.getTaskQueue(), result); | ||
WorkflowExecutionDescription description = WorkflowStub.fromTyped(workflowStub).describe(); | ||
assertEquals(testWorkflowRule.getTaskQueue(), description.getTaskQueue()); | ||
assertEquals("TestWorkflow1", description.getWorkflowType()); | ||
assertEquals(WorkflowStub.fromTyped(workflowStub).getExecution(), description.getExecution()); | ||
} | ||
|
||
public static class TestInitWorkflow implements TestWorkflow1 { | ||
@Override | ||
public String execute(String taskQueue) { | ||
return taskQueue; | ||
} | ||
} | ||
} |
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