class: TestBase

public class: TestBase
Author: Johannes Mueller (initial creation)
Project: Phase: 1.0; Status: Proposed; Version: $Revision$ $LastChangedDate$ @revised by MuJ: 03.; Complexity: 1
Dates: Created: 16.07.2009 15:15:31; Modified: 16.07.2009 15:15:31;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {EBFAC556-A69E-424a-BDFD-1DCF8D35E100}
Base Class for tests in common_logic.
 

Goto: Custom Properties, Fields, Methods

See also: CreateOrganizationsTest, FindRevisionsOfItemTest, EmailHandlingTest, EncodingTest, ObjectComparatorTest, AccountUserVOTest, ValueObjectCloneTest, ValueObjectEqualsTest, TransformAccountUserAndGrantsIntegrationTest, TransformAffiliationIntegrationTest, TransformFileUrlTest, TransformPubCollectionIntegrationTest, TransformSchindlMayrIntegrationTest, JiBXHelperTest, XmlTransformingIntegrationTest, XmlTransformingTestBase, AffiliationCreator

Appears in: common

Connections
 
Custom Properties
 
TestBase Attributes
Attribute Details
protected static const String
  COMPONENT_FILE
Initial: TEST_FILE_ROOT + "schindlmayr/schindlmayr-springer.pdf"
protected static const String
  FACES_CONTENT_MODEL_ID
Initial: "escidoc:faces50"
protected static const String
  FACES_TEST_COLLECTION_ID
Initial: "escidoc:2024"
protected static const String
  ITEM_FILE
Initial: TEST_FILE_ROOT + "schindlmayr/schindlmayr-springer.xml"
private static const Logger
  logger
Initial: Logger.getLogger(TestBase.class)
Notes: Logger for this class.
protected static const String
  MIME_TYPE
Initial: "application/pdf"
private static const int
  NUMBER_OF_URL_TOKENS
Initial: 2
protected static const String
  PROPERTY_FACES_CONTEXTID
Initial: "escidoc.faces.contextid"
Notes: The default faces test container property.
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_EDITOR
Initial: "framework.editor.password"
Notes: The default editor 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_EDITOR
Initial: "framework.editor.username"
Notes: The default editor 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
  PUBMAN_TEST_COLLECTION_DESCRIPTION
Initial: "This is the sample collection description of the PubMan Test\n" + "collection. Any content can be stored in this collection, which is of relevance\n" + "for the users of the system. You can submit relevant bibliographic information\n" + "for your publication (metadata) and all relevant files. The MPS is the\n" + "responsible affiliation for this collection. Please contact\n" + "u.tschida@zim.mpg.de for any questions."
protected static const String
  PUBMAN_TEST_COLLECTION_ID
Initial: "escidoc:persistent3"
protected static const String
  PUBMAN_TEST_COLLECTION_NAME
Initial: "PubMan Test Collection"
private static Map
  schemas
Initial: null
protected static const String
  TEST_FILE_ROOT
Initial: "target/test-classes/"
 
TestBase Methods
Operation Details
private
addIdentifiers(
   MdsPublicationVO mds):List
Sequential
Notes: @return
public static
assertXMLExist(
   String message,
   Node node,
   String xPath):void
Sequential
Tags: throws=Exception
Notes: Assert that the Element/Attribute selected by the xPath exists.
public static
assertXMLValid(
   String xmlData):void
Sequential
Tags: throws=Exception
Notes: Assert that the XML is valid to the schema.
@param schemaFileName
private
createAnotherCreator():CreatorVO
Sequential
Notes: @return
private
createComplexSources(
   TextVO title,
   CreatorVO creator,
   List identifierList,
   List sourcesList,
   PublishingInfoVO publishingInfoVO):void
Sequential
private
createCreator(
   MdsPublicationVO mds):CreatorVO
Sequential
Notes: @return
private
createEvent():EventVO
Sequential
Notes: @return
protected
createItemWithFile(
   String userHandle):String
Sequential
Tags: throws=Exception
Notes: Creates an item with a file in the framework.
@return The XML of the created item with a file, given back by the framework.
private
createSource():SourceVO
Sequential
Notes: @return
public static
findFileInClasspath(
   String fileName):File
Sequential
Tags: throws=FileNotFoundException
Notes: Searches the Java classpath for a given file name and gives back the file (or a FileNotFoundException).
@return The file
public static
formatDate(
   Date date):String
Sequential
Notes: Formats a given date to the format used by the framework.
@return The formatted date
protected
getAccountUser(
   String userHandle):AccountUserVO
Sequential
Tags: throws=Exception
Notes: @return The AccountUserVO
public static
getAttributeValue(
   Node node,
   String xPath,
   String attributeName):String
