本文整理汇总了Java中org.jboss.arquillian.test.spi.event.suite.BeforeClass类的典型用法代码示例。如果您正苦于以下问题:Java BeforeClass类的具体用法?Java BeforeClass怎么用?Java BeforeClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeforeClass类属于org.jboss.arquillian.test.spi.event.suite包,在下文中一共展示了BeforeClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startTestClass
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
public void startTestClass(@Observes(precedence = Integer.MAX_VALUE) BeforeClass event) {
TestClass testClass = event.getTestClass();
boolean runAsClient = event.getTestClass().isAnnotationPresent(RunAsClient.class);
TestClassReport testClassReport = new TestClassReport(testClass.getName());
Reporter
.createReport(new ConfigurationReport(TEST_CLASS_CONFIGURATION))
.addKeyValueEntry(CLASS_RUNS_AS_CLIENT, runAsClient);
String reportMessage = ReportMessageParser.parseTestClassReportMessage(event.getTestClass().getJavaClass());
Reporter
.createReport(testClassReport)
.addKeyValueEntry(TEST_CLASS_REPORT_MESSAGE, reportMessage)
.inSection(new TestClassSection(testClass.getJavaClass(), DEFAULT_TEST_SUITE_ID))
.fire(sectionEvent);
}
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:18,代码来源:ArquillianCoreReporterLifecycleManager.java
示例2: should_load_pacts_from_annotation_test
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Test
public void should_load_pacts_from_annotation_test() {
// Given
final PactsRetriever pactsRetriever = new PactsRetriever();
pactsRetriever.pactsInstanceProducer = instanceProducer;
pactsRetriever.algeronProviderConfigurationInstance = instance;
// When
pactsRetriever.retrievePacts(new BeforeClass(PactDefinition.class));
// Then
verify(instanceProducer).set(argumentCaptor.capture());
Pacts pacts = argumentCaptor.getValue();
final List<Pact> listOfLoadedPacts = pacts.getPacts();
assertThat(listOfLoadedPacts).hasSize(1).element(0)
.hasFieldOrPropertyWithValue("provider", new au.com.dius.pact.model.Provider("planets_provider"))
.hasFieldOrPropertyWithValue("consumer", new Consumer("planets_consumer"));
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:20,代码来源:PactsRetrieverTest.java
示例3: gitHubGovernorTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Test
public void gitHubGovernorTest() {
fire(new BeforeClass(FakeTestClass.class));
assertEventFired(BeforeClass.class, 1);
assertEventFired(DecideMethodExecutions.class, 1);
final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
assertThat(configuration, is(not(nullValue())));
final RedmineGovernorConfiguration gitHubConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(RedmineGovernorConfiguration.class);
assertThat(gitHubConfiguration, is(not(nullValue())));
// for every method and for every Governor annotation of that method
assertEventFired(ExecutionDecisionEvent.class, 1);
final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);
assertThat(decision, is(not(nullValue())));
assertEquals(decision.getDecision(), Decision.EXECUTE);
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:22,代码来源:RedmineGovernorTestCase.java
示例4: gitHubGovernorTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Test
public void gitHubGovernorTest() {
fire(new BeforeClass(FakeTestClass.class));
assertEventFired(BeforeClass.class, 1);
assertEventFired(DecideMethodExecutions.class, 1);
final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
assertThat(configuration, is(not(nullValue())));
final GitHubGovernorConfiguration gitHubConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(GitHubGovernorConfiguration.class);
assertThat(gitHubConfiguration, is(not(nullValue())));
// for every method and for every Governor annotation of that method
assertEventFired(ExecutionDecisionEvent.class, 1);
final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);
assertThat(decision, is(not(nullValue())));
assertEquals(decision.getDecision(), Decision.EXECUTE);
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:22,代码来源:GitHubGovernorTestCase.java
示例5: onBeforeClass
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
public void onBeforeClass(@Observes BeforeClass event) {
TestMethodExecutionRegister.setConfigration(governorConfiguration.get());
TestMethodExecutionRegister.clear();
if (governorConfiguration.get().getIgnore()) {
return;
}
final Collection<GovernorProvider> governorProviders = serviceLoader.get().all(GovernorProvider.class);
checkGovernorProviderUniqueness(governorProviders);
final Map<Method, List<Annotation>> scannedTestMethods = scanTestMethods(event.getTestClass(), Governor.class);
final GovernorRegistryImpl governorRegistry = new GovernorRegistryImpl();
governorRegistry.put(scannedTestMethods);
this.governorRegistry.set(governorRegistry);
decideMethodExecution.fire(new DecideMethodExecutions());
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:21,代码来源:GovernorTestClassScanner.java
示例6: startBeforeSuiteTrueTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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);
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java
示例7: startBeforeClassTrueTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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);
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java
示例8: startBeforeTestTrueTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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);
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java
示例9: applyIstioResources
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
public void applyIstioResources(@Observes(precedence = -20) BeforeClass beforeClass, final IstioClient istioClient) {
final TestClass testClass = beforeClass.getTestClass();
Arrays.stream(findAnnotations(testClass))
.map(IstioResource::value)
.map(RunnerExpressionParser::parseExpressions)
.map(IstioResourceResolver::resolve)
.forEach(istioResource -> {
try (BufferedInputStream istioResourceStream = new BufferedInputStream(istioResource) ) {
createdIstioResources.addAll(istioClient.registerCustomResources(istioResourceStream));
} catch (IOException e) {
throw new IllegalStateException(e);
}
});
}
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:18,代码来源:IstioResourcesApplier.java
示例10: configure
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
public void configure(@Observes(precedence = 50) BeforeClass beforeClass) throws IOException {
final InputStream resourceAsStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("/pact-consumer-configuration.properties");
Properties properties = new Properties();
properties.load(resourceAsStream);
final Map<String, String> config = properties.entrySet()
.stream()
.collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString()));
pactConsumerConfigurationInstanceProducer.set(PactConsumerConfiguration.fromMap(config));
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:13,代码来源:PactConsumerConfigurator.java
示例11: getPacts
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
protected List<Pact> getPacts(BeforeClass test) {
final TestClass testClass = test.getTestClass();
final Provider providerInfo = testClass.getAnnotation(Provider.class);
if (providerInfo == null) {
return Collections.emptyList();
}
final String serviceName = providerInfo.value();
final Consumer consumerInfo = testClass.getAnnotation(Consumer.class);
final String consumerName = consumerInfo != null ? consumerInfo.value() : null;
List<Pact> pacts;
try {
final ContractsRetriever contractsSource =
getContractsSource(testClass, algeronProviderConfigurationInstance.get());
contractsSource.setProviderName(serviceName);
final List<URI> contractsDirectory = contractsSource.retrieve();
pacts = loadContractFiles(contractsDirectory, serviceName).stream()
.filter(p -> consumerName == null || p.getConsumer().getName().equals(consumerName))
.collect(toList());
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
return pacts;
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:29,代码来源:PactsRetriever.java
示例12: setup
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Before
public void setup() {
final PactsRetriever pactsRetriever = new PactsRetriever();
pactsRetriever.algeronProviderConfigurationInstance = algeronConfiguration;
final List<Pact> pacts = pactsRetriever.getPacts(new BeforeClass(PactProvider.class));
pactsInstance = () -> new Pacts(pacts);
when(eventContext.getEvent()).thenReturn(test);
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:10,代码来源:InteractionRunnerTest.java
示例13: should_load_pacts_from_algeron_provider_configuration
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Test
public void should_load_pacts_from_algeron_provider_configuration() {
// Given
final PactsRetriever pactsRetriever = new PactsRetriever();
pactsRetriever.pactsInstanceProducer = instanceProducer;
pactsRetriever.algeronProviderConfigurationInstance = instance;
String retriever = "provider: folder" + System.lineSeparator() + "contractsFolder: pacts";
final Map<String, String> configuration = new HashMap<>();
configuration.put("retrieverConfiguration", retriever);
final AlgeronProviderConfiguration algeronProviderConfiguration =
AlgeronProviderConfiguration.fromMap(configuration);
when(instance.get()).thenReturn(algeronProviderConfiguration);
// When
pactsRetriever.retrievePacts(new BeforeClass(NonePactDefinition.class));
// Then
verify(instanceProducer).set(argumentCaptor.capture());
Pacts pacts = argumentCaptor.getValue();
final List<Pact> listOfLoadedPacts = pacts.getPacts();
assertThat(listOfLoadedPacts).hasSize(1).element(0)
.hasFieldOrPropertyWithValue("provider", new au.com.dius.pact.model.Provider("planets_provider"))
.hasFieldOrPropertyWithValue("consumer", new Consumer("planets_consumer"));
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:29,代码来源:PactsRetrieverTest.java
示例14: createEnvironment
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
/**
* Create the environment as specified by @Template or
* arq.extension.ce-cube.openshift.template.* properties.
* <p>
* In the future, this might be handled by starting application Cube
* objects, e.g. CreateCube(application), StartCube(application)
* <p>
* Needs to fire before the containers are started.
*/
public void createEnvironment(@Observes(precedence = 10) BeforeClass event, OpenShiftAdapter client,
CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws DeploymentException {
final TestClass testClass = event.getTestClass();
log.info(String.format("Creating environment for %s", testClass.getName()));
OpenShiftResourceFactory.createResources(testClass.getName(), client, null, testClass.getJavaClass(), configuration.getProperties());
processTemplateResources(testClass, client, configuration);
final CubeOpenShiftConfiguration config = (CubeOpenShiftConfiguration) configurationInstance.get();
registerRoutes(config, openshiftClient);
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:19,代码来源:CEEnvironmentProcessor.java
示例15: jiraGovernorTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@Test
public void jiraGovernorTest() {
fire(new BeforeClass(FakeTestClass.class));
assertEventFired(BeforeClass.class, 1);
assertEventFired(DecideMethodExecutions.class, 1);
final GovernorRegistry governorRegistry = manager.getContext(ClassContext.class).getObjectStore().get(GovernorRegistry.class);
assertThat(governorRegistry, is(not(nullValue())));
final GovernorConfiguration configuration = manager.getContext(ApplicationContext.class).getObjectStore().get(GovernorConfiguration.class);
assertThat(configuration, is(not(nullValue())));
final JiraGovernorConfiguration jiraConfiguration = manager.getContext(ApplicationContext.class).getObjectStore().get(JiraGovernorConfiguration.class);
assertThat(jiraConfiguration, is(not(nullValue())));
final List<Method> jiraMethods = governorRegistry.getMethodsForAnnotation(Jira.class);
assertEquals(1, jiraMethods.size());
// for every method and for every Governor annotation of that method
assertEventFired(ExecutionDecisionEvent.class, 1);
final ExecutionDecision decision = manager.getContext(ClassContext.class).getObjectStore().get(ExecutionDecision.class);
assertThat(decision, is(not(nullValue())));
assertEquals(decision.getDecision(), Decision.EXECUTE);
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:28,代码来源:JiraGovernorTestCase.java
示例16: setupClass
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@org.junit.BeforeClass
public static void setupClass() throws Exception {
REPOSITORY_USERNAME = resolveRepositoryUser();
REPOSITORY_NAME = resolveRepository();
TOKEN = resolveToken();
USERNAME = resolvUsername();
PASSWORD = resolvePassword();
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:9,代码来源:GitHubGovernorTestCase.java
示例17: beforeClass
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
public void beforeClass(@Observes BeforeClass event) {
if (strategy.get().isTakingAction(event)) {
VideoMetaData classMetaData = getClassMetaData(event);
VideoType videoType = getVideoType();
beforeVideoStart.fire(new BeforeVideoStart(videoType, classMetaData));
startRecordClassVideo.fire(new StartRecordClassVideo(videoType, classMetaData));
afterVideoStart.fire(new AfterVideoStart(videoType, classMetaData));
}
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:13,代码来源:VideoLifecycleObserver.java
示例18: isTakingAction
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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;
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:16,代码来源:DefaultVideoStrategy.java
示例19: defaultConfigurationTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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);
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:28,代码来源:RecorderLifecycleObserverTestCase.java
示例20: takeOnlyOnFailTestFailedTest
import org.jboss.arquillian.test.spi.event.suite.BeforeClass; //导入依赖的package包/类
@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);
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:28,代码来源:RecorderLifecycleObserverTestCase.java
注:本文中的org.jboss.arquillian.test.spi.event.suite.BeforeClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论