com.ptc.windchill.uwgm.proesrv.request
Class AbstractUwgmRequestTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.ptc.windchill.uwgm.test.util.AbstractUwgmTest
              extended bycom.ptc.windchill.uwgm.proesrv.request.AbstractUwgmRequestTest
All Implemented Interfaces:
junit.framework.Test, com.ptc.windchill.uwgm.test.util.UwgmTestConstants
Direct Known Subclasses:
AddToWorkspaceRequestTest, EpmRenameRequestTest, FindIterationsRequestTest, GetFolderContentRequestTest, IBAModificationRequestTest, PartRenameRequestTest, ProeServiceFrameworkTest, RemoveFromWorkspaceRequestTest, SetTargetFolderRequestTest, UndoCheckoutRequestTest, UpdateWorkspaceRequestTest, WorkspaceDeleteRequestTest, WorkspaceGetInformationRequestTest

public abstract class AbstractUwgmRequestTest
extends com.ptc.windchill.uwgm.test.util.AbstractUwgmTest

Parent abstract class for writing test classes for the Pro/E services implementations of UwgmRequests e.g. AddToWorkspaceRequest. This class adds some capabilities to AbstractUwgmTest like creating transaction from requests, verifying the results of executing the tranasaction etc. Each subclass i.e. a concrete implentation of this class will have to implement at least two methods viz. createRequests() for creating an array of one or more requests that are to be invoked and verifySuccessMessage() for verifying the success message returned by Pro/E services after executing the request. Optionally, the subclass may override the following methods: - setUp() to create additional fixtures apart from the bare minimum set up by the implementation of this method in this class - performUwgmRequestTest() to perform the creation, execution and verification of the request in case the subclass wants to provide a mechanism different from the one provided by this class. - printRequest() to print the contents of a request. Though this is optional, it is recommended that the subclasses provide an implementation of this method for debugging purposes. - verifySuccessMessage() for more detail verification - verifyTransactionMessages() for expected failures verification


Nested Class Summary
 
Nested classes inherited from class com.ptc.windchill.uwgm.test.util.AbstractUwgmTest
 
Field Summary
private static Log log
           
protected static ObjectIdentifierHelper oidHelper
           
protected  WTPrincipal principal
           
protected  WTContainer testProduct
           
protected  WTContainer testProject
           
 
Fields inherited from class com.ptc.windchill.uwgm.test.util.AbstractUwgmTest
 
Fields inherited from class junit.framework.TestCase
 
Fields inherited from interface com.ptc.windchill.uwgm.test.util.UwgmTestConstants
UWGM_CLIENT_CACHE_ID, UWGM_CLIENT_NAME, UWGM_CLIENT_VERSION, UWGM_TEST_ASSEMBLY_CHILDREN_NOS, UWGM_TEST_BOOLEAN, UWGM_TEST_DEFAULT_FOLDER_PATH, UWGM_TEST_DEFAULT_LIFECYCLE_NAME, UWGM_TEST_DEFAULT_LIFECYCLE_PROP_NAME, UWGM_TEST_DEFAULT_TEAMTEMPLATE_NAME, UWGM_TEST_DOC_NAME_PREFIX, UWGM_TEST_DOC_NOS, UWGM_TEST_FAMILY_INSTANCE_NOS, UWGM_TEST_FLOAT, UWGM_TEST_FOLDER_NAME_PREFIX, UWGM_TEST_GENERIC_NAME_PREFIX, UWGM_TEST_INSTANCE_NAME_PREFIX, UWGM_TEST_INTEGER, UWGM_TEST_PART_NAME_PREFIX, UWGM_TEST_PART_NOS, UWGM_TEST_PRODUCT1_NAME, UWGM_TEST_PROJECT1_NAME, UWGM_TEST_STRING, UWGM_TEST_WORKSPACE_NAME_PREFIX
 
Constructor Summary
AbstractUwgmRequestTest()
           
AbstractUwgmRequestTest(String methodName)
           
 
Method Summary
protected abstract  com.ptc.windchill.uwgm.soap.uwgm.Request[] createRequests()
           
private  com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction createTransaction()
           
private  com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction createTransaction(com.ptc.windchill.uwgm.soap.uwgm.Request[] requests)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(com.ptc.windchill.uwgm.test.fixture.WorkspaceRequestDataLoader wsDataLoader)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(WTCollection testObjects)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(EPMWorkspace workspace)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader)
           
protected  com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(com.ptc.windchill.uwgm.test.fixture.WorkspaceRequestDataLoader wsDataLoader)
           
protected  WTCollection getWorkspaceObjects(EPMWorkspace workspace)
           
protected  WTKeyedMap getWorkspaceObjectsMap(EPMWorkspace workspace)
           
protected  void performUwgmRequestTest()
           
protected  void printIterations(com.ptc.windchill.uwgm.soap.uwgmsvc.IterationRequest iterationRequest)
           
protected  void printRequest(com.ptc.windchill.uwgm.soap.uwgm.UwgmRequest uwgmRequest, int cnt)
           
private  void printTransaction(com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction transaction)
           
protected  void printWorkspace(com.ptc.windchill.uwgm.soap.uwgmsvc.WorkspaceRequest workspaceRequest)
           
