public void testPact(@Observes EventContext<Test> testEventContext) throws Throwable { final Test event = testEventContext.getEvent(); final TestClass testClass = event.getTestClass(); final PactVerification pactVerification = event.getTestMethod().getAnnotation(PactVerification.class); if (pactVerification == null) { logger.log(Level.INFO, String.format("Method %s is not annotated with %s annotation and it is going to be executed as normal junit test.", event.getTestMethod().getName(), PactVerification.class.getName())); testEventContext.proceed(); return; } executeConsumerTest(testEventContext, testClass, pactVerification); }
public void beforeTest(@Observes(precedence = 100) EventContext<Before> context) { Object inspectionObject = context.getEvent().getTestInstance(); if (!executedInspections.contains(inspectionObject)) { executedInspections.add(inspectionObject); beforeClass.fire(new BeforeClass(inspectionObject.getClass())); } context.proceed(); }
public void endTransactionAfterTest(@Observes(precedence = -1) EventContext<After> afterTestContext) { try { afterTestContext.proceed(); } finally { endTransaction(afterTestContext.getEvent()); } }
public void createSuiteContext(@Observes(precedence = 100) EventContext<SuiteEvent> context) { SuiteContext suiteContext = this.suiteContextInstance.get(); try { suiteContext.activate(); context.proceed(); } finally { suiteContext.deactivate(); if (AfterSuite.class.isAssignableFrom(context.getEvent().getClass())) { suiteContext.destroy(); } } }
public void setup(@Observes EventContext<SetupContainer> setup) throws Exception { SetupContainer event = setup.getEvent(); if (isChameleonContainer(event)) { initiateChameleon(event); } setup.proceed(); }
public void restoreOriginalFieldValues(@Observes(precedence = 100) EventContext<After> context) { final Object testInstance = context.getEvent().getTestInstance(); try { context.proceed(); } finally { restoreFields(testInstance); } }
public void deactivateApplicationContext(@Observes(precedence = 100) EventContext<PassivateManager> context) { try { context.proceed(); } finally { context.getEvent().getManager().getContext(ApplicationContext.class).deactivate(); } } }
public void createContainerContext(@Observes EventContext<ContainerControlEvent> context) { ContainerContext containerContext = this.containerContext.get(); ContainerControlEvent event = context.getEvent(); try { containerContext.activate(event.getContainerName()); context.proceed(); } finally { containerContext.deactivate(); } }
public void createDeploymentContext(@Observes EventContext<DeploymentEvent> context) { DeploymentContext deploymentContext = this.deploymentContext.get(); try { DeploymentEvent event = context.getEvent(); deploymentContext.activate(event.getDeployment()); context.proceed(); } finally { deploymentContext.deactivate(); } } }
public void createContainerContext(@Observes EventContext<ContainerControlEvent> context) { ContainerContext containerContext = this.containerContext.get(); ContainerControlEvent event = context.getEvent(); try { containerContext.activate(event.getContainerName()); context.proceed(); } finally { containerContext.deactivate(); } }
@Override public void aroundCleanup(@Observes EventContext<CleanupData> context) { if (!configuration.get().isDumpData()) { context.proceed(); return; } CleanupData event = context.getEvent(); dumpDatabaseState(event, Phase.BEFORE_CLEAN); context.proceed(); dumpDatabaseState(event, Phase.AFTER_CLEAN); }
@Override public void aroundDataSeeding(@Observes EventContext<PrepareDBUnitData> context) { if (!configuration.get().isDumpData()) { context.proceed(); return; } PrepareDBUnitData event = context.getEvent(); dumpDatabaseState(event, Phase.BEFORE_SEED); context.proceed(); dumpDatabaseState(event, Phase.AFTER_SEED); }