wt.step.processor
Class ExportTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bywt.step.STEPTestCase
              extended bywt.step.processor.ExportTest
All Implemented Interfaces:
junit.framework.Test

public class ExportTest
extends STEPTestCase

Test for export functionality. Builds its own test data as necessary.


Field Summary
private  WTPartConfigSpec _defaultConfigSpec
           
private  Properties _exportScope
           
private  File _pdmTestFile
           
private static WTDocument _testDocument
           
private static WTObject[] _testScope
           
private static HashSet _testScopeNumbers
           
private static WTPart[] _testScopeParts
           
private  ExpressSchema _wtSchema
           
private  File _wtTestFile
           
private static boolean CONTENT_TESTS_POSSIBLE
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
ExportTest(String name)
           
 
Method Summary
private static void addTestContent(WTDocument doc, String docNumber)
          Compare actual content files with required and request changes.
private  void applyLinkTypes()
          Apply knowledge of link types to the Windchill schema data.
protected  void assertEntityUnsetAttributes(File stepFile, String entity, int expectedCount)
          Count the unset attributes in entities of a specific type.
private static void buildTestData()
          Build a test structure in Windchill for export validation.
protected  int countEntities(File stepFile, String entity)
          Count the number of a specific entity by looking for lines of the form:
#nn= SPECIFIC_ENTITY(...);
protected static WTPart createPart(String masterNumber)
           
protected static WTPartUsageLink createPartUsageLink(WTPart part1, WTPart part2)
           
protected  HashSet extractMastersList(File stepFile)
          Extract id numbers from part/document master lines like:
#14= W_T_PART_MASTER($,$,$,$,$,$,$,$,$,'ASNA2026HK3-8',$,$,'Bolt',$,$);
protected static WTDocument findDocument(String masterNumber)
           
protected static WTPart findPart(String masterNumber)
           
protected  WTPartMaster findPartMaster(String masterNumber)
           
protected static WTPartUsageLink getPartUsageLink(WTPart part1, WTPart part2)
           
private static void initExampleScope()
          Initialise export scopes (collections of parts/documents) for use in test cases.
private  void loadWtSchema()
          Extracted out loading of windchill_schema file as this takes a long time and is not necessary for all tests.
 void setUp()
          Setup for each test.
static junit.framework.Test suite()
           
 void testAssemblyExport()
          Test that all items in an AssemblyExportSelection are exported.
 void testEntityAttributes()
          Test that inherited attributes in the Windchill schema have the correct indices for export in Part21/STEP format.
 void testLinkTypes()
          Test that Windchill link types are appropriately applied to the schema.
 void testScopedExport()
          Test that the exported data is limited to the scope of the requested parts (with associated documents) in both the WT schema export file and the converted PDM schema export file.
 
Methods inherited from class wt.step.STEPTestCase
assertSTEPTrue, assertSTEPTrue
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, 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

CONTENT_TESTS_POSSIBLE

private static final boolean CONTENT_TESTS_POSSIBLE
See Also:
Constant Field Values

_wtSchema

private ExpressSchema _wtSchema

_wtTestFile

private File _wtTestFile

_pdmTestFile

private File _pdmTestFile

_testScope

private static WTObject[] _testScope

_testDocument

private static WTDocument _testDocument

_testScopeParts

private static WTPart[] _testScopeParts

_testScopeNumbers

private static HashSet _testScopeNumbers

_exportScope

private Properties _exportScope

_defaultConfigSpec

private WTPartConfigSpec _defaultConfigSpec
Constructor Detail

ExportTest

public ExportTest(String name)
Method Detail

findPart

protected static WTPart findPart(String masterNumber)
                          throws Exception
Throws:
Exception

createPart

protected static WTPart createPart(String masterNumber)
                            throws Exception
Throws:
Exception

findPartMaster

protected WTPartMaster findPartMaster(String masterNumber)
                               throws Exception
Throws:
Exception

getPartUsageLink

protected static WTPartUsageLink getPartUsageLink(WTPart part1,
                                                  WTPart part2)
                                           throws Exception
Throws:
Exception

createPartUsageLink

protected static WTPartUsageLink createPartUsageLink(WTPart part1,
                                                     WTPart part2)
                                              throws Exception
Throws:
Exception

findDocument

protected static WTDocument findDocument(String masterNumber)
                                  throws Exception
Throws:
Exception

loadWtSchema

private void loadWtSchema()
                   throws Exception
Extracted out loading of windchill_schema file as this takes a long time and is not necessary for all tests.

Throws:
Exception

applyLinkTypes

private void applyLinkTypes()
                     throws Exception
Apply knowledge of link types to the Windchill schema data. (i.e. ObjectToObject subtypes).

Throws:
Exception

setUp

public void setUp()
Setup for each test. Creates WT and PDM export files ensuring that they do not already exist.


buildTestData

private static void buildTestData()
                           throws Exception
Build a test structure in Windchill for export validation.
 ROOT
 A      B      C
 A1 A2  B1      \
        B11      DocA
 

Throws:
Exception

addTestContent

private static void addTestContent(WTDocument doc,
                                   String docNumber)
                            throws Exception
Compare actual content files with required and request changes. Changes have to be performed manually as a Client cannot perform uploads.

Throws:
Exception

initExampleScope

private static void initExampleScope()
                              throws Exception
Initialise export scopes (collections of parts/documents) for use in test cases.

Throws:
Exception

extractMastersList

protected HashSet extractMastersList(File stepFile)
                              throws Exception
Extract id numbers from part/document master lines like:
#14= W_T_PART_MASTER($,$,$,$,$,$,$,$,$,'ASNA2026HK3-8',$,$,'Bolt',$,$);

Throws:
Exception

countEntities

protected int countEntities(File stepFile,
                            String entity)
                     throws Exception
Count the number of a specific entity by looking for lines of the form:
#nn= SPECIFIC_ENTITY(...);

Throws:
Exception

assertEntityUnsetAttributes

protected void assertEntityUnsetAttributes(File stepFile,
                                           String entity,
                                           int expectedCount)
                                    throws Exception
Count the unset attributes in entities of a specific type. That is the number of '$'s on a line of the form:
#nn= SPECIFIC_ENTITY(...);

Throws:
Exception

testEntityAttributes

public void testEntityAttributes()
                          throws Exception
Test that inherited attributes in the Windchill schema have the correct indices for export in Part21/STEP format.

Throws:
Exception

testLinkTypes

public void testLinkTypes()
                   throws Exception
Test that Windchill link types are appropriately applied to the schema.

Throws:
Exception

testScopedExport

public void testScopedExport()
                      throws Exception
Test that the exported data is limited to the scope of the requested parts (with associated documents) in both the WT schema export file and the converted PDM schema export file.

Throws:
Exception

testAssemblyExport

public void testAssemblyExport()
                        throws Exception
Test that all items in an AssemblyExportSelection are exported. There should be no repeats and no subparts missing.

Throws:
Exception

suite

public static final junit.framework.Test suite()