-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clients/java): add resolve incident command
- Loading branch information
1 parent
e2eca8d
commit 25c1df3
Showing
7 changed files
with
138 additions
and
20 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
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
20 changes: 20 additions & 0 deletions
20
clients/java/src/main/java/io/zeebe/client/api/commands/ResolveIncidentCommandStep1.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,20 @@ | ||
/* | ||
* Copyright © 2017 camunda services GmbH (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file 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.zeebe.client.api.commands; | ||
|
||
public interface ResolveIncidentCommandStep1 extends FinalCommandStep<Void> { | ||
// the place for new optional parameters | ||
} |
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
46 changes: 46 additions & 0 deletions
46
clients/java/src/main/java/io/zeebe/client/impl/workflow/ResolveIncidentCommandImpl.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,46 @@ | ||
/* | ||
* Copyright © 2017 camunda services GmbH (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file 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.zeebe.client.impl.workflow; | ||
|
||
import io.zeebe.client.api.ZeebeFuture; | ||
import io.zeebe.client.api.commands.ResolveIncidentCommandStep1; | ||
import io.zeebe.client.impl.ZeebeClientFutureImpl; | ||
import io.zeebe.gateway.protocol.GatewayGrpc.GatewayStub; | ||
import io.zeebe.gateway.protocol.GatewayOuterClass.ResolveIncidentRequest; | ||
import io.zeebe.gateway.protocol.GatewayOuterClass.ResolveIncidentRequest.Builder; | ||
import io.zeebe.gateway.protocol.GatewayOuterClass.ResolveIncidentResponse; | ||
|
||
public class ResolveIncidentCommandImpl implements ResolveIncidentCommandStep1 { | ||
|
||
private final GatewayStub asyncStub; | ||
private final Builder builder; | ||
|
||
public ResolveIncidentCommandImpl(GatewayStub asyncStub, long incidentKey) { | ||
this.asyncStub = asyncStub; | ||
this.builder = ResolveIncidentRequest.newBuilder().setIncidentKey(incidentKey); | ||
} | ||
|
||
@Override | ||
public ZeebeFuture<Void> send() { | ||
final ResolveIncidentRequest request = builder.build(); | ||
|
||
final ZeebeClientFutureImpl<Void, ResolveIncidentResponse> future = | ||
new ZeebeClientFutureImpl<>(); | ||
|
||
asyncStub.resolveIncident(request, future); | ||
return future; | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
clients/java/src/test/java/io/zeebe/client/workflow/ResolveIncidentTest.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,35 @@ | ||
/* | ||
* Copyright © 2017 camunda services GmbH (info@camunda.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file 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.zeebe.client.workflow; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.zeebe.client.util.ClientTest; | ||
import io.zeebe.gateway.protocol.GatewayOuterClass.ResolveIncidentRequest; | ||
import org.junit.Test; | ||
|
||
public class ResolveIncidentTest extends ClientTest { | ||
|
||
@Test | ||
public void shouldSendCommand() { | ||
// when | ||
client.workflowClient().newResolveIncidentCommand(123).send().join(); | ||
|
||
// then | ||
final ResolveIncidentRequest request = gatewayService.getLastRequest(); | ||
assertThat(request.getIncidentKey()).isEqualTo(123); | ||
} | ||
} |