-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRESOURCES-284] Support JSON format for parameter filter files #20
Open
ImadBL
wants to merge
1
commit into
apache:master
Choose a base branch
from
ImadBL:Support-JSON-parameter-filter-files_MRESOURCES-284
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ under the License. | |
</distributionManagement> | ||
|
||
<properties> | ||
<mavenFilteringVersion>3.2.0</mavenFilteringVersion> | ||
<mavenFilteringVersion>3.3.0-SNAPSHOT</mavenFilteringVersion> | ||
<mavenVersion>3.1.0</mavenVersion> | ||
<javaVersion>7</javaVersion> | ||
<project.build.outputTimestamp>2020-08-05T15:25:21Z</project.build.outputTimestamp> | ||
|
@@ -79,6 +79,10 @@ under the License. | |
<contributor> | ||
<name>Graham Leggett</name> | ||
</contributor> | ||
<contributor> | ||
<name>Imad BELMOUJAHID</name> | ||
<email>[email protected]</email> | ||
</contributor> | ||
</contributors> | ||
|
||
<dependencies> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ | |
/** | ||
* Copy resources for the main source code to the main output directory. Always uses the project.build.resources element | ||
* to specify the resources to copy. | ||
* | ||
* @author <a href="mailto:[email protected]>Imad BELMOUJAHID</a> @ImadBL | ||
* @author <a href="[email protected]">Michal Maczka</a> | ||
* @author <a href="mailto:[email protected]">Jason van Zyl</a> | ||
* @author Andreas Hoheneder | ||
|
@@ -208,6 +208,14 @@ public class ResourcesMojo | |
@Parameter | ||
protected LinkedHashSet<String> delimiters; | ||
|
||
/** | ||
* This parameter is used in particular for filters properties files with format json. | ||
* if this parameter is not empty, we select all the parameters who are the nodes start with this parameter | ||
* This helps us to add a ROOT node FOR EACH environment in a same JSON file | ||
*/ | ||
@Parameter | ||
protected String rootNode; | ||
|
||
/** | ||
* Use default delimiters in addition to custom delimiters, if any. | ||
* | ||
|
@@ -349,6 +357,9 @@ public void execute() | |
// Handle MRESOURCES-171 | ||
mavenResourcesExecution.setPropertiesEncoding( propertiesEncoding ); | ||
|
||
// Set rootNode for new feature with json file ### MRESOURCES-284 ### | ||
mavenResourcesExecution.setRootNode( rootNode ); | ||
|
||
if ( nonFilteredFileExtensions != null ) | ||
{ | ||
mavenResourcesExecution.setNonFilteredFileExtensions( nonFilteredFileExtensions ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ | |
|
||
import org.apache.maven.shared.filtering.PropertyUtils; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]>Imad BELMOUJAHID</a> @ImadBL | ||
*/ | ||
public class BasicPropertyUtilsTest | ||
extends AbstractPropertyUtilsTest | ||
{ | ||
|
@@ -58,41 +61,44 @@ protected File getValidationFile() | |
|
||
/** | ||
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties | ||
* I added a null for this parameter (rootNode) because it is only used with json file @ImadBL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be an API doc comment |
||
* | ||
* @throws Exception | ||
*/ | ||
public void testBasicLoadProperty_FF() | ||
throws Exception | ||
{ | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, false, false ); | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, false, false, null ); | ||
|
||
assertNotNull( prop ); | ||
assertTrue( validateProperties( prop ) ); | ||
} | ||
|
||
/** | ||
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties | ||
* I added a null for this parameter (rootNode) because it is only used with json file @ImadBL | ||
* | ||
* @throws Exception | ||
*/ | ||
public void testBasicLoadProperty_TF() | ||
throws Exception | ||
{ | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, false ); | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, false, null ); | ||
|
||
assertNotNull( prop ); | ||
assertTrue( validateProperties( prop ) ); | ||
} | ||
|
||
/** | ||
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties | ||
* I added a null for this parameter (rootNode) because it is only used with json file @ImadBL | ||
* | ||
* @throws Exception | ||
*/ | ||
public void testBasicLoadProperty_TT() | ||
throws Exception | ||
{ | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, true ); | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, true, null ); | ||
|
||
validationProp.putAll( System.getProperties() ); | ||
assertNotNull( prop ); | ||
|
@@ -101,13 +107,14 @@ public void testBasicLoadProperty_TT() | |
|
||
/** | ||
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties | ||
* I added a null for this parameter (rootNode) because it is only used with json file @ImadBL | ||
* | ||
* @throws Exception | ||
*/ | ||
public void testNonExistentProperty() | ||
throws Exception | ||
{ | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, true ); | ||
Properties prop = PropertyUtils.loadPropertyFile( propertyFile, true, true, null ); | ||
|
||
validationProp.putAll( System.getProperties() ); | ||
assertNotNull( prop ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,22 @@ | |
import org.apache.maven.shared.filtering.PropertyUtils; | ||
import org.junit.Test; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]>Imad BELMOUJAHID</a> @ImadBL | ||
*/ | ||
public class PropertyUtilsExceptionTest | ||
{ | ||
|
||
/** | ||
* load property test case can be adjusted by modifying the basic.properties and basic_validation properties | ||
* I added a null for this parameter (rootNode) because it is only used with json file @ImadBL | ||
* | ||
* @throws Exception | ||
*/ | ||
@Test( expected = FileNotFoundException.class ) | ||
public void loadPropertyFileShouldFailWithFileNotFoundException() | ||
throws Exception | ||
{ | ||
PropertyUtils.loadPropertyFile( new File( "NON_EXISTENT_FILE" ), true, true ); | ||
PropertyUtils.loadPropertyFile( new File( "NON_EXISTENT_FILE" ), true, true, null ); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If