nesstar.test
Class NesstarTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by nesstar.test.NesstarTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ACUTestBase, AdminClientTest, AgreementTestBase, AllCheckedInTest, APITest, CatalogTestBase, CatalogTestBase, CategoryStatisticTestBase, CompleteSystemTest, ConceptTestBase, CubeTestBase, CVSTest, DatabaseTest, DatafileTestBase, DatasetTestBase, DCResourceTestBase, DimensionTestBase, EGMSResource2TestBase, EGMSResourceTestBase, EventTestBase, ExplorerTestBase, FactsheetTestBase, GeographicalUnitTestBase, HCTest, InstallTest, JBossTest, MeasureTestBase, MyTestClient, NesstarLightTest, NSDStatEngineTestBase, ObjectBrowserTest, OrganisationTestBase, PersonTestBase, ProjectTestBase, ProtocolTest, ProxiesTest, ProxiesTestClient, PurposeTestBase, QueryTest, RangeTestBase, RDFTest, ReleaseTest, ReliabilityTest, ResourceTestBase, RoleTestBase, SectionTestBase, SecurityTest, SeriesTestBase, ServerAdminPagesTest, ServerTestBase, ServerTestBase, SimulatedSingleClient, SimulatedTransactionsTest, SSLTest, StatementTestBase, StatFormatTestBase, Study2TestBase, Study3TestBase, StudyDeployerTest, StudySetup, StudyTestBase, TableTestBase, TermTestBase, UserTestBase, Variable2TestBase, VariableGroupTestBase, VariableTestBase, WebClientTest, XMLTest

public class NesstarTestCase
extends junit.framework.TestCase

Root cl ass for all Nesstar Test classes. Contains many utility methods to make tests more simple.

Each test class should call in its setUp() method the appropriate setup method e.g. dependsOn("studySetup");


Field Summary
 int ALL
          Constant Field Variable
static CatalogHome CATALOG_HOME
          A static reference to CatalogHome, initialised by catalogSetup
static Cube CUBE_CUBE
          A static reference to Cube "no.uib.nsd.ddi.LungekreftCube", initialised by cubeSetup
static Datafile DATAFILE_2568_F1
          A static reference to Datafile "uk.ac.data-archive.ddi.2568_F1", initialised by studySetup
static Datafile DATAFILE_4176_F1
          A static reference to Datafile "uk.ac.data-archive.ddi.4176_F1", initialised by studySetup
static Datafile DATAFILE_4213_F1
          A static reference to Datafile "uk.ac.data-archive.ddi.4213_F1", initialised by studySetup
static Datafile DATAFILE_44871_F1
          A static reference to Datafile "uk.ac.data-archive.ddi.44871_F1", initialised by studySetup
static Datafile DATAFILE_Cube_C1
          A static reference to Datafile "no.uib.nsd.ddi.LungekreftCube_C1", initialised by studySetup
static Datafile DATAFILE_Mergetest_F2
          A static reference to Datafile "com.nesstar.ddi.MergeTest_F2", initialised by studySetup
static Datafile DATAFILE_UnpopulatedElementsTest_F1
          A static reference to Datafile "com.nesstar.ddi.UnpopulatedElementsTest_F1", initialised by studySetup
 EMWindow emWindow
          a static reference to a Mozilla WebClient frame
static VariableHome HC_VAR_HOME
          A static reference to the VariableHome
static String ID_2568
          Constant Field Variable
static String ID_2981
          Constant Field Variable
static String ID_3690
          Constant Field Variable
static String ID_4176
          Constant Field Variable
static String ID_4213
          Constant Field Variable
static String ID_4396
          Constant Field Variable
static String ID_44871
          Constant Field Variable
static String ID_4638
          Constant Field Variable
static String ID_CAMEROON
          Constant Field Variable
static String ID_CIRCULATORY
          Constant Field Variable
static String ID_CUBE
          Constant Field Variable
static String ID_HIERARCHY
          Constant Field Variable
static String ID_LANDET
          Constant Field Variable
static String ID_MERGE
          Constant Field Variable
static String ID_NOGROUPS
          Constant Field Variable
static String ID_NSD50
          Constant Field Variable
static String ID_PUBLISH
          Constant Field Variable
static String ID_UPElements
          Constant Field Variable
static String LICENSE
          A static reference to the Nesstar License.
static String localIP
          Constant Field Variable
static String NESSTAR2_SERVER_URL
           
static String NESSTAR2_URL
          Constant Field Variable
 int NONE
          Constant Field Variable
static Catalog ROOT_CATALOG
          A static reference to the (first) root catalog, initialised by basicSetup
static Section SECTION_MERGE_VG10
           
static Section SECTION_MERGE_VG7
           
static Section SECTION_MERGE_VG8
           
static Server SERVER
           
 int SOME
          Constant Field Variable
static StatFormat SPSS_FORMAT
           
static NSDStatEngine STAT_ENGINE
           
static StatementHome STATEMENT_HOME
          a static reference to a STATEMENT_HOME
static Statement STATEMENT1
          a static reference to a Statement
static Study3 STUDY_2568
          A static reference to Study "uk.ac.data-archive.ddi.2568", initialised by studySetup
static Study3 STUDY_2981
          A static reference to Study "uk.ac.data-archive.ddi.2981", initialised by studySetup
static Study3 STUDY_4176
          A static reference to Study "uk.ac.data-archive.ddi.4176", initialised by studySetup
static Study3 STUDY_4213
          A static reference to Study "uk.ac.data-archive.ddi.4213", initialised by studySetup
static Study3 STUDY_44871
          A static reference to Study "uk.ac.data-archive.ddi.44871", initialised by studySetup
static Study3 STUDY_CAMEROON
          A static reference to Study "HH-CMR-ECAM-2001", initialised by studySetup
static Study3 STUDY_CIRCULATORY
          A static reference to Study "uk.org.erpho.circulatory", initialised by studySetup
static Study3 STUDY_CUBE
          A static reference to Study "no.uib.nsd.ddi.LungekreftCube", initialised by studySetup
static Study3 STUDY_HIERARCHY
          A static reference to Study "com.nesstar.ddi.HierarchyTest", initialised by studySetup
static StudyHome STUDY_HOME
          a static reference to the StudyHome
static Study3 STUDY_LANDET
          A static reference to Study "no.uib.nsd.ddi.LANDET97", initialised by studySetup
static Study3 STUDY_MERGE
          A static reference to Study "com.nesstar.ddi.MergeTest", initialised by studySetup
static Study3 STUDY_NOGROUPS
          A static reference to Study "com.nesstar.ddi.nogroups", initialised by studySetup
static Study3 STUDY_NSD50
          A static reference to Study "no.uib.nsd.ddi.NSD0050", initialised by studySetup
static Study3 STUDY_UPElements
          A static reference to Study "com.nesstar.ddi.UnpopulatedElementsTest", initialised by studySetup
static Study3 STUDY2_2568
          A static reference to Study "uk.ac.data-archive.ddi.2568", initialised by studySetup
static Study3 STUDY2_4638
          A static reference to Study "uk.ac.data-archive.ddi.4638", initialised by studySetup
static Study3 STUDY2_UPElements
          A static reference to Study "com.nesstar.ddi.UnpopulatedElementsTest", initialised by studySetup
static Protocol TEST_PROTOCOL
          Basic setup for testing: setup the protocol get the server object login as administrator
static VariableHome VAR_HOME
          a static reference to the VariableHome
static Variable VARIABLE_2568_V1
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V1", initialised by studySetup
static Variable VARIABLE_2568_V13
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V13", initialised by studySetup
static Variable VARIABLE_2568_V16
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V16", initialised by studySetup
static Variable VARIABLE_2568_V17
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V17", initialised by studySetup
static Variable VARIABLE_2568_V18
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V18", initialised by studySetup
static Variable VARIABLE_2568_V3
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V3", initialised by studySetup
static Variable VARIABLE_2568_V354
           
static Variable VARIABLE_2568_V77
          A static reference to Variable "uk.ac.data-archive.ddi.2568_V77", initialised by studySetup
static Variable VARIABLE_44871_V1
          A static reference to Variable "uk.ac.data-archive.ddi.44871_V1", initialised by studySetup
static Variable VARIABLE_CAMEROON_V238
          A static reference to Variable "HH-CMR-ECAM-2001_V238", initialised by studySetup
static Variable VARIABLE_CAMEROON_V355
          A static reference to Variable "HH-CMR-ECAM-2001_V355", initialised by studySetup
static Variable VARIABLE_LANDET_V1
          A static reference to Variable "no.uib.nsd.ddi.LANDET97_V1", initialised by studySetup
static Variable VARIABLE_LANDET_V2
          A static reference to Variable "no.uib.nsd.ddi.LANDET97_V2", initialised by studySetup
static Variable VARIABLE_MERGE_V22
          A static reference to Variable "com.nesstar.ddi.MergeTest_V22", initialised by studySetup
static Variable VARIABLE_MERGE_V23
          A static reference to Variable "com.nesstar.ddi.MergeTest_V23", initialised by studySetup
static Variable VARIABLE_MERGE_V26
          A static reference to Variable "com.nesstar.ddi.MergeTest_V26", initialised by studySetup
static Variable VARIABLE_MERGE_V41
          A static reference to Variable "com.nesstar.ddi.MergeTest_V41", initialised by studySetup
static String VID_2568_V1
          Constant Field Variable
static String VID_2568_V13
          Constant Field Variable
static String VID_2568_V16
          Constant Field Variable
static String VID_2568_V17
          Constant Field Variable
static String VID_2568_V18
          Constant Field Variable
static String VID_2568_V3
          Constant Field Variable
