Examples of TxHandler


Examples of ch.inftec.ju.db.TxHandler

    }
  }
 
  @Override
  public void runTestMethodInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      logger.debug(String.format("Running Test %s", handler));
  //    this.dateProvider.resetProvider();
     
      // Run the test method
      try {
        handler.executeTestMethod();
      } catch (Throwable t) {
        // Special handling for assumption exceptions. They contain unserializable data, so we create a new
        // one that doesn't contain this extra info.
        if (t instanceof InvocationTargetException) {
          InvocationTargetException ite = (InvocationTargetException) t;
          AssumptionViolatedException ave = JuObjectUtils.as(ite.getTargetException(), AssumptionViolatedException.class);
          if (ave != null) {
            throw new AssumptionViolatedException(ave.getMessage());
          }
        }
        throw t;
      }
      txHandler.commit(); // Perform a commit after the execution of the test method
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

  }
 
  @Override
  public void runPostTestActionsInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    // Run post server annotations in an own annotation so any changed made there is available in the export / verifying phase
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostServerCode(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    }
   
    // Run post test annotations (export, verify)
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostTestAnnotations(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    } finally {
      if (JuUtils.getJuPropertyChain().get("ju-testing-ee.clearPropertyChainAfterEachTest", Boolean.class, "false")) {
        JuUtils.clearPropertyChain();
      }
    }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler


  @Override
  public Object runMethodInEjbContext(String className, String methodName,
      Class<?> argumentTypes[], Object[] args) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      Class<?> clazz = Class.forName(className);
      Object instance = clazz.newInstance();
     
      Method method = clazz.getMethod(methodName, argumentTypes);
      Object res = method.invoke(instance, args);
     
      txHandler.commit();
      return res;
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

//  @Inject
//  private DateProvider dateProvider;
 
  @Override
  public void runPreTestActionsInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePreTestAnnotations(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

    }
  }
 
  @Override
  public void runTestMethodInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      logger.debug(String.format("Running Test %s", handler));
  //    this.dateProvider.resetProvider();
     
      // Run the test method
      handler.executeTestMethod();

      txHandler.commit(); // Perform a commit after the execution of the test method
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

  }
 
  @Override
  public void runPostTestActionsInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    // Run post server annotations in an own annotation so any changed made there is available in the export / verifying phase
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostServerCode(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    }
   
    // Run post test annotations (export, verify)
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostTestAnnotations(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    } finally {
      if (JuUtils.getJuPropertyChain().get("ju-testing-ee.clearPropertyChainAfterEachTest", Boolean.class, "false")) {
        JuUtils.clearPropertyChain();
      }
    }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler


  @Override
  public Object runMethodInEjbContext(String className, String methodName,
      Class<?> argumentTypes[], Object[] args) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      Class<?> clazz = Class.forName(className);
      Object instance = clazz.newInstance();
     
      Method method = clazz.getMethod(methodName, argumentTypes);
      Object res = method.invoke(instance, args);
     
      txHandler.commit();
      return res;
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

 
  @Override
  public SystemPropertyTempSetter runPreTestActionsInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    SystemPropertyTempSetter tempSetter = handler.initContainerTestEnv();
   
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePreTestAnnotations(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    } catch (Exception ex) {
      // Reset properties in case of an exception
      tempSetter.close();
      throw ex;
    }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

    return tempSetter;
  }
 
  @Override
  public void runTestMethodInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      logger.debug(String.format("Running Test %s", handler));
  //    this.dateProvider.resetProvider();
     
      // Run the test method
      handler.executeTestMethod(txHandler);

      txHandler.commit(); // Perform a commit after the execution of the test method
    }
  }
View Full Code Here

Examples of ch.inftec.ju.db.TxHandler

  }
 
  @Override
  public void runPostTestActionsInEjbContext(TestRunnerAnnotationHandler handler) throws Exception {
    // Run post server annotations in an own annotation so any changed made there is available in the export / verifying phase
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostServerCode(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    }
   
    // Run post test annotations (export, verify)
    try (TxHandler txHandler = new TxHandler(this.tx, true)) {
      // Execute post test annotations (dataset exporting, data verifying)
      handler.executePostTestAnnotations(new JuEmUtil(this.em));
      txHandler.commit(); // Commit after data verifying / exporting
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.