Skip to content

Commit

Permalink
update new test case files[beetp]
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris2018998 committed Mar 11, 2024
1 parent 69ce1eb commit fecff97
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/test/java/org/stone/beetp/config/PoolConfigCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import org.stone.base.TestCase;
import org.stone.beetp.TaskServiceConfig;
import org.stone.beetp.exception.TaskServiceConfigException;
import org.stone.beetp.pool.exception.TaskServiceConfigException;

import java.lang.reflect.Field;
import java.util.LinkedList;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/stone/beetp/join/ArraySumJoinOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public Task<Integer>[] split(Task task) {
public Integer join(TaskHandle<Integer>[] children) {
int sum = 0;
for (TaskHandle<Integer> handle : children) {
try {
sum += handle.get();
} catch (Exception e) {
}
try {
sum += handle.get();
} catch (Exception e) {
}
}
return sum;
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/stone/beetp/once/GetTimeoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.stone.beetp.TaskHandle;
import org.stone.beetp.TaskService;
import org.stone.beetp.TaskServiceConfig;
import org.stone.beetp.exception.TaskResultGetTimeoutException;
import org.stone.beetp.pool.exception.TaskResultGetTimeoutException;

import java.util.concurrent.TimeUnit;

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/stone/beetp/once/InvokeAllTimeoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import static org.stone.beetp.TaskStates.TASK_CALL_EXCEPTION;
import static org.stone.beetp.TaskStates.TASK_CANCELLED;
import static org.stone.beetp.TaskStates.TASK_EXEC_EXCEPTION;

public class InvokeAllTimeoutTest extends TestCase {
public void test() throws Exception {
Expand All @@ -38,7 +38,7 @@ public void test() throws Exception {

for (TaskHandle handle : handleList) {
int state = handle.getState();
if (state == TASK_CANCELLED || state == TASK_CALL_EXCEPTION) {
if (state == TASK_CANCELLED || state == TASK_EXEC_EXCEPTION) {
existException = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/stone/beetp/once/InvokeAnyNormalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.ArrayList;
import java.util.List;

import static org.stone.beetp.TaskStates.TASK_CALL_EXCEPTION;
import static org.stone.beetp.TaskStates.TASK_EXEC_EXCEPTION;

public class InvokeAnyNormalTest extends TestCase {
public void test() throws Exception {
Expand All @@ -30,6 +30,6 @@ public void test() throws Exception {
taskList.add(new ExceptionTask());
taskList.add(new HelloTask());
TaskHandle handle = service.invokeAny(taskList);
if (handle.getState() == TASK_CALL_EXCEPTION) TestUtil.assertError("InvokeAny test failed");
if (handle.getState() == TASK_EXEC_EXCEPTION) TestUtil.assertError("InvokeAny test failed");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.stone.base.TestCase;
import org.stone.base.TestUtil;
import org.stone.beetp.*;
import org.stone.beetp.exception.TaskResultGetTimeoutException;
import org.stone.beetp.pool.exception.TaskResultGetTimeoutException;

import java.util.ArrayList;
import java.util.List;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/stone/beetp/once/TaskInterruptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.stone.beetp.TaskHandle;
import org.stone.beetp.TaskService;
import org.stone.beetp.TaskServiceConfig;
import org.stone.beetp.exception.TaskExecutionException;
import org.stone.beetp.pool.exception.TaskExecutionException;

/**
* cancel test
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/stone/beetp/once/TaskRejectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.stone.beetp.HelloTask;
import org.stone.beetp.TaskService;
import org.stone.beetp.TaskServiceConfig;
import org.stone.beetp.exception.TaskRejectedException;
import org.stone.beetp.pool.exception.TaskRejectedException;

/**
* task reject test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface TimeMonitorTaskThreadsFactory {

public TimeMonitorTaskSubmitThread[] create(TimeMonitorTaskPoolInitConfig config);
TimeMonitorTaskSubmitThread[] create(TimeMonitorTaskPoolInitConfig config);

public void shutdownTaskPool();
void shutdownTaskPool();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

import static org.stone.beetp.TaskStates.TASK_CALL_RESULT;
import static org.stone.beetp.TaskStates.TASK_EXEC_RESULT;

/**
* OnceTimedTaskTest
Expand All @@ -37,7 +37,7 @@ public void test() throws Exception {

if (handle.isPeriodic()) TestUtil.assertError("Once Timed Task can't be periodic");
if (!"Hello".equals(handle.get())) TestUtil.assertError("Once Timed Task test failed");
if (handle.getState() != TASK_CALL_RESULT) TestUtil.assertError("Once Timed Task test failed");
if (handle.getState() != TASK_EXEC_RESULT) TestUtil.assertError("Once Timed Task test failed");
if (!callback.beforeInd || !callback.onCallDoneInd) TestUtil.assertError("Call back test Failed");
if (!"Hello".equals(callback.result)) TestUtil.assertError("Call back test Failed");
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/stone/beetp/schedlue/OnceTimedTaskTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

import static org.stone.beetp.TaskStates.TASK_CALL_RESULT;
import static org.stone.beetp.TaskStates.TASK_EXEC_RESULT;

/**
* OnceTimedTaskTest
Expand All @@ -39,6 +39,6 @@ public void test() throws Exception {

if (handle.isPeriodic()) TestUtil.assertError("Once Timed Task can't be periodic");
if (!"Hello".equals(handle.get())) TestUtil.assertError("Once Timed Task test failed");
if (handle.getState() != TASK_CALL_RESULT) TestUtil.assertError("Once Timed Task test failed");
if (handle.getState() != TASK_EXEC_RESULT) TestUtil.assertError("Once Timed Task test failed");
}
}

0 comments on commit fecff97

Please sign in to comment.