FileDocCategorySizeDatePackage
SignJarTest.javaAPI DocApache Ant 1.705905Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs

SignJarTest

public class SignJarTest extends org.apache.tools.ant.BuildFileTest
Testcase for the Signjar task

Fields Summary
public static final String
EXPANDED_MANIFEST
Constructors Summary
public SignJarTest(String name)



       
        super(name);
    
Methods Summary
public voidNotestVerifyJarNotInKeystore()

        expectBuildExceptionContaining("testVerifyJarNotInKeystore",
                "signature not in keystore",
                VerifyJar.ERROR_NO_VERIFY);
    
private booleanisOffline()
check for being offline

return
true iff the system property "offline" is "true"

        return Boolean.getBoolean("offline");
    
public voidsetUp()

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

        executeTarget("clean");
    
public voidtestBasicSigning()

        executeTarget("basic");
    
public voidtestDestDir()

        executeTarget("testDestDir");
    
public voidtestDestDirAndSignedJar()

        expectBuildExceptionContaining("testFilesetAndSignedJar",
                "incompatible attributes",
                SignJar.ERROR_SIGNEDJAR_AND_PATHS);
    
public voidtestDestDirAndSignedJar2()

        expectBuildExceptionContaining("testPathAndSignedJar",
                "incompatible attributes",
                SignJar.ERROR_SIGNEDJAR_AND_PATHS);
    
public voidtestDestDirFileset()

        executeTarget("testDestDirFileset");
    
public voidtestDestDirPath()

        executeTarget("testDestDirPath");
    
public voidtestFileset()

        executeTarget("testFileset");
    
public voidtestFilesetAndJar()

        executeTarget("testFilesetAndJar");
    
public voidtestFilesetAndSignedJar()

        expectBuildExceptionContaining("testFilesetAndSignedJar",
                "incompatible attributes",
                SignJar.ERROR_SIGNEDJAR_AND_PATHS);
    
public voidtestMapperFileset()

        executeTarget("testMapperFileset");
    
public voidtestMapperNoDest()

        expectBuildExceptionContaining("testMapperNoDest",
                "two mappers",
                SignJar.ERROR_MAPPER_WITHOUT_DEST);
    
public voidtestMapperPath()

        executeTarget("testMapperPath");
    
public voidtestMaxMemory()

        executeTarget("maxmemory");
    
public voidtestNoAlias()

        expectBuildExceptionContaining("testNoAlias",
                "no alias",
                SignJar.ERROR_NO_ALIAS);
    
public voidtestNoFiles()

        expectBuildExceptionContaining("testNoFiles",
                "no files",
                SignJar.ERROR_NO_SOURCE);
    
public voidtestNoStorePass()

        expectBuildExceptionContaining("testNoStorePass",
                "no password",
                SignJar.ERROR_NO_STOREPASS);
    
public voidtestPath()

        executeTarget("testPath");
    
public voidtestPathAndJar()

        executeTarget("testPathAndJar");
    
public voidtestPathAndSignedJar()

        expectBuildExceptionContaining("testPathAndSignedJar",
                "incompatible attributes",
                SignJar.ERROR_SIGNEDJAR_AND_PATHS);
    
public voidtestPreserveLastModified()

        executeTarget("preserveLastModified");
    
public voidtestSigFile()

        executeTarget("sigfile");
    
public voidtestSignedJar()

        executeTarget("testSignedJar");
    
public voidtestSysProperty()

        executeTarget("testSysProperty");
    
public voidtestTsaLocalhost()

        //only test on java1.5+
        if(JavaEnvUtils.getJavaVersionNumber()>=15) {
            expectBuildException("testTsaLocalhost",
                "no TSA at localhost:0");
            assertLogContaining("java.net.ConnectException");
        }
    
public voidtestTwoMappers()

        expectBuildExceptionContaining("testTwoMappers",
                "two mappers",
                SignJar.ERROR_TOO_MANY_MAPPERS);
    
public voidtestURLKeystoreFile()

        executeTarget("urlKeystoreFile");
    
public voidtestURLKeystoreHTTP()

        if(!isOffline()) {
            executeTarget("urlKeystoreHTTP");
        }
    
public voidtestVerifyFileset()

        executeTarget("testVerifyFileset");
    
public voidtestVerifyJar()

        executeTarget("testVerifyJar");
    
public voidtestVerifyJarUnsigned()

        expectBuildExceptionContaining("testVerifyJarUnsigned",
                "unsigned JAR file",
                VerifyJar.ERROR_NO_VERIFY);
    
public voidtestVerifyNoArgs()

        expectBuildExceptionContaining("testVerifyNoArgs",
                "no args",
                AbstractJarSignerTask.ERROR_NO_SOURCE);
    
public voidtestVerifyPath()

        executeTarget("testVerifyPath");