org.jboss.arquillian.test.spi.event.suite.AfterClass Java Examples
The following examples show how to use
org.jboss.arquillian.test.spi.event.suite.AfterClass.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeSuiteTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeSuite()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new After(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordSuiteVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordSuiteVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #2
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeClassTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeClass()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordClassVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordClassVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #3
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 6 votes |
@Test public void startBeforeTestTrueTest() throws Exception { Mockito.when(configuration.getStartBeforeTest()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #4
Source File: VideoLifecycleObserver.java From arquillian-recorder with Apache License 2.0 | 5 votes |
public void afterClass(@Observes AfterClass event) { if (strategy.get().isTakingAction(event)) { VideoMetaData metaData = getClassMetaData(event); VideoType videoType = getVideoType(); beforeVideoStop.fire(new BeforeVideoStop(videoType, metaData)); stopRecordClassVideo.fire(new StopRecordClassVideo(videoType, metaData)); afterVideoStop.fire(new AfterVideoStop(videoType, metaData)); } }
Example #5
Source File: AppServerTestEnricher.java From keycloak with Apache License 2.0 | 5 votes |
public void stopAppServer(@Observes(precedence = 2) AfterClass event) { if (testContext.getAppServerInfo() == null) { return; // no adapter test } ContainerController controller = containerConrollerInstance.get(); if (controller.isStarted(testContext.getAppServerInfo().getQualifier())) { log.info("Stopping app server: " + testContext.getAppServerInfo().getQualifier()); controller.stop(testContext.getAppServerInfo().getQualifier()); } }
Example #6
Source File: KeycloakContainerEventsController.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void execute(@Observes(precedence = 0) AfterClass event) { try { container.fire(new UnDeployManagedDeployments()); } finally { container.fire(new StopClassContainers()); } if (event.getTestClass().isAnnotationPresent(RestartContainer.class)) { afterOriginalContainerStop(event.getTestClass().getAnnotation(RestartContainer.class)); } }
Example #7
Source File: AuthServerTestEnricher.java From keycloak with Apache License 2.0 | 5 votes |
public void afterClass(@Observes(precedence = 1) AfterClass event) throws Exception { //check if a test accidentally left the auth-server not running ContainerController controller = containerConroller.get(); if (!controller.isStarted(suiteContext.getAuthServerInfo().getQualifier())) { log.warn("Auth server wasn't running. Starting " + suiteContext.getAuthServerInfo().getQualifier()); controller.start(suiteContext.getAuthServerInfo().getQualifier()); } TestContext testContext = testContextProducer.get(); Keycloak adminClient = testContext.getAdminClient(); KeycloakTestingClient testingClient = testContext.getTestingClient(); removeTestRealms(testContext, adminClient); if (!isAuthServerRemote() && event.getTestClass().isAnnotationPresent(EnableVault.class)) { VaultUtils.disableVault(suiteContext, event.getTestClass().getAnnotation(EnableVault.class).providerId()); restartAuthServer(); testContext.reconnectAdminClient(); } if (adminClient != null) { adminClient.close(); } if (testingClient != null) { testingClient.close(); } }
Example #8
Source File: AsciidoctorTestObserver.java From asciidoctorj with Apache License 2.0 | 5 votes |
public void afterTestClassShutdownSharedTemporaryFolderInstance(@Observes AfterClass afterClass) { TemporaryFolder temporaryFolder = scopedTemporaryFolder.get().getSharedTemporaryFolder(); if (temporaryFolder != null) { temporaryFolder.delete(); scopedTemporaryFolder.get().setSharedTemporaryFolder(null); } }
Example #9
Source File: AsciidoctorTestObserver.java From asciidoctorj with Apache License 2.0 | 5 votes |
public void afterTestClassShutdownSharedAsciidoctorInstance(@Observes AfterClass afterClass) { Asciidoctor asciidoctor = scopedAsciidoctor.get().getSharedAsciidoctor(); if (asciidoctor != null) { asciidoctor.shutdown(); scopedAsciidoctor.get().setSharedAsciidoctor(null); } }
Example #10
Source File: ReporterLifecycleObserver.java From arquillian-recorder with Apache License 2.0 | 5 votes |
private boolean shouldReport(org.jboss.arquillian.core.spi.event.Event event, String frequency) { if (event instanceof AfterClass && ReportFrequency.CLASS.toString().equals(frequency) || (event instanceof After && ReportFrequency.METHOD.toString().equals(frequency)) ) { return true; } return false; }
Example #11
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void takeOnlyOnFailTestPassedTest() throws Exception { Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(PropertyReportEvent.class, 0); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #12
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void takeOnlyOnFailTestFailedTest() throws Exception { Mockito.when(configuration.getTakeOnlyOnFail()).thenReturn(true); fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.failed(new RuntimeException("some exception"))); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 1); assertEventFired(StartRecordVideo.class, 1); assertEventFired(AfterVideoStart.class, 1); assertEventFired(PropertyReportEvent.class, 1); assertEventFired(BeforeVideoStop.class, 1); assertEventFired(StopRecordVideo.class, 1); assertEventFired(AfterVideoStop.class, 1); }
Example #13
Source File: RecorderLifecycleObserverTestCase.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void defaultConfigurationTest() throws Exception { // by default, no videos are taken at all fire(new VideoExtensionConfigured()); fire(new BeforeSuite()); fire(new BeforeClass(DummyTestCase.class)); fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test"))); bind(TestScoped.class, TestResult.class, TestResult.passed()); fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP)); fire(new AfterClass(DummyTestCase.class)); fire(new AfterSuite()); assertEventFired(BeforeVideoStart.class, 0); assertEventFired(StartRecordVideo.class, 0); assertEventFired(StartRecordSuiteVideo.class, 0); assertEventFired(AfterVideoStart.class, 0); assertEventFired(BeforeVideoStop.class, 0); assertEventFired(StopRecordVideo.class, 0); assertEventFired(StopRecordSuiteVideo.class, 0); assertEventFired(AfterVideoStop.class, 0); }
Example #14
Source File: DefaultVideoStrategy.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Override public boolean isTakingAction(Event event) { if (event instanceof BeforeSuite || event instanceof AfterSuite) { return configuration.getStartBeforeSuite(); } else if (event instanceof BeforeClass || event instanceof AfterClass) { return configuration.getStartBeforeClass(); } else if (event instanceof Before) { return configuration.getStartBeforeTest() || configuration.getTakeOnlyOnFail(); } return false; }
Example #15
Source File: ArquillianTestCleanUpExtension.java From tomee with Apache License 2.0 | 4 votes |
public void cleanup(@Observes final AfterClass ignored) { ActionSequence.reset(); // avoids to leak between tests, works in war cause of classloading but not in embedded mode }
Example #16
Source File: DeploymentExceptionObserver.java From tomee with Apache License 2.0 | 4 votes |
public void cleanUp(@Observes final AfterClass event) throws Exception { EXCEPTIONS.clear(); PARENT_EXCEPTIONS.clear(); }
Example #17
Source File: KeycloakContainerFeaturesController.java From keycloak with Apache License 2.0 | 4 votes |
public void handleEnableFeaturesAnnotationAfterClass(@Observes(precedence = 2) AfterClass event) throws Exception { checkAnnotatedElementForFeatureAnnotations(event.getTestClass().getJavaClass(), State.AFTER); }
Example #18
Source File: SkipperReporter.java From arquillian-governor with Apache License 2.0 | 3 votes |
public void on(@Observes AfterClass afterClass) { final List<TestSpec> testSpecs = holder.get().getAll(); if (this.asciiDocExporter.get() != null) { this.asciiDocExporter.get().append(testSpecs, afterClass.getTestClass().getJavaClass().getCanonicalName()); } propertyReportEvent.fire(new PropertyReportEvent(new TableExporter().constructReportTable(testSpecs))); holder.get().clear(); }
Example #19
Source File: ReporterLifecycleObserver.java From arquillian-recorder with Apache License 2.0 | 2 votes |
public void observeAfterClass(@Observes(precedence = Integer.MIN_VALUE) AfterClass event) { reporter.get().setReporterCursor(new ReporterCursor(reporter.get().getLastTestSuiteReport())); report(event, descriptor.get()); }