static String VID_2568_V354
           
static String VID_2568_V77
          Constant Field Variable
static String VID_44871_V1
          Constant Field Variable
static String VID_CAMEROON_V238
          Constant Field Variable
static String VID_CAMEROON_V355
          Constant Field Variable
static String VID_LANDET_V1
          Constant Field Variable
static String VID_LANDET_V2
          Constant Field Variable
static String VID_MERGE_V22
          Constant Field Variable
static String VID_MERGE_V23
          Constant Field Variable
static String VID_MERGE_V26
          Constant Field Variable
static String VID_MERGE_V41
          Constant Field Variable
static String WebDataURL
          Constant Field Variable
 
Constructor Summary
NesstarTestCase(String testName)
           
 
Method Summary
static void addAllTests(junit.framework.TestSuite suite)
          This method adds all tests to the testsuite
static void addAllTests(junit.framework.TestSuite suite, String pkg)
          This method adds packages of tests to a classpath
static boolean addDatafile(Study study, String studyID, String fileID)
          Adds a datafile to a study
 void addPath(StringBuffer path, String prop, List list, Object obj)
           
static void adminLogin()
           
 void assertBinary(MIMEObject mime)
          Assert that the passed MIMEObject is of binary type.
 void assertContains(String text, String toFind)
          Asserts that the toFind String was found within the text String.
 void assertContains(String message, String text, String toFind)
          Asserts that the toFind String was found within the text String.
 void assertDoesNotContain(String text, String notToFind)
          Asserts that the toFind String was NOT found within the text String.
 void assertDoesNotContain(String message, String text, String notToFind)
          Asserts that the toFind String was NOT found within the text String.
 void assertDuration(String msg, long expectedDuration, long actualDuration)
          Asserts that the actual duration is less than or equal to the expected duration, and fails if not.
 void assertEqualIgnoreOrder(List lista, List listb)
          assert the contents of a List are the same, regardless of order
static void assertEquals(Object[] a1, Object[] a2)
          Asserts that the two arrays have the same length and contents
static void assertMatches(String[] patterns, String[] actuals)
          Asserts that the 'patterns' match the corresponding elements of the 'actual' results
static void assertMatches(String pattern, String actual)
          Asserts that the 'pattern' match the 'actual' result
 void assertNoAccess(Bookmark op)
          Assert that the operation returns a No Access Exception
 void assertNoAccess(String url)
          Assert that the URL returns a No Access Exception
 void assertNoAccess(String message, String url)
          Assert that the URL returns a No Access Exception message String is a failure message
 void assertNotEquals(int first, int second)
          Asserts that two ints are not equal
 void assertNotEquals(String message, int first, int second)
          Asserts that two ints are not equal, and show the specified failure message
static void assertObjDoesNotExists(RDFObj object)
           
static void assertObjDoesNotExists(String objURL)
          Asserts that the object with the given URL doesn't exists
static void assertObjExists(RDFObj object)
           
static void assertObjExists(String objURL)
          Asserts that the object with the given URL exists
 void assertWebAuthorisationRequired(String relativeURL)
          Assert that the URL returns a Web Authorisation Required request
 void assertWebAuthorisationRequired(String msg, String relativeURL)
          Assert that the URL returns a Web Authorisation Required request
static void basicSetup()
           
static void cannotRun(String reason)
          Produce a warning or error if a test cannot be executed for the indicated reason.
static void catalogSetup()
          Basic setup for Catalogs testing load and setup the test catalogs
static void checkIllegalArgument(nesstar.util.FallibleFunction f, Object argument, String argumentName)
           
 void checkPaths(RDFObject from, RDFObject to, String paths, int numPaths)
           
 void checkPathsTo(String expectedPaths, String paths, RDFObject from, RDFObject to)
           
 void checkPathsTo(String expectedPaths, String paths, RDFObject from, RDFObject to, int numPaths)
           
static void checkPerformance(Worker worker, int minUnitsPerSec, boolean throwError)
          Execute the indicated worker and throw an exception or a warning if the worker executed less than minUnitPerSec
static void compareWithFile(File in, File out)
          Compare contents of file 'in' with contents of file 'out'
 void compareWithReferenceFile(String filename, Hashtable files)
           
static void compareWithTestFile(String filename, String contents)
          Compare 'contents' with the contents of the indicated testfile.
static void compareWithTestFile(String filename, String contents, int index)
          Compare 'contents' with the contents of the indicated testfile.
 Variable createDerivedVariable(Study3 study, String name, String label, String comment, String expression)
           
 Variable createDerivedVariable(Study3 study, String name, String label, String comment, String expression, boolean checkExists)
           
 Variable createDerivedVariableUnprotected(Study3 study, String name, String label, String comment, String expression)
           
static void cubeSetup()
           
 String cvsAbstractName(String name)
           
