@Test public void testExecuteWithQueueAsyncAction() throws Throwable { transDef.setReadOnly(false); final List<UserActionRequest> requests = new ArrayList<UserActionRequest>(); requests.add(userActionRequest); final TaskHandlerActionContext<ActionContext> taskHandlerActionContextMock = context .mock(TaskHandlerActionContext.class); setupTaskHandlerTransactionContext(false, taskHandlerActionContextMock, false); sut.execute(asyncActionContextMock, queueSubmitterActionMock); context.assertIsSatisfied(); }
public Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction) { Serializable results = null; DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setName(inAsyncAction.toString()); transDef.setReadOnly(inAsyncAction.isReadOnly()); TransactionStatus transStatus = transMgr.getTransaction(transDef); try { inAsyncAction.getValidationStrategy().validate(inAsyncActionContext); results = inAsyncAction.getExecutionStrategy().execute(inAsyncActionContext); transMgr.commit(transStatus); } catch (ValidationException vex) { onException(transStatus); logger.warn("Validation failed for the current action.", vex); for (Entry<String, String> currentError : vex.getErrors().entrySet()) { logger.warn("Validation key: " + currentError.getKey() + ", value: " + currentError.getValue()); } throw vex; } catch (ExecutionException eex) { onException(transStatus); logger.error("Error occurred during execution.", eex); throw eex; } catch (Exception ex) { onException(transStatus); logger.error("Error occurred performing transaction.", ex); throw new GeneralException(ex); } return results; }
AsyncActionController implements AsynchronousActionController { public Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction) { Serializable results = null; DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setName(inAsyncAction.toString()); transDef.setReadOnly(inAsyncAction.isReadOnly()); TransactionStatus transStatus = transMgr.getTransaction(transDef); try { inAsyncAction.getValidationStrategy().validate(inAsyncActionContext); results = inAsyncAction.getExecutionStrategy().execute(inAsyncActionContext); transMgr.commit(transStatus); } catch (ValidationException vex) { onException(transStatus); logger.warn("Validation failed for the current action.", vex); for (Entry<String, String> currentError : vex.getErrors().entrySet()) { logger.warn("Validation key: " + currentError.getKey() + ", value: " + currentError.getValue()); } throw vex; } catch (ExecutionException eex) { onException(transStatus); logger.error("Error occurred during execution.", eex); throw eex; } catch (Exception ex) { onException(transStatus); logger.error("Error occurred performing transaction.", ex); throw new GeneralException(ex); } return results; } }
AsyncActionController implements AsynchronousActionController { public Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction) { Serializable results = null; DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setName(inAsyncAction.toString()); transDef.setReadOnly(inAsyncAction.isReadOnly()); TransactionStatus transStatus = transMgr.getTransaction(transDef); try { inAsyncAction.getValidationStrategy().validate(inAsyncActionContext); results = inAsyncAction.getExecutionStrategy().execute(inAsyncActionContext); transMgr.commit(transStatus); } catch (ValidationException vex) { onException(transStatus); logger.warn("Validation failed for the current action.", vex); for (Entry<String, String> currentError : vex.getErrors().entrySet()) { logger.warn("Validation key: " + currentError.getKey() + ", value: " + currentError.getValue()); } throw vex; } catch (ExecutionException eex) { onException(transStatus); logger.error("Error occurred during execution.", eex); throw eex; } catch (Exception ex) { onException(transStatus); logger.error("Error occurred performing transaction.", ex); throw new GeneralException(ex); } return results; } AsyncActionController(final PlatformTransactionManager inTransMgr); }
AsyncActionController implements AsynchronousActionController { public Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction) { Serializable results = null; DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setName(inAsyncAction.toString()); transDef.setReadOnly(inAsyncAction.isReadOnly()); TransactionStatus transStatus = transMgr.getTransaction(transDef); try { inAsyncAction.getValidationStrategy().validate(inAsyncActionContext); results = inAsyncAction.getExecutionStrategy().execute(inAsyncActionContext); transMgr.commit(transStatus); } catch (ValidationException vex) { onException(transStatus); logger.warn("Validation failed for the current action.", vex); for (Entry<String, String> currentError : vex.getErrors().entrySet()) { logger.warn("Validation key: " + currentError.getKey() + ", value: " + currentError.getValue()); } throw vex; } catch (ExecutionException eex) { onException(transStatus); logger.error("Error occurred during execution.", eex); throw eex; } catch (Exception ex) { onException(transStatus); logger.error("Error occurred performing transaction.", ex); throw new GeneralException(ex); } return results; } AsyncActionController(final PlatformTransactionManager inTransMgr); Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction); @SuppressWarnings("unchecked") Serializable execute(final AsyncActionContext inAsyncActionContext,
            final TaskHandlerAction inTaskHandlerAction); }
AsyncActionController implements AsynchronousActionController { public Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction) { Serializable results = null; DefaultTransactionDefinition transDef = new DefaultTransactionDefinition(); transDef.setName(inAsyncAction.toString()); transDef.setReadOnly(inAsyncAction.isReadOnly()); TransactionStatus transStatus = transMgr.getTransaction(transDef); try { inAsyncAction.getValidationStrategy().validate(inAsyncActionContext); results = inAsyncAction.getExecutionStrategy().execute(inAsyncActionContext); transMgr.commit(transStatus); } catch (ValidationException vex) { onException(transStatus); logger.warn("Validation failed for the current action.", vex); for (Entry<String, String> currentError : vex.getErrors().entrySet()) { logger.warn("Validation key: " + currentError.getKey() + ", value: " + currentError.getValue()); } throw vex; } catch (ExecutionException eex) { onException(transStatus); logger.error("Error occurred during execution.", eex); throw eex; } catch (Exception ex) { onException(transStatus); logger.error("Error occurred performing transaction.", ex); throw new GeneralException(ex); } return results; } AsyncActionController(final PlatformTransactionManager inTransMgr); Serializable execute(final AsyncActionContext inAsyncActionContext, final AsyncAction inAsyncAction); @SuppressWarnings("unchecked") Serializable execute(final AsyncActionContext inAsyncActionContext,
            final TaskHandlerAction inTaskHandlerAction);  }