Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.crawler.selftest
Class SelfTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              org.archive.crawler.selftest.SelfTestCase

All Implemented Interfaces:
  junit.framework.Test

Direct Known Subclasses:
  BackgroundImageExtractionSelfTestCase, FramesSelfTestCase

    public abstract class SelfTestCase

extends junit.framework.TestCase

Base class for integrated selftest unit tests. Has utility for integrated selftest such as location of selftest generated arc file.

Version:
  $Id: SelfTestCase.java 4931 2007-02-21 18:48:17Z gojomo $
Author:
  stack

Field Summary
`protected static java.lang.String` | `SELFTEST` Suffix for selftest classes.

Constructor Summary
`SelfTestCase()`
`SelfTestCase(java.lang.String testName)`

Method Summary
`protected static void` | `assertExists(java.io.File file)` Test nonull and exits.
`void` | `assertInitialized()`
`protected static void` | `assertNonEmpty(java.lang.String str)` Test non null and not empty.
`boolean` | `fileExists(java.io.File file)` Confirm passed file exists on disk under the test directory.
`boolean` | `filesExist(java.util.List files)` Confirm passed files exist on disk under the test directory.
`protected java.util.List<java.io.File>` | `filesFoundInArc()` Find all files that belong to this test that are mentioned in the arc.
`protected static java.io.File[]` | `getArcFiles()`
`static CrawlJob` | `getCrawlJob()`
`protected static java.io.File` | `getCrawlJobDir()`
`static java.io.File` | `getHtdocs()`
`protected static java.io.File` | `getLogsDir()`
`protected static java.util.List[]` | `getMetaDatas()`
`protected static ARCReader[]` | `getReadReaders()` Returns the selftest read ARCReader.
`static java.lang.String` | `getSelftestURL()`
`static java.lang.String` | `getSelftestURLWithTrailingSlash()`
`java.lang.String` | `getTestName()` Calculates test name by stripping SelfTest from current class name.
`static void` | `initialize(java.lang.String url, CrawlJob job, java.io.File jobDir, java.io.File docs)` Static initializer.
`void` | `testFilesInArc(java.util.List<java.io.File> files)` Test passed list were all found in the arc.
`void` | `testFilesInArc(java.util.List<java.io.File> files, java.util.List<java.io.File> foundFiles)` Test passed list were all found in the arc.
`void` | `testNothing()`

Methods inherited from class junit.framework.TestCase
`countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString`

Methods inherited from class junit.framework.Assert
`assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### SELFTEST

    protected static final java.lang.String SELFTEST

  Suffix for selftest classes.

  See Also:
    Constant Field Values

Constructor Detail

### SelfTestCase

    public SelfTestCase()

### SelfTestCase

    public SelfTestCase(java.lang.String testName)

Method Detail

### testNothing

    public void testNothing()

### assertInitialized

    public void assertInitialized()

### assertNonEmpty

    protected static void assertNonEmpty(java.lang.String str)

  Test non null and not empty.

  Parameters:
    `str` - String to test.
  Throws:
    `java.lang.IllegalArgumentException` - if null or empty string.

### assertExists

    protected static void assertExists(java.io.File file)

  Test nonull and exits.

  Parameters:
    `file` - File to test.
  Throws:
    `java.io.FileNotFoundException` - passed file doesn't exist.

### initialize

    public static void initialize(java.lang.String url,
                                  CrawlJob job,
                                  java.io.File jobDir,
                                  java.io.File docs)
                           throws java.io.IOException,
                                  javax.management.AttributeNotFoundException,
                                  javax.management.MBeanException,
                                  javax.management.ReflectionException,
                                  java.lang.InterruptedException

  Static initializer. Must be called before instantiation of any tests based off this class.

  Parameters:
    `url` - URL to selftest webapp.
    `job` - The selftest crawl job.
    `jobDir` - Job output directory. Has the seed file, the order file and logs.
    `docs` - Expanded webapp directory location.
  Throws:
    `java.io.IOException` - if nonexistent directories passed.
    `javax.management.AttributeNotFoundException`
    `javax.management.MBeanException`
    `javax.management.ReflectionException`
    `java.lang.InterruptedException`

### getArcFiles

    protected static java.io.File[] getArcFiles()

  Returns:
    Returns the arcDir.

### getCrawlJobDir

    protected static java.io.File getCrawlJobDir()

  Returns:
    Returns the jobDir.

### getLogsDir

    protected static java.io.File getLogsDir()

  Returns:
    Return the directory w/ logs in it.

### getReadReaders

    protected static ARCReader[] getReadReaders()

  Returns the selftest read ARCReader. The returned ARCReader has been validated. Use it to get at metadata.

  Returns:
    Returns the readReader, an ARCReader that has been validated.

### getMetaDatas

    protected static java.util.List[] getMetaDatas()

  Returns:
    Returns list of ARCReader metadatas, the byproduct of calling validate.

### getSelftestURL

    public static java.lang.String getSelftestURL()

  Returns:
    Returns the selftestURL.

### getSelftestURLWithTrailingSlash

    public static java.lang.String getSelftestURLWithTrailingSlash()

  Returns:
    Returns the selftestURL. URL returned is guaranteed to have a trailing '/'.

### getTestName

    public java.lang.String getTestName()

  Calculates test name by stripping SelfTest from current class name.

  Returns:
    The name of the test.

### getHtdocs

    public static java.io.File getHtdocs()

  Returns:
    Returns the selftest webappDir.

### getCrawlJob

    public static CrawlJob getCrawlJob()

  Returns:
    Returns the crawlJob.

### filesExist

    public boolean filesExist(java.util.List files)

  Confirm passed files exist on disk under the test directory.

  Parameters:
    `files` - Files to test for existence under the test's directory.
  Returns:
    true if all files exist on disk.

### fileExists

    public boolean fileExists(java.io.File file)

  Confirm passed file exists on disk under the test directory. This method takes care of building up the file path under the selftest webapp. Just pass the file name.

  Parameters:
    `file` - Name of file to look for.
  Returns:
    True if file exists.

### testFilesInArc

    public void testFilesInArc(java.util.List<java.io.File> files)

  Test passed list were all found in the arc. If more or less found, test fails.

  Parameters:
    `files` - List of files to find in the arc. No other files but these should be found in the arc.

### testFilesInArc

    public void testFilesInArc(java.util.List<java.io.File> files,
                               java.util.List<java.io.File> foundFiles)

  Test passed list were all found in the arc. If more or less found, test fails.

  Parameters:
    `files` - List of files to find in the arc. No other files but these should be found in the arc.
    `foundFiles` - Files found in the arc.

### filesFoundInArc

    protected java.util.List<java.io.File> filesFoundInArc()

  Find all files that belong to this test that are mentioned in the arc.

  Returns:
    List of unique found file File objects.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.