public CleanupData(TestEvent testEvent, BuiltInCleanupStrategy cleanupStrategy) { super(testEvent.getTestInstance(), testEvent.getTestMethod()); this.cleanupStrategy = cleanupStrategy; } }
/** * @param testInstance * The test case instance * @param testMethod * The test method * * @throws IllegalArgumentException * if testInstance is null * @throws IllegalArgumentException * if testMethod is null */ public TestEvent(Object testInstance, Method testMethod) { super(validateAndExtractClass(testInstance, testMethod)); this.testInstance = testInstance; this.testMethod = testMethod; }
private JpaCacheEviction obtainAnnotation(TestEvent event) { final JpaCacheEviction classLevel = event.getTestClass().getAnnotation(JpaCacheEviction.class); final JpaCacheEviction methodLevel = event.getTestMethod().getAnnotation(JpaCacheEviction.class); if (methodLevel != null) { return methodLevel; } return classLevel; }
@Override public boolean isTransactionHandlingDefinedOnMethodLevel(TestEvent testEvent) { return testEvent.getTestMethod().isAnnotationPresent(Transactional.class); }
public void createTestContext(@Observes(precedence = 100) EventContext<TestEvent> context) { TestContext testContext = this.testContextInstance.get(); try { testContext.activate(context.getEvent().getTestInstance()); synchronized (activatedTestContexts) { Class<?> testClass = context.getEvent().getTestClass().getJavaClass(); Set<Object> instances = activatedTestContexts.get(testClass); if (instances == null) { instances = new HashSet<Object>(); activatedTestContexts.put(testClass, instances); } instances.add(context.getEvent().getTestInstance()); } context.proceed(); } finally { testContext.deactivate(); } } }
private boolean schemaCreated(final TestEvent beforePersistenceTest) { return commandService.get() .execute( new SchemaCreationControlCommand(beforePersistenceTest.getTestInstance().getClass().getSimpleName())); } }
@Override public boolean isTransactionHandlingDefinedOnClassLevel(TestEvent testEvent) { return testEvent.getTestClass().isAnnotationPresent(Transactional.class); }
public static void matched(final StepDefinitionMatch match) { final TestEvent event; try { final Field field = StepDefinitionMatch.class.getDeclaredField("stepDefinition"); if (!field.isAccessible()) { field.setAccessible(true); } final StepDefinition stepDefinition = StepDefinition.class.cast(field.get(match)); if (ArquillianStepDefinition.class.isInstance(stepDefinition)) { final ArquillianStepDefinition arquillianStepDefinition = ArquillianStepDefinition.class.cast(stepDefinition); event = new TestEvent(arquillianStepDefinition.getInstance(), arquillianStepDefinition.getMethod()); TEST_EVENT.set(event); } else { // mock to still fire events but just as marker, TODO: don't use TestEvent? -> java 8 event = new TestEvent(TEST_EVENT, EventHelper.class.getMethod("currentEvent")); } } catch (final Exception e) { throw new IllegalStateException(e); } TEST_EVENT.set(event); }
private JpaCacheEviction obtainAnnotation(TestEvent event) { final JpaCacheEviction classLevel = event.getTestClass().getAnnotation(JpaCacheEviction.class); final JpaCacheEviction methodLevel = event.getTestMethod().getAnnotation(JpaCacheEviction.class); if (methodLevel != null) { return methodLevel; } return classLevel; }
@Override public boolean isTransactionHandlingDefinedOnMethodLevel(TestEvent testEvent) { return shouldWrapTestMethodInTransaction(testEvent.getTestMethod()); }
private boolean schemaCreated(final TestEvent beforePersistenceTest) { return commandService.get().execute(new SchemaCreationControlCommand(beforePersistenceTest.getTestInstance().getClass().getSimpleName())); } }
@Override public TransactionMode getTransactionModeFromClassLevel(TestEvent testEvent) { return testEvent.getTestClass().getAnnotation(Transactional.class).value(); }
public CleanupData(TestEvent testEvent, CleanupStrategy cleanupStrategy) { super(testEvent.getTestInstance(), testEvent.getTestMethod()); this.cleanupStrategy = cleanupStrategy; }
private JpaCacheEviction obtainAnnotation(TestEvent event) { final JpaCacheEviction classLevel = event.getTestClass().getAnnotation(JpaCacheEviction.class); final JpaCacheEviction methodLevel = event.getTestMethod().getAnnotation(JpaCacheEviction.class); if (methodLevel != null) { return methodLevel; } return classLevel; }
@Override public TransactionMode getTransactionModeFromMethodLevel(TestEvent testEvent) { return testEvent.getTestMethod().getAnnotation(Transactional.class).value(); } }
private boolean schemaCreated(final TestEvent beforePersistenceTest) { return commandService.get().execute(new SchemaCreationControlCommand(beforePersistenceTest.getTestInstance().getClass().getSimpleName())); } }
/** * @param testInstance * The test case instance * @param testMethod * The test method * * @throws IllegalArgumentException * if testInstance is null * @throws IllegalArgumentException * if testMethod is null */ public TestEvent(Object testInstance, Method testMethod) { super(validateAndExtractClass(testInstance, testMethod)); this.testInstance = testInstance; this.testMethod = testMethod; }
public CleanupData(TestEvent testEvent, CleanupStrategy cleanupStrategy) { super(testEvent.getTestInstance(), testEvent.getTestMethod()); this.cleanupStrategy = cleanupStrategy; }
private BlurLevel resolveBlurLevel(TestEvent event) { if (event.getTestMethod().getAnnotation(Blur.class) != null) { return event.getTestMethod().getAnnotation(Blur.class).value(); } else { Class<? extends TestClass> testClass = event.getTestClass().getClass(); Class<?> annotatedClass = ReflectionUtil.getClassWithAnnotation(testClass, Blur.class); BlurLevel blurLevel = null; if (annotatedClass != null) { blurLevel = annotatedClass .getAnnotation(Blur.class).value(); } return blurLevel; } }
@Override public boolean isTransactionHandlingDefinedOnMethodLevel(TestEvent testEvent) { return shouldWrapTestMethodInTransaction(testEvent.getTestMethod()); }