Sequential
Tags: throws=Exception
Notes: Return the text value of the selected attribute.
@return The text value of the selected attribute.
protected
getComplexPubItemWithoutFiles():PubItemVO
Sequential
Notes: Creates a well-defined, complex PubItemVO without files.
@return pubItem
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
getFacesAlbumContainer():ContainerVO
Sequential
Tags: throws=IOException,URISyntaxException
Notes: Creates a well-defined, simple Faces container without members.
@return The container
protected static
getLastModificationDate(
   String item):String
Sequential
Notes: Search the given String for the first occurence of "last-modification-date" and return its value.
@return The last-modification-date value
private
getMdsFacesAlbum():MdsFacesContainerVO
Sequential
Notes: Create metadata for a Faces album.
@return The metadata VO
protected
getMdsPublication1():MdsPublicationVO
Sequential
Notes: Creates a well-defined, complex MdsPublicationVO.
@return The generated MdsPublicationVO.
protected
getMdsPublication2():MdsPublicationVO
Sequential
Notes: Creates a well-defined, complex MdsPublicationVO.
@return The generated MdsPublicationVO.
private static
getNameSpaceFromXml(
   String xmlData):String
Sequential
Tags: throws=ParserConfigurationException,SAXException,IOException,UnsupportedEncodingException
Notes: @return
protected static
getObjid(
   String item):String
Sequential
Notes: Search the given String for the first occurence of "objid" and return its value.
@return The objid value
protected
getPubItem2():PubItemVO
Sequential
Notes: Creates anpther well-defined PubItemVO.
@return pubItem
protected
getPubItemNamedTheFirstOfAll():PubItemVO
Sequential
Notes: Creates a well-defined PubItemVO named "PubMan: The first of all.".
@return pubItem
protected
getPubItemResultNamedTheFirstOfAll():ItemResultVO
Sequential
Notes: Creates a well-defined PubItemVO named "PubMan: The first of all.".
@return pubItem
protected
getPubItemWithoutFiles():PubItemVO
Sequential
Notes: Creates a well-defined PubItemVO without any files attached.
@return pubItem
public 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 Returns 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 Returns the <code>Schema</code> object.
protected static
getService(
   String serviceName):Object
Sequential
Tags: throws=NamingException
Notes: Helper method to retrieve a EJB service instance. The name to be passed to the method is normally 'ServiceXY.SERVICE_NAME'.
@return instance of the EJB service
protected
getValue(
   Document document,
   String xpathExpression):String
Sequential
Tags: throws=TransformerException
Notes: Delivers the value of one distinct node in an <code>org.w3c.dom.Document</code>.
@return The value of the node.
private static
initializeSchemas():void
Sequential
Tags: throws=IOException,SAXException,ParserConfigurationException
protected static
loginAuthor():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs the user test_author in and returns the corresponding user handle.
@return userHandle
protected static
loginEditor():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs the user test_editor in and returns the corresponding user handle.
@return userHandle
protected static
loginLibrarian():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs the user test_dep_lib in and returns the corresponding user handle.
@return userHandle
protected static
loginScientist():String
Sequential
Tags: throws=ServiceException,HttpException,IOException,URISyntaxException
Notes: Logs the user test_dep_scientist in and returns the corresponding user handle.
@return userHandle
protected static
loginSystemAdministrator():String
Sequential
Tags: throws=Exception
Notes: Logs the user roland in who is a system administrator and returns the corresponding user handle.
@return userHandle
protected static
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 static
logout(
   String userHandle):void
Sequential
Tags: throws=RemoteException,ServiceException,URISyntaxException
Notes: Logs the user with the given userHandle out from the system.
protected static
readFile(
   String fileName):String
Sequential
Tags: throws=IOException
Notes: Reads contents from text file and returns it as String.
@return Entire contents of filename as a String
public static
selectNodeList(
   Node node,
   String xpathExpression):NodeList
Sequential
Tags: throws=TransformerException
Notes: Return the list of children of the node selected by the xPath.
@return The list of children of the node selected by the xPath.
public static
selectSingleNode(
   Node node,
   String xpathExpression):Node
Sequential
Tags: throws=TransformerException
Notes: Return the child of the node selected by the xPath.
@return The child of the node selected by the xPath.
protected static
toString(
   Node node,
   boolean omitXMLDeclaration):String
Sequential
Tags: throws=Exception
Notes: Serialize the given Dom Object to a String.
@param xml The Xml Node to serialize.
@return The String representation of the Xml Node.
protected
uploadFile(
   String fileName,
   String mimetype,
   String userHandle):URL
Sequential
Tags: throws=Exception
Notes: Uploads a file to the staging servlet and returns the corresponding URL.
@return The URL of the uploaded file.