FileDocCategorySizeDatePackage
CVSPassTest.javaAPI DocApache Ant 1.703645Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.taskdefs

CVSPassTest

public class CVSPassTest extends org.apache.tools.ant.BuildFileTest
Tests CVSLogin task.

Fields Summary
private final String
EOL
private static final String
JAKARTA_URL
private static final String
XML_URL
private static final String
TIGRIS_URL
Constructors Summary
public CVSPassTest(String name)



       
        super(name);
    
Methods Summary
private java.lang.StringreadFile(java.io.File f)

        BufferedReader reader = null;

        try {
            reader = new BufferedReader(new FileReader(f));

            StringBuffer buf = new StringBuffer();
            String line=null;
            while((line=reader.readLine())!=null){
                buf.append(line + EOL);
            }
            return buf.toString();
        } finally {
            if (reader != null) {
                reader.close();
            }
        }
    
public voidsetUp()

        configureProject("src/etc/testcases/taskdefs/cvspass.xml");
    
public voidtearDown()

        executeTarget("cleanup");
    
public voidtestNoCVSRoot()

        try{
            executeTarget("test1");
            fail("BuildException not thrown");
        }catch(BuildException e){
            assertEquals("cvsroot is required", e.getMessage());
        }
    
public voidtestNoPassword()

        try{
            executeTarget("test2");
            fail("BuildException not thrown");
        }catch(BuildException e){
            assertEquals("password is required", e.getMessage());
        }
    
public voidtestPassFile()

        executeTarget("test3");
        File f = new File(getProjectDir(), "testpassfile.tmp");

        assertTrue( "Passfile "+f+" not created", f.exists());

        assertEquals(JAKARTA_URL+EOL, readFile(f));

    
public voidtestPassFileDuplicateEntry()

        executeTarget("test4");
        File f = new File(getProjectDir(), "testpassfile.tmp");

        assertTrue( "Passfile "+f+" not created", f.exists());

        assertEquals(
            JAKARTA_URL+ EOL+
            TIGRIS_URL+ EOL,
            readFile(f));
    
public voidtestPassFileMultipleEntry()

        executeTarget("test5");
        File f = new File(getProjectDir(), "testpassfile.tmp");

        assertTrue( "Passfile "+f+" not created", f.exists());

        assertEquals(
            JAKARTA_URL+ EOL+
            XML_URL+ EOL+
            TIGRIS_URL+ EOL,
            readFile(f));