001package org.kuali.ole.utility; 002 003import java.net.URL; 004import java.util.List; 005import java.util.Properties; 006 007import org.junit.Test; 008 009public class ConvertUrlPropertiesToRiceURLProperties_UT { 010 011 @Test 012 public void convert() throws Exception { 013 URL xmlLocation = ConvertUrlPropertiesToRiceURLProperties_UT.class.getProtectionDomain().getCodeSource().getLocation(); 014 String propertiesFileLocation=xmlLocation.getFile(); 015 propertiesFileLocation=propertiesFileLocation.substring(0,propertiesFileLocation.indexOf("/target/",0)); 016 String location = propertiesFileLocation+"/target/classes/org/kuali/ole/url-rice-properties.xml"; 017 Properties p = org.kuali.common.util.PropertyUtils.load(location); 018 List<String> keys = org.kuali.common.util.PropertyUtils.getSortedKeys(p); 019 StringBuilder sb = new StringBuilder(); 020 sb.append("<config>\n"); 021 for (String key : keys) { 022 String value = p.getProperty(key); 023 sb.append(" <param name=\"" + key + "\">" + value + "</param>\n"); 024 } 025 sb.append("</config>\n"); 026 System.out.println(sb); 027 028 } 029 030}