Skip to content

Commit 23febff

Browse files
author
Artur Ciocanu
committed
Adjusting the class names based on feedback
Signed-off-by: Artur Ciocanu <[email protected]>
1 parent a0f6511 commit 23febff

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

sdk-workflows/src/main/java/io/dapr/workflows/runtime/DaprWorkflowActivityContext.java renamed to sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowActivityContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Wrapper for Durable Task Framework {@link TaskActivityContext}.
2121
*/
22-
class DaprWorkflowActivityContext implements WorkflowActivityContext {
22+
class DefaultWorkflowActivityContext implements WorkflowActivityContext {
2323
private final TaskActivityContext innerContext;
2424

2525
/**
@@ -28,7 +28,7 @@ class DaprWorkflowActivityContext implements WorkflowActivityContext {
2828
* @param context TaskActivityContext
2929
* @throws IllegalArgumentException if context is null
3030
*/
31-
public DaprWorkflowActivityContext(TaskActivityContext context) throws IllegalArgumentException {
31+
public DefaultWorkflowActivityContext(TaskActivityContext context) throws IllegalArgumentException {
3232
if (context == null) {
3333
throw new IllegalArgumentException("Context cannot be null");
3434
}

sdk-workflows/src/main/java/io/dapr/workflows/runtime/DaprWorkflowContext.java renamed to sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.microsoft.durabletask.TaskOptions;
2020
import com.microsoft.durabletask.TaskOrchestrationContext;
2121
import io.dapr.workflows.WorkflowContext;
22-
import io.dapr.workflows.runtime.saga.DaprSagaContext;
22+
import io.dapr.workflows.runtime.saga.DefaultSagaContext;
2323
import io.dapr.workflows.saga.Saga;
2424
import io.dapr.workflows.saga.SagaContext;
2525
import org.slf4j.Logger;
@@ -33,7 +33,7 @@
3333
import java.util.List;
3434
import java.util.UUID;
3535

36-
public class DaprWorkflowContext implements WorkflowContext {
36+
public class DefaultWorkflowContext implements WorkflowContext {
3737
private final TaskOrchestrationContext innerContext;
3838
private final Logger logger;
3939
private final Saga saga;
@@ -44,7 +44,7 @@ public class DaprWorkflowContext implements WorkflowContext {
4444
* @param context TaskOrchestrationContext
4545
* @throws IllegalArgumentException if context is null
4646
*/
47-
public DaprWorkflowContext(TaskOrchestrationContext context) throws IllegalArgumentException {
47+
public DefaultWorkflowContext(TaskOrchestrationContext context) throws IllegalArgumentException {
4848
this(context, LoggerFactory.getLogger(WorkflowContext.class));
4949
}
5050

@@ -55,11 +55,11 @@ public DaprWorkflowContext(TaskOrchestrationContext context) throws IllegalArgum
5555
* @param logger Logger
5656
* @throws IllegalArgumentException if context or logger is null
5757
*/
58-
public DaprWorkflowContext(TaskOrchestrationContext context, Logger logger) throws IllegalArgumentException {
58+
public DefaultWorkflowContext(TaskOrchestrationContext context, Logger logger) throws IllegalArgumentException {
5959
this(context, logger, null);
6060
}
6161

62-
public DaprWorkflowContext(TaskOrchestrationContext context, Saga saga) throws IllegalArgumentException {
62+
public DefaultWorkflowContext(TaskOrchestrationContext context, Saga saga) throws IllegalArgumentException {
6363
this(context, LoggerFactory.getLogger(WorkflowContext.class), saga);
6464
}
6565

@@ -71,7 +71,7 @@ public DaprWorkflowContext(TaskOrchestrationContext context, Saga saga) throws I
7171
* @param saga saga object, if null, saga is disabled
7272
* @throws IllegalArgumentException if context or logger is null
7373
*/
74-
public DaprWorkflowContext(TaskOrchestrationContext context, Logger logger, Saga saga)
74+
public DefaultWorkflowContext(TaskOrchestrationContext context, Logger logger, Saga saga)
7575
throws IllegalArgumentException {
7676
if (context == null) {
7777
throw new IllegalArgumentException("Context cannot be null");
@@ -249,6 +249,6 @@ public SagaContext getSagaContext() {
249249
throw new UnsupportedOperationException("Saga is not enabled");
250250
}
251251

252-
return new DaprSagaContext(this.saga, this);
252+
return new DefaultSagaContext(this.saga, this);
253253
}
254254
}

sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowActivityWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public TaskActivity create() {
6363
);
6464
}
6565

66-
result = activity.run(new DaprWorkflowActivityContext(ctx));
66+
result = activity.run(new DefaultWorkflowActivityContext(ctx));
6767
return result;
6868
};
6969
}

sdk-workflows/src/main/java/io/dapr/workflows/runtime/WorkflowWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public TaskOrchestration create() {
5858

5959
if (workflow.getSagaOption() != null) {
6060
Saga saga = new Saga(workflow.getSagaOption());
61-
workflow.run(new DaprWorkflowContext(ctx, saga));
61+
workflow.run(new DefaultWorkflowContext(ctx, saga));
6262
} else {
63-
workflow.run(new DaprWorkflowContext(ctx));
63+
workflow.run(new DefaultWorkflowContext(ctx));
6464
}
6565
};
6666

sdk-workflows/src/main/java/io/dapr/workflows/runtime/saga/DaprSagaContext.java renamed to sdk-workflows/src/main/java/io/dapr/workflows/runtime/saga/DefaultSagaContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Dapr Saga Context implementation.
2222
*/
23-
public class DaprSagaContext implements SagaContext {
23+
public class DefaultSagaContext implements SagaContext {
2424

2525
private final Saga saga;
2626
private final WorkflowContext workflowContext;
@@ -32,7 +32,7 @@ public class DaprSagaContext implements SagaContext {
3232
* @param workflowContext Workflow context.
3333
* @throws IllegalArgumentException if saga or workflowContext is null.
3434
*/
35-
public DaprSagaContext(Saga saga, WorkflowContext workflowContext) {
35+
public DefaultSagaContext(Saga saga, WorkflowContext workflowContext) {
3636
if (saga == null) {
3737
throw new IllegalArgumentException("Saga should not be null");
3838
}

sdk-workflows/src/test/java/io/dapr/workflows/DaprWorkflowContextTest.java renamed to sdk-workflows/src/test/java/io/dapr/workflows/DefaultWorkflowContextTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.microsoft.durabletask.TaskOptions;
2121
import com.microsoft.durabletask.TaskOrchestrationContext;
2222

23-
import io.dapr.workflows.runtime.DaprWorkflowContext;
23+
import io.dapr.workflows.runtime.DefaultWorkflowContext;
2424
import io.dapr.workflows.saga.Saga;
2525
import io.dapr.workflows.saga.SagaContext;
2626

@@ -44,15 +44,15 @@
4444
import static org.mockito.Mockito.when;
4545
import static org.junit.jupiter.api.Assertions.assertThrows;
4646

47-
public class DaprWorkflowContextTest {
48-
private DaprWorkflowContext context;
47+
public class DefaultWorkflowContextTest {
48+
private DefaultWorkflowContext context;
4949
private TaskOrchestrationContext mockInnerContext;
5050
private WorkflowContext testWorkflowContext;
5151

5252
@BeforeEach
5353
public void setUp() {
5454
mockInnerContext = mock(TaskOrchestrationContext.class);
55-
context = new DaprWorkflowContext(mockInnerContext);
55+
context = new DefaultWorkflowContext(mockInnerContext);
5656
testWorkflowContext = new WorkflowContext() {
5757
@Override
5858
public Logger getLogger() {
@@ -191,13 +191,13 @@ public void callActivityTest() {
191191
@Test
192192
public void DaprWorkflowContextWithEmptyInnerContext() {
193193
assertThrows(IllegalArgumentException.class, () -> {
194-
context = new DaprWorkflowContext(mockInnerContext, (Logger)null);
194+
context = new DefaultWorkflowContext(mockInnerContext, (Logger)null);
195195
}); }
196196

197197
@Test
198198
public void DaprWorkflowContextWithEmptyLogger() {
199199
assertThrows(IllegalArgumentException.class, () -> {
200-
context = new DaprWorkflowContext(null, (Logger)null);
200+
context = new DefaultWorkflowContext(null, (Logger)null);
201201
});
202202
}
203203

@@ -217,7 +217,7 @@ public void getIsReplayingTest() {
217217
public void getLoggerReplayingTest() {
218218
Logger mockLogger = mock(Logger.class);
219219
when(context.isReplaying()).thenReturn(true);
220-
DaprWorkflowContext testContext = new DaprWorkflowContext(mockInnerContext, mockLogger);
220+
DefaultWorkflowContext testContext = new DefaultWorkflowContext(mockInnerContext, mockLogger);
221221

222222
String expectedArg = "test print";
223223
testContext.getLogger().info(expectedArg);
@@ -229,7 +229,7 @@ public void getLoggerReplayingTest() {
229229
public void getLoggerFirstTimeTest() {
230230
Logger mockLogger = mock(Logger.class);
231231
when(context.isReplaying()).thenReturn(false);
232-
DaprWorkflowContext testContext = new DaprWorkflowContext(mockInnerContext, mockLogger);
232+
DefaultWorkflowContext testContext = new DefaultWorkflowContext(mockInnerContext, mockLogger);
233233

234234
String expectedArg = "test print";
235235
testContext.getLogger().info(expectedArg);
@@ -323,15 +323,15 @@ public void newUuidTestNoImplementationExceptionTest() {
323323
@Test
324324
public void getSagaContextTest_sagaEnabled() {
325325
Saga saga = mock(Saga.class);
326-
WorkflowContext context = new DaprWorkflowContext(mockInnerContext, saga);
326+
WorkflowContext context = new DefaultWorkflowContext(mockInnerContext, saga);
327327

328328
SagaContext sagaContext = context.getSagaContext();
329329
assertNotNull("SagaContext should not be null", sagaContext);
330330
}
331331

332332
@Test
333333
public void getSagaContextTest_sagaDisabled() {
334-
WorkflowContext context = new DaprWorkflowContext(mockInnerContext);
334+
WorkflowContext context = new DefaultWorkflowContext(mockInnerContext);
335335
assertThrows(UnsupportedOperationException.class, () -> {
336336
context.getSagaContext();
337337
});

sdk-workflows/src/test/java/io/dapr/workflows/saga/DaprSagaContextTest.java renamed to sdk-workflows/src/test/java/io/dapr/workflows/saga/DefaultSagaContextTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66
import static org.mockito.Mockito.times;
77
import static org.mockito.Mockito.verify;
88

9-
import io.dapr.workflows.runtime.saga.DaprSagaContext;
9+
import io.dapr.workflows.runtime.saga.DefaultSagaContext;
1010
import org.junit.Test;
1111

1212
import io.dapr.workflows.WorkflowContext;
1313

14-
public class DaprSagaContextTest {
14+
public class DefaultSagaContextTest {
1515

1616
@Test
1717
public void testDaprSagaContextImpl_IllegalArgumentException() {
1818
Saga saga = mock(Saga.class);
1919
WorkflowContext workflowContext = mock(WorkflowContext.class);
2020

2121
assertThrows(IllegalArgumentException.class, () -> {
22-
new DaprSagaContext(saga, null);
22+
new DefaultSagaContext(saga, null);
2323
});
2424

2525
assertThrows(IllegalArgumentException.class, () -> {
26-
new DaprSagaContext(null, workflowContext);
26+
new DefaultSagaContext(null, workflowContext);
2727
});
2828
}
2929

3030
@Test
3131
public void test_registerCompensation() {
3232
Saga saga = mock(Saga.class);
3333
WorkflowContext workflowContext = mock(WorkflowContext.class);
34-
DaprSagaContext ctx = new DaprSagaContext(saga, workflowContext);
34+
DefaultSagaContext ctx = new DefaultSagaContext(saga, workflowContext);
3535

3636
String activityClassName = "name1";
3737
Object activityInput = new Object();
@@ -45,7 +45,7 @@ public void test_registerCompensation() {
4545
public void test_compensate() {
4646
Saga saga = mock(Saga.class);
4747
WorkflowContext workflowContext = mock(WorkflowContext.class);
48-
DaprSagaContext ctx = new DaprSagaContext(saga, workflowContext);
48+
DefaultSagaContext ctx = new DefaultSagaContext(saga, workflowContext);
4949

5050
doNothing().when(saga).compensate(workflowContext);
5151

0 commit comments

Comments
 (0)