1 17 18 package org.apache.pluto.testsuite; 19 20 import java.io.IOException ; 21 import java.io.InputStream ; 22 import java.util.Properties ; 23 24 29 public class ExpectedResults { 30 public static final String PROPERTY_FILENAME = "expectedResults.properties"; 31 32 public static final String EXPECTED_PORTAL_INFO_KEY = "expected.portalInfo"; 33 34 private static ExpectedResults expectedResults; 35 private Properties properties; 36 37 private ExpectedResults() throws IOException { 38 this.properties = new Properties (); 39 40 InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(PROPERTY_FILENAME); 41 if (in == null) { 42 throw new IOException ("Could not find " + PROPERTY_FILENAME); 43 } 44 this.properties.load(in); 45 } 46 47 public Properties getProperties() { 48 return this.properties; 49 } 50 51 57 public static Properties getExpectedProperties() throws InvalidConfigurationException { 58 try { 59 if (expectedResults == null) { 60 expectedResults = new ExpectedResults(); 61 } 62 63 return expectedResults.getProperties(); 64 } catch (IOException e) { 65 throw new InvalidConfigurationException("An error occured reading the resource " + PROPERTY_FILENAME + ". Error was " + e.getMessage()); 66 } 67 } 68 69 } 70 | Popular Tags |