com.ptc.windchill.uwgm.common.pdm
Class PartDocumentRetrieverTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.ptc.windchill.uwgm.test.util.AbstractUwgmTest
              extended bycom.ptc.windchill.uwgm.common.pdm.PartDocumentRetrieverTest
All Implemented Interfaces:
junit.framework.Test, com.ptc.windchill.uwgm.test.util.UwgmTestConstants

public class PartDocumentRetrieverTest
extends com.ptc.windchill.uwgm.test.util.AbstractUwgmTest

This class tests the methods from PartDocumentRetriever. As in case of WorkspaceContentTest from package com.ptc.windchill.uwgm.common.workspace, this class also creates a workspace and a few documents and parts using WorkspaceDataLoader. It then uses the cached PartDocumentRetriever instance to test whether correct objects are retrieved based upon appropriate specs. Note that currently only retrieval based on Object IDs is working since other specs are not yet supported in WorkspaceContent. This test should be updated to include support for master ID, number and CAD name specs once that is available. Finally as in case of WorkspaceContentTest, all the objects are destroyed in tearDown(). This class provides an implementation of RetrieverSpec which is exactly the same as the one in RetrieverSpecHelper.java. Instances of the implemented class are used to create lists of retriever specs for parts and documents. Again, as in case of WorkspaceContentTest.java, a default implementation of suite() method has been provided to run the tests in this class as a suite or within another suite.


Nested Class Summary
private  class PartDocumentRetrieverTest.Spec
          internal implementation for non-versioned specs.
 
Nested classes inherited from class com.ptc.windchill.uwgm.test.util.AbstractUwgmTest
 
Field Summary
private  WTPrincipal principal
           
private  PartDocumentRetriever retriever
           
private  EPMDocument[] testDocs
           
private  WTPart[] testParts
           
private  WTContainer testProduct
           
private  EPMWorkspace workspace
           
private  com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader
           
 
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
PartDocumentRetrieverTest()
           
PartDocumentRetrieverTest(String methodName)
           
 
Method Summary
private  void compare(EPMDocument[] docs1, EPMDocument[] docs2, boolean isCheckedIn)
           
private  void compare(WTPart[] parts1, WTPart[] parts2, boolean isCheckedIn)
           
private  Collection getRetrieverSpecs(RetrieverSpec.Type specType, Persistable[] objects)
           
static void main(String[] args)
           
private  void retrieveDocuments(RetrieverSpec.Type[] docSpecTypes, boolean isCheckedIn)
           
private  void retrieveObjects(boolean isCheckedIn)
           
private  void retrieveParts(RetrieverSpec.Type[] partSpecTypes, boolean isCheckedIn)
           
protected  void setUp()
           
static junit.framework.Test suite()
           
protected  void tearDown()
           
 void testObjectRetrieval()
           
 
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, 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

workspace

private EPMWorkspace workspace

wsDataLoader

private com.ptc.windchill.uwgm.test.fixture.WorkspaceDataLoader wsDataLoader

testProduct

private WTContainer testProduct

testParts

private WTPart[] testParts

testDocs

private EPMDocument[] testDocs

principal

private WTPrincipal principal

retriever

private PartDocumentRetriever retriever
Constructor Detail

PartDocumentRetrieverTest

public PartDocumentRetrieverTest()

PartDocumentRetrieverTest

public PartDocumentRetrieverTest(String methodName)
Method Detail

setUp

protected void setUp()

testObjectRetrieval

public void testObjectRetrieval()

tearDown

protected void tearDown()

suite

public static junit.framework.Test suite()

main

public static void main(String[] args)

getRetrieverSpecs

private Collection getRetrieverSpecs(RetrieverSpec.Type specType,
                                     Persistable[] objects)
                              throws WTException
Throws:
WTException

compare

private void compare(WTPart[] parts1,
                     WTPart[] parts2,
                     boolean isCheckedIn)

compare

private void compare(EPMDocument[] docs1,
                     EPMDocument[] docs2,
                     boolean isCheckedIn)

retrieveObjects

private void retrieveObjects(boolean isCheckedIn)
                      throws WTException
Throws:
WTException

retrieveParts

private void retrieveParts(RetrieverSpec.Type[] partSpecTypes,
                           boolean isCheckedIn)
                    throws WTException
Throws:
WTException

retrieveDocuments

private void retrieveDocuments(RetrieverSpec.Type[] docSpecTypes,
                               boolean isCheckedIn)
                        throws WTException
Throws:
WTException