1 package org.kuali.ole.utility; 2 3 import java.net.URL; 4 import java.util.List; 5 import java.util.Properties; 6 7 import org.junit.Test; 8 9 public class ConvertUrlPropertiesToRiceURLProperties_UT { 10 11 @Test 12 public void convert() throws Exception { 13 URL xmlLocation = ConvertUrlPropertiesToRiceURLProperties_UT.class.getProtectionDomain().getCodeSource().getLocation(); 14 String propertiesFileLocation=xmlLocation.getFile(); 15 propertiesFileLocation=propertiesFileLocation.substring(0,propertiesFileLocation.indexOf("/target/",0)); 16 String location = propertiesFileLocation+"/target/classes/org/kuali/ole/url-rice-properties.xml"; 17 Properties p = org.kuali.common.util.PropertyUtils.load(location); 18 List<String> keys = org.kuali.common.util.PropertyUtils.getSortedKeys(p); 19 StringBuilder sb = new StringBuilder(); 20 sb.append("<config>\n"); 21 for (String key : keys) { 22 String value = p.getProperty(key); 23 sb.append(" <param name=\"" + key + "\">" + value + "</param>\n"); 24 } 25 sb.append("</config>\n"); 26 System.out.println(sb); 27 28 } 29 30 }