Packageorg.puremvc.as3.multicore.utilities.pipes.plumbing
Classpublic class FilterTest
InheritanceFilterTest Inheritance flexunit.framework.TestCase

Test the Filter class.



Public Methods
 MethodDefined by
  
FilterTest(methodName:String)
Constructor.
FilterTest
  
suite():TestSuite
[static] Create the TestSuite.
FilterTest
  
Test setting filter to bypass mode, writing, then setting back to filter mode and writing.
FilterTest
  
Test connecting input and output pipes to a filter as well as disconnecting the output.
FilterTest
  
Test applying filter to a normal message.
FilterTest
  
Test setting filter function by sending control message.
FilterTest
  
Test setting filter parameters by sending control message.
FilterTest
  
Test using a filter function to stop propagation of a message.
FilterTest
Constructor detail
FilterTest()constructor
public function FilterTest(methodName:String)

Constructor.

Parameters
methodName:String — the name of the test method an instance to run
Method detail
suite()method
public static function suite():TestSuite

Create the TestSuite.

Returns
TestSuite
testBypassAndFilterModeToggle()method 
public function testBypassAndFilterModeToggle():void

Test setting filter to bypass mode, writing, then setting back to filter mode and writing.

testConnectingAndDisconnectingIOPipes()method 
public function testConnectingAndDisconnectingIOPipes():void

Test connecting input and output pipes to a filter as well as disconnecting the output.

testFilteringNormalMessage()method 
public function testFilteringNormalMessage():void

Test applying filter to a normal message.

testSetFilterByControlMessage()method 
public function testSetFilterByControlMessage():void

Test setting filter function by sending control message.

testSetParamsByControlMessage()method 
public function testSetParamsByControlMessage():void

Test setting filter parameters by sending control message.

testUseFilterToStopAMessage()method 
public function testUseFilterToStopAMessage():void

Test using a filter function to stop propagation of a message.

The way to stop propagation of a message from within a filter is to throw an error from the filter function. This test creates two NORMAL messages, each with header objects that contain a bozoLevel property. One has this property set to 10, the other to 3.

Creates a Filter, named 'bozoFilter' with an anonymous pipe listener feeding the output back into this test. The filter funciton is an anonymous function that throws an error if the message's bozoLevel property is greater than the filter parameter bozoThreshold. the anonymous filter parameters object has a bozoThreshold value of 5.

The messages are written to the filter and it is shown that the message with the bozoLevel of 10 is not written, while the message with the bozoLevel of 3 is.