private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
public void stopContainerObjects(@Observes(precedence = 100) After afterClass) { final ConnectionMode connectionMode = ConnectionMode.START_AND_STOP_AROUND_METHOD; final TestClass testClass = afterClass.getTestClass(); stopAndDestroyCubes(connectionMode, testClass); }
public void stopContainerObjects(@Observes(precedence = 100) After afterClass) { final ConnectionMode connectionMode = ConnectionMode.START_AND_STOP_AROUND_METHOD; final TestClass testClass = afterClass.getTestClass(); stopAndDestroyCubes(connectionMode, testClass); }
public void removeKubernetesResourcesAtMethodScope(@Observes(precedence = -10) After afterMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient); }
public void removeIstioResourcesAtMethodScope(@Observes(precedence = 20) After afterMethod, final IstioClient istioClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting Istio resource for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testMethod), istioClient, findRestoreAnnotations(testMethod)); }
public void removeKubernetesResourcesAtMethodScope(@Observes(precedence = -10) After afterMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
/** * <p>The after test event handler.</p> * * <p>Delegates to the registered {@link ApplicationContextProducer} instances in order to create the application * context.</p> * * @param event the after test event */ public void afterTest(@Observes After event) { ContextLifeCycleMode mode = getContextLifeCycleMode(event.getTestClass()); if (mode == ContextLifeCycleMode.TEST) { destroyTestApplicationContext(); } }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
void cleanAfter(@Observes After after) { this.clean(after.getTestClass(), after.getTestMethod(), true); }
public void deleteOpenShiftResource(@Observes(precedence = -10) After event, OpenShiftAdapter client, CubeOpenShiftConfiguration cubeOpenShiftConfiguration) throws Exception { final TestClass testClass = event.getTestClass(); final Method testMethod = event.getTestMethod(); final Class<?> javaClass = testClass.getJavaClass(); final String templateKeyPrefix = createResourceKey(javaClass, testMethod); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); OpenShiftResourceFactory.deleteResources(javaClass, testMethod, client); OpenShiftResourceFactory.deleteTemplates(templateKeyPrefix, methodTemplateProcessor.getTemplates(), client, cubeOpenShiftConfiguration); }
void sendAfter(@Observes After event) throws Exception { if (WarpCommons.isWarpTest(event.getTestClass().getJavaClass())) { remoteOperationService().execute(new FireAfterSuiteOnServer()); } }
@Test public void should_move_recording_video() throws IOException, NoSuchMethodException { final File destination = temporaryFolder.newFolder("destination"); final File video = temporaryFolder.newFile("file.flv"); Files.write(video.toPath(), "Hello".getBytes()); when(seleniumContainers.getVideoRecordingFile()).thenReturn(video.toPath()); when(after.getTestClass()).thenReturn(new TestClass(VncRecorderLifecycleManagerTest.class)); when(after.getTestMethod()).thenReturn( VncRecorderLifecycleManagerTest.class.getMethod("should_move_recording_video")); Map<String, String> conf = new HashMap<>(); conf.put("videoOutput", destination.getAbsolutePath()); TestResult testResult = TestResult.passed(); VncRecorderLifecycleManager vncRecorderLifecycleManager = new VncRecorderLifecycleManager(); vncRecorderLifecycleManager.vnc = cube; vncRecorderLifecycleManager.afterVideoRecordedEvent = event; vncRecorderLifecycleManager.stopRecording(after, testResult, CubeDroneConfiguration.fromMap(conf), seleniumContainers ); assertThat(new File(destination, "org_arquillian_cube_docker_drone_VncRecorderLifecycleManagerTest_should_move_recording_video.flv")) .exists() .hasContent("Hello"); }
when(after.getTestClass()).thenReturn(new TestClass(VncRecorderLifecycleManagerTest.class)); when(after.getTestMethod()).thenReturn(VncRecorderLifecycleManagerTest.class.getMethod( "should_move_recording_if_configured_in_only_failing_and_failed_test"));
@Test public void should_discard_recording_if_configured_in_only_failing_and_passed_test() throws IOException, NoSuchMethodException { final File destination = temporaryFolder.newFolder("destination"); final File video = temporaryFolder.newFile("file.flv"); when(seleniumContainers.getVideoRecordingFile()).thenReturn(video.toPath()); when(after.getTestClass()).thenReturn(new TestClass(VncRecorderLifecycleManagerTest.class)); when(after.getTestMethod()).thenReturn(VncRecorderLifecycleManagerTest.class.getMethod( "should_discard_recording_if_configured_in_only_failing_and_passed_test")); Map<String, String> conf = new HashMap<>(); conf.put("videoOutput", destination.getAbsolutePath()); conf.put("recordingMode", "ONLY_FAILING"); TestResult testResult = TestResult.passed(); VncRecorderLifecycleManager vncRecorderLifecycleManager = new VncRecorderLifecycleManager(); vncRecorderLifecycleManager.vnc = cube; vncRecorderLifecycleManager.afterVideoRecordedEvent = event; vncRecorderLifecycleManager.stopRecording(after, testResult, CubeDroneConfiguration.fromMap(conf), seleniumContainers ); assertThat(new File(destination, "org_arquillian_cube_docker_drone_VncRecorderLifecycleManagerTest_should_discard_recording_if_configured_in_only_failing_and_passed_test.flv")) .doesNotExist(); }
@Test public void should_stop_vnc_by_default() throws IOException, NoSuchMethodException { final File destination = temporaryFolder.newFolder("destination"); final File video = temporaryFolder.newFile("file.flv"); when(seleniumContainers.getVideoRecordingFile()).thenReturn(video.toPath()); when(after.getTestClass()).thenReturn(new TestClass(VncRecorderLifecycleManagerTest.class)); when(after.getTestMethod()).thenReturn( VncRecorderLifecycleManagerTest.class.getMethod("should_stop_vnc_by_default")); Map<String, String> conf = new HashMap<>(); conf.put("videoOutput", destination.getAbsolutePath()); TestResult testResult = TestResult.passed(); VncRecorderLifecycleManager vncRecorderLifecycleManager = new VncRecorderLifecycleManager(); vncRecorderLifecycleManager.vnc = cube; vncRecorderLifecycleManager.afterVideoRecordedEvent = event; vncRecorderLifecycleManager.stopRecording(after, testResult, CubeDroneConfiguration.fromMap(conf), seleniumContainers ); verify(cube).stop(); verify(cube).destroy(); }
public void redmineReportEntries(@Observes After event) { final Method testMethod = event.getTestMethod(); final TestClass testClass = event.getTestClass(); final String redmineServerURL = redmineGovernorConfigurationInstance.get().getServer(); final Redmine redmineValue = getRedmineValue(testMethod, testClass); if (redmineValue != null) { final String issueURL = constructRedmineIssueURL(redmineServerURL, redmineValue.value()); final TableEntry redmineDetector = new TableEntry(); redmineDetector.setTableName("RedmineOptions"); redmineDetector.getTableHead().getRow().addCells(new TableCellEntry("Force")); final TableRowEntry row = new TableRowEntry(); row.addCells(new TableCellEntry(String.valueOf(redmineValue.force()))); redmineDetector.getTableBody().addRow(row); propertyReportEvent.fire(new PropertyReportEvent(new KeyValueEntry("Redmine URL", issueURL))); propertyReportEvent.fire(new PropertyReportEvent(redmineDetector)); } }