当前位置: 首页>>代码示例>>Java>>正文


Java EventContext类代码示例

本文整理汇总了Java中org.jboss.arquillian.core.spi.EventContext的典型用法代码示例。如果您正苦于以下问题:Java EventContext类的具体用法?Java EventContext怎么用?Java EventContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EventContext类属于org.jboss.arquillian.core.spi包,在下文中一共展示了EventContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPact

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的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

示例2: testPact

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的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

示例3: testPact

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的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

示例4: start

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void start(@Observes final EventContext<ManagerStarted> starting) {
    starting.proceed();
    final ArquillianDescriptor descriptor = getDescriptorInstance();
    Thread adocThread = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                long initialTime = System.currentTimeMillis();
                initAsciidoctor(descriptor);
                getLogger().info(String.format("Asciidoctor successfully initialized in %s milliseconds", System.currentTimeMillis() - initialTime));
            }catch (Exception e){
                getLogger().log(Level.SEVERE, "Could not initilize Asciidoctor instance", e);
            }
        }
    }, "arquillian-asciidoctor-thread");
    adocThread.setDaemon(true);
    adocThread.start();
}
 
开发者ID:cukespace,项目名称:arquillian-asciidoctor-extension,代码行数:20,代码来源:AsciidoctorObserver.java

示例5: x

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void x(@Observes(precedence = -1) EventContext<Test> context) {
	final MailTest mailTest = ExtractSetupUtil.extractMailTestFromTestMethod(context.getEvent());
	if (mailTest != null) {
		if (mailTest.clearAllMails()) {
			mailTestEvent.fire(MailTestEvent.DeleteAllMails);
		}
	}
	
    context.proceed();
    
    if (mailTest != null && mailTest.verifyResult()) {
		try {
			final MimeMessage[] messages = greenMailProxy.get().getReceivedMessages();	
			final FilterChain chain = new FilterChain();						
			final List<MimeMessage> messagesFiltered = chain.filter(mailTest, messages);
			if (mailTest.expectedMessageCount() != messagesFiltered.size()) {
				throw new MailTestAssertionError(String.format("Expected mail message count %d but was %d", 
						mailTest.expectedMessageCount(), messagesFiltered.size()));
			}				
		} catch (MessagingException ex) {
			throw new RuntimeException(ex.getMessage(), ex);
		}
	}	    
}
 
开发者ID:rbattenfeld,项目名称:arquillian-extension-mail-master,代码行数:25,代码来源:MailTestVerifier.java