protected  void setUp()
           
protected  void verifyResponseMessages(com.ptc.windchill.uwgm.soap.uwgm.Messages messages)
          verifies Response messages Default implementation assumes that there are only success/info/warning messages in each Response (if any) Could be overwritten by test implementation
private  void verifyResults(com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction uwgmTransaction)
           
protected  void verifySuccessMessage(com.ptc.windchill.uwgm.soap.uwgm.Message message)
           
protected  void verifyTransactionMessages(com.ptc.windchill.uwgm.soap.uwgm.Messages messages)
          verifies Transaction messages Default implementation assumes that there are no messages in Transaction Could be overwritten by test implementation
 
Methods inherited from class com.ptc.windchill.uwgm.test.util.AbstractUwgmTest
getTestResult, reportError, reportFailure, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

principal

protected WTPrincipal principal

testProduct

protected WTContainer testProduct

testProject

protected WTContainer testProject

log

private static Log log

oidHelper

protected static final ObjectIdentifierHelper oidHelper
Constructor Detail

AbstractUwgmRequestTest

public AbstractUwgmRequestTest()

AbstractUwgmRequestTest

public AbstractUwgmRequestTest(String methodName)
Method Detail

setUp

protected void setUp()
              throws Exception
Throws:
Exception

createUwgmWorkspace

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(com.ptc.windchill.uwgm.test.fixture.WorkspaceRequestDataLoader wsDataLoader)
                                                                          throws WTException
Throws:
WTException

createUwgmWorkspace

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader)
                                                                          throws WTException
Throws:
WTException

createUwgmWorkspace

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Workspace createUwgmWorkspace(EPMWorkspace workspace)
                                                                          throws WTException
Throws:
WTException

createUwgmIterations

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(com.ptc.windchill.uwgm.test.fixture.WorkspaceRequestDataLoader wsDataLoader)
                                                                                    throws WTException
Throws:
WTException

createUwgmIterations

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader)
                                                                                    throws WTException
Throws:
WTException

createUwgmIterations

protected final com.ptc.windchill.uwgm.soap.uwgmdb.Iteration.Iterator createUwgmIterations(WTCollection testObjects)
                                                                                    throws WTException
Throws:
WTException

performUwgmRequestTest

protected void performUwgmRequestTest()
                               throws Exception
Throws:
Exception

getWorkspaceObjectsMap

protected final WTKeyedMap getWorkspaceObjectsMap(EPMWorkspace workspace)
                                           throws WTException
Throws:
WTException

getWorkspaceObjects

protected final WTCollection getWorkspaceObjects(EPMWorkspace workspace)
                                          throws WTException
Throws:
WTException

createTransaction

private com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction createTransaction()
                                                                    throws com.ptc.cipjava.jxthrowable,
                                                                           WTException
Throws:
com.ptc.cipjava.jxthrowable
WTException

createRequests

protected abstract com.ptc.windchill.uwgm.soap.uwgm.Request[] createRequests()
                                                                      throws com.ptc.cipjava.jxthrowable,
                                                                             WTException
Throws:
com.ptc.cipjava.jxthrowable
WTException

createTransaction

private com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction createTransaction(com.ptc.windchill.uwgm.soap.uwgm.Request[] requests)
                                                                    throws com.ptc.cipjava.jxthrowable,
                                                                           WTException
Throws:
com.ptc.cipjava.jxthrowable
WTException

printTransaction

private void printTransaction(com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction transaction)

printRequest

protected void printRequest(com.ptc.windchill.uwgm.soap.uwgm.UwgmRequest uwgmRequest,
                            int cnt)

printWorkspace

protected void printWorkspace(com.ptc.windchill.uwgm.soap.uwgmsvc.WorkspaceRequest workspaceRequest)

printIterations

protected void printIterations(com.ptc.windchill.uwgm.soap.uwgmsvc.IterationRequest iterationRequest)

verifyResults

private void verifyResults(com.ptc.windchill.uwgm.soap.uwgm.UwgmTransaction uwgmTransaction)
                    throws com.ptc.cipjava.jxthrowable,
                           WTException
Throws:
com.ptc.cipjava.jxthrowable
WTException

verifyTransactionMessages

protected void verifyTransactionMessages(com.ptc.windchill.uwgm.soap.uwgm.Messages messages)
                                  throws com.ptc.cipjava.jxthrowable,
                                         WTException
verifies Transaction messages Default implementation assumes that there are no messages in Transaction Could be overwritten by test implementation

Parameters:
messages - Messages to be verified
Throws:
com.ptc.cipjava.jxthrowable
WTException

verifyResponseMessages

protected void verifyResponseMessages(com.ptc.windchill.uwgm.soap.uwgm.Messages messages)
                               throws com.ptc.cipjava.jxthrowable,
                                      WTException
verifies Response messages Default implementation assumes that there are only success/info/warning messages in each Response (if any) Could be overwritten by test implementation

Parameters:
messages - Messages to be verified
Throws:
com.ptc.cipjava.jxthrowable
WTException

verifySuccessMessage

protected void verifySuccessMessage(com.ptc.windchill.uwgm.soap.uwgm.Message message)
                             throws WTException
Throws:
WTException