Cleaning Objects

In order to clean the provtest environment, you may use the "clean" action, which expects a "domain" attribute allowing to clean the flow, objects, checkpoints or all of them.

Cleaning the Current Flow

You will use the domain "flow".

<test name="action_clean_flow">
		<flow>flow1</flow>
		<description>
		Test action clean on domain "flow" and action loadFlow.
		The clean action on domain "flow" only deletes modules defined in the flow.
		</description>
		<action>
			<checkObject object="getSo"/>
		</action>
		<action>
			<clean domain="flow"/>
		</action>
		<action>
			<checkCardinality type="provtest::MessageValidator" cardinality="0"/>
		</action>
	</test>

Cleaning Test Objects

You will use the domain "test". Test objects are objects created within a unit test.

<test name="action_clean_test">
		<flow>flow1</flow>
		<description>This should delete any object referenced by the user in the tests but not 
the modules defined in the flows.</description>
		<action>
			<createSo orderId="1">
				<sod/>
			</createSo>
			</action>
			<action>
				<clean domain="test"/>
				<checkCardinality type="sodata::ServiceOrderData" cardinality="0"/>
				<checkObject object="getSo"/>
		</action>
	</test>

Cleaning Checkpoints

You will use the domain "checkpoints". Notice that only file checkpoints are removed here.

<test name="action_clean_checkpoints">
		<flow>flow1</flow>
		<description>This should delete any checkpoint file in the checkpoint directory hold by 
the checkpoint::CheckpointManager.</description>
		<action>
			<system command="touch checkpoints/action_clean_checkpoints_0.chk"/>
		</action>
		<action>
			<clean domain="checkpoints"/>
		</action>
		<action expr="KO">
			<system command="cat checkpoints/action_clean_checkpoints_0.chk"/>
		</action>
	</test>

Cleaning Users Objects

Use the domain "user".

<test name="action_clean_user">
		<flow>flow1</flow>
		<description>This should delete everything in domains "test", "flow" and "checkpoints". 
			The test ends with no flow, next test should reload a flow in the natural way.
		</description>
		<action>
			<createSo orderId="1">
			<sod/>
			</createSo>
		</action>
		<action>
			<clean domain="user"/>
			<checkCardinality type="sodata::ServiceOrderData" cardinality="0"/>
			<checkCardinality type="provtest::MessageValidator" cardinality="0"/>
		</action>
	</test>