示例6: execute

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void execute(@Observes EventContext<Test> context) {
    Test event = context.getEvent();

    Method testMethod = event.getTestMethod();
    WithinNamespace ns = testMethod.getAnnotation(WithinNamespace.class);
    if (ns == null) {
        ns = event.getTestClass().getAnnotation(WithinNamespace.class);
        if (ns == null) {
            Class<?> testClass = event.getTestClass().getJavaClass();
            ns = testClass.getPackage().getAnnotation(WithinNamespace.class);
        }
    }

    if (ns != null) {
        runWithinNamespaces(context, ns.value());
    } else {
        context.proceed();
    }
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:20,代码来源:NamespaceExtensionContainer.java

示例7: runWithinNamespaces

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
private void runWithinNamespaces(EventContext<Test> context, String[] namespaces) {
    final List<FailedNamespaceException> exceptions = new ArrayList<>();
    final String original = NamespaceManager.get();
    try {
        for (String namespace : namespaces) {
            try {
                NamespaceManager.set(namespace);
                context.proceed();
            } catch (Exception e) {
                exceptions.add(new FailedNamespaceException(e, namespace));
            }
        }
    } finally {
        NamespaceManager.set(original);
    }
    if (exceptions.size() > 1) {
        throw new MultipleExceptions(exceptions);
    } else if (exceptions.size() == 1) {
        throw exceptions.get(0);
    }
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-tck,代码行数:22,代码来源:NamespaceExtensionContainer.java

示例8: release

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void release(@Observes final EventContext<BeforeUnDeploy> event) {
    if (!SystemInstance.isInitialized()) {
        event.proceed();
        return;
    }

    try {
        event.proceed();
    } finally {
        final BeanContext bc = beanContext();
        if (bc != null) { // can be null if deployment exception
            final CreationalContext<?> cc = bc.get(CreationalContext.class);
            if (cc != null) {
                cc.release();
            }
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:TestObserver.java

示例9: executeConsumerTest

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
protected ConsumerProviderPair executeConsumerTest(EventContext<Test> testEventContext, TestClass testClass,
    PactVerification pactVerification) throws Throwable {
    String currentProvider = getProvider(testClass, pactVerification);

    // Start of execution

    return executePactFragment(testEventContext, currentProvider, pactVerification);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:9,代码来源:AbstractConsumerPactTest.java

示例10: executePacts

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void executePacts(@Observes EventContext<Test> test) {
    final Pacts pacts = pactsInstance.get();
    if (pacts == null) {
        test.proceed();
        return;
    }

    TestClass testClass = test.getEvent().getTestClass();

    final List<Throwable> errors = new ArrayList<>();
    validateState(testClass, errors);
    validateTargetRequestFilters(testClass, errors);
    validateTestTarget(testClass, errors);

    Field interactionField =
        validateAndGetResourceField(testClass, RequestResponseInteraction.class, CurrentInteraction.class, errors);
    Field consumerField = validateAndGetResourceField(testClass, Consumer.class, CurrentConsumer.class, errors);

    if (errors.size() != 0) {
        String errorMessage = errors.stream()
            .map(Throwable::getMessage)
            .collect(Collectors.joining(" * "));
        throw new IllegalArgumentException(errorMessage);
    }

    executePacts(test, pacts, interactionField, consumerField);
}
 
开发者ID:arquillian,项目名称:arquillian-algeron,代码行数:28,代码来源:InteractionRunner.java

示例11: stop

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void stop(@Observes final EventContext<ManagerStopping> ending) {
    final ArquillianDescriptor descriptor = getDescriptorInstance();
    try {
        ending.proceed();
    } finally {
        renderAll(descriptor);
    }
}
 
开发者ID:cukespace,项目名称:arquillian-asciidoctor-extension,代码行数:9,代码来源:AsciidoctorObserver.java

示例12: execute

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void execute(@Observes(precedence = Integer.MAX_VALUE)
	EventContext<BeforeSuite> event) throws InvalidSyntaxException {

	Bundle bundle = FrameworkUtil.getBundle(getClass());

	BundleContext bundleContext = bundle.getBundleContext();

	Filter filter = FrameworkUtil.createFilter(
		"(&(objectClass=org.springframework.context.ApplicationContext)" +
			"(org.springframework.context.service.name=" +
				bundle.getSymbolicName() + "))");

	ServiceTracker<ApplicationContext, ApplicationContext> serviceTracker =
		new ServiceTracker<>(bundleContext, filter, null);

	serviceTracker.open();

	try {
		serviceTracker.waitForService(30 * 1000L);
	}
	catch (InterruptedException ie) {
		throw new RuntimeException(ie);
	}

	serviceTracker.close();

	event.proceed();
}
 
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:29,代码来源:LiferayWaitForServiceBuilderObserver.java

示例13: execute

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
private void execute(EventContext<? extends ExecutionEvent> context, String phase) {
    if (shouldPerformExecution(context.getEvent())) {
        context.proceed();
    } else {
        log.info("Ignore test [" + phase + "]: " + toFqn(context.getEvent()));
        testResultProducer.set(TestResult.skipped());
    }
}
 
开发者ID:arquillian,项目名称:arquillian-governor,代码行数:9,代码来源:IgnoreObserver.java

示例14: execute

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
public void execute(@Observes(precedence = Integer.MAX_VALUE)
		EventContext<BeforeSuite> event) throws InvalidSyntaxException {

	Bundle bundle = FrameworkUtil.getBundle(getClass());

	BundleContext bundleContext = bundle.getBundleContext();

	Filter filter = FrameworkUtil.createFilter(
		"(&(objectClass=org.springframework.context.ApplicationContext)" +
			"(org.springframework.context.service.name=" +
			bundleContext.getBundle().getSymbolicName() + "))");

	ServiceTracker<ApplicationContext, ApplicationContext> serviceTracker =
		new ServiceTracker<>(bundleContext, filter, null);

	serviceTracker.open();

	try {
		serviceTracker.waitForService(30 * 1000L);
	}
	catch (InterruptedException e) {
		throw new RuntimeException(e);
	}

	serviceTracker.close();

	event.proceed();
}
 
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:29,代码来源:LiferayWaitForServiceObserver.java

示例15: blockDeployManagedDeploymentsWhenNeeded

import org.jboss.arquillian.core.spi.EventContext; //导入依赖的package包/类
/**
 * Method ignoring DeployManagedDeployments events if already deployed.
 *
 * @param eventContext Event to check
 */
public void blockDeployManagedDeploymentsWhenNeeded(@Observes EventContext<DeployManagedDeployments> eventContext) {
    if (deployDeployments) {
        deployDeployments = false;
        debug("NOT Blocking DeployManagedDeployments event {0}", eventContext.getEvent().toString());
        eventContext.proceed();
    } else {
        // Do nothing with event.
        debug("Blocking DeployManagedDeployments event {0}", eventContext.getEvent().toString());
    }
}
 
开发者ID:ingwarsw,项目名称:arquillian-suite-extension,代码行数:16,代码来源:ArquillianSuiteExtension.java


注:本文中的org.jboss.arquillian.core.spi.EventContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。