org.jboss.arquillian.test.spi.event.suite.After.getTestClass()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.jboss.arquillian.test.spi.event.suite.After.getTestClass()方法的一些代码示例,展示了After.getTestClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。After.getTestClass()方法的具体详情如下:
包路径:org.jboss.arquillian.test.spi.event.suite.After
类名称:After
方法名:getTestClass

After.getTestClass介绍

暂无

代码示例

代码示例来源:origin: org.arquillian.cube/arquillian-cube-docker-drone

private static String getFinalVideoName(After afterTestMethod) {

    final String className = afterTestMethod.getTestClass().getName().replace('.', '_');
    final String methodName = afterTestMethod.getTestMethod().getName();

    return className + "_" + methodName + ".flv";
  }
}

代码示例来源:origin: arquillian/arquillian-cube

private static String getFinalVideoName(After afterTestMethod) {

    final String className = afterTestMethod.getTestClass().getName().replace('.', '_');
    final String methodName = afterTestMethod.getTestMethod().getName();

    return className + "_" + methodName + ".flv";
  }
}

代码示例来源:origin: org.arquillian.cube/arquillian-cube-docker

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);
}

代码示例来源:origin: arquillian/arquillian-cube

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);
}

代码示例来源:origin: arquillian/arquillian-cube

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);
}

代码示例来源:origin: arquillian/arquillian-cube

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));
}

代码示例来源:origin: org.arquillian.cube/arquillian-cube-kubernetes

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);
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-nosql-mongodb

void cleanAfter(@Observes After after) {
  this.clean(after.getTestClass(), after.getTestMethod(), true);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-service-integration-spring

/**
 * <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();
  }
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-nosql-vault

void cleanAfter(@Observes After after) {
  this.clean(after.getTestClass(), after.getTestMethod(), true);
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-sql-standalone-flyway

void cleanAfter(@Observes After after) {
  this.clean(after.getTestClass(), after.getTestMethod(), true);
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-nosql-redis

void cleanAfter(@Observes After after) {
  this.clean(after.getTestClass(), after.getTestMethod(), true);
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-nosql-couchbase

void cleanAfter(@Observes After after) {
  this.clean(after.getTestClass(), after.getTestMethod(), true);
}

代码示例来源:origin: arquillian/arquillian-cube

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);
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-warp-impl

void sendAfter(@Observes After event) throws Exception {
  if (WarpCommons.isWarpTest(event.getTestClass().getJavaClass())) {
    remoteOperationService().execute(new FireAfterSuiteOnServer());
  }
}

代码示例来源:origin: arquillian/arquillian-cube

@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");
}

代码示例来源:origin: arquillian/arquillian-cube

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"));

代码示例来源:origin: arquillian/arquillian-cube

@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();
}

代码示例来源:origin: arquillian/arquillian-cube

@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();
}

代码示例来源:origin: org.arquillian.extension/arquillian-governor-redmine

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));
  }
}

相关文章

微信公众号

最新文章

更多