/*
 * 
 * 
 * Copyright (C) 2004 SIPfoundry Inc.
 * Licensed by SIPfoundry under the LGPL license.
 * 
 * Copyright (C) 2004 Pingtel Corp.
 * Licensed to SIPfoundry under a Contributor Agreement.
 * 
 * $
 */
package org.sipfoundry.sipxconfig.common;

import java.io.File;
import java.util.Properties;

import org.sipfoundry.sipxconfig.test.TestUtil;

import junit.framework.TestCase;


public class TestUtilTest extends TestCase {
    
    public void testGetClasspathDirectory() {
        String classpathDir = TestUtil.getClasspathDirectory(TestUtilTest.class);
        File thisClassFile = new File(classpathDir + "/org/sipfoundry/sipxconfig/common/TestUtilTest.class");
        assertTrue(thisClassFile.exists());
    }
    
    public void testGetProjectDirectory() {
        String projectDirectory = TestUtil.getProjectDirectory();
        assertEquals("neoconf", new File(projectDirectory).getName());
    }
    
    public void testGetSysDirProperties() {
        Properties props = new Properties();
        TestUtil.setSysDirProperties(props, "etc", "out");
        assertEquals("etc", props.getProperty("sysdir.etc"));
        assertEquals("out", props.getProperty("sysdir.data"));
        assertEquals("out", props.getProperty("sysdir.phone"));
        assertEquals("out", props.getProperty("sysdir.log"));
    }
    
    public void testGetTopBuildDirectory() {
        String buildDir = TestUtil.getBuildDirectory("neoconf");
        File topBuild = new File(buildDir).getParentFile();
        File configProperties = new File(topBuild, "build.properties");
        assertTrue(configProperties.exists());
    }
}

@@ -282,23 +282,85 @@
 ava.
-util.Properties
+io.IOException;%0Aimport java.util.Properties;%0A%0Aimport junit.framework.TestCase
 ;%0A%0Ai
@@ -411,42 +411,8 @@
 l;%0A%0A
-import junit.framework.TestCase;%0A%0A
 %0Apub
@@ -984,16 +984,35 @@
 erties()
+ throws IOException
  %7B%0A     
@@ -1047,24 +1047,83 @@
 operties();%0A
+        String out = System.getProperty(%22java.io.tmpdir%22);%0A
         Test
@@ -1161,21 +1161,19 @@
  %22etc%22, 
-%22
 out
-%22
 );%0A     
@@ -1242,37 +1242,35 @@
    assertEquals(
-%22
 out
-%22
 , props.getPrope
@@ -1303,37 +1303,35 @@
    assertEquals(
-%22
 out
-%22
 , props.getPrope
@@ -1377,13 +1377,11 @@
 als(
-%22
 out
-%22
 , pr

Refactor unit test creating rogue 'out' directory in src directory in ant env.