Skip to content

Commit f038a26

Browse files
Remove broken SuperCommand (#268)
1 parent fc0d00e commit f038a26

File tree

10 files changed

+11
-420
lines changed

10 files changed

+11
-420
lines changed

src/main/java/io/iworkflow/core/command/CommandRequest.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ public abstract class CommandRequest {
2929
* @return the command request
3030
*/
3131
public static CommandRequest forAllCommandCompleted(final BaseCommand... commands) {
32-
final List<BaseCommand> allSingleCommands = getAllSingleCommands(commands);
33-
return ImmutableCommandRequest.builder().addAllCommands(allSingleCommands).commandWaitingType(CommandWaitingType.ALL_COMPLETED).build();
32+
return ImmutableCommandRequest.builder()
33+
.addAllCommands(Arrays.asList(commands))
34+
.commandWaitingType(CommandWaitingType.ALL_COMPLETED)
35+
.build();
3436
}
3537

3638
/**
@@ -40,7 +42,10 @@ public static CommandRequest forAllCommandCompleted(final BaseCommand... command
4042
* @return the command request
4143
*/
4244
public static CommandRequest forAnyCommandCompleted(final BaseCommand... commands) {
43-
return ImmutableCommandRequest.builder().addAllCommands(Arrays.asList(commands)).commandWaitingType(CommandWaitingType.ANY_COMPLETED).build();
45+
return ImmutableCommandRequest.builder()
46+
.addAllCommands(Arrays.asList(commands))
47+
.commandWaitingType(CommandWaitingType.ANY_COMPLETED)
48+
.build();
4449
}
4550

4651
/**
@@ -76,20 +81,7 @@ public static CommandRequest forAnyCommandCombinationCompleted(final List<List<S
7681
}
7782

7883
private static List<BaseCommand> getAllSingleCommands(final BaseCommand... commands) {
79-
final ArrayList<BaseCommand> allSingleCommands = new ArrayList<>();
80-
Arrays.stream(commands).forEach(
81-
command -> {
82-
if (command instanceof SuperCommand) {
83-
allSingleCommands.addAll(
84-
SuperCommand.toList((SuperCommand) command)
85-
);
86-
return;
87-
}
88-
89-
allSingleCommands.add(command);
90-
}
91-
);
9284

93-
return allSingleCommands;
85+
return new ArrayList<>(Arrays.asList(commands));
9486
}
9587
}

src/main/java/io/iworkflow/core/command/SuperCommand.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/main/java/io/iworkflow/core/communication/InternalChannelCommand.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
package io.iworkflow.core.communication;
22

33
import io.iworkflow.core.command.BaseCommand;
4-
import io.iworkflow.core.command.ImmutableSuperCommand;
5-
import io.iworkflow.core.command.SuperCommand;
64
import org.immutables.value.Value;
75

86
@Value.Immutable
97
public abstract class InternalChannelCommand implements BaseCommand {
108

119
public abstract String getChannelName();
1210

13-
/**
14-
* Create a super command that represents one or many internal channel commands.
15-
*
16-
* @param commandId required. All the internal channel commands created here will share the same commandId.
17-
* @param channelName required.
18-
* @param count required. It represents the number of internal channel commands to create.
19-
* @return super command
20-
*/
21-
public static SuperCommand create(final String commandId, final String channelName, final int count) {
22-
return ImmutableSuperCommand.builder()
23-
.commandId(commandId)
24-
.name(channelName)
25-
.count(Math.max(1, count))
26-
.type(SuperCommand.Type.INTERNAL_CHANNEL)
27-
.build();
28-
}
29-
3011
/**
3112
* Create one internal channel command.
3213
*
@@ -41,21 +22,6 @@ public static InternalChannelCommand create(final String commandId, final String
4122
.build();
4223
}
4324

44-
/**
45-
* Create a super command that represents one or many internal channel commands.
46-
*
47-
* @param channelName required.
48-
* @param count required. It represents the number of internal channel commands to create.
49-
* @return super command
50-
*/
51-
public static SuperCommand create(final String channelName, final int count) {
52-
return ImmutableSuperCommand.builder()
53-
.name(channelName)
54-
.count(Math.max(1, count))
55-
.type(SuperCommand.Type.INTERNAL_CHANNEL)
56-
.build();
57-
}
58-
5925
/**
6026
* Create one internal channel command.
6127
*

src/main/java/io/iworkflow/core/communication/SignalCommand.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
package io.iworkflow.core.communication;
22

33
import io.iworkflow.core.command.BaseCommand;
4-
import io.iworkflow.core.command.ImmutableSuperCommand;
5-
import io.iworkflow.core.command.SuperCommand;
64
import org.immutables.value.Value;
75

86
@Value.Immutable
97
public abstract class SignalCommand implements BaseCommand {
108

119
public abstract String getSignalChannelName();
1210

13-
/**
14-
* Create a super command that represents one or many signal commands.
15-
*
16-
* @param commandId required. All the signal commands created here will share the same commandId.
17-
* @param signalName required.
18-
* @param count required. It represents the number of signal commands to create.
19-
* @return super command
20-
*/
21-
public static SuperCommand create(final String commandId, final String signalName, final int count) {
22-
return ImmutableSuperCommand.builder()
23-
.commandId(commandId)
24-
.name(signalName)
25-
.count(Math.max(1, count))
26-
.type(SuperCommand.Type.SIGNAL_CHANNEL)
27-
.build();
28-
}
29-
3011
/**
3112
* Create one signal command.
3213
*
@@ -41,21 +22,6 @@ public static SignalCommand create(final String commandId, final String signalNa
4122
.build();
4223
}
4324

44-
/**
45-
* Create a super command that represents one or many signal commands.
46-
*
47-
* @param signalName required.
48-
* @param count required. It represents the number of signal commands to create.
49-
* @return super command
50-
*/
51-
public static SuperCommand create(final String signalName, final int count) {
52-
return ImmutableSuperCommand.builder()
53-
.name(signalName)
54-
.count(Math.max(1, count))
55-
.type(SuperCommand.Type.SIGNAL_CHANNEL)
56-
.build();
57-
}
58-
5925
/**
6026
* Create one signal command.
6127
*

src/test/java/io/iworkflow/integ/InternalChannelTest.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io.iworkflow.core.Client;
44
import io.iworkflow.core.ClientOptions;
55
import io.iworkflow.integ.internalchannel.BasicInternalChannelWorkflow;
6-
import io.iworkflow.integ.internalchannel.MultipleSameInternalChannelWorkflow;
76
import io.iworkflow.spring.TestSingletonWorkerService;
87
import io.iworkflow.spring.controller.WorkflowRegistry;
98
import org.junit.jupiter.api.Assertions;
@@ -29,15 +28,4 @@ public void testBasicInternalWorkflow() throws InterruptedException {
2928
final Integer output = client.getSimpleWorkflowResultWithWait(Integer.class, wfId);
3029
Assertions.assertEquals(3, output);
3130
}
32-
33-
@Test
34-
public void testMultipleSameInternalWorkflow() throws InterruptedException {
35-
final Client client = new Client(WorkflowRegistry.registry, ClientOptions.localDefault);
36-
final String wfId = "multiple-same-internal-test-id" + System.currentTimeMillis() / 1000;
37-
final Integer input = 1;
38-
final String runId = client.startWorkflow(
39-
MultipleSameInternalChannelWorkflow.class, wfId, 10, input);
40-
final Integer output = client.getSimpleWorkflowResultWithWait(Integer.class, wfId);
41-
Assertions.assertEquals(5, output);
42-
}
4331
}

src/test/java/io/iworkflow/integ/SignalTest.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import io.iworkflow.gen.models.ErrorSubStatus;
77
import io.iworkflow.integ.signal.BasicSignalWorkflow;
88
import io.iworkflow.integ.signal.BasicSignalWorkflowState2;
9-
import io.iworkflow.integ.signal.MultipleSameSignalWorkflow;
10-
import static io.iworkflow.integ.signal.MultipleSameSignalWorkflow.SIGNAL_NAME_1;
119
import io.iworkflow.spring.TestSingletonWorkerService;
1210
import io.iworkflow.spring.controller.WorkflowRegistry;
1311
import org.junit.jupiter.api.Assertions;
@@ -69,23 +67,6 @@ public void testBasicSignalWorkflow() throws InterruptedException {
6967
Assertions.fail("signal closed workflow should fail");
7068
}
7169

72-
@Test
73-
public void testMultipleSameSignalWorkflow() {
74-
final Client client = new Client(WorkflowRegistry.registry, ClientOptions.localDefault);
75-
final String wfId = "multiple-same-signal-test-id" + System.currentTimeMillis() / 1000;
76-
final Integer input = 1;
77-
final String runId = client.startWorkflow(
78-
MultipleSameSignalWorkflow.class, wfId, 10, input);
79-
client.signalWorkflow(
80-
MultipleSameSignalWorkflow.class, wfId, runId, SIGNAL_NAME_1, Integer.valueOf(2));
81-
82-
client.signalWorkflow(
83-
MultipleSameSignalWorkflow.class, wfId, runId, SIGNAL_NAME_1, Integer.valueOf(3));
84-
85-
final Integer output = client.getSimpleWorkflowResultWithWait(Integer.class, wfId);
86-
Assertions.assertEquals(5, output);
87-
}
88-
8970
private void checkWorkflowResultAfterComplete(final Client client, final String wfId, final String runId) {
9071
Assertions.assertEquals(6, client.getSimpleWorkflowResultWithWait(Integer.class, wfId, runId));
9172
Assertions.assertEquals(6, client.getSimpleWorkflowResultWithWait(Integer.class, wfId));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy