[JBoss JIRA] (ARQ-2170) RulesEnricher doubles each test enrichment
by Matous Jobanek (JIRA)
[ https://issues.jboss.org/browse/ARQ-2170?page=com.atlassian.jira.plugin.s... ]
Matous Jobanek commented on ARQ-2170:
-------------------------------------
There is a way to disable the functionality of the {{RulesEnricher}} - you need to create an Arquillian extension with an interceptor where you don't proceed the event {{RulesEnrichment}}. Interceptor is an observer, but instead of observing the event itself, you observe the context of the event:
{code:java}
public void observe(@Observes(precedence = 100) EventContext<RulesEnrichment> event) {
{code}
If the {{event.proceed()}} is not called within this method, then the event flow is stopped, and thus the observer {{RulesEnricher}} is not invoked.
Currently, it is necessary to create an Arquillian extension using SPI for it - from the next version of Arquillian core it should be possible to do it specifically just for one test class inside of your test suite using an annotation {{@Observer}}.
For more information see:
https://github.com/arquillian/arquillian-core/pull/161
https://issues.jboss.org/browse/ARQ-2174
I hope that this will help.
> RulesEnricher doubles each test enrichment
> ------------------------------------------
>
> Key: ARQ-2170
> URL: https://issues.jboss.org/browse/ARQ-2170
> Project: Arquillian
> Issue Type: Bug
> Components: core
> Environment: arquillian-junit-core-1.1.11.Final (all versions affected)
> Reporter: kostd kostd
>
> RulesEnricher created in ARQ-1954
> 1. RulesEnricher is not implementor of TestEnricher, so it cannot be overrided through LoadableExtension.
> 2. RulesEnricher#enrichRulesAndTestInstance adds into collection toEnrich test instance:
> {code}
> toEnrich.add(event.getTestInstance());
> {code}
> https://github.com/arquillian/arquillian-core/blob/master/junit/core/src/...
> So, if MyTest have`nt field rules, will be only one MyTest enrichment. If MyTest contains one or more test rule, will be two MyTest enrichments.
> Each testEnrichment of MyTest do a soap call to server to prepare data for test. It is very important to me, one or two soap call will happen.
> How can I change this behaviour?
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 10 months
[JBoss JIRA] (ARQ-2174) Provide a way of observing Arqullian events within a test class
by Matous Jobanek (JIRA)
Matous Jobanek created ARQ-2174:
-----------------------------------
Summary: Provide a way of observing Arqullian events within a test class
Key: ARQ-2174
URL: https://issues.jboss.org/browse/ARQ-2174
Project: Arquillian
Issue Type: Enhancement
Components: core
Reporter: Matous Jobanek
Assignee: Matous Jobanek
Fix For: 1.2.2.Final
Provide some way to observe Arquillian events from the test class or some external class defined by an annotation (eg. {{Observer}}). This observer should be related only to the specific test class and should behave as any other Arquillian observer (supporting injection).
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 10 months
[JBoss JIRA] (ARQ-2173) Create of SPI for auto-deployment feature
by Alex Soto (JIRA)
Alex Soto created ARQ-2173:
------------------------------
Summary: Create of SPI for auto-deployment feature
Key: ARQ-2173
URL: https://issues.jboss.org/browse/ARQ-2173
Project: Arquillian
Issue Type: Enhancement
Components: Base Implementation
Reporter: Alex Soto
Creates a Java Service (SPI) to allow developers hook into deployment process and be able to generate its own automation process for creating the deployment archive instead of relying on method annotated with @Deployment.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 10 months
[JBoss JIRA] (ARQ-2170) RulesEnricher doubles each test enrichment
by kostd kostd (JIRA)
[ https://issues.jboss.org/browse/ARQ-2170?page=com.atlassian.jira.plugin.s... ]
kostd kostd commented on ARQ-2170:
----------------------------------
[~mjobanek], thanks for your answer. So, if both items are by design, can you provide some other spi to override RulesEnricher or yet another way to remove unnecessary (in some cases) second enrichment?
For example, we use both enrichers and rules, but our rules agreed if testclass-fields will be null.
> RulesEnricher doubles each test enrichment
> ------------------------------------------
>
> Key: ARQ-2170
> URL: https://issues.jboss.org/browse/ARQ-2170
> Project: Arquillian
> Issue Type: Bug
> Components: core
> Environment: arquillian-junit-core-1.1.11.Final (all versions affected)
> Reporter: kostd kostd
>
> RulesEnricher created in ARQ-1954
> 1. RulesEnricher is not implementor of TestEnricher, so it cannot be overrided through LoadableExtension.
> 2. RulesEnricher#enrichRulesAndTestInstance adds into collection toEnrich test instance:
> {code}
> toEnrich.add(event.getTestInstance());
> {code}
> https://github.com/arquillian/arquillian-core/blob/master/junit/core/src/...
> So, if MyTest have`nt field rules, will be only one MyTest enrichment. If MyTest contains one or more test rule, will be two MyTest enrichments.
> Each testEnrichment of MyTest do a soap call to server to prepare data for test. It is very important to me, one or two soap call will happen.
> How can I change this behaviour?
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 11 months
[JBoss JIRA] (ARQ-2170) RulesEnricher doubles each test enrichment
by Matous Jobanek (JIRA)
[ https://issues.jboss.org/browse/ARQ-2170?page=com.atlassian.jira.plugin.s... ]
Matous Jobanek commented on ARQ-2170:
-------------------------------------
Hi,
thanks for reporting this issue.
> 1. RulesEnricher is not implementor of TestEnricher, so it cannot be overrided through LoadableExtension.
The {{RulesEnricher}} cannot be an implementation of the {{TestEnricher}} because {{TestEnrichers}} are called in a later phase than the rules are created. That's why it is an observer that observes the event {{RulesEnrichment}} that is invoked before the other test enrichers. For more information see this issue https://issues.jboss.org/browse/ARQ-2034
> 2. RulesEnricher#enrichRulesAndTestInstance adds into collection toEnrich test instance:
It is known that it does the double enrichment of the test instances, unfortunately, it is there for a purpose. The rules can be created inside of the test classes as an anonymous class that is using fields from the test class itself:
{code:java}
@ArquillianResource
URL url;
@Rule
public TestRule rule = new TestRule() {
public Statement apply(final Statement base, Description description) {
doSomethingWithUrl(url);
return new Statement() {
@Override
public void evaluate() throws Throwable {
base.evaluate();
}
};
}
};
{code}
For this purpose, it is necessary to inject the fields also into the test class. The second enrichment is then performed in the standard enrichment phase.
> RulesEnricher doubles each test enrichment
> ------------------------------------------
>
> Key: ARQ-2170
> URL: https://issues.jboss.org/browse/ARQ-2170
> Project: Arquillian
> Issue Type: Bug
> Components: core
> Environment: arquillian-junit-core-1.1.11.Final (all versions affected)
> Reporter: kostd kostd
>
> RulesEnricher created in ARQ-1954
> 1. RulesEnricher is not implementor of TestEnricher, so it cannot be overrided through LoadableExtension.
> 2. RulesEnricher#enrichRulesAndTestInstance adds into collection toEnrich test instance:
> {code}
> toEnrich.add(event.getTestInstance());
> {code}
> https://github.com/arquillian/arquillian-core/blob/master/junit/core/src/...
> So, if MyTest have`nt field rules, will be only one MyTest enrichment. If MyTest contains one or more test rule, will be two MyTest enrichments.
> Each testEnrichment of MyTest do a soap call to server to prepare data for test. It is very important to me, one or two soap call will happen.
> How can I change this behaviour?
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 11 months
[JBoss JIRA] (ARQ-2144) Incomplete arquillian-testng.jar for TestNG 6.10+
by Dipak Pawar (JIRA)
[ https://issues.jboss.org/browse/ARQ-2144?page=com.atlassian.jira.plugin.s... ]
Dipak Pawar commented on ARQ-2144:
----------------------------------
We found the root cause of this issue. TestNG has some issue while packaging there jars. You can find all the details at https://github.com/cbeust/testng/issues/1677 and https://github.com/cbeust/jcommander/issues/430.
We have to wait TestNG fixes this in upstream. If you are blocked with this issue then for the time being as workaround just "org.testng:testng" dependency as library while creating archive using srinkwrap in it,. Something like
{code:java}
@Deployment
public static WebArchive createDeployment() {
final PomEquippedResolveStage pomEquippedResolveStage = Maven.resolver().loadPomFromFile("pom.xml");
File[] mavenFiles = pomEquippedResolveStage.importRuntimeDependencies().resolve()
.withTransitivity().asFile();
return ShrinkWrap.create(WebArchive.class).addPackage("application.rest").addPackage("application")
.addAsLibraries(mavenFiles)
.addAsLibraries(pomEquippedResolveStage.resolve("org.testng:testng").withTransitivity().asFile());
}
{code}
> Incomplete arquillian-testng.jar for TestNG 6.10+
> -------------------------------------------------
>
> Key: ARQ-2144
> URL: https://issues.jboss.org/browse/ARQ-2144
> Project: Arquillian
> Issue Type: Bug
> Components: Base Implementation, Daemon
> Affects Versions: 1.1.13.Final
> Environment: jdk1.8.0_141 OSX
> Reporter: Scott Stark
> Assignee: Andrew Rubinger
> Priority: Critical
> Attachments: TestNGWorkaround.java
>
>
> I have created a simple cdi test that illustrates a problem I'm seeing with TestNG based remote tests running in Wildfly-Swarm. The issue is that the arquillian-testng.jar that is attached to the test WebArchive is missing the majority of TestNG classes, and so the test fails to load in the container runtime.
> I have created a https://github.com/starksm64/arq-testnq-tests repository with two tests that illustrate the problem.
> There is a ex.ExceptionTest that illustrates the inability to deploy the test due to NoClassDefFoundError:
> {noformat}
> 2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) java.lang.NoClassDefFoundError: Failed to link ex/ExceptionTest (Module "deployment.exTest.war:main" from Service Module Loader): Failed to link org/jboss/arquillian/testng/Arquillian (Module "deployment.exTest.war:main" from Service Module Loader): Failed to link org/testng/IHookable (Module "deployment.exTest.war:main" from Service Module Loader): org/testng/ITestNGListener
> 2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 2017-09-20 16:49:37,560 ERROR [stderr] (nioEventLoopGroup-3-1) at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.Module.loadModuleClass(Module.java:606)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
> 2017-09-20 16:49:37,561 ERROR [stderr] (nioEventLoopGroup-3-1) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at org.wildfly.swarm.arquillian.daemon.TestRunner.executeTest(TestRunner.java:45)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at org.wildfly.swarm.arquillian.daemon.server.Server.executeTest(Server.java:250)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:361)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at org.wildfly.swarm.arquillian.daemon.server.Server$StringCommandHandler.channelRead0(Server.java:303)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276)
> 2017-09-20 16:49:37,562 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
> 2017-09-20 16:49:37,563 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
> 2017-09-20 16:49:37,564 ERROR [stderr] (nioEventLoopGroup-3-1) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
> 2017-09-20 16:49:37,564 ERROR [stderr] (nioEventLoopGroup-3-1) at java.lang.Thread.run(Thread.java:748)
> {noformat}
> The test includes a TestNGArchiveProcessor AuxiliaryArchiveProcessor implementation that dumps out the arquillian-testng.jar seen in the WebArchive. It shows only the following org.testng package classes when run form within the Intellij IDEA IDE:
> {noformat}
> *-testng.jar contents: arquillian-testng.jar:
> /org/
> /org/testng/
> /org/testng/IDEARemoteTestNG.class
> /org/testng/IDEATestNGConfigurationListener.class
> /org/testng/IDEATestNGInvokedMethodListener.class
> /org/testng/IDEATestNGListener.class
> /org/testng/IDEATestNGRemoteListener$DelegatedResult.class
> /org/testng/IDEATestNGRemoteListener$ExposedTestResult.class
> /org/testng/IDEATestNGRemoteListener.class
> /org/testng/IDEATestNGSuiteListener.class
> /org/testng/IDEATestNGTestListener.class
> /org/testng/MapSerializerUtil$1.class
> /org/testng/MapSerializerUtil$EscapeInfoProvider.class
> /org/testng/MapSerializerUtil.class
> /org/testng/RemoteTestNGStarter.class
> /org/testng/TestNGExpectedPatterns.class
> /org/testng/TestNGForkedSplitter.class
> /org/testng/TestNGForkedStarter.class
> /org/testng/TestNGTestDiscoveryListener.class
> /org/testng/TestNGXmlSuiteHelper$Logger$1.class
> /org/testng/TestNGXmlSuiteHelper$Logger.class
> /org/testng/TestNGXmlSuiteHelper.class
> {noformat}
> When run from the command line the arquillian-testng.jar contains no org.testng package classes.
> The underlying problem seems to be how the org.jboss.shrinkwrap.impl.base.URLPackageScanner includes package classes. I have a simple arq.URLPackageScannerTest in the that illustrates how URLPackageScanner fails to located org.testng classes.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
6 years, 11 months