source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/NhincLib/test/gov/hhs/fha/nhinc/properties/PropertyFileManagerTest.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.2 KB
Line 
1package gov.hhs.fha.nhinc.properties;
2
3import java.util.Properties;
4import org.junit.After;
5import org.junit.AfterClass;
6import org.junit.Before;
7import org.junit.BeforeClass;
8import org.junit.Test;
9import static org.junit.Assert.*;
10
11/**
12 * This unit test is used to test the FileManagerTest class.
13 *
14 * @author Les Westberg
15 */
16public class PropertyFileManagerTest
17{
18
19 public PropertyFileManagerTest()
20 {
21 }
22
23 @BeforeClass
24 public static void setUpClass() throws Exception
25 {
26 }
27
28 @AfterClass
29 public static void tearDownClass() throws Exception
30 {
31 }
32
33 @Before
34 public void setUp()
35 {
36 }
37
38 @After
39 public void tearDown()
40 {
41 }
42
43 /**
44 * Test of writePropertyFile method, of class PropertyFileManager.
45 */
46 @Test
47 public void testWritePropertyFile() throws Exception
48 {
49 System.out.println("writePropertyFile");
50 String sPropertyFile = "testprops";
51 Properties oProps = new Properties();
52 oProps.setProperty("CacheRefreshDuration", "0");
53 oProps.setProperty("Prop1", "Value1");
54 oProps.setProperty("Prop2", "Value2");
55 PropertyFileManager.writePropertyFile(sPropertyFile, oProps);
56
57 String sValue = PropertyAccessor.getProperty(sPropertyFile, "CacheRefreshDuration");
58 assertEquals("0", sValue);
59
60 sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop1");
61 assertEquals("Value1", sValue);
62
63 sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop2");
64 assertEquals("Value2", sValue);
65
66 oProps.setProperty("Prop3", "Value3");
67 PropertyFileManager.writePropertyFile(sPropertyFile, oProps);
68
69 sValue = PropertyAccessor.getProperty(sPropertyFile, "CacheRefreshDuration");
70 assertEquals("0", sValue);
71
72 sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop1");
73 assertEquals("Value1", sValue);
74
75 sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop2");
76 assertEquals("Value2", sValue);
77
78 sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop3");
79 assertEquals("Value3", sValue);
80
81 PropertyFileManager.deletePropertyFile(sPropertyFile);
82
83 }
84}
Note: See TracBrowser for help on using the repository browser.