class: TestBase

public class: TestBase
Author: Johannes Mueller (initial creation)
Project: Phase: 1.0; Status: Proposed; Version: $Revision: 1951 $ $LastChangedDate: 2009-05-07 10:; Complexity: 1
Dates: Created: 16.07.2009 15:15:03; Modified: 16.07.2009 15:15:03;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {E208DD6E-E7CA-4517-BBEE-989174A4BE16}
Base Class for tests in common_logic.
 

Goto: Custom Properties, Fields, Methods

See also: AccountUserVOTest, ValueObjectCloneTest, ValueObjectEqualsTest, TransformAffiliationTest, TransformContextTest, TransformExportFormatTest, TransformGrantsTest, TransformLockTest, TransformParamTest, TransformRelationTest, XmlTransformingTest, XmlTransformingTestBase

Appears in: test

Connections
 
Custom Properties
 
TestBase Attributes
Attribute Details
protected static const String
  COMPONENT_FILE
Initial: TEST_FILE_ROOT + "schindlmayr-springer.pdf"
protected static const String
  ITEM_FILE
Initial: TEST_FILE_ROOT + "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"
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
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.
private
createCreator1():CreatorVO
Sequential
Notes: @return
private
createCreator2():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
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 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
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
Tags: throws=Exception
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
logout(
   String userHandle):void
Sequential
Tags: throws=ServiceException,URISyntaxException,AuthenticationException,SystemException,RemoteException
Notes: Logs the user with the given userHandle out from the system.
public static
main(
   String[] args):void
Sequential
Tags: throws=Exception
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 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.
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.