class: TestBase

public class: TestBase
Author: Peter Broszeit (initial creation)
Project: Phase: 1.0; Status: Proposed; Version: $Revision:60 $ $LastChangedDate:2007-01-25 13:08:4; Complexity: 1
Dates: Created: 16.07.2009 15:17:13; Modified: 16.07.2009 15:17:13;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {46492B98-E4EA-4d41-9B2D-C16A1B977FAA}
Methods which are used in mostly all test cases.
 

Goto: Custom Properties, Fields, Methods

See also: CleanupUserData, TestRetrieveUserAccount, TestShowUserData, XPathTest, TestContentModels, CleanupContextData, TestContext, TestItemBase, TestShowContextData, CleanupOrgUnitData, TestRetrieveOrganizationalUnit, TestShowOrgUnitData, TestReportHandler, TestFile, DeleteObjectsTest

Appears in: framework

Connections
 
Custom Properties
 
TestBase Attributes
Attribute Details
protected static const String
  ILLEGAL_ID
Initial: "escidoc:persistentX"
Notes: An illegal id ofa framework object.
protected static const String
  LINE
Initial: "--------------------"
Notes: A line for separating output.
private static const int
  NUMBER_OF_URL_TOKENS
Initial: 2
protected static const String
  PROPERTY_PASSWORD_ADMIN
Initial: "framework.admin.password"
Notes: The default admin password property.
protected static const String
  PROPERTY_PASSWORD_AUTHOR
Initial: "framework.author.password"
Notes: The default admin password property.
protected static const String
  PROPERTY_PASSWORD_LIBRARIAN
Initial: "framework.librarian.password"
Notes: The default librarian password property.
protected static const String
  PROPERTY_PASSWORD_SCIENTIST
Initial: "framework.scientist.password"
Notes: The default scientist password property.
protected static const String
  PROPERTY_USERNAME_ADMIN
Initial: "framework.admin.username"
Notes: The default admin password property.
protected static const String
  PROPERTY_USERNAME_AUTHOR
Initial: "framework.author.username"
Notes: The default admin password property.
protected static const String
  PROPERTY_USERNAME_LIBRARIAN
Initial: "framework.librarian.username"
Notes: The default librarian password property.
protected static const String
  PROPERTY_USERNAME_SCIENTIST
Initial: "framework.scientist.username"
Notes: The default scientist password property.
protected static const String
  PUBITEM_TYPE_ID
Initial: "escidoc:persistent6"
Notes: The id of the content model Publication Item.
protected String
  userHandle
Notes: The handle of the logged in user or null if not logged in.
protected static const String
  USERID
Initial: "escidoc:user1"
Notes: The default users id.
 
TestBase Methods
Operation Details
protected static
assertXMLExist(
   String message,
   Node node,
   String xPath):void
Sequential
Tags: throws=Exception
Notes: Assert that the Element/Attribute selected by the xPath exists.
protected static
assertXMLValid(
   String xmlData,
   String schemaFileName):void
Sequential
Tags: throws=Exception
Notes: Assert that the XML is valid to the schema.
protected static
getAttributeValue(
   Node node,
   String xPath,
   String attributeName):String
Sequential
Tags: throws=Exception
Notes: Return the text value of the selected attribute NOT considering namespaces.
@return The text value of the selected attribute.
protected static
getAttributeValueNS(
   Node node,
   String xPath,
   String attributeNamespaceURI,
   String attributeLocalName):String
Sequential
Tags: throws=Exception
Notes: Return the text value of the selected attribute considering namespaces.
@return The value for the given attribute.
protected static
getDocument(
   String xml,
   boolean namespaceAwareness):Document
Sequential
Tags: throws=Exception
Notes: Parse the given xml String into a Document.
@return The Document.
protected static
getRootElementAttributeValue(
   Document document,
   String attributeName):String
Sequential
Tags: throws=Exception
Notes: Gets the value of the specified attribute of the root element from the document.
@return The attribute value.
private static
getSchema(
   String schemaFileName):Schema
Sequential
Tags: throws=Exception
Notes: Gets the <code>Schema</code> object for the provided <code>File</code>.
@param schemaStream The file containing the schema.
@return The <code>Schema</code> object.
protected
getValue(
   Document document,
   String xpathExpression):String
Sequential
Tags: throws=TransformerException
Notes: Gets a value from the document for the given xpath expression.
@param xPath The xpath to select the node containing the attribute.
@return The value for the xpath expression.
protected
loginAuthor():String
Sequential
Tags: throws=Exception
Notes: Logs in the user test_author who is nothing but an author and returns the corresponding user handle.
@return A handle for the logged in user.
protected
loginLibrarian():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs in the user test_dep_lib and returns the corresponding user handle.
@return A handle for the logged in user.
protected
loginScientist():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs in the user test_dep_scientist and returns the corresponding user handle.
@return A handle for the logged in user.
protected
loginSystemAdministrator():String
Sequential
Tags: throws=Exception
Notes: Logs in the user roland who is a system administrator and returns the corresponding user handle.
@return A handle for the logged in user.
protected
loginUser(
   String userid,
   String password):String
Sequential
Tags: throws=HttpException,IOException,ServiceException,URISyntaxException
Notes: Logs in the given user with the given password.
@return The handle for the logged in user.
protected
logout(
   String userHandle):void
Sequential
Tags: throws=WebserverSystemException,SqlDatabaseSystemException,AuthenticationException,RemoteException,ServiceException,URISyntaxException
Notes: Logs out the user with the given userhandle from the system.
@return userHandle The handle for the logged in user.
protected
readFile(
   String fileName):String
Sequential
Tags: throws=IOException,FileNotFoundException
Notes: Reads contents from text file and returns it as String.
@return The entire contents of the filename as a String.
protected static
selectNodeList(
   Node node,
   String xpathExpression):NodeList
Sequential
Tags: throws=TransformerException
Notes: Return the list of children of the node selected by the xPath.
@param xPath The xPath expression.
@return The list of children of the node selected by the xPath.
protected static
selectSingleNode(
   Node node,
   String xpathExpression):Node
Sequential
Tags: throws=TransformerException
Notes: Return the child of the node selected by the xPath.
@param xPath The xPath expression.
@return The child of the node selected by the xPath.
public
setUp():void
Sequential
Tags: annotations=@Before
throws=Exception
Notes: Logs in as the default user before each test case.
public
tearDown():void
Sequential
Tags: annotations=@After
throws=Exception
Notes: Logs the user out after each test case.
protected static
toString(
   Node xml,
   boolean omitXMLDeclaration):String
Sequential
Tags: throws=Exception
Notes: Serialize the given Dom Object to a String.
@return The String representation of the Xml Node.