Make MdsalHelper.getFullPropertiesPath generic 31/88031/1
authorSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Fri, 17 May 2019 20:41:13 +0000 (20:41 +0000)
committerSmokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Fri, 17 May 2019 20:41:13 +0000 (20:41 +0000)
Make MdsalHelper.getFullPropertiesPath generic and have a default for backwards compatibility

Change-Id: I0d5006b895691d2f0fb2b71803324d58c8819956
Issue-ID: CCSDK-1342
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java

index 818077f..4d17f87 100755 (executable)
@@ -1325,7 +1325,8 @@ public class MdsalHelper {
 
     @Deprecated
     public static String getFullPropertiesPath(String propertiesFileName) {
-        return "/opt/bvc/controller/configuration/" + propertiesFileName;
+       String karafHome = System.getProperty("karaf.home","/opt/lsc/controller");
+        return karafHome + "/configuration/" + propertiesFileName;
     }
 
     // This is called when mapping a valid java enumeration back to the yang model value
index 56d0369..744d48d 100755 (executable)
@@ -349,4 +349,15 @@ public class MdsalHelperTest extends TestCase {
                MdsalHelper.toProperties(props, address);
                assertEquals("/cafe:0:0:0:0:0:0:8888", props.getProperty(""));
        }
-}
\ No newline at end of file
+
+       public void testGetFullPropertiesPath() {
+           String propertiesName = "l3ucpe.properties";
+           String path = MdsalHelper.getFullPropertiesPath(propertiesName);
+           //verify the default works
+           assertEquals("/opt/lsc/controller/configuration/l3ucpe.properties",path);
+           System.setProperty("karaf.home", "/opt/opendaylight/current");
+           path = MdsalHelper.getFullPropertiesPath(propertiesName);
+           //verify the system property is read
+           assertEquals("/opt/opendaylight/current/configuration/l3ucpe.properties",path);
+       }
+}