本文整理汇总了Java中org.jboss.arquillian.test.spi.TestClass类的典型用法代码示例。如果您正苦于以下问题:Java TestClass类的具体用法?Java TestClass怎么用?Java TestClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestClass类属于org.jboss.arquillian.test.spi包,在下文中一共展示了TestClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
@Override
public void process(Archive<?> appArchive, TestClass testClass) {
if (!(appArchive instanceof WebArchive)) {
return;
}
log.info("Preparing archive: "+appArchive);
WebArchive war = WebArchive.class.cast(appArchive);
// Add WEB-INF resources
String[] webInfRes = getWebInfResources();
for(String resName : webInfRes) {
war.addAsWebInfResource(resName);
}
// Add WEB-INF/lib libraries
String[] artifactNames = getWebInfLibArtifacts();
// TODO; use shrinkwrap resolvers
for (String mvnArtifact: artifactNames) {
// Resolve this artifact...
}
}
开发者ID:eclipse,项目名称:microprofile-jwt-auth,代码行数:21,代码来源:BaseWarArchiveProcessor.java
示例2: startTestClass
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的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
示例3: stopNodesAndContainersForClass
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
/**
* Destroys test class level WildFly containers (and related Nodes) in test classes annotated with {@link WithWildFlyContainer}.
*/
public void stopNodesAndContainersForClass(@Observes StopClassContainers event, TestClass testClass, ContainerRegistry registry,
CloudsRegistry cloudProviderRegistry) throws Exception {
final Set<String> nodeNames = new HashSet<>();
WithNode[] withNodes = testClass.getJavaClass().getAnnotationsByType(WithNode.class);
if (withNodes != null) {
Arrays.stream(withNodes).forEach(wn -> nodeNames.add(wn.value()));
}
WithWildFlyContainer[] containers = testClass.getJavaClass().getAnnotationsByType(WithWildFlyContainer.class);
if (containers != null) {
for (WithWildFlyContainer wflyContainer : containers) {
final String nodeName = wflyContainer.value();
nodeNames.add(nodeName);
LOGGER.debug("Removing WildFly container configuration for class level node '{}'", nodeName);
cloudProviderRegistry.stopWildFlyContainerInRegistry(nodeName, registry, containerContext.get());
}
}
cloudProviderRegistry.cleanupNodes(node->nodeNames.contains(node.getName()));
}
开发者ID:wildfly-extras,项目名称:sunstone,代码行数:24,代码来源:SunstoneObserver.java
示例4: testPact
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
public void testPact(@Observes EventContext<Test> testEventContext) throws Throwable {
final Test event = testEventContext.getEvent();
final TestClass testClass = event.getTestClass();
final PactVerification pactVerification = event.getTestMethod().getAnnotation(PactVerification.class);
if (pactVerification == null) {
logger.log(Level.INFO,
String.format(
"Method %s is not annotated with %s annotation and it is going to be executed as normal junit test.",
event.getTestMethod().getName(), PactVerification.class.getName()));
testEventContext.proceed();
return;
}
executeConsumerTest(testEventContext, testClass, pactVerification);
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:19,代码来源:StandaloneConsumerPactTest.java
示例5: testPact
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
public void testPact(@Observes(precedence = -50) EventContext<Test> testEventContext, Deployment deployment)
throws Throwable {
final Test event = testEventContext.getEvent();
final TestClass testClass = event.getTestClass();
// We need to check this because in case of embedded containers this class is executed too
if (RunModeUtils.isRunAsClient(deployment, testClass, event.getTestMethod())) {
final PactVerification pactVerification = event.getTestMethod().getAnnotation(PactVerification.class);
if (pactVerification == null) {
logger.log(Level.INFO,
String.format(
"Method %s is not annotated with %s annotation and it is going to be executed as normal junit test.",
event.getTestMethod().getName(), PactVerification.class.getName()));
testEventContext.proceed();
return;
}
executeConsumerTest(testEventContext, testClass, pactVerification);
} else {
// We are in container and this class is executed in client side so we should only pass the execution and incontainer class will do the job
testEventContext.proceed();
}
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:27,代码来源:ConsumerPactTest.java
示例6: testPact
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
public void testPact(@Observes(precedence = -50) EventContext<Test> testEventContext) throws Throwable {
final Test event = testEventContext.getEvent();
final TestClass testClass = event.getTestClass();
final PactVerification pactVerification = event.getTestMethod().getAnnotation(PactVerification.class);
if (pactVerification == null) {
logger.log(Level.INFO,
String.format(
"Method %s is not annotated with %s annotation and it is going to be executed as normal junit test.",
event.getTestMethod().getName(), PactVerification.class.getName()));
testEventContext.proceed();
return;
}
final ConsumerProviderPair consumerProviderPair =
executeConsumerTest(testEventContext, testClass, pactVerification);
// Send results back to client
final String filename = getFilename(consumerProviderPair);
final byte[] content = loadPact(filename);
getCommandService().execute(new PactFilesCommand(filename, content));
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:26,代码来源:RemoteConsumerPactTest.java
示例7: getProvider
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
protected String getProvider(TestClass testClass, PactVerification pactVerification) {
if (!"".equals(pactVerification.value().trim())) {
return pactVerification.value();
} else {
if (isClassAnnotatedWithPact(testClass)) {
return testClass.getAnnotation(Pact.class).provider();
} else {
PactConsumerConfiguration pactConsumerConfiguration = pactConsumerConfigurationInstance.get();
if (pactConsumerConfiguration.isProviderSet()) {
return pactConsumerConfiguration.getProvider();
} else {
throw new IllegalArgumentException(
String.format(
"Provider name must be set either by using provider configuration property in arquillian.xml or annotating %s test with %s with a provider set.",
testClass.getName(), PactVerification.class.getName()));
}
}
}
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:20,代码来源:AbstractConsumerPactTest.java
示例8: findPactMethod
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
protected Optional<PactMethod> findPactMethod(String currentProvider, TestClass testClass,
PactVerification pactVerification) {
String pactFragment = pactVerification.fragment();
final Optional<Class<?>> classWithPactAnnotation =
ResolveClassAnnotation.getClassWithAnnotation(testClass.getJavaClass(), Pact.class);
final List<Method> pactMethods = findPactFragmentMethods(testClass);
for (Method method : pactMethods) {
Optional<Pact> pact = resolvePactAnnotation(classWithPactAnnotation, method);
if (pact.isPresent() && pact.get().provider().equals(currentProvider)
&& (pactFragment.isEmpty() || pactFragment.equals(method.getName()))) {
validatePactSignature(method);
return Optional.of(new PactMethod(method, pact.get()));
}
}
return Optional.empty();
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:19,代码来源:AbstractConsumerPactTest.java
示例9: validateTargetRequestFilters
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
private void validateTargetRequestFilters(final TestClass testClass, final List<Throwable> errors) {
Method[] methods = testClass.getMethods(TargetRequestFilter.class);
for (Method method : methods) {
if (!isPublic(method)) {
String publicError = String.format("Method %s annotated with %s should be public.", method.getName(),
TargetRequestFilter.class.getName());
logger.log(Level.SEVERE, publicError);
errors.add(new IllegalArgumentException(publicError));
}
if (method.getParameterCount() != 1) {
String argumentError = String.format("Method %s should take only a single %s parameter", method.getName(),
HttpRequest.class.getName());
logger.log(Level.SEVERE, argumentError);
errors.add(new IllegalArgumentException(argumentError));
} else if (!HttpRequest.class.isAssignableFrom(method.getParameterTypes()[0])) {
String httpRequestError = String.format("Method %s should take only %s parameter", method.getName(),
HttpRequest.class.getName());
logger.log(Level.SEVERE, httpRequestError);
errors.add(new IllegalArgumentException(httpRequestError));
}
}
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:24,代码来源:InteractionRunner.java
示例10: validateAndGetResourceField
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
private Field validateAndGetResourceField(TestClass testClass, Class<?> fieldType,
Class<? extends Annotation> annotation, List<Throwable> errors) {
final List<Field> fieldsWithArquillianResource = getFieldsWithAnnotation(testClass.getJavaClass(), annotation);
List<Field> rri = fieldsWithArquillianResource
.stream()
.filter(
field -> fieldType.isAssignableFrom(field.getType())
).collect(Collectors.toList());
if (rri.size() > 1) {
String rriError =
String.format("Only one field annotated with %s of type %s should be present", annotation.getName(),
fieldType.getName());
logger.log(Level.SEVERE, rriError);
errors.add(new IllegalArgumentException(rriError));
} else {
if (rri.size() == 1) {
return rri.get(0);
}
}
return null;
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:25,代码来源:InteractionRunner.java
示例11: executeStateChanges
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
protected void executeStateChanges(final RequestResponseInteraction interaction, final TestClass testClass,
final Object target) {
if (!interaction.getProviderStates().isEmpty()) {
for (final ProviderState state : interaction.getProviderStates()) {
Arrays.stream(testClass.getMethods(State.class))
.filter(method -> ArrayMatcher.matches(
method.getAnnotation(State.class).value(), state.getName()))
.forEach(method -> {
if (isStateMethodWithMapParameter(method)) {
executeMethod(method, target, state.getParams());
} else {
if (method.getParameterCount() > 0) {
// Use regular expressions to pass parameters.
executeStateMethodWithRegExp(method, state, target);
} else {
executeMethod(method, target);
}
}
});
}
}
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:23,代码来源:InteractionRunner.java
示例12: should_execute_test_for_each_interaction
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
@Test
public void should_execute_test_for_each_interaction() {
when(test.getTestClass()).thenReturn(new TestClass(PactProvider.class));
PactProvider pactDefinition = new PactProvider();
when(test.getTestInstance()).thenReturn(pactDefinition);
InteractionRunner interactionRunner = new InteractionRunner();
interactionRunner.pactsInstance = pactsInstance;
interactionRunner.targetInstance = () -> target;
interactionRunner.executePacts(eventContext);
assertThat(pactDefinition.consumer).isEqualTo(new Consumer("planets_consumer"));
assertThat(pactDefinition.interaction).isNotNull();
verify(eventContext, times(2)).proceed();
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:17,代码来源:InteractionRunnerTest.java
示例13: should_execute_states_with_regular_expression_syntax_for_simple_types
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
@org.junit.Test
public void should_execute_states_with_regular_expression_syntax_for_simple_types() {
ProviderState providerState = new ProviderState("I have 36 cukes in my belly");
final List<ProviderState> providerStates = new ArrayList<>();
providerStates.add(providerState);
when(requestResponseInteraction.getProviderStates()).thenReturn(providerStates);
InteractionRunner interactionRunner = new InteractionRunner();
TestClass testClass = new TestClass(PactProviderWithIntegerParameterStateMethod.class);
PactProviderWithIntegerParameterStateMethod test = new PactProviderWithIntegerParameterStateMethod();
interactionRunner.executeStateChanges(requestResponseInteraction, testClass, test);
assertThat(test.getNumberOfCukes())
.isEqualTo(36);
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:19,代码来源:InteractionRunnerTest.java
示例14: should_execute_states_with_regular_expression_syntax_for_collection_types
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
@org.junit.Test
public void should_execute_states_with_regular_expression_syntax_for_collection_types() {
ProviderState providerState = new ProviderState("The following animals: cow, pig, bug");
final List<ProviderState> providerStates = new ArrayList<>();
providerStates.add(providerState);
when(requestResponseInteraction.getProviderStates()).thenReturn(providerStates);
InteractionRunner interactionRunner = new InteractionRunner();
TestClass testClass = new TestClass(PactProviderWithListParameterStateMethod.class);
PactProviderWithListParameterStateMethod test = new PactProviderWithListParameterStateMethod();
interactionRunner.executeStateChanges(requestResponseInteraction, testClass, test);
assertThat(test.getAnimals())
.contains("cow", "pig", "bug");
}
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:19,代码来源:InteractionRunnerTest.java
示例15: process
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
@Override
public void process(Archive<?> appArchive, TestClass testClass) {
if (!(appArchive instanceof WebArchive)) {
return;
}
log.info("Preparing archive: " + appArchive);
// Only augment archives with a publicKey indicating a MP-JWT test
WebArchive war = WebArchive.class.cast(appArchive);
Node publicKeyNode = war.get("/WEB-INF/classes/publicKey.pem");
if (publicKeyNode == null) {
return;
}
// This allows for test specific web.xml files. Generally this should not be needed.
String warName = war.getName();
String webXmlName = "/WEB-INF/" + warName + ".xml";
URL webXml = WFSwarmWarArchiveProcessor.class.getResource(webXmlName);
if (webXml != null) {
war.setWebXML(webXml);
}
war.addAsResource("project-defaults.yml", "/project-defaults.yml")
.addAsWebInfResource("jwt-roles.properties", "classes/jwt-roles.properties")
.addAsManifestResource(publicKeyNode.getAsset(), "/MP-JWT-SIGNER");
log.fine("Augmented war: \n" + war.toString(true));
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:26,代码来源:WFSwarmWarArchiveProcessor.java
示例16: readReplicas
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
public static int readReplicas(TestClass testClass) {
Replicas replicas = testClass.getAnnotation(Replicas.class);
int r = -1;
if (replicas != null) {
if (replicas.value() <= 0) {
throw new IllegalArgumentException("Non-positive replicas size: " + replicas.value());
}
r = replicas.value();
}
int max = 0;
for (Method c : testClass.getMethods(TargetsContainer.class)) {
int index = Strings.parseNumber(c.getAnnotation(TargetsContainer.class).value());
if (r > 0 && index >= r) {
throw new IllegalArgumentException(String.format("Node / pod index bigger then replicas; %s >= %s ! (%s)", index, r, c));
}
max = Math.max(max, index);
}
if (r < 0) {
return max + 1;
} else {
return r;
}
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:24,代码来源:TemplateUtils.java
示例17: generate
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
public List<DeploymentDescription> generate(TestClass testClass) {
List<DeploymentDescription> descriptions = delegate(testClass);
boolean inCeContainer = isDeployedInCeContainer();
List<DeploymentDescription> copy = new ArrayList<>();
for (DeploymentDescription description : descriptions) {
Archive<?> archive = description.getArchive();
// only wrap in war, if it's in CE container
if (inCeContainer && JavaArchive.class.isInstance(archive)) {
JavaArchive jar = JavaArchive.class.cast(archive);
copy.add(new DeploymentDescription(description.getName(), toWar(jar)));
} else {
copy.add(description);
}
}
return copy;
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:19,代码来源:LegacyDeploymentScenarioGenerator.java
示例18: waitForDeployments
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
/**
* Wait for the template resources to come up after the test container has
* been started. This allows the test container and the template resources
* to come up in parallel.
*/
public void waitForDeployments(@Observes(precedence = -100) AfterStart event, OpenShiftAdapter client, TemplateDetails details, TestClass testClass, CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws Exception {
if (testClass == null) {
// nothing to do, since we're not in ClassScoped context
return;
}
if (details == null) {
log.warning(String.format("No environment for %s", testClass.getName()));
return;
}
log.info(String.format("Waiting for environment for %s", testClass.getName()));
try {
for (List<? extends OpenShiftResource> resources : details.getResources()) {
delay(client, resources);
}
} catch (Throwable t) {
logEvents(openshiftClient, configuration);
throw new DeploymentException("Error waiting for template resources to deploy: " + testClass.getName(), t);
}
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:25,代码来源:CEEnvironmentProcessor.java
示例19: deleteEnvironment
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
private void deleteEnvironment(final TestClass testClass, OpenShiftAdapter client, CECubeConfiguration configuration) throws Exception {
StringResolver resolver;
String templateURL;
if (configuration.getCubeConfiguration().isNamespaceCleanupEnabled()) {
log.info(String.format("Deleting environment for %s", testClass.getName()));
for(Template template : templates) {
// Delete pods and services related to each template
resolver = Strings.createStringResolver(configuration.getProperties());
templateURL = readTemplateUrl(template, configuration, false, resolver);
client.deleteTemplate(testClass.getName() + templateURL);
}
OpenShiftResourceFactory.deleteResources(testClass.getName(), client);
additionalCleanup(client, Collections.singletonMap("test-case", testClass.getJavaClass().getSimpleName().toLowerCase()));
} else {
log.info(String.format("Ignoring cleanup for %s", testClass.getName()));
}
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:20,代码来源:CEEnvironmentProcessor.java
示例20: redmineReportEntries
import org.jboss.arquillian.test.spi.TestClass; //导入依赖的package包/类
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));
}
}
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:24,代码来源:RedmineGovernorRecorder.java
注:本文中的org.jboss.arquillian.test.spi.TestClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论