[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Juraj Húska updated ARQGRA-433:
-------------------------------
Assignee: Juraj Húska
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Assignee: Juraj Húska
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Lukáš Fryč edited comment on ARQGRA-433 at 5/29/14 6:11 AM:
------------------------------------------------------------
{quote}
I would personaly remove that FieldAccessEnricherValidator from Graphene completely when you are considering to remove it in the future, why not to remove it now ...
{quote}
[As I have pointed out|https://issues.jboss.org/browse/ARQGRA-433?focusedCommentId=12963482&...], there are two reasons why using publicly accessible fields can't be recommended. We either need to fix the approach how proxies are used for interception of calls and injections or we should keep warning user that his usage can has unexpected consequences.
----
-One approach that could work without checking test class annotations is leveraging Arquillian BeforeClass event, that contain a type of the test class. When stored properly, you can access it during injection time and check whether enriched object is type of test being ran at the moment.-
was (Author: lfryc):
{quote}
I would personaly remove that FieldAccessEnricherValidator from Graphene completely when you are considering to remove it in the future, why not to remove it now ...
{quote}
[As I have pointed out|https://issues.jboss.org/browse/ARQGRA-433?focusedCommentId=12963482&...], there are two reasons why using publicly accessible fields can't be recommended. We either need to fix the approach how proxies are used for interception of calls and injections or we should keep warning user that his usage can has unexpected consequences.
----
One approach that could work without checking test class annotations is leveraging Arquillian BeforeClass event, that contain a type of the test class. When stored properly, you can access it during injection time and check whether enriched object is type of test being ran at the moment.
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Lukáš Fryč commented on ARQGRA-433:
-----------------------------------
+1, Juraj's solution seems to be most viable :-)
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Lukáš Fryč edited comment on ARQGRA-433 at 5/29/14 6:03 AM:
------------------------------------------------------------
{quote}
I would personaly remove that FieldAccessEnricherValidator from Graphene completely when you are considering to remove it in the future, why not to remove it now ...
{quote}
[As I have pointed out|https://issues.jboss.org/browse/ARQGRA-433?focusedCommentId=12963482&...], there are two reasons why using publicly accessible fields can't be recommended. We either need to fix the approach how proxies are used for interception of calls and injections or we should keep warning user that his usage can has unexpected consequences.
----
One approach that could work without checking test class annotations is leveraging Arquillian BeforeClass event, that contain a type of the test class. When stored properly, you can access it during injection time and check whether enriched object is type of test being ran at the moment.
was (Author: lfryc):
{quote}
I would personaly remove that FieldAccessEnricherValidator from Graphene completely when you are considering to remove it in the future, why not to remove it now ...
{quote}
[As I have pointed out|https://issues.jboss.org/browse/ARQGRA-433?focusedCommentId=12963482&...], there are two reasons why using publicly accessible fields can't be recommended. We either need to fix the approach how proxies are used for interception of calls and injections or we should keep warning user that his usage can has unexpected consequences.
----
One approach that could work without checking test class annotations is leveraging Arquillian BeforeClass event, that contain a type of the test class. When stored properly, you can access it during injection time.
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Lukáš Fryč commented on ARQGRA-433:
-----------------------------------
{quote}
I would personaly remove that FieldAccessEnricherValidator from Graphene completely when you are considering to remove it in the future, why not to remove it now ...
{quote}
[As I have pointed out|https://issues.jboss.org/browse/ARQGRA-433?focusedCommentId=12963482&...], there are two reasons why using publicly accessible fields can't be recommended. We either need to fix the approach how proxies are used for interception of calls and injections or we should keep warning user that his usage can has unexpected consequences.
----
One approach that could work without checking test class annotations is leveraging Arquillian BeforeClass event, that contain a type of the test class. When stored properly, you can access it during injection time.
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Juraj Húska edited comment on ARQGRA-433 at 5/29/14 6:00 AM:
-------------------------------------------------------------
What about excluding that particular enricher just here:
https://github.com/arquillian/arquillian-graphene/blob/master/impl/src/ma...
That is the place where enrichers are called over Test Case Object.
was (Author: jhuska):
What about excluding that particular enricher just here:
https://github.com/arquillian/arquillian-graphene/blob/master/impl/src/ma...
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Juraj Húska (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Juraj Húska commented on ARQGRA-433:
------------------------------------
What about excluding that particular enricher just here:
https://github.com/arquillian/arquillian-graphene/blob/master/impl/src/ma...
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months
[JBoss JIRA] (ARQGRA-433) FieldAccessValidatorEnricher checks access to fields uniformly
by Karel Piwko (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-433?page=com.atlassian.jira.plugin... ]
Karel Piwko commented on ARQGRA-433:
------------------------------------
+1 on not relying on {{@RunWith}} or {{extends Arquillian}}.
I still miss why FieldAccessEnricher can't trigger only for enrichers defined at
https://github.com/arquillian/arquillian-graphene/blob/master/impl/src/ma...
, e.g. moving FieldAccessValidatorEnricher functionality into AbstractSeachContextEnricher.
> FieldAccessValidatorEnricher checks access to fields uniformly
> --------------------------------------------------------------
>
> Key: ARQGRA-433
> URL: https://issues.jboss.org/browse/ARQGRA-433
> Project: Arquillian Graphene
> Issue Type: Bug
> Components: core
> Affects Versions: 2.0.2.Final
> Reporter: Stefan Miklosovic
> Priority: Optional
> Fix For: 2.0.3.Final
>
>
> I have this test
> {code}
> @Rule
> public ExpectedException expectedException = ExpectedException.none();
> @Test
> @InSequence(2)
> @ReportMessage("This method should pass.")
> public void testWithExpectedExceptionRule() {
> expectedException.expect(RuntimeException.class);
> throw new RuntimeException("this exception is expected");
> }
> {code}
> Logger writes this out:
> WARNING: Public field 'expectedException' found in org.arquillian.droidium.devconf.AeroGearTestCase. Direct access to fields outside of the declaring class is not allowed.
> Apr 01, 2014 11:50:27 AM org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
> However that @Rule field _has to be_ public
> {quote}
> A field must be public, not static, and a subtype of TestRule
> {quote}
> So in this case validation does not make sense.
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
10 years, 7 months