org.jboss.arquillian.test.spi.event.suite.Before类的使用及代码示例

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

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

Before介绍

[英]Event fired Before the Test method execution
[中]在执行测试方法之前激发的事件

代码示例

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

void cleanBefore(@Observes(precedence = 10) Before before) {
  this.clean(before.getTestClass(), before.getTestMethod(), false);
}

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

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

代码示例来源:origin: org.arquillian.extension/arquillian-recorder-screenshooter-impl-base

@Override
public boolean isTakingAction(Event event) {
  if (event instanceof Before) {
    Screenshot screenshotAnnotation = ScreenshotAnnotationScanner.getScreenshotAnnotation(((Before) event).getTestMethod());
    if (screenshotAnnotation != null) {
      return screenshotAnnotation.takeBeforeTest();
    }
  }
  return false;
}

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

public void enrich(@Observes Before event) throws Exception {
    Object instance = event.getTestInstance();
    Method method = event.getTestMethod();
    enrichmentEvent.fire(new BeforeEnrichment(instance, method));
    Collection<TestEnricher> testEnrichers = serviceLoader.get().all(TestEnricher.class);
    for (TestEnricher enricher : testEnrichers) {
      enricher.enrich(instance);
    }
    enrichmentEvent.fire(new AfterEnrichment(instance, method));
  }
}

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

/**
 * <p>The before test event handler.</p>
 *
 * <p>Delegates to the registered {@link ApplicationContextProducer} instances in order to create the application
 * context.</p>
 *
 * @param event the before test event
 */
public void beforeTest(@Observes Before event) {
  createTestApplicationContext(event.getTestClass());
}

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

public void before(Object testInstance, Method testMethod, LifecycleMethodExecutor executor) throws Exception {
  Validate.notNull(testInstance, "TestInstance must be specified");
  Validate.notNull(testMethod, "TestMethod must be specified");
  ExecutionDecision executionDecision = resolveExecutionDecision(manager, testMethod);
  if (executionDecision.getDecision() == Decision.DONT_EXECUTE) {
    return;
  }
  manager.fire(new Before(testInstance, testMethod, executor));
}

代码示例来源:origin: org.arquillian.extension/arquillian-recorder-screenshooter-impl-base

private boolean hasScreenshotAnnotation(org.jboss.arquillian.core.spi.event.Event event) {
    if (event instanceof Before) {
      return ScreenshotAnnotationScanner.getScreenshotAnnotation(((Before) event).getTestMethod()) != null;
    } else if (event instanceof AfterTestLifecycleEvent) {
      return ScreenshotAnnotationScanner
        .getScreenshotAnnotation(((AfterTestLifecycleEvent) event).getTestMethod()) != null;
    }
    return false;
  }
}

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

void sendBefore(@Observes Before event) throws Exception {
  if (WarpCommons.isWarpTest(event.getTestClass().getJavaClass())) {
    remoteOperationService().execute(new FireBeforeSuiteOnServer());
  }
}

代码示例来源:origin: org.jboss.arquillian.test/arquillian-test-impl-base

@Test
  public void shouldCallAllEnrichers() throws Exception {
    Mockito.when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(enricher, enricher));
    bind(SuiteScoped.class, ServiceLoader.class, serviceLoader);

    fire(new Before(this, getClass().getMethod("shouldCallAllEnrichers")));

    Mockito.verify(enricher, Mockito.times(2)).enrich(this);

    assertEventFired(BeforeEnrichment.class, 1);
    assertEventFired(AfterEnrichment.class, 1);
  }
}

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

void populate(@Observes Before before) {
  populate(before.getTestClass(), before.getTestMethod());
}

代码示例来源:origin: org.jboss.arquillian.graphene/arquillian-browser-screenshooter

