private void sendStageUpdate(TaskState.TaskStage stage, Throwable e) { State fail = new State(); fail.taskInfo = new TaskState(); fail.taskInfo.stage = stage; if (e != null) { fail.taskInfo.failure = Utils.toServiceErrorResponse(e); } this.sendSelfPatch(fail, TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString(), null); }
private void sendStageUpdate(TaskState.TaskStage stage, Throwable e) { State fail = new State(); fail.taskInfo = new TaskState(); fail.taskInfo.stage = stage; if (e != null) { fail.taskInfo.failure = Utils.toServiceErrorResponse(e); } this.sendSelfPatch(fail, TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString(), null); }
get.setContextId(TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString());
private void validate(Operation op, String expectedContextId, String caller) { logFine("%s(%s): expected cid[%s] op cid[%s] thread cid[%s]", caller, op.getId(), expectedContextId, op.getContextId(), OperationContext.getContextId()); if (Objects.equals( op.getContextId(), TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString())) { return; } if (!Objects.equals(op.getContextId(), expectedContextId)) { throw new IllegalArgumentException( String.format("%s(%s): operation contextId invalid: expected[%s] got[%s]", caller, op.getId(), expectedContextId, op.getContextId())); } if (!Objects.equals(OperationContext.getContextId(), expectedContextId)) { throw new IllegalStateException( String.format("%s(%s): thread contextId invalid: expected[%s] got[%s]", caller, op.getId(), expectedContextId, OperationContext.getContextId())); } }
get.setContextId(TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString());
private void validate(Operation op, String expectedContextId, String caller) { logFine("%s(%s): expected cid[%s] op cid[%s] thread cid[%s]", caller, op.getId(), expectedContextId, op.getContextId(), OperationContext.getContextId()); if (Objects.equals( op.getContextId(), TestProperty.DISABLE_CONTEXT_ID_VALIDATION.toString())) { return; } if (!Objects.equals(op.getContextId(), expectedContextId)) { throw new IllegalArgumentException( String.format("%s(%s): operation contextId invalid: expected[%s] got[%s]", caller, op.getId(), expectedContextId, op.getContextId())); } if (!Objects.equals(OperationContext.getContextId(), expectedContextId)) { throw new IllegalStateException( String.format("%s(%s): thread contextId invalid: expected[%s] got[%s]", caller, op.getId(), expectedContextId, OperationContext.getContextId())); } }
post.setContextId(TestProperty.SET_CONTEXT_ID.toString());
post.setContextId(TestProperty.SET_CONTEXT_ID.toString());
stateWithContextId.taskInfo = new TaskState(); stateWithContextId.taskInfo.stage = TaskState.TaskStage.STARTED; stateWithContextId.startContextId = TestProperty.SET_CONTEXT_ID.toString(); stateWithContextId.getContextId = UUID.randomUUID().toString(); stateWithContextId.patchContextId = UUID.randomUUID().toString();
stateWithContextId.taskInfo = new TaskState(); stateWithContextId.taskInfo.stage = TaskState.TaskStage.STARTED; stateWithContextId.startContextId = TestProperty.SET_CONTEXT_ID.toString(); stateWithContextId.getContextId = UUID.randomUUID().toString(); stateWithContextId.patchContextId = UUID.randomUUID().toString();