Eliminate use of environment variables 38/48638/1
authorRobert Varga <rovarga@cisco.com>
Wed, 23 Nov 2016 17:30:12 +0000 (18:30 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 23 Nov 2016 17:30:12 +0000 (18:30 +0100)
Change I1edbed691ac1a01c8bfc1c8178d4836781aba0a1
introduced a back-channel to move effective settings
into the IT test. Use that instead of magic properties,
as it is safer.

Change-Id: If1b2d6e91ca4e9dd0c15f1c8dc10fa64ad7cdcdf
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-maven-plugin-it/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/it/YangToSourcesPluginTestIT.java

index 770e32781228aed569418229b1360b12396b861b..9ade2fdc6e4e5320281f452bc0c41b8dd13fc5ca 100644 (file)
@@ -28,16 +28,6 @@ import org.junit.Test;
 
 public class YangToSourcesPluginTestIT {
 
-    private static String GLOBAL_SETTINGS_OVERRIDE;
-    private static String USER_SETTINGS_OVERRIDE;
-
-    @BeforeClass
-    public static void setupClass() {
-        // OpenDaylight Jenkins does not have settings at the default path, pick file locations from environment
-        GLOBAL_SETTINGS_OVERRIDE = System.getenv("GLOBAL_SETTINGS_FILE");
-        USER_SETTINGS_OVERRIDE = System.getenv("SETTINGS_FILE");
-    }
-
     // TODO Test yang files in transitive dependencies
 
     @Test
@@ -132,16 +122,11 @@ public class YangToSourcesPluginTestIT {
         if (ignoreF) {
             verifier.addCliOption("-fn");
         }
-        if (GLOBAL_SETTINGS_OVERRIDE != null) {
-            verifier.addCliOption("-gs");
-            verifier.addCliOption(GLOBAL_SETTINGS_OVERRIDE);
-        } else if (getEffectiveSettingsXML().isPresent()) {
+
+               final Optional<String> maybeSettings = getEffectiveSettingsXML();
+               if (maybeSettings.isPresent()) {
             verifier.addCliOption("-gs");
-            verifier.addCliOption(getEffectiveSettingsXML().get());
-        }
-        if (USER_SETTINGS_OVERRIDE != null) {
-            verifier.addCliOption("-s");
-            verifier.addCliOption(USER_SETTINGS_OVERRIDE);
+            verifier.addCliOption(maybeSettings.get());
         }
         verifier.setMavenDebug(true);
         verifier.executeGoal("generate-sources");