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); }
public void observeTestExecution(@Observes EventContext<Test> context) { Test event = context.getEvent(); try { context.proceed(); } finally { if (event.getTestMethodExecutor() instanceof LifecycleMethodExecutor) { List<Annotation> qualifiers = ((LifecycleMethodExecutor) event.getTestMethodExecutor()).getQualifiers(); ExecutedMethod executedMethod = new ExecutedMethod(event.getTestMethod(), qualifiers); responsePayload.get().getExecutedMethods().add(executedMethod); } } } }
public void execute(@Observes Test event) throws Exception { boolean runAsClient = RunModeUtils.isRunAsClientAndCheck( this.deployment.get(), event.getTestClass(), event.getTestMethod()); if (runAsClient) { executionEvent.fire(new LocalExecutionEvent(event.getTestMethodExecutor())); } else { executionEvent.fire(new RemoteExecutionEvent(event.getTestMethodExecutor())); } } }
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); } }
public void execute(@Observes Test event) throws Exception { boolean runAsClient = RunModeUtils.isRunAsClientAndCheck( this.deployment.get(), event.getTestClass(), event.getTestMethod()); if (runAsClient) { executionEvent.fire(new LocalExecutionEvent(event.getTestMethodExecutor())); } else { executionEvent.fire(new RemoteExecutionEvent(event.getTestMethodExecutor())); } } }
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.getJavaClass(), 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(); } }
public void execute(@Observes Test event) throws Exception { TestResult result = TestResult.passed(); try { event.getTestMethodExecutor().invoke( enrichArguments( event.getTestMethod(), serviceLoader.get().all(TestEnricher.class))); } catch (Throwable e) { result = TestResult.failed(e); } finally { result.setEnd(System.currentTimeMillis()); } testResult.set(result); }
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(); } } }
public void execute(@Observes Test event) throws Exception { TestResult result = new TestResult(); try { event.getTestMethodExecutor().invoke( enrichArguments( event.getTestMethod(), serviceLoader.get().all(TestEnricher.class))); result.setStatus(Status.PASSED); } catch (Throwable e) { result.setStatus(Status.FAILED); result.setThrowable(e); } finally { result.setEnd(System.currentTimeMillis()); } testResult.set(result); }
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)); }
public void execute(@Observes Test event) throws Exception { TestResult result = new TestResult(); try { event.getTestMethodExecutor().invoke( enrichArguments( event.getTestMethod(), serviceLoader.get().all(TestEnricher.class))); result.setStatus(Status.PASSED); } catch (Throwable e) { result.setStatus(Status.FAILED); result.setThrowable(e); } finally { result.setEnd(System.currentTimeMillis()); } testResult.set(result); }
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)); }
public void execute(@Observes Test event) throws Exception { TestResult result = new TestResult(); try { event.getTestMethodExecutor().invoke( enrichArguments( event.getTestMethod(), serviceLoader.get().all(TestEnricher.class))); result.setStatus(Status.PASSED); } catch (Throwable e) { result.setStatus(Status.FAILED); result.setThrowable(e); } finally { result.setEnd(System.currentTimeMillis()); } testResult.set(result); }
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(); } }