static void cvsClientSetup()
          this sets up the CVS Client object ready to do operations
 boolean cvsCompare(String filename, String old_rev)
          This will compare an old revision of a file with the newest one (will check with the cvs server which is the newest one)
 boolean cvsCompare(String filename, String old_rev, String new_rev)
          This will compare different revisions of one file.
 void cvsFailIfDifferent(String filename, String old_rev)
          This will compare an old revision of a file with the newest one If any differences occur, the test will fail
 void cvsFailIfDifferent(String filename, String old_rev, String new_rev)
          This will compare different revisions of one file.
 String cvsFileRevision(String filename, boolean debug)
          returns the current revision number of a file
 Hashtable cvsFileRevisions(Vector v, boolean debug)
          iterates a vector of filenames, checks each file's revision in CVS and adds to a hashtable (with filename turned into cvs abstract name)
 String cvsRootDir()
          this returns the current local location of the 'faster' directory (i.e.
static void dependsOn(String setupMethodName)
           
static void dependsOn(String setupMethodName, String className)
          Make sure that the passed setup method is executed once.
static boolean equalToFile(File in, File out)
          returns whether two files are equal
static boolean equalToTestFile(String filename, String contents)
          returns whether two test files are equal
static boolean equalToTestFile(String filename, String contents, int index)
          returns whether two test files are equal
static List executeRangeQuery(Object target, String query, int startHit, int maxHits, boolean wantPaths)
          if user doesn't specify the expected size, this uses the maxHits as the expected size
static List executeRangeQuery(Object target, String query, int startHit, int maxHits, boolean wantPaths, int size)
          a rangequery method to test the speed of results based on the number of results, specifying that hits come back at a speed of at least 3 hits per second without paths, and at least 2 hits per second with paths
static List executeRangeQuery(Object target, String query, int startHit, int maxHits, boolean wantPaths, int size, int minQueryHitsPerSec, int minQueryPathHitsPerSec)
          a rangequery method to test the speed of results based on the number of results, including whether they also return the full paths to those objects
 void executeRangeQueryAdditivity(Object target, String query)
          RangeQueryAdditivity tests the ability to add the results of a range query together.
static void expectFalse(String msg, boolean condition)
          Print warning if condition is true
static void expectTrue(String msg, boolean condition)
          Print warning if condition is false
static void extractZipFile(File zip)
           
static void factsheetSetup()
          sets up some Health Canada Objects
 int findPosition(List list, Object obj)
           
static void flirtWithTestFile(String filename, String contents)
          flirts 'contents' with the contents of the indicated testfile.
 String getBrowserPage(String url)
           
 String getBrowserPage(URL url)
           
static Catalog getCatalog(String key)
          retrieves a Catalog given its id
static CategoryStatistic getCategoryStatistic(String key)
          retrieves a CategoryStatistic object given its id
 CategoryStatistic getCategoryStatisticFromVariable(Variable s, String id)
          retrieves a CategoryStatistic from a Variable
static Concept getConcept(String key)
          retrieves a Concept object given its id
 String getCurrentBrowserPage(String shortURL)
           
 File getCvsPropertiesFile()
          gets the cvs properties file
static Datafile getDatafile(String key)
          retrieves a Datafile given its id
static File getDDITestFile(String shortID)
           
static String getDDITestFileContents(String shortID)
           
 Variable getDerivedVariableByName(Study3 study, String name)
           
static Dimension getDimension(String key)
          retrieves a Dimension object given its id
 Dimension getDimensionFromCube(Cube s, String id)
          gets a Dimension from a Cube, given an ID
static EGMSResource getEGMSResource(String key)
          retrieves an EGMSResource given its id
static EGMSResource2Ex getEGMSResource2(String key)
           
static Event getEvent(String key)
          retrieves an Event given its id
 Collection getExisting(Collection objects)
          retrieves a Collection of objects which are assured to exist
static File getFailedDir()
           
static File getFailedFile(String filename)
           
 Vector getFilenames(String dir, String endswith)
          a method to search a directory (and nested directories) for files which match the endswith parameter, and add their names to a vector
static File getFilteredTestFile(String filename)
           
static GeographicalUnit getGeographicalUnit(String key)
          retrieves a GeographicalUnit given its id
static File getLocalFile(String property, String filename)
          returns a file whose path is located as a property in a properties files, and whose filename is given
static int getMaxConcurrentOps(String report)
          extracts from the server report the number of concurrent operations on the server
static Measure getMeasure(String key)
          retrieves a Measure object given its id
static int getNumberCompletedOps(String report)
          extracts from the server report the number of completed operations on the server
static int getNumberHTTPConnections(String report)
          extracts from the server report the number of open HTTPConnections on the server
static int getNumberStartedOps(String report)
          extracts from the server report the number of started operations on the server
static RDFObject getObj(String shortURL)
          reloads the specified object on the server.
 Collection getObjectsFrom(String objURL, int maxHits)
          Methods to get objects that are parts of other objects
static String getObjURL(String shortURL)
          returns the full URL of an object on the default server
static Organisation getOrganisation(String key)
          retrieves a Organisation given its id
 String getPage(String url)
           
 String getPage(URL url)
           
 Collection getPartsOf(RDFObject obj)
          checks that an RDFObject is made up of no parts
 Collection getPartsOf(RDFObject obj, Hashtable visited, int maxHits)
          checks that an RDFObject is made up of the correct number of parts (generally, use the getPartsOf with the two parameter signature)
 Collection getPartsOf(RDFObject obj, int maxHits)
          checks that an RDFObject is made up of the correct number of parts
static Person getPerson(String key)
          retrieves a Person given its id
 String getRawPage(String url)
           
static String getRDF(NetDB db, Vector roots)
           
static String getReport()
          returns the report from the default server
static File getResultDir()
           
static File getResultFile(String filename)
           
static String getSecureObjURL(String shortURL)
          returns the full URL of a secure object on the default server
static String getSecureServerURL()
          returns the URL of the secure default server
static File getServerDataDir()
          gets the server data directory
static File getServerDatafile(String filename)
          gets a datafile from the server
static String getServerIP()
          gets the server ip address
 String getServerLog()
          gets the servers logfile
static String getServerName()
          gets the server name
static String getServerObjURL()
          returns the URL of the default server
 String getServerPage(String relativeURL)
           
 URL getServerPageURL(String relativeURL)
           
static String getServerPassword()
          gets the server administrators password
static int getServerPort()
          gets the server port
static int getServerSecurePort()
          gets the server secure port
static String getServerURL()
          returns the URL of the default server
static String getServerUsername()
          gets the server administrators username
static Collection getStatementsOn(String id)
          returns objects from the statement table
static Collection getStatementsOn(String sid, String oid)
           
 Table getTableFromStudy(Study s, String id)
          gets a Table from a Study, given an ID
static Term getTerm(String key)
          retrieves a Term object given its id
static File getTestDir()
           
static File getTestFile(String filename)
           
static File getTestFile(String filename, String ext)
           
static Variable getVariable(String key)
          retrieves a Variable given its id
 Variable getVariableFromStudy(Study s, String id)
          Retrieves a variable from a study
static void getWebFile(URL url, File target)
           
static File getZipFile(File file, String entryName, String zipName)
          generate a zip file in the test directory with the name and the contents provided
static boolean hasWebData(String id)
          Return true if id is in the WebDataList array
static void HCSetup()
          sets up some Health Canada Objects
static boolean isLocalServer()
          evaluates whether the server is local to the testsuite
static boolean isNTService()
           
static boolean isOnline()
          deduces whether the test program is running on a machine that is connected to the Internet.
static boolean isQuickie()
          evaluates whether this is a 'quick' test: a test that skips unessential checks for performance sake.
static boolean isReleaseTest()
           
static boolean isWaitForSQLServerIndexer()
           
static Cube loadCube(Study study, String cubeID)
          Make sure that the cube data files are loaded in the target server
static Study loadDDI(String id)
          Make sure that the given study is loaded in the target server Example: Study d2981 = addStudy(studyHome,ID_2981,NAME_2981);
 Hashtable loadHashFromFile(String filename)
          load the contents of a file, separate into lines and add to a hashtable (as key/value pairs for lines containing an equals, or key/"" pairs for normal lines)
static Study loadStudy(String id)
          Make sure that the given study and its datafiles are loaded in the target server Example: Study d2981 = addStudy(studyHome, "uk.ac.data-archive.ddi.2981");
static Study3 loadStudy3(String id)
           
static Variable loadVariable(String id)
          Get the given variable with specified id
static void msg(Object msg)
          Print message to standard output
static void msg(String prefix, Object msg)
          Print message to standard output
static boolean noDirectAccess()
          Use at the beginning of direct tests (tests that require access to the server directory) as if (noDirectAccess()) return;
 boolean objExists(String shortURL)
          checks if an object exists on the default server
 int objsExists(String[] shortURLs)
          establishes how many of the objects (whose short Urls are in the String array) exist
 void openEMWindow(String title, String startURL)
          opens a Mozilla Webclient window
 void performRangeQuery(Catalog target, String query, int from, int maxHits, boolean paths, int expectedHits, long expectedDuration)
          a method to perform a rangequery, and check that it returned the correct number of results, within an acceptable timeframe
static void querySetup()
          sets up Queries
static String read(String name)
          reads in a files and returns a string of the content
 void rebootServer()
          Reboot server and reapply basic setup
 void rebootServer(int repetition)
          Reboot server
static RDFObject reloadObj(String shortURL)
          reloads the specified object on the server (checks the net for the object)
 void removeAllVars(Study3 subject)
           
static String removeCreationDate(String result)
           
 void removeProperties(RDFObject subject, URL property)
          Delete all property values
static String removeServerURL(String result)
          Remove server dependent URL from result
static boolean repeatCheck(Class cls, String methodName, int times, int interval)
          Call repeatedly a method with signature 'static boolean methodName()' waiting 'interval' milliseconds between calls until the method returns true or the method has been called 'times' times.
static boolean saveToTestFile(String filename, String contents)
          simply saves test files
static void setNTService(boolean b)
           
static void setQuickie(boolean b)
           
static void setReleaseTest(boolean b)
           
static void setWaitForSQLServerIndexer(boolean b)
           
static void statementSetup()
          sets up Statements
static void studyCleanup()
          Basic setup for Studies testing Make sure that the server does not contain these test studies.
static void studySetup()
          Basic setup for Studies testing Make sure that the server contains the test studies.
static void tableSetup()
          sets up some Health Canada Objects
static String toMsg(Collection objects)
          returns a more readable representation of a collection
 String toString(List list)
           
 void untested(String feature)
          Mark a test as 'untested' (no proper test has been provided).
static List updateChildren(Catalog catalog)
          returns a list of children from a catalog, and does a reload on them
static void variableSetup()
          Basic setup for Variables testing
static void waitForSQLServerIndexer()
           
 void waitServer(boolean upOrDown)
          waits for the server to go up or go down.
static void warn(String msg)
          Print a warning.
static void webclientSetup()
          A method to setup Webclient for Mozilla.
static void write(String content, File file)
          writes a string to a file
static void xthesaurusSetup()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localIP

public static final String localIP
Constant Field Variable


WebDataURL

public static final String WebDataURL
Constant Field Variable

See Also:
Constant Field Values

NESSTAR2_URL

public static final String NESSTAR2_URL
Constant Field Variable

See Also:
Constant Field Values

NESSTAR2_SERVER_URL

public static final String NESSTAR2_SERVER_URL
See Also:
Constant Field Values

STATEMENT_HOME

public static StatementHome STATEMENT_HOME
a static reference to a STATEMENT_HOME


STATEMENT1

public static Statement STATEMENT1
a static reference to a Statement


SERVER

public static Server SERVER

STAT_ENGINE

public static NSDStatEngine STAT_ENGINE

SPSS_FORMAT

public static StatFormat SPSS_FORMAT

STUDY_HOME

public static StudyHome STUDY_HOME
a static reference to the StudyHome


VAR_HOME

public static VariableHome VAR_HOME
a static reference to the VariableHome


STUDY_NOGROUPS

public static Study3 STUDY_NOGROUPS
A static reference to Study "com.nesstar.ddi.nogroups", initialised by studySetup


ID_NOGROUPS

public static final String ID_NOGROUPS
Constant Field Variable

See Also:
Constant Field Values

STUDY_UPElements

public static Study3 STUDY_UPElements
A static reference to Study "com.nesstar.ddi.UnpopulatedElementsTest", initialised by studySetup


STUDY2_UPElements

public static Study3 STUDY2_UPElements
A static reference to Study "com.nesstar.ddi.UnpopulatedElementsTest", initialised by studySetup


ID_UPElements

public static final String ID_UPElements
Constant Field Variable

See Also:
Constant Field Values

STUDY_CAMEROON

public static Study3 STUDY_CAMEROON
A static reference to Study "HH-CMR-ECAM-2001", initialised by studySetup


ID_CAMEROON

public static final String ID_CAMEROON
Constant Field Variable

See Also:
Constant Field Values

STUDY_HIERARCHY

public static Study3 STUDY_HIERARCHY
A static reference to Study "com.nesstar.ddi.HierarchyTest", initialised by studySetup


ID_HIERARCHY

public static final String ID_HIERARCHY
Constant Field Variable

See Also:
Constant Field Values

STUDY_MERGE

public static Study3 STUDY_MERGE
A static reference to Study "com.nesstar.ddi.MergeTest", initialised by studySetup


ID_MERGE

public static final String ID_MERGE
Constant Field Variable

See Also:
Constant Field Values

STUDY_2568

public static Study3 STUDY_2568
A static reference to Study "uk.ac.data-archive.ddi.2568", initialised by studySetup


STUDY2_2568

public static Study3 STUDY2_2568
A static reference to Study "uk.ac.data-archive.ddi.2568", initialised by studySetup


STUDY2_4638

public static Study3 STUDY2_4638
A static reference to Study "uk.ac.data-archive.ddi.4638", initialised by studySetup


ID_2568

public static final String ID_2568
Constant Field Variable

See Also:
Constant Field Values

STUDY_2981

public static Study3 STUDY_2981
A static reference to Study "uk.ac.data-archive.ddi.2981", initialised by studySetup


ID_2981

public static final String ID_2981
Constant Field Variable

See Also:
Constant Field Values

STUDY_44871

public static Study3 STUDY_44871
A static reference to Study "uk.ac.data-archive.ddi.44871", initialised by studySetup


ID_44871

public static final String ID_44871
Constant Field Variable

See Also:
Constant Field Values

ID_3690

public static final String ID_3690
Constant Field Variable

See Also:
Constant Field Values

ID_4396

public static final String ID_4396
Constant Field Variable

See Also:
Constant Field Values

STUDY_CIRCULATORY

public static Study3 STUDY_CIRCULATORY
A static reference to Study "uk.org.erpho.circulatory", initialised by studySetup


ID_CIRCULATORY

public static final String ID_CIRCULATORY
Constant Field Variable

See Also:
Constant Field Values

STUDY_4213

public static Study3 STUDY_4213
A static reference to Study "uk.ac.data-archive.ddi.4213", initialised by studySetup


ID_4213

public static final String ID_4213
Constant Field Variable

See Also:
Constant Field Values

STUDY_4176

public static Study3 STUDY_4176
A static reference to Study "uk.ac.data-archive.ddi.4176", initialised by studySetup


ID_4176

public static final String ID_4176
Constant Field Variable

See Also:
Constant Field Values

STUDY_NSD50

public static Study3 STUDY_NSD50
A static reference to Study "no.uib.nsd.ddi.NSD0050", initialised by studySetup


ID_NSD50

public static final String ID_NSD50
Constant Field Variable

See Also:
Constant Field Values

STUDY_LANDET

public static Study3 STUDY_LANDET
A static reference to Study "no.uib.nsd.ddi.LANDET97", initialised by studySetup


ID_LANDET

public static final String ID_LANDET
Constant Field Variable

See Also:
Constant Field Values

STUDY_CUBE

public static Study3 STUDY_CUBE
A static reference to Study "no.uib.nsd.ddi.LungekreftCube", initialised by studySetup


CUBE_CUBE

public static Cube CUBE_CUBE
A static reference to Cube "no.uib.nsd.ddi.LungekreftCube", initialised by cubeSetup


ID_CUBE

public static final String ID_CUBE
Constant Field Variable

See Also:
Constant Field Values

ID_4638

public static final String ID_4638
Constant Field Variable

See Also:
Constant Field Values

ID_PUBLISH

public static final String ID_PUBLISH
Constant Field Variable

See Also:
Constant Field Values

DATAFILE_4176_F1

public static Datafile DATAFILE_4176_F1
A static reference to Datafile "uk.ac.data-archive.ddi.4176_F1", initialised by studySetup


DATAFILE_4213_F1

public static Datafile DATAFILE_4213_F1
A static reference to Datafile "uk.ac.data-archive.ddi.4213_F1", initialised by studySetup


DATAFILE_2568_F1

public static Datafile DATAFILE_2568_F1
A static reference to Datafile "uk.ac.data-archive.ddi.2568_F1", initialised by studySetup


DATAFILE_44871_F1

public static Datafile DATAFILE_44871_F1
A static reference to Datafile "uk.ac.data-archive.ddi.44871_F1", initialised by studySetup


DATAFILE_Mergetest_F2

public static Datafile DATAFILE_Mergetest_F2
A static reference to Datafile "com.nesstar.ddi.MergeTest_F2", initialised by studySetup


DATAFILE_UnpopulatedElementsTest_F1

public static Datafile DATAFILE_UnpopulatedElementsTest_F1
A static reference to Datafile "com.nesstar.ddi.UnpopulatedElementsTest_F1", initialised by studySetup


DATAFILE_Cube_C1

public static Datafile DATAFILE_Cube_C1
A static reference to Datafile "no.uib.nsd.ddi.LungekreftCube_C1", initialised by studySetup


VARIABLE_2568_V354

public static Variable VARIABLE_2568_V354

VID_2568_V354

public static final String VID_2568_V354
See Also:
Constant Field Values

VARIABLE_2568_V1

public static Variable VARIABLE_2568_V1
A static reference to Variable "uk.ac.data-archive.ddi.2568_V1", initialised by studySetup


VID_2568_V1

public static final String VID_2568_V1
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V3

public static Variable VARIABLE_2568_V3
A static reference to Variable "uk.ac.data-archive.ddi.2568_V3", initialised by studySetup


VID_2568_V3

public static final String VID_2568_V3
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V13

public static Variable VARIABLE_2568_V13
A static reference to Variable "uk.ac.data-archive.ddi.2568_V13", initialised by studySetup


VID_2568_V13

public static final String VID_2568_V13
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V16

public static Variable VARIABLE_2568_V16
A static reference to Variable "uk.ac.data-archive.ddi.2568_V16", initialised by studySetup


VID_2568_V16

public static final String VID_2568_V16
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V17

public static Variable VARIABLE_2568_V17
A static reference to Variable "uk.ac.data-archive.ddi.2568_V17", initialised by studySetup


VID_2568_V17

public static final String VID_2568_V17
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V18

public static Variable VARIABLE_2568_V18
A static reference to Variable "uk.ac.data-archive.ddi.2568_V18", initialised by studySetup


VID_2568_V18

public static final String VID_2568_V18
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_2568_V77

public static Variable VARIABLE_2568_V77
A static reference to Variable "uk.ac.data-archive.ddi.2568_V77", initialised by studySetup


VID_2568_V77

public static final String VID_2568_V77
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_CAMEROON_V238

public static Variable VARIABLE_CAMEROON_V238
A static reference to Variable "HH-CMR-ECAM-2001_V238", initialised by studySetup


VID_CAMEROON_V238

public static final String VID_CAMEROON_V238
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_CAMEROON_V355

public static Variable VARIABLE_CAMEROON_V355
A static reference to Variable "HH-CMR-ECAM-2001_V355", initialised by studySetup


VID_CAMEROON_V355

public static final String VID_CAMEROON_V355
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_MERGE_V22

public static Variable VARIABLE_MERGE_V22
A static reference to Variable "com.nesstar.ddi.MergeTest_V22", initialised by studySetup


VID_MERGE_V22

public static final String VID_MERGE_V22
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_MERGE_V23

public static Variable VARIABLE_MERGE_V23
A static reference to Variable "com.nesstar.ddi.MergeTest_V23", initialised by studySetup


VID_MERGE_V23

public static final String VID_MERGE_V23
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_MERGE_V26

public static Variable VARIABLE_MERGE_V26
A static reference to Variable "com.nesstar.ddi.MergeTest_V26", initialised by studySetup


VID_MERGE_V26

public static final String VID_MERGE_V26
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_MERGE_V41

public static Variable VARIABLE_MERGE_V41
A static reference to Variable "com.nesstar.ddi.MergeTest_V41", initialised by studySetup


VID_MERGE_V41

public static final String VID_MERGE_V41
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_44871_V1

public static Variable VARIABLE_44871_V1
A static reference to Variable "uk.ac.data-archive.ddi.44871_V1", initialised by studySetup


VID_44871_V1

public static final String VID_44871_V1
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_LANDET_V1

public static Variable VARIABLE_LANDET_V1
A static reference to Variable "no.uib.nsd.ddi.LANDET97_V1", initialised by studySetup


VID_LANDET_V1

public static final String VID_LANDET_V1
Constant Field Variable

See Also:
Constant Field Values

VARIABLE_LANDET_V2

public static Variable VARIABLE_LANDET_V2
A static reference to Variable "no.uib.nsd.ddi.LANDET97_V2", initialised by studySetup


VID_LANDET_V2

public static final String VID_LANDET_V2
Constant Field Variable

See Also:
Constant Field Values

SECTION_MERGE_VG10

public static Section SECTION_MERGE_VG10

SECTION_MERGE_VG8

public static Section SECTION_MERGE_VG8

SECTION_MERGE_VG7

public static Section SECTION_MERGE_VG7

CATALOG_HOME

public static CatalogHome CATALOG_HOME
A static reference to CatalogHome, initialised by catalogSetup


ROOT_CATALOG

public static Catalog ROOT_CATALOG
A static reference to the (first) root catalog, initialised by basicSetup


HC_VAR_HOME

public static VariableHome HC_VAR_HOME
A static reference to the VariableHome


LICENSE

public static final String LICENSE
A static reference to the Nesstar License. Constant Field Variable

See Also:
Constant Field Values

ALL

public final int ALL
Constant Field Variable

See Also:
Constant Field Values

SOME

public final int SOME
Constant Field Variable

See Also:
Constant Field Values

NONE

public final int NONE
Constant Field Variable

See Also:
Constant Field Values

emWindow

public EMWindow emWindow
a static reference to a Mozilla WebClient frame


TEST_PROTOCOL

public static Protocol TEST_PROTOCOL
Basic setup for testing:

Constructor Detail

NesstarTestCase

public NesstarTestCase(String testName)
Method Detail

addAllTests

public static void addAllTests(junit.framework.TestSuite suite,
                               String pkg)
This method adds packages of tests to a classpath

Parameters:
suite - the testsuite to add the tests to
the - packages to include. i.e. "nesstar.api" , "" (all packages)

addAllTests

public static void addAllTests(junit.framework.TestSuite suite)
This method adds all tests to the testsuite

Parameters:
suite - the testsuite to add the tests to

assertObjExists

public static void assertObjExists(String objURL)
                            throws Exception
Asserts that the object with the given URL exists

Parameters:
objURL - the URL of the object
Throws:
Exception

assertObjExists

public static void assertObjExists(RDFObj object)
                            throws Exception
Throws:
Exception

assertObjDoesNotExists

public static void assertObjDoesNotExists(String objURL)
                                   throws Exception
Asserts that the object with the given URL doesn't exists

Parameters:
objURL - the URL of the object
Throws:
Exception

assertObjDoesNotExists

public static void assertObjDoesNotExists(RDFObj object)
                                   throws Exception
Throws:
Exception

assertDuration

public void assertDuration(String msg,
                           long expectedDuration,
                           long actualDuration)
Asserts that the actual duration is less than or equal to the expected duration, and fails if not. actualDuration <= expectedDuration

Parameters:
msg - the failure message to show (if a failure occurs)
expectedDuration - a time measurement
actualDuration - a time measurement

assertEquals

public static void assertEquals(Object[] a1,
                                Object[] a2)
Asserts that the two arrays have the same length and contents


assertMatches

public static void assertMatches(String pattern,
                                 String actual)
Asserts that the 'pattern' match the 'actual' result


assertMatches

public static void assertMatches(String[] patterns,
                                 String[] actuals)
Asserts that the 'patterns' match the corresponding elements of the 'actual' results


assertNotEquals

public void assertNotEquals(int first,
                            int second)
Asserts that two ints are not equal


assertNotEquals

public void assertNotEquals(String message,
                            int first,
                            int second)
Asserts that two ints are not equal, and show the specified failure message


assertContains

public void assertContains(String message,
                           String text,
                           String toFind)
Asserts that the toFind String was found within the text String. message String is a failure message

Parameters:
message - the error message to display if the test fails
text - the text to check
toFind - what should be found in the text

assertContains

public void assertContains(String text,
                           String toFind)
Asserts that the toFind String was found within the text String.

Parameters:
text - the text to check
toFind - what should be found in the text

assertDoesNotContain

public void assertDoesNotContain(String message,
                                 String text,
                                 String notToFind)
Asserts that the toFind String was NOT found within the text String. message String is a failure message

Parameters:
message - the error message to display if the test fails
text - the text to check
notToFind - what should NOT be found in the text

assertDoesNotContain

public void assertDoesNotContain(String text,
                                 String notToFind)
Asserts that the toFind String was NOT found within the text String.

Parameters:
text - the text to check
notToFind - what should NOT be found in the text

assertNoAccess

public void assertNoAccess(String message,
                           String url)
                    throws Exception
Assert that the URL returns a No Access Exception message String is a failure message

Parameters:
message - the error message to display if the test fails
url - the url to check
Throws:
Exception

assertNoAccess

public void assertNoAccess(String url)
                    throws Exception
Assert that the URL returns a No Access Exception

Parameters:
url - the url to check
Throws:
Exception

assertNoAccess

public void assertNoAccess(Bookmark op)
                    throws Exception
Assert that the operation returns a No Access Exception

Parameters:
op - the operation (a Bookmark) to check
Throws:
Exception

assertWebAuthorisationRequired

public void assertWebAuthorisationRequired(String msg,
                                           String relativeURL)
                                    throws Exception
Assert that the URL returns a Web Authorisation Required request

Parameters:
msg - the error message to display
relativeUrl - the url to check
Throws:
Exception

assertWebAuthorisationRequired

public void assertWebAuthorisationRequired(String relativeURL)
                                    throws Exception
Assert that the URL returns a Web Authorisation Required request

Parameters:
relativeUrl - the url to check
Throws:
Exception

assertBinary

public void assertBinary(MIMEObject mime)
                  throws Exception
Assert that the passed MIMEObject is of binary type.

Parameters:
mime - the MIMEObject to check
Throws:
Exception

assertEqualIgnoreOrder

public void assertEqualIgnoreOrder(List lista,
                                   List listb)
                            throws Exception
assert the contents of a List are the same, regardless of order

Throws:
Exception

expectTrue

public static void expectTrue(String msg,
                              boolean condition)
Print warning if condition is false

Parameters:
condition - the condition to check
msg - the message to display

expectFalse

public static void expectFalse(String msg,
                               boolean condition)
Print warning if condition is true

Parameters:
condition - the condition to check
msg - the message to display

checkIllegalArgument

public static void checkIllegalArgument(nesstar.util.FallibleFunction f,
                                        Object argument,
                                        String argumentName)

isLocalServer

public static boolean isLocalServer()
evaluates whether the server is local to the testsuite

Returns:
true if the server is installed on the machine were the test is taking place.

isOnline

public static boolean isOnline()
deduces whether the test program is running on a machine that is connected to the Internet.

Returns:
true if the test program is running on a machine that is connected to the Internet.

noDirectAccess

public static boolean noDirectAccess()
Use at the beginning of direct tests (tests that require access to the server directory) as if (noDirectAccess()) return;

Returns:
true if a direct test cannot be executed

getFilenames

public Vector getFilenames(String dir,
                           String endswith)
a method to search a directory (and nested directories) for files which match the endswith parameter, and add their names to a vector

Parameters:
dir - the directory to look in (within CVS)
endswith - filenames to match against
Returns:
a vector of strings which are filenames

getLocalFile

public static File getLocalFile(String property,
                                String filename)
returns a file whose path is located as a property in a properties files, and whose filename is given

Parameters:
the - name of the property that contains the directory
Returns:
the file or null if we are not testing a local server

getServerDataDir

public static File getServerDataDir()
gets the server data directory

Returns:
the local server data directory

getServerDatafile

public static File getServerDatafile(String filename)
gets a datafile from the server

Parameters:
filename, - e.g. "no.uib.nsd.ddi.NSD0050.xml"
Returns:
the server data directory

getServerLog

public String getServerLog()
                    throws Exception
gets the servers logfile

Returns:
the server log
Throws:
Exception

getCvsPropertiesFile

public File getCvsPropertiesFile()
                          throws Exception
gets the cvs properties file

Returns:
the cvs properties file
Throws:
Exception

getServerName

public static String getServerName()
gets the server name

Returns:
the server name

getServerIP

public static String getServerIP()
gets the server ip address

Returns:
the server IP address

getServerPort

public static int getServerPort()
gets the server port

Returns:
the server port number

getServerSecurePort

public static int getServerSecurePort()
gets the server secure port

Returns:
the server secure port number

getServerUsername

public static String getServerUsername()
gets the server administrators username

Returns:
the server username

getServerPassword

public static String getServerPassword()
gets the server administrators password

Returns:
the server password

getRawPage

public String getRawPage(String url)
                  throws Exception
Parameters:
url - the url of the textual resource to read-in
Returns:
the content of the URL as a string (or of the challenge if there was any)
Throws:
Exception

getPage

public String getPage(URL url)
               throws Exception
Parameters:
url - the url of the textual resource to read-in
Returns:
the content of the URL as a string
Throws:
Exception

getPage

public String getPage(String url)
               throws Exception
Parameters:
url - the url of the textual resource to read-in
Returns:
the content of the URL as a string
Throws:
Exception

getServerPageURL

public URL getServerPageURL(String relativeURL)
                     throws Exception
Parameters:
relativeURL - an url relative to the current server, e.g. of the textual resource to read-in
Returns:
the URL of the page on the server
Throws:
Exception

getServerPage

public String getServerPage(String relativeURL)
                     throws Exception
Parameters:
relativeURL - an url relative to the current server, e.g. of the textual resource to read-in
Returns:
the content of the URL as a string
Throws:
Exception

getBrowserPage

public String getBrowserPage(String url)
                      throws Exception
Parameters:
url - the url of the object
Returns:
the page returned by the Object Browser (without frames) for the object with the given URL
Throws:
Exception

getBrowserPage

public String getBrowserPage(URL url)
                      throws Exception
Parameters:
url - the url of the object
Returns:
the page returned by the Object Browser (without frames) for the object with the given URL
Throws:
Exception

getCurrentBrowserPage

public String getCurrentBrowserPage(String shortURL)
                             throws Exception
Parameters:
shortURL - the short url of the object
Returns:
the page returned by the Object Browser (without frames) for the object with the given short URL
Throws:
Exception

isQuickie

public static boolean isQuickie()
evaluates whether this is a 'quick' test: a test that skips unessential checks for performance sake.

Returns:
true if this is a 'quick' test: a test that skips unessential checks for performance sake.

setQuickie

public static void setQuickie(boolean b)

isReleaseTest

public static boolean isReleaseTest()

setReleaseTest

public static void setReleaseTest(boolean b)

isWaitForSQLServerIndexer

public static boolean isWaitForSQLServerIndexer()

setWaitForSQLServerIndexer

public static void setWaitForSQLServerIndexer(boolean b)

isNTService

public static boolean isNTService()

setNTService

public static void setNTService(boolean b)

dependsOn

public static void dependsOn(String setupMethodName)
                      throws Exception
Parameters:
setupMethodName - the method name to execute (if not already executed)
Throws:
Exception

dependsOn

public static void dependsOn(String setupMethodName,
                             String className)
                      throws Exception
Make sure that the passed setup method is executed once.

Parameters:
setupMethodName - the name of the setup method to execute, e.g. "basicSetup"
Throws:
Exception

adminLogin

public static void adminLogin()
                       throws Exception
Throws:
Exception

basicSetup

public static void basicSetup()
                       throws Exception
Throws:
Exception

studyCleanup

public static void studyCleanup()
                         throws Exception
Basic setup for Studies testing Make sure that the server does not contain these test studies.

Throws:
Exception

studySetup

public static void studySetup()
                       throws Exception
Basic setup for Studies testing Make sure that the server contains the test studies.

Throws:
Exception

variableSetup

public static void variableSetup()
                          throws Exception
Basic setup for Variables testing

Throws:
Exception

catalogSetup

public static void catalogSetup()
                         throws Exception
Basic setup for Catalogs testing load and setup the test catalogs

Throws:
Exception

cubeSetup

public static void cubeSetup()
                      throws Exception
Throws:
Exception

tableSetup

public static void tableSetup()
                       throws Exception
sets up some Health Canada Objects

Throws:
Exception

factsheetSetup

public static void factsheetSetup()
                           throws Exception
sets up some Health Canada Objects

Throws:
Exception

HCSetup

public static void HCSetup()
                    throws Exception
sets up some Health Canada Objects

Throws:
Exception

statementSetup

public static void statementSetup()
                           throws Exception
sets up Statements

Throws:
Exception

querySetup

public static void querySetup()
                       throws Exception
sets up Queries

Throws:
Exception

getRDF

public static String getRDF(NetDB db,
                            Vector roots)
                     throws Exception
Parameters:
root - the root of the object graph
Returns:
the RDF serialization of the object graph
Throws:
Exception

xthesaurusSetup

public static void xthesaurusSetup()
                            throws Exception
Throws:
Exception

webclientSetup

public static void webclientSetup()
                           throws Exception
A method to setup Webclient for Mozilla. Tasks:

Throws:
Exception

openEMWindow

public void openEMWindow(String title,
                         String startURL)
                  throws Exception
opens a Mozilla Webclient window

Parameters:
title - the title to set in the window
startURL - the URL to send the Mozilla window to
Throws:
Exception

cvsClientSetup

public static void cvsClientSetup()
                           throws Exception
this sets up the CVS Client object ready to do operations

Throws:
Exception

cvsCompare

public boolean cvsCompare(String filename,
                          String old_rev,
                          String new_rev)
                   throws Exception
This will compare different revisions of one file. If any differences occur, a 'false' will be returned, otherwise a 'true'

Parameters:
filename - the name of the file to compare i.e. "faster\\ejbserver\\build.xml"
old_rev - the older revision number i.e. "1.6"
new_rev - the newer revision number i.e. "1.7"
Throws:
Exception

cvsCompare

public boolean cvsCompare(String filename,
                          String old_rev)
                   throws Exception
This will compare an old revision of a file with the newest one (will check with the cvs server which is the newest one)

Parameters:
filename - the name of the file to compare i.e. "faster\\ejbserver\\build.xml"
old_rev - the older revision number i.e. "1.6"
Throws:
Exception

cvsFailIfDifferent

public void cvsFailIfDifferent(String filename,
                               String old_rev,
                               String new_rev)
                        throws Exception
This will compare different revisions of one file. If any differences occur, the test will fail

Parameters:
filename - the name of the file to compare i.e. "faster\\ejbserver\\build.xml"
old_rev - the older revision number i.e. "1.6"
new_rev - the newer revision number i.e. "1.7"
Throws:
Exception

cvsFailIfDifferent

public void cvsFailIfDifferent(String filename,
                               String old_rev)
                        throws Exception
This will compare an old revision of a file with the newest one If any differences occur, the test will fail

Parameters:
filename - the name of the file to compare i.e. "faster\\ejbserver\\build.xml"
old_rev - the older revision number i.e. "1.6"
Throws:
Exception

cvsFileRevision

public String cvsFileRevision(String filename,
                              boolean debug)
                       throws Exception
returns the current revision number of a file

Parameters:
filename - the name of the file i.e. "faster\\ejbserver\\build.xml"
debug - print debug information
Returns:
the revision of the file specified
Throws:
Exception

cvsFileRevisions

public Hashtable cvsFileRevisions(Vector v,
                                  boolean debug)
                           throws Exception
iterates a vector of filenames, checks each file's revision in CVS and adds to a hashtable (with filename turned into cvs abstract name)

Parameters:
v - a vector of files to get revisions for i.e. "faster\\ejbserver\\build.xml"
debug - print debug information
Returns:
a hashtable of filenames & their revisions
Throws:
Exception

waitForSQLServerIndexer

public static void waitForSQLServerIndexer()

cvsRootDir

public String cvsRootDir()
this returns the current local location of the 'faster' directory (i.e. C:\CVS)

Returns:
the root directory of the CVS install

getTestFile

public static File getTestFile(String filename)
                        throws Exception
Parameters:
filename - the filename of the file relative to the test data directory
Returns:
the file from the test directory with the given name
Throws:
Exception

getTestFile

public static File getTestFile(String filename,
                               String ext)
                        throws Exception
Parameters:
filename - the name of the file relative to the test data directory
extension - the extension of the file
Returns:
the file from the test directory with the given name
Throws:
Exception

getFilteredTestFile

public static File getFilteredTestFile(String filename)
                                throws Exception
Parameters:
filename - the filename of the file relative to the test data directory
Returns:
a file whose contents are the same as the test file except that @server.name@ has been replaced with the server name
Throws:
Exception

getZipFile

public static File getZipFile(File file,
                              String entryName,
                              String zipName)
                       throws Exception
generate a zip file in the test directory with the name and the contents provided

Parameters:
file - the file whose content is to be zipped
entryName - the name of the file in the zip file
zipName - the name of the zip file generated
Returns:
the zip file generated
Throws:
Exception

extractZipFile

public static void extractZipFile(File zip)
                           throws Exception
Parameters:
zip - the compressed file to extact from (usually in the test data directory) Note: files ending with the extension ".zip" are automatically extracted and assumed to contain the target file name.
Throws:
Exception

getWebFile

public static void getWebFile(URL url,
                              File target)
                       throws Exception
Parameters:
url - the http address of the file to copy from (usually WebDataURL)
target - the target file to write to (usually in the test data directory)
Throws:
Exception - Warning: this may take some time for large files and low bandwidths! Note: urls ending with the extension ".zip" are automatically extracted and assumed to contain the target file name.

getTestDir

public static File getTestDir()
                       throws Exception
Parameters:
filename - the filename of the file relative to the 'test' directory
Returns:
the file from the test directory with the given name
Throws:
Exception

getResultFile

public static File getResultFile(String filename)
                          throws Exception
Parameters:
filename - the filename of the file relative to the 'test' directory
Returns:
the file from the test directory with the given name
Throws:
Exception

getResultDir

public static File getResultDir()
                         throws Exception
Returns:
the directory where the results are stored
Throws:
Exception

getFailedFile

public static File getFailedFile(String filename)
                          throws Exception
Parameters:
filename - the filename of the file relative to the 'test' directory
Returns:
the file from the test directory with the given name
Throws:
Exception

getFailedDir

public static File getFailedDir()
                         throws Exception
Returns:
the directory where the failures are stored
Throws:
Exception

getDDITestFile

public static File getDDITestFile(String shortID)
                           throws Exception
Parameters:
shortID - the shortID of the DDI file, the name of the DDI file without the ".xml" suffix, e.g. "2981"
Returns:
the DDI file from the test directory with the given name
Throws:
Exception

getDDITestFileContents

public static String getDDITestFileContents(String shortID)
                                     throws Exception
Parameters:
shortID - the shortID of the DDI file, the name of the DDI file without the ".xml" suffix, e.g. "2981"
Returns:
the contents of the DDI/XML file from the test directory with the given name
Throws:
Exception

compareWithTestFile

public static void compareWithTestFile(String filename,
                                       String contents)
                                throws Exception
Compare 'contents' with the contents of the indicated testfile. If the testfile does not exist is created with contents = 'contents'

Parameters:
filename - the filename of the test file in the 'test' directory
contents - the contents to compare @throw Exception if the compare failed
Throws:
Exception

compareWithTestFile

public static void compareWithTestFile(String filename,
                                       String contents,
                                       int index)
                                throws Exception
Compare 'contents' with the contents of the indicated testfile. If the testfile does not exist is created with contents = 'contents'

Parameters:
filename - the filename of the test file in the 'test' directory
contents - the contents to compare @throw Exception if the compare failed
Throws:
Exception

equalToTestFile

public static boolean equalToTestFile(String filename,
                                      String contents)
                               throws Exception
returns whether two test files are equal

Parameters:
filename -
contents -
Returns:
boolean
Throws:
Exception

equalToTestFile

public static boolean equalToTestFile(String filename,
                                      String contents,
                                      int index)
                               throws Exception
returns whether two test files are equal

Parameters:
filename -
contents -
Returns:
boolean
Throws:
Exception

flirtWithTestFile

public static void flirtWithTestFile(String filename,
                                     String contents)
                              throws Exception
flirts 'contents' with the contents of the indicated testfile. If the testfile does not exist is created with contents = 'contents'

Parameters:
filename - the filename of the test file in the 'test' directory
contents - the contents to flirt
Throws:
Exception

saveToTestFile

public static boolean saveToTestFile(String filename,
                                     String contents)
                              throws Exception
simply saves test files

Parameters:
filename -
contents -
Returns:
boolean
Throws:
Exception

compareWithFile

public static void compareWithFile(File in,
                                   File out)
                            throws Exception
Compare contents of file 'in' with contents of file 'out'

Parameters:
in -
out -
Throws:
Exception

equalToFile

public static boolean equalToFile(File in,
                                  File out)
                           throws Exception
returns whether two files are equal

Parameters:
in -
out -
Returns:
boolean
Throws:
Exception

cvsAbstractName

public String cvsAbstractName(String name)

compareWithReferenceFile

public void compareWithReferenceFile(String filename,
                                     Hashtable files)
                              throws Exception
Throws:
Exception

loadHashFromFile

public Hashtable loadHashFromFile(String filename)
                           throws Exception
load the contents of a file, separate into lines and add to a hashtable (as key/value pairs for lines containing an equals, or key/"" pairs for normal lines)

Parameters:
filename - the name of the file to load, and turn into a hashtable
Returns:
Hashtable of returns
Throws:
Exception

getObjectsFrom

public Collection getObjectsFrom(String objURL,
                                 int maxHits)
Methods to get objects that are parts of other objects

Parameters:
objURL - the object to reload
maxHits -
Returns:
Collection
Throws:
Exception

getPartsOf

public Collection getPartsOf(RDFObject obj)
                      throws Exception
checks that an RDFObject is made up of no parts

Parameters:
obj - the object whose parts are to be found
Returns:
the parts of which the object is composition, with their subparts
Throws:
Exception

getPartsOf

public Collection getPartsOf(RDFObject obj,
                             int maxHits)
                      throws Exception
checks that an RDFObject is made up of the correct number of parts

Parameters:
obj - the object whose parts are to be found
maxHits - the maximum number of subparts to be expanded for each object, if < 0 all parts are retrieved
Returns:
the parts of which the object is composition, with their subparts
Throws:
Exception

getPartsOf

public Collection getPartsOf(RDFObject obj,
                             Hashtable visited,
                             int maxHits)
                      throws Exception
checks that an RDFObject is made up of the correct number of parts (generally, use the getPartsOf with the two parameter signature)

Parameters:
obj - the RDFObject containing the parts to be found
visited - a Hashtable of objects already noted
maxHits - the maximum number of hits expected
Returns:
the parts of which the object is composition, with their subparts
Throws:
Exception

objExists

public boolean objExists(String shortURL)
checks if an object exists on the default server

Parameters:
shortURL - the short URL of the object to check
Returns:
true if the object on the default server with the specified shortURL exists on the server

objsExists

public int objsExists(String[] shortURLs)
establishes how many of the objects (whose short Urls are in the String array) exist

Parameters:
shortURLs - a string array of shortURLs of objects
Returns:
NONE | SOME | ALL depending if none, some or all of the specified objects exists in the default server

getExisting

public Collection getExisting(Collection objects)
retrieves a Collection of objects which are assured to exist

Parameters:
objects - the objects to test for existence
Returns:
a collection of all objects in 'objects' that exists

checkPerformance

public static void checkPerformance(Worker worker,
                                    int minUnitsPerSec,
                                    boolean throwError)
                             throws Exception
Execute the indicated worker and throw an exception or a warning if the worker executed less than minUnitPerSec

Parameters:
worker - the worker object which performed some operations
minUnitPerSec - minimum number of units per second
throwError - if true an error will be thrown, otherwise a warning
Throws:
Exception

getReport

public static String getReport()
                        throws Exception
returns the report from the default server

Returns:
the report from the default server
Throws:
Exception

getNumberHTTPConnections

public static int getNumberHTTPConnections(String report)
                                    throws Exception
extracts from the server report the number of open HTTPConnections on the server

Parameters:
report - the server report
Returns:
the number of open HTTPConnections on the server (as reported by getReport)
Throws:
Exception

getNumberStartedOps

public static int getNumberStartedOps(String report)
                               throws Exception
extracts from the server report the number of started operations on the server

Parameters:
report - the server report
Returns:
the number of started operations on the server (as reported by getReport)
Throws:
Exception

getNumberCompletedOps

public static int getNumberCompletedOps(String report)
                                 throws Exception
extracts from the server report the number of completed operations on the server

Parameters:
report - the server report
Returns:
the number of completed operations on the server (as reported by getReport)
Throws:
Exception

getMaxConcurrentOps

public static int getMaxConcurrentOps(String report)
                               throws Exception
extracts from the server report the number of concurrent operations on the server

Parameters:
report - the server report
Returns:
the maximum recorded number of concurrent ops on the server (as reported by getReport)
Throws:
Exception

updateChildren

public static List updateChildren(Catalog catalog)
                           throws Exception
returns a list of children from a catalog, and does a reload on them

Parameters:
catalog - the catalog to return children from
Returns:
the updated children list
Throws:
Exception

getStatementsOn

public static Collection getStatementsOn(String id)
                                  throws Exception
returns objects from the statement table

Parameters:
id - the id of the objects to return from the statement table @returns Collection
Throws:
Exception

getStatementsOn

public static Collection getStatementsOn(String sid,
                                         String oid)
                                  throws Exception
Throws:
Exception

loadVariable

public static Variable loadVariable(String id)
                             throws Exception
Get the given variable with specified id

Parameters:
id - the unique ID of the variable, e.g. "uk.ac.data-archive.ddi.2567_V1"
Returns:
the variable object
Throws:
Exception - if variable is not found

loadDDI

public static Study loadDDI(String id)
                     throws Exception
Make sure that the given study is loaded in the target server Example: Study d2981 = addStudy(studyHome,ID_2981,NAME_2981);

Parameters:
id - the unique ID of the study, e.g. "uk.ac.data-archive.ddi.4213"
Returns:
the study object
Throws:
Exception

loadStudy

public static Study loadStudy(String id)
                       throws Exception
Make sure that the given study and its datafiles are loaded in the target server Example: Study d2981 = addStudy(studyHome, "uk.ac.data-archive.ddi.2981");

Parameters:
id - the unique ID of the study, e.g. "uk.ac.data-archive.ddi.4213"
Returns:
the study object
Throws:
Exception

loadStudy3

public static Study3 loadStudy3(String id)
                         throws Exception
Throws:
Exception

loadCube

public static Cube loadCube(Study study,
                            String cubeID)
                     throws Exception
Make sure that the cube data files are loaded in the target server

Parameters:
study - the study that the cube belongs to
cubeID - the short name of the cube data file to load without extension, e.g. "nsdkube_C1"
Returns:
the study object
Throws:
Exception

hasWebData

public static boolean hasWebData(String id)
Return true if id is in the WebDataList array

Parameters:
id - of the object
Returns:
true if id is in the web data list

addDatafile

public static boolean addDatafile(Study study,
                                  String studyID,
                                  String fileID)
                           throws Exception
Adds a datafile to a study

Parameters:
study - the study
studyID - the shortID of the study, e.g. "2981"
fileID - the ID of the file, e.g. "F2"
Returns:
true if the datafile was found and has been added, false otherwise
Throws:
Exception

createDerivedVariable

public Variable createDerivedVariable(Study3 study,
                                      String name,
                                      String label,
                                      String comment,
                                      String expression)
                               throws Exception
Throws:
Exception

createDerivedVariableUnprotected

public Variable createDerivedVariableUnprotected(Study3 study,
                                                 String name,
                                                 String label,
                                                 String comment,
                                                 String expression)
                                          throws Exception
Throws:
Exception

createDerivedVariable

public Variable createDerivedVariable(Study3 study,
                                      String name,
                                      String label,
                                      String comment,
                                      String expression,
                                      boolean checkExists)
                               throws Exception
Throws:
Exception

getDerivedVariableByName

public Variable getDerivedVariableByName(Study3 study,
                                         String name)
                                  throws Exception
Throws:
Exception

getServerURL

public static String getServerURL()
returns the URL of the default server

Returns:
the URL of the default server, e.g. http://nesstar2.essex.ac.uk:80

getSecureServerURL

public static String getSecureServerURL()
returns the URL of the secure default server

Returns:
the URL of the default server, e.g. http://nesstar2.essex.ac.uk:80

getObjURL

public static String getObjURL(String shortURL)
returns the full URL of an object on the default server

Parameters:
shortURL - the last part of the object URL, e.g. "fStudy/uk.ac.data-archive.ddi.2981"
Returns:
the full URL of an object on the default server e.g. "http://nesstar2.essex.ac.uk/obj/fStudy/uk.ac.data-archive.ddi.2981"

getSecureObjURL

public static String getSecureObjURL(String shortURL)
returns the full URL of a secure object on the default server

Parameters:
shortURL - the last part of the object URL, e.g. "fStudy/uk.ac.data-archive.ddi.2981"
Returns:
the full URL of an object on the default server e.g. "https://nesstar2.essex.ac.uk/obj/fStudy/uk.ac.data-archive.ddi.2981"

getServerObjURL

public static String getServerObjURL()
returns the URL of the default server

Returns:
the URL of the Server object for the default server, e.g. "http://nesstar2.essex.ac.uk/obj/cServer/ESSEXTEST"

getObj

public static RDFObject getObj(String shortURL)
                        throws Exception
reloads the specified object on the server. (checks the server cache first, then checks the net for the object)

Parameters:
shortURL - the last part of the object URL, e.g. "fStudy/uk.ac.data-archive.ddi.2981"
Returns:
the object on the default server with the specified shortURL
Throws:
Exception

reloadObj

public static RDFObject reloadObj(String shortURL)
                           throws Exception
reloads the specified object on the server (checks the net for the object)

Parameters:
shortURL - the last part of the object URL, e.g. "fStudy/uk.ac.data-archive.ddi.2981"
Returns:
reload the object on the default server with the specified shortURL
Throws:
Exception

getCatalog

public static Catalog getCatalog(String key)
                          throws Exception
retrieves a Catalog given its id

Parameters:
key - the id of the Catalog @returns Catalog
Throws:
Exception

getDatafile

public static Datafile getDatafile(String key)
                            throws Exception
retrieves a Datafile given its id

Parameters:
key - the id of the Datafile @returns Datafile
Throws:
Exception

getVariable

public static Variable getVariable(String key)
                            throws Exception
retrieves a Variable given its id

Parameters:
key - the id of the variable @returns Variable
Throws:
Exception

getEGMSResource

public static EGMSResource getEGMSResource(String key)
                                    throws Exception
retrieves an EGMSResource given its id

Parameters:
key - the id of the EGMSResource @returns EGMSResource
Throws:
Exception

getEGMSResource2

public static EGMSResource2Ex getEGMSResource2(String key)
                                        throws Exception
Throws:
Exception

getEvent

public static Event getEvent(String key)
                      throws Exception
retrieves an Event given its id

Parameters:
key - the id of the Event @returns Event
Throws:
Exception

getOrganisation

public static Organisation getOrganisation(String key)
                                    throws Exception
retrieves a Organisation given its id

Parameters:
key - the id of the Organisation @returns Organisation
Throws:
Exception

getGeographicalUnit

public static GeographicalUnit getGeographicalUnit(String key)
                                            throws Exception
retrieves a GeographicalUnit given its id

Parameters:
key - the id of the GeographicalUnit @returns GeographicalUnit
Throws:
Exception

getPerson

public static Person getPerson(String key)
                        throws Exception
retrieves a Person given its id

Parameters:
key - the id of the Person @returns Person
Throws:
Exception

getCategoryStatistic

public static CategoryStatistic getCategoryStatistic(String key)
                                              throws Exception
retrieves a CategoryStatistic object given its id

Parameters:
key - the id of the category statistic @returns CategoryStatistic
Throws:
Exception

getTerm

public static Term getTerm(String key)
                    throws Exception
retrieves a Term object given its id

Parameters:
key - the id of the term @returns Term
Throws:
Exception

getConcept

public static Concept getConcept(String key)
                          throws Exception
retrieves a Concept object given its id

Parameters:
key - the id of the concept @returns Concept
Throws:
Exception

getDimension

public static Dimension getDimension(String key)
                              throws Exception
retrieves a Dimension object given its id

Parameters:
key - the id of the dimension @returns Dimension
Throws:
Exception

getMeasure

public static Measure getMeasure(String key)
                          throws Exception
retrieves a Measure object given its id

Parameters:
key - the id of the measure @returns Measure
Throws:
Exception

getVariableFromStudy

public Variable getVariableFromStudy(Study s,
                                     String id)
                              throws Exception
Retrieves a variable from a study

Parameters:
s - the Study holding the variable
id - the id of the Variable to return (i.e. V1, V3)
Returns:
the Variable with the specified id, otherwise null
Throws:
Exception

getCategoryStatisticFromVariable

public CategoryStatistic getCategoryStatisticFromVariable(Variable s,
                                                          String id)
                                                   throws Exception
retrieves a CategoryStatistic from a Variable

Parameters:
s - the Variable holding the CategoryStatistic
id - the id of the CategoryStatistic to return (i.e. http://155.245.254.45:8080/obj/fCategoryStatistic/uk.ac.data-archive.ddi.4213_4)
Returns:
the CategoryStatistic with the specified id, otherwise null
Throws:
Exception
Bug:
the category statistic can be retrieved directly knowing its URL

getTableFromStudy

public Table getTableFromStudy(Study s,
                               String id)
                        throws Exception
gets a Table from a Study, given an ID

Parameters:
s - the Study holding the Table
id - the id of the Table to return (i.e. ?)
Returns:
the Table with the specified id, otherwise null
Throws:
Exception

getDimensionFromCube

public Dimension getDimensionFromCube(Cube s,
                                      String id)
                               throws Exception
gets a Dimension from a Cube, given an ID

Parameters:
s - the Cube containing the Dimension
id - the id of the dimension to find
Returns:
the Dimension with the specified id, otherwise null
Throws:
Exception

executeRangeQuery

public static List executeRangeQuery(Object target,
                                     String query,
                                     int startHit,
                                     int maxHits,
                                     boolean wantPaths,
                                     int size)
                              throws Exception
a rangequery method to test the speed of results based on the number of results, specifying that hits come back at a speed of at least 3 hits per second without paths, and at least 2 hits per second with paths

Parameters:
target - the catalog/study to perform the range query on
query - the query to execute
startHit - the result position number to start from
maxHits - the number of results to return
wantPaths - return the full object paths
size - the correct number of results to return
Returns:
a List of results
Throws:
Exception

executeRangeQuery

public static List executeRangeQuery(Object target,
                                     String query,
                                     int startHit,
                                     int maxHits,
                                     boolean wantPaths,
                                     int size,
                                     int minQueryHitsPerSec,
                                     int minQueryPathHitsPerSec)
                              throws Exception
a rangequery method to test the speed of results based on the number of results, including whether they also return the full paths to those objects

Parameters:
target - the catalog/study to perform the range query on
query - the query to execute
startHit - the result position number to start from
maxHits - the number of results to return
wantPaths - return the full object paths
size - the correct number of results to return
minQueryHitsPerSec - a minimum threshold of hits to return per second
minQueryPathHitsPerSec - a minimum threshold of hits to return per second (including paths)
Returns:
a List of results
Throws:
Exception

executeRangeQuery

public static List executeRangeQuery(Object target,
                                     String query,
                                     int startHit,
                                     int maxHits,
                                     boolean wantPaths)
                              throws Exception
if user doesn't specify the expected size, this uses the maxHits as the expected size

Parameters:
target - the catalog/study to perform the range query on
query - the query to execute
startHit - the result position number to start from
maxHits - the number of results to return
wantPaths - return the full object paths
Throws:
Exception

executeRangeQueryAdditivity

public void executeRangeQueryAdditivity(Object target,
                                        String query)
                                 throws Exception
RangeQueryAdditivity tests the ability to add the results of a range query together.

Parameters:
target - the catalog/study to perform the range query on
query - the query to execute
Throws:
Exception

performRangeQuery

public void performRangeQuery(Catalog target,
                              String query,
                              int from,
                              int maxHits,
                              boolean paths,
                              int expectedHits,
                              long expectedDuration)
                       throws Exception
a method to perform a rangequery, and check that it returned the correct number of results, within an acceptable timeframe

Parameters:
target - the catalog on which to perform the query
query - the query to perform
from - the hit number to return from (in the total results)(0 for all)
maxHits - the maximum number of hits to return
paths - return full path of hits?
expectedHits - expected number of results
expectedDuration - expected time to do query
Throws:
Exception

removeAllVars

public void removeAllVars(Study3 subject)
                   throws Exception
Throws:
Exception

removeProperties

public void removeProperties(RDFObject subject,
                             URL property)
                      throws Exception
Delete all property values

Parameters:
subject -
property -
Throws:
Exception

toString

public String toString(List list)
                throws Exception
Throws:
Exception

findPosition

public int findPosition(List list,
                        Object obj)
                 throws Exception
Throws:
Exception

addPath

public void addPath(StringBuffer path,
                    String prop,
                    List list,
                    Object obj)
             throws Exception
Throws:
Exception

checkPaths

public void checkPaths(RDFObject from,
                       RDFObject to,
                       String paths,
                       int numPaths)
                throws Exception
Parameters:
from - the origin of the paths
to - the destination of the paths
path - the results of a PathsTo operation
numPaths - the expected number of paths
Throws:
Exception - if the paths number is incorrect or the paths do not lead from the origin to the destination

checkPathsTo

public void checkPathsTo(String expectedPaths,
                         String paths,
                         RDFObject from,
                         RDFObject to,
                         int numPaths)
                  throws Exception
Throws:
Exception

checkPathsTo

public void checkPathsTo(String expectedPaths,
                         String paths,
                         RDFObject from,
                         RDFObject to)
                  throws Exception
Throws:
Exception

repeatCheck

public static boolean repeatCheck(Class cls,
                                  String methodName,
                                  int times,
                                  int interval)
                           throws Exception
Call repeatedly a method with signature 'static boolean methodName()' waiting 'interval' milliseconds between calls until the method returns true or the method has been called 'times' times.

Parameters:
cls - the class where the method is defined
methodName - the name of the method
times - the maximum number of times that the check should be repeated
interval - the interval between checks
Throws:
Exception

waitServer

public void waitServer(boolean upOrDown)
                throws Exception
waits for the server to go up or go down.

Parameters:
upOrDown - true if it has to wait for the server to go up, false if it has to wait for the server to go down
Throws:
Exception

read

public static String read(String name)
                   throws Exception
reads in a files and returns a string of the content

Parameters:
name - file name
Returns:
a string representation of the file
Throws:
Exception

write

public static void write(String content,
                         File file)
                  throws Exception
writes a string to a file

Parameters:
content - the data to output to the file
file - the file to write to
Throws:
Exception

rebootServer

public void rebootServer()
                  throws Exception
Reboot server and reapply basic setup

Throws:
Exception

rebootServer

public void rebootServer(int repetition)
                  throws Exception
Reboot server

Parameters:
repetition: - the number of time it have to wait for a server to go up and down (if the server has being rebooted for a policy change, it will restart twice)
Throws:
Exception

msg

public static void msg(String prefix,
                       Object msg)
Print message to standard output

Parameters:
prefix - a string to prefix to the message
msg - an object on which a toString will be called

msg

public static void msg(Object msg)
Print message to standard output

Parameters:
msg - an object on which a toString will be called

warn

public static void warn(String msg)
Print a warning.

Parameters:
msg - a string to print with WARN as prefix

cannotRun

public static void cannotRun(String reason)
Produce a warning or error if a test cannot be executed for the indicated reason.

Parameters:
reason - the reason why the test cannot be executed

untested

public void untested(String feature)
              throws Exception
Mark a test as 'untested' (no proper test has been provided). Automatically generated test cases will call 'untested' by default.

Parameters:
feature - the name of the feature (method or attribute that is untested)
Throws:
Exception

toMsg

public static String toMsg(Collection objects)
returns a more readable representation of a collection

Parameters:
objects - a collection of objects
Returns:
a more readable representation of a collection

removeServerURL

public static String removeServerURL(String result)
                              throws Exception
Remove server dependent URL from result

Parameters:
result - a string to be edited
Returns:
a string with server ip, port & name replaced
Throws:
Exception

removeCreationDate

public static String removeCreationDate(String result)
                                 throws Exception
Throws:
Exception

Nesstar SDK

Copyright©2003 NSD - All Rights Reserved