-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] Remove Demo Classes, add No-Op Step (#132)
Remove Demo Classes, add No-Op Step (#129) * Remove Demo Classes, add No-Op Step * Add test coverage * Revert enum javadocs as they are handled by #119 --------- (cherry picked from commit 9dffc0a) Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: Owais Kazi <owaiskazi19@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Owais Kazi <owaiskazi19@gmail.com>
- Loading branch information
1 parent
4effda0
commit dd1963b
Showing
11 changed files
with
73 additions
and
344 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
src/main/java/org/opensearch/flowframework/workflow/NoOpStep.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,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.flowframework.workflow; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* A workflow step that does nothing. May be used for synchronizing other actions. | ||
*/ | ||
public class NoOpStep implements WorkflowStep { | ||
|
||
/** The name of this step, used as a key in the template and the {@link WorkflowStepFactory} */ | ||
public static final String NAME = "noop"; | ||
|
||
@Override | ||
public CompletableFuture<WorkflowData> execute(List<WorkflowData> data) throws IOException { | ||
return CompletableFuture.completedFuture(WorkflowData.EMPTY); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return NAME; | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/test/java/org/opensearch/flowframework/workflow/NoOpStepTests.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,26 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.flowframework.workflow; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class NoOpStepTests extends OpenSearchTestCase { | ||
|
||
public void testNoOpStep() throws IOException { | ||
NoOpStep noopStep = new NoOpStep(); | ||
assertEquals(NoOpStep.NAME, noopStep.getName()); | ||
CompletableFuture<WorkflowData> future = noopStep.execute(Collections.emptyList()); | ||
assertTrue(future.isDone()); | ||
assertFalse(future.isCompletedExceptionally()); | ||
} | ||
} |
Oops, something went wrong.