<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="./spec.xsl" ?>

<spec title="BPEL Refactoring" version="1.5" author = "Mikhail Kondratyev, Maksim Khramov" author-email="mikk@netbeans.org"  last-updated = "09 November 2006">
    <intro>This specification provides test cases description for testing the BPEL Refactoring feature in the NB 5.5 Enterprise Pack release.
    </intro>
    
    
    
    <caseblock name="Upstream refactoring in the XML schema">  
        <purpose>Test how refactoring in upstream artifacts affects the BPEL process.</purpose>
        <setup> Start the IDE.</setup>
        <!--
        <usecase name="Rename Schema document">
            <action>Open the <a href="SchemaRefactoring.zip">test project</a></action>
            <action>Select Schema document in the project tree</action>
            <action>Invoke rename on it</action>
            <result>There should not be any changes in the diagram</result>
            <result>Schema imports should be updated in Navigator</result>
        </usecase>
        --> 
        <usecase name="Rename Schema complex type">
            <action>Open the <a href="RefactoringSchemaComplex.zip">test project</a></action>
	    <action>Open TestXmlSchema document in editor</action>
            <action>Find and select complex type element ComplexTypeAlpha in editor</action>
            <action>Invoke Refactor->Rename command for element</action>
	    <action>Proceed to perform the Rename operation</action>
	    <result>Variable declaration in diagram should be updated</result>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the complex type should be renamed</result>
            <result>Complex type usages should be renamed in Navigator</result>
        </usecase>

        <usecase name="Find usages of the Schema complex type">
            <action>Open the <a href="RefactoringSchemaComplex.zip">test project</a></action>
            <action>Find and select complex type element ComplexTypeAlpha in editor</action>
            <action>Invoke Find Usages command for element</action>
            <result>IDE should find 2 complex type usages in process scope</result>
            <result>IDE should find complex type usage in process nested scope</result>
        </usecase>

        <usecase name="Rename Schema element">
            <action>Open the <a href="RefactoringSchemaElement.zip">test project</a></action>
	    <action>Open TestXmlSchema document in editor</action>
            <action>Find and select schema element named SchemaElement in editor</action>
            <action>Invoke Refactor->Rename command for element</action>
	    <action>Proceed to perform the Rename operation</action>
	    <result>Variable declaration in diagram should be updated</result>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the element type should be renamed</result>
            <result>Element type usages should be renamed in Navigator</result>
        </usecase>

        <usecase name="Find usages of the Schema element">
            <action>Open the <a href="RefactoringSchemaElement.zip">test project</a></action>
            <action>Find and select schema element SchemaElement in editor</action>
            <action>Invoke Find Usages command for element</action>
            <result>IDE should find 2 schema element usages in process scope</result>
            <result>IDE should find schema element usage in process nested scope</result>   	  
        </usecase>
        
        <usecase name="Rename Schema simple type">
            <action>Open the <a href="RefactoringSchemaSimple.zip">test project</a></action>
	    <action>Open TestXmlSchema document in editor</action>
            <action>Find and select schema element TestSimpleType editor</action>
            <action>Invoke Refactor->Rename command for element</action>
	    <action>Proceed to perform the Rename operation</action>
	    <result>Variable declaration in diagram should be updated</result>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the simple type should be renamed</result>
            <result>Element type usages should be renamed in Navigator</result>
        </usecase>

        <usecase name="Find usages of the Schema simple type">
            <action>Open the <a href="RefactoringSchemaSimple.zip">test project</a></action>
            <action>Find and select schema element TestSimpleType in editor</action>
            <action>Invoke Find Usages command for element</action>
            <result>IDE should find 2 schema simple type usages in process scope</result>
            <result>IDE should find schema simple type usage in process nested scope</result>   	  
        </usecase> 

	<usecase name="Rename schema nested elements">
            <action>Open the <a href="RefactoringSchemaNested.zip">test project</a></action>
	    <action>Open TestXmlSchema document in editor</action>
	    <action>Find and select nested element ParamA under RootComplexType element</action>
            <action>Invoke Refactor->Rename command for element</action>
	    <action>Proceed to perform the Rename operation</action>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the nested type in XPath expressions should be renamed</result>
            <result>Element type usages should be renamed in Navigator</result>
	</usecase>

	<usecase name="Find usages of nested elements">
            <action>Open the <a href="RefactoringSchemaNested.zip">test project</a></action>
	    <action>Open TestXmlSchema document in editor</action>	
            <action>Find and select schema nested element RootComplexType in editor</action>
            <action>Invoke Find Usages command for element</action>
	    <result>Usage of nested element in If activity should be found</result>	
	    <result>2 Usages of nested element in Assign activity should be found</result>
	    <result>Usage of nested element in While activity should be found</result>
	    <result>Usage of nested element in RepeatUntil activity should be found</result>
	</usecase>

    </caseblock>
    
    
    
    <caseblock name="Upstream refactoring in the WSDL file">  
        <purpose>Test how refactoring in upstream artifacts affects the BPEL process.</purpose>
        <setup>Start the IDE. </setup>
        
        <usecase name="Find message usages from the WSDL document">
            <action>Open the <a href="RefactoringMessage.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the requestMessage message</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find message usage in the variable declaration</result>
            <result>IDE should find message usage in the faultHandler declaration</result>
            <result>IDE should find message usage in the property alias in wsdl file</result>
            <result>IDE should find message usage in the input1 parameter in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        <usecase name="Rename message from the WSDL document">
            <action>Open the <a href="RefactoringMessage.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the requestMessage message</action>
            <action>Click Refactor->Rename in the context menu</action>
            <action>Proceed to perform the rename operation</action>
            <result>IDE should rename message usage in the variable declaration</result>
            <result>IDE should rename message usage in the faultHandler declaration</result>
            <result>IDE should rename message usage in the property alias in wsdl file</result>
            <result>IDE should rename message usage in the input1 parameter in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Find message part usages from the WSDL document">
            <action>Open the <a href="RefactoringMessagePart.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Messages->requestMessage->inputType message</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find message usage in the EventHandlers->AlarmHandler->For</result>
            <result>IDE should find message usage in the EventHandlers->AlarmHandler->Until</result>
            <result>IDE should find message usage in the assignment</result>
            <result>IDE should find message usage in the Pick->AlarmHandler->For</result>
            <result>IDE should find message usage in the Pick->AlarmHandler->Until</result>
            <result>IDE should find message usage in the Wait</result>
            <result>IDE should find message usage in the If</result>
            <result>IDE should find message usage in the Else-If</result>
            <result>IDE should find message usage in the While</result>
            <result>IDE should find message usage in the RepeatUntil</result>
            <result>IDE should find message usage in the Foreach (3 usages)</result>
            <result>IDE should find message usage in the property alias in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
         <usecase name="Rename message part usages from the WSDL document">
            <action>Open the <a href="RefactoringMessagePart.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Messages->requestMessage->inputType message</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should rename message usage in the EventHandlers->AlarmHandler->For</result>
            <result>IDE should rename message usage in the EventHandlers->AlarmHandler->Until</result>
            <result>IDE should rename message usage in the assignment</result>
            <result>IDE should rename message usage in the Pick->AlarmHandler->For</result>
            <result>IDE should rename message usage in the Pick->AlarmHandler->Until</result>
            <result>IDE should rename message usage in the Wait</result>
            <result>IDE should rename message usage in the If</result>
            <result>IDE should rename message usage in the Else-If</result>
            <result>IDE should rename message usage in the While</result>
            <result>IDE should rename message usage in the RepeatUntil</result>
            <result>IDE should rename message usage in the Foreach (3 usages)</result>
            <result>IDE should rename message usage in the property alias in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Find fault usages from the WSDL document">
            <action>Open the <a href="RefactoringFault.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Port Types->PortType1->operation1->testFault</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find message usage in the Reply declaration</result>
            <result>IDE should find message usage in the faultHandler declaration</result>
            <result>IDE should find message usage in the Throw declaration</result>
            <result>IDE should find message usage in the operation1 in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        <usecase name="Rename fault usages from the WSDL document">
            <action>Open the <a href="RefactoringFault.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Port Types->PortType1->operation1->testFault</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename message usage in the Reply declaration</result>
            <result>IDE should rename message usage in the faultHandler declaration</result>
            <result>IDE should rename message usage in the Throw declaration</result>
            <result>IDE should rename message usage in the operation1 in wsdl file</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Find property usages from the WSDL document">
            <action>Open the <a href="RefactoringProperty.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the testProperty property</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find property usage in the Correlation set declaration</result>
            <result>IDE should find property usage in the WSDL document (it's declaration)</result>
            <result>IDE should find property alias usage in the WSDL document </result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        <usecase name="Rename property usages from the WSDL document">
            <action>Open the <a href="RefactoringProperty.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the testProperty property</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename property usage in the Correlation set declaration</result>
            <result>IDE should rename property usage in the WSDL document (it's declaration)</result>
            <result>IDE should rename property alias usage in the WSDL document </result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Find portType usages from WSDL">
            <action>Open the <a href="RefactoringPortType.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the portType1 node</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find portType usage in the onEvent EventHandler declaration</result>
            <result>IDE should find portType usage in the Receive declaration</result>
            <result>IDE should find portType usage in the Reply declaration</result>
            <result>IDE should find portType usage in the Invoke declaration</result>
            <result>IDE should find portType usage in the MessageHandler declaration</result>
            <result>IDE should find portType usage in the WSDL document partner link role (it's declaration)</result>
            <result>IDE should find portType usage in the binding1 in the WSDL document</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        <usecase name="Rename portType usages from WSDL">
            <action>Open the <a href="RefactoringPortType.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the portType1 node</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename portType usage in the onEvent EventHandler declaration</result>
            <result>IDE should rename portType usage in the Receive declaration</result>
            <result>IDE should rename portType usage in the Reply declaration</result>
            <result>IDE should rename portType usage in the Invoke declaration</result>
            <result>IDE should rename portType usage in the MessageHandler declaration</result>
            <result>IDE should rename portType usage in the WSDL document partner link role (it's declaration)</result>
            <result>IDE should rename portType usage in the binding1 in the WSDL document</result>
            <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Find operation usages from WSDL">
            <action>Open the <a href="RefactoringOperation.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Port Types->portType1->operation1 node</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find operation usage in the onEvent EventHandler declaration</result>
            <result>IDE should find operation usage in the Receive declaration</result>
            <result>IDE should find operation usage in the Reply declaration</result>
            <result>IDE should find operation usage in the Invoke declaration</result>
            <result>IDE should find operation usage in the MessageHandler declaration</result>
            <result>IDE should find operation usage in the binding1 in the WSDL document</result>
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
         <usecase name="Rename operation usages from WSDL">
            <action>Open the <a href="RefactoringOperation.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the Port Types->portType1->operation1 node</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename operation usage in the onEvent EventHandler declaration</result>
            <result>IDE should rename operation usage in the Receive declaration</result>
            <result>IDE should rename operation usage in the Reply declaration</result>
            <result>IDE should rename operation usage in the Invoke declaration</result>
            <result>IDE should rename operation usage in the MessageHandler declaration</result>
            <result>IDE should rename operation usage in the binding1 in the WSDL document</result>
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
         <usecase name="Find partnerLinkType usages from WSDL">
            <action>Open the <a href="RefactoringPartnerLinkType.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the BPEL Extensibility Elements->partnerlinktype node</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find type usage in the first partnerLink declaration</result>
            <result>IDE should find type usage in the second partnerLink declaration</result>
            <result>IDE should find type usage in the WSDL file</result>            
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
         <usecase name="Rename partnerLinkType usages from WSDL">
            <action>Open the <a href="RefactoringPartnerLinkType.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the BPEL Extensibility Elements->partnerlinktype node</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename type usage in the first partnerLink declaration</result>
            <result>IDE should rename type usage in the second partnerLink declaration</result>
            <result>IDE should rename type usage in the WSDL file</result>            
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
         <usecase name="Find partnerLinkType Role usages from WSDL">
            <action>Open the <a href="RefactoringRole.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the BPEL Extensibility Elements->partnerlinktype->partnerlinktyperole1 node</action>
            <action>Click Find Usages in the context menu</action>
            <result>IDE should find role usage in the  partnerLink declaration</result>
           <result>IDE should find role usage in the WSDL file</result>            
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
         <usecase name="Rename partnerLinkType Role usages from WSDL">
            <action>Open the <a href="RefactoringRole.zip">test project</a></action>
            <action>Open process wsdl file in wsdl designer</action>
            <action>Find and select the BPEL Extensibility Elements->partnerlinktype->partnerlinktyperole1 node</action>
            <action>Click Refactor->Rename in the context menu</action>
            <result>IDE should rename role usage in the  partnerLink declaration</result>
           <result>IDE should rename role usage in the WSDL file</result>            
           <result>There should be no more usages in the BPEL-specific artifacts</result>
        </usecase>
        
        
    </caseblock>
    
    
    <caseblock name="Implicit refactoring in the BPEL designer">
        <purpose>Test that renaming artifacts in BPEL designer renames all the usages of the artifact</purpose>
        <setup>Start the IDE. Open the <a href="BPELSample.zip">sample</a> project</setup>
        
        <usecase name="Rename a variable">
            <action>Open the <a href="RefactoringVariable.zip">test project</a></action>
            <action>Open BPEL process in designer</action>
            <action>Rename inputVar variable to inputVar1</action>
            <action>Rename outputVar variable to outputVar1</action>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the variables should be renamed</result>
            <result>Variables should be renamed in Navigator</result>
        </usecase>  
        
        <usecase name="Rename a variable used in XPath expressions">
            <action>Open the <a href="RefactoringXPathVariable.zip">test project</a></action>
            <action>Open BPEL process in designer</action>
            <action>Rename inputVar variable to inputVar1</action>
            <action>Rename outputVar variable to outputVar1</action>
            <result>There should not be any changes in the diagram</result>
            <result>All usages of the variables should be renamed. String literals equal to variable names should not be renamed</result>
            <result>Variables should be renamed in Navigator</result>
        </usecase> 
        
        <usecase name="Rename a correlation set">
            <action>Open the <a href="RefactoringCorrelationSet.zip">test project</a></action>
            <action>Open BPEL process in designer</action>
            <action>Find myCorrealtionSet correlation set in Navigator, choose Edit in context menu</action>
            <action>Rename myCorrelationSet to myCorrelationSet1</action>
            <result>There should not be any changes in the diagram</result>
            <result>All correlation set usages should be renamed in Navigator</result>
            <result>All correlation set usages should be renamed in sources</result>           
        </usecase>
        
        <usecase name="Rename a partner link">
            <action>Open the <a href="RefactoringPartnerLink.zip">test project</a></action>
            <action>Open BPEL process in designer</action>
            <action>Open partnerLinkA editor by double clicking on the activity</action>
            <action>Rename partner link partnerLinkA to partnerLinkA1</action>
            <action>Open partnerLinkB editor by double clicking on the activity</action>
            <action>Rename partner link partnerLinkB to partnerLinkB1</action>
            <result>There should not be any changes in the diagram except the changed activities names</result>
            <result>In source all usages of partnerLinkA should be renamed to partnerLinkA1</result>
            <result>In source all usages of partnerLinkB should be renamed to partnerLinkB1</result>
        </usecase>       
        
    </caseblock>
    
    
</spec>
