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

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

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

After.getTestMethod介绍

暂无

代码示例

代码示例来源: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: arquillian/arquillian-cube

private Method getTestMethod(@Observes AfterVideoRecorded event) {
    return event.getAfter().getTestMethod();
  }
}

代码示例来源: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.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: arquillian/arquillian-cube

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_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

@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-github

public void gitHubReportEntries(@Observes After event) {
  final Method testMethod = event.getTestMethod();
  final TestClass testClass = event.getTestClass();
  final GitHub gitHubValue = getGitHubValue(testMethod, testClass);
  if (gitHubValue != null) {
    final GitHubGovernorConfiguration configuration = gitHubGovernorConfigurationInstance.get();
    final String gitHubIssueURL = contructGitHubIssueURL(configuration, gitHubValue);
    final Class<? extends Detectable>[] detectables = gitHubValue.detector().value();
    final Set<String> uniqDetectables = new TreeSet<String>();
    for (final Class<? extends Detectable> detectable : detectables) {
      uniqDetectables.add(detectable.getSimpleName());
    }
    String detectablesName = "";
    for (final String detectable : uniqDetectables) {
      detectablesName += (detectablesName == "" ? "" : ",") + detectable;
    }
    final TableEntry gitHubDetector = new TableEntry();
    gitHubDetector.setTableName("GitHubOptions");
    gitHubDetector.getTableHead().getRow().addCells(new TableCellEntry("Force"), new TableCellEntry("Detector Value"), new TableCellEntry("Detector Strategy"));
    final TableRowEntry row = new TableRowEntry();
    row.addCells(new TableCellEntry(String.valueOf(gitHubValue.force())), new TableCellEntry(String.valueOf(gitHubValue.detector().strategy().getSimpleName())), new TableCellEntry(detectablesName));
    gitHubDetector.getTableBody().addRow(row);
    propertyReportEvent.fire(new PropertyReportEvent(new KeyValueEntry("GitHub URL", gitHubIssueURL)));
    propertyReportEvent.fire(new PropertyReportEvent(gitHubDetector));
  }
}

代码示例来源: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));
  }
}

相关文章

微信公众号

最新文章

更多