[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-18 Thread Ivan Bessonov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794961#comment-16794961
 ] 

Ivan Bessonov commented on IGNITE-11323:


Related fix is in IGNITE-11323

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
>  Labels: MakeTeamcityGreenAgain
> Fix For: 2.8
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-15 Thread Ivan Bessonov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793555#comment-16793555
 ] 

Ivan Bessonov commented on IGNITE-11323:


[~amashenkov] "currTestMtd" was static by mistake. I'll check other fields that 
you mentioned, thank you!

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
>  Labels: MakeTeamcityGreenAgain
> Fix For: 2.8
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-15 Thread Dmitriy Govorukhin (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793552#comment-16793552
 ] 

Dmitriy Govorukhin commented on IGNITE-11323:
-

[~ibessonov] Thanks, merged to master.

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
>  Labels: MakeTeamcityGreenAgain
> Fix For: 2.8
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-15 Thread Andrew Mashenkov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793520#comment-16793520
 ] 

Andrew Mashenkov commented on IGNITE-11323:
---

[~ibessonov], just one question.

What is the reason making GridAbstractTest.currTestMtd field non-static?
I see it was marked as 'static' together with 'forceFailure' and 
'forceFailureMsg' in IGNITE-10179.

Is IGNITE-10179 changes outdated and forceFailure* can be non-static as well? 
or 'currTestMtd' static modifier change should be reverted?

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
>  Labels: MakeTeamcityGreenAgain
> Fix For: 2.8
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-15 Thread Andrew Mashenkov (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793480#comment-16793480
 ] 

Andrew Mashenkov commented on IGNITE-11323:
---

[~ibessonov], great idea.

PR look good to me.

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
> Fix For: 2.8
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests

2019-03-15 Thread Ignite TC Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/IGNITE-11323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16793423#comment-16793423
 ] 

Ignite TC Bot commented on IGNITE-11323:


{panel:title=--> Run :: All: No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
[TeamCity *--> Run :: All* 
Results|https://ci.ignite.apache.org/viewLog.html?buildId=3311887&buildTypeId=IgniteTests24Java8_RunAll]

> Reduce boilerplate "System.setProperty" code in tests
> -
>
> Key: IGNITE-11323
> URL: https://issues.apache.org/jira/browse/IGNITE-11323
> Project: Ignite
>  Issue Type: Test
>Reporter: Ivan Bessonov
>Assignee: Ivan Bessonov
>Priority: Major
> Fix For: 2.8
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are many examples in tests where some property gets new value in 
> "beforeTestsStarted"/"beforeTest"/"beginning of test method" and then gets 
> its previous value in "afterTestsStopped"/"afterTest"/"finally block of test 
> method". This approach leads to excessive code that can be avoided.
> I suggest implementing annotation "WithSystemProperty" (name is the subject 
> to discussion) that will allow us to write this:
> {code:java}
> @Test
> @WithSystemProperty(key = IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, value 
> = "true")
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> ...
> }
> {code}
> instead of this:
> {code:java}
> @Test
> public void testSkipCheckConsistencyFlagEnabled() throws Exception {
> String backup = 
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, "true");
> try {
> ...
> }
> finally {
> if (backup != null)
> System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
> backup);
> else
> System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
> }
> }
> {code}
>  
> There also has to be ability to use this annotation on test class so new 
> value of system properties will be used in all of its test methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)