public void registerOnEveryActionInterceptor(@Observes Before event) {
  BrowserScreenshooterConfiguration configuration = (BrowserScreenshooterConfiguration) this.configuration.get();
  Screenshot annotation = event.getTestMethod().getAnnotation(Screenshot.class);
  if (((annotation != null && annotation.takeOnEveryAction()))
    || ((annotation == null) && (configuration.getTakeOnEveryAction()))) {
    registerInterceptor(event);
  }
}

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

@Test
  public void shouldCallAllEnrichers() throws Exception {
    Mockito.when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(enricher, enricher));
    bind(SuiteScoped.class, ServiceLoader.class, serviceLoader);

    fire(new Before(this, getClass().getMethod("shouldCallAllEnrichers")));

    Mockito.verify(enricher, Mockito.times(2)).enrich(this);

    assertEventFired(BeforeEnrichment.class, 1);
    assertEventFired(AfterEnrichment.class, 1);
  }
}

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

void beforeTest(@Observes(precedence = 500) Before event) {
  Class<?> testClass = event.getTestInstance().getClass();
  if (WarpCommons.isWarpTest(testClass)) {
    startBus.fire(new StartBus(event));
  }
}

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

void cleanBefore(@Observes(precedence = 10) Before before) {
  this.clean(before.getTestClass(), before.getTestMethod(), false);
}

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

public void registerOnEveryActionInterceptor(@Observes Before event) {
  BrowserScreenshooterConfiguration configuration = (BrowserScreenshooterConfiguration) this.configuration.get();
  Screenshot annotation = event.getTestMethod().getAnnotation(Screenshot.class);
  if (((annotation != null && annotation.takeOnEveryAction()))
    || ((annotation == null) && (configuration.getTakeOnEveryAction()))) {
    registerInterceptor(event);
  }
}

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

private void executeTest(Object inspection, Method method, List<Annotation> qualifiers) {
  before.fire(new Before(inspection, method));
  test.fire(new Test(new LifecycleMethodExecutor(inspection, method, qualifiers)));
  after.fire(new After(inspection, method));
}

代码示例来源:origin: org.mobicents.arquillian.container/mss-arquillian-container-extension

public void executeBeforeTest(@Observes Before event, TestClass testClass) throws IllegalArgumentException, IllegalAccessException
{
  testInstance = event.getTestInstance();
  if (isGetDeployableContainerAnnoPresent) {
    ContainerManagerTool containerWrapper = new ContainerManagerTool(deployableContainer);
    setContainer(testInstance, containerWrapper, deployableContainerFields);
  }
}

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

void cleanBefore(@Observes(precedence = 10) Before before) {
  this.clean(before.getTestClass(), before.getTestMethod(), false);
}

代码示例来源:origin: org.jboss.arquillian.graphene/arquillian-browser-screenshooter

private void registerInterceptor(Before event) {
    ScreenshotMetaData metaData = getMetaData(event);
    String screenshotName = getScreenshotName(metaData, When.ON_EVERY_ACTION);
    Screenshot annotation = event.getTestMethod().getAnnotation(Screenshot.class);

    TakeScreenshot takeScreenshot = new TakeScreenshot(screenshotName, metaData, When.ON_EVERY_ACTION, annotation);

    TakeScreenshotOnEveryActionInterceptor onEveryActionInterceptor =
      new TakeScreenshotOnEveryActionInterceptor(takeScreenshot, getTakeAndReportService(),
        interceptorRegistry.get());

    interceptorRegistry.get().register(onEveryActionInterceptor);
  }
}

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

@Test
public void shouldInvokeBeforeInContainerDeploymentContext() throws Exception {
  fire(new org.jboss.arquillian.test.spi.event.suite.Before(this, testMethod()));
  assertEventFiredInContext(org.jboss.arquillian.test.spi.event.suite.Before.class, ContainerContext.class);
  assertEventFiredInContext(org.jboss.arquillian.test.spi.event.suite.Before.class, DeploymentContext.class);
}

相关文章

微信公众号

最新文章

更多