forked from apache/nifi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NIFI-9826 Moved build locale settings from Maven to GitHub Workflow
- Adjusted Java 17 build locale settings - Added test to verify match between System properties and build environment variables This closes apache#5980 Signed-off-by: David Handermann <exceptionfactory@apache.org>
- Loading branch information
1 parent
73ee1a9
commit c88c404
Showing
5 changed files
with
114 additions
and
19 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.nifi</groupId> | ||
<artifactId>nifi-commons</artifactId> | ||
<version>1.17.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>nifi-build</artifactId> | ||
</project> |
55 changes: 55 additions & 0 deletions
55
nifi-commons/nifi-build/src/test/java/org/apache/nifi/build/VerifyBuildLocaleTest.java
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.nifi.build; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; | ||
import org.junit.platform.commons.util.StringUtils; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class VerifyBuildLocaleTest { | ||
|
||
/** | ||
* Verify that the intended system locale is active for the surefire invocation. | ||
* | ||
* NiFi Surefire invocations may be executed in the context of a particular locale, in order to verify the locale | ||
* independence of the code base. | ||
* | ||
* If "NIFI_CI_LOCALE" is defined, then it must specify each system property enumerated in this test case. | ||
*/ | ||
@Test | ||
@EnabledIfEnvironmentVariable(named = "NIFI_CI_LOCALE", matches = ".+", | ||
disabledReason = "NiFi CI build sets this environment variable; it will not normally be set") | ||
public void testEnvironmentLocaleMatchesSystemProperties() { | ||
final String ciLocale = System.getenv("NIFI_CI_LOCALE"); | ||
// if the flag variable is set, verify the system locale of the surefire process against NIFI_CI_LOCALE | ||
final String[] systemPropertyKeys = { | ||
"user.language", | ||
"user.country", | ||
}; | ||
for (String key : systemPropertyKeys) { | ||
assertTrue(ciLocale.contains(key)); | ||
final String value = System.getProperty(key); | ||
final String message = String.format( | ||
"system property - CI_LOCALE:[%s] ACTUAL:[%s=%s]", ciLocale, key, value); | ||
assertTrue(StringUtils.isNotBlank(value), message); | ||
final String expected = String.format("%s=%s", key, value); | ||
assertTrue(ciLocale.contains(expected), message); | ||
} | ||
} | ||
} |
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
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