[ 
https://jira.codehaus.org/browse/SUREFIRE-649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356096#comment-356096
 ] 

Arne Franken edited comment on SUREFIRE-649 at 11/13/14 12:03 PM:
------------------------------------------------------------------

as a background:
We have a Spring Framework based application that uses the 
[PropertyPlaceholderConfigurer in System Properties Override 
mode|http://docs.spring.io/spring-framework/docs/2.0.8/api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html#SYSTEM_PROPERTIES_MODE_OVERRIDE]

The defaults for properties are managed by the application.

We execute a test with Failsafe, loading the application with the test.

In order to be able to override properties in tests (for example URLs to 
connect against), we use System Properties:

#POM#
<properties>
<myProperty/>
</properties>
...
failsafe configration
<systemPropertyVariables>
<myProperty>${myProperty}</myProperty>
</systemPropertyVariables>
#POM#

If the plugin is executed without setting -DmyProperty, Surefire 2.16 ignored 
the configuration and the application would use the property default when 
creating the Spring Beans.

Now, an empty String is passed to the JVM, so an empty String is used when 
creating the Spring Beans...

Why was the behaviour changed if it was working fine before and there is syntax 
to set empty System Properties?

Now, there is no way to optionally pass SystemProperties to the process started 
by Surefire...


was (Author: afranken):
as a background:
We have a Spring Framework based application that uses the 
[PropertyPlaceholderConfigurer in System Properties Override 
mode|http://docs.spring.io/spring-framework/docs/2.0.8/api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html#SYSTEM_PROPERTIES_MODE_OVERRIDE]

The defaults for properties are managed by the application.

We execute a test with Failsafe, loading the application with the test.

In order to be able to override properties in tests (for example URLs to 
connect against), we use System Properties:

--POM--
<properties>
<myProperty/>
</properties>
...
failsafe configration
<systemPropertyVariables>
<myProperty>${myProperty}</myProperty>
</systemPropertyVariables>
--POM--

If the plugin is executed without setting -DmyProperty, Surefire 2.16 ignored 
the configuration and the application would use the property default when 
creating the Spring Beans.

Now, an empty String is passed to the JVM, so an empty String is used when 
creating the Spring Beans...

Why was the behaviour changed if it was working fine before and there is syntax 
to set empty System Properties?

Now, there is no way to optionally pass SystemProperties to the process started 
by Surefire...

> Might be impossible to have empty strings in systemPropertyVariables element
> ----------------------------------------------------------------------------
>
>                 Key: SUREFIRE-649
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-649
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.6
>            Reporter: Laird Nelson
>            Assignee: Tibor Digana
>            Priority: Minor
>             Fix For: 2.18
>
>         Attachments: surefireEmptyStringIssue.tar.gz
>
>
> This stanza:
> <systemProperties>
>   <property>
>     <name>emptyProperty</name>
>     <value></value>
>   </property>
> </systemProperties>
> ...yields "" from System.getProperty("emptyProperty").
> This (supposedly better) stanza:
> <systemPropertyVariables>
>   <emptyProperty></emptyProperty>
> </systemPropertyVariables>
> ...yields null from System.getProperty("emptyProperty").
> A test case is attached that demonstrates the issue.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to