Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.presumo.jms.selector
Class SelectorTests  view SelectorTests download SelectorTests.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.presumo.jms.selector.SelectorTests
All Implemented Interfaces:
junit.framework.Test

public class SelectorTests
extends junit.framework.TestCase

Unit test used to exercise the sql-jms filter; This class was generated during initial development. It should be maintained along with the rest of the code in this package. The class is meant to test package protected functionality and thus should remain in this package.


Field Summary
private  java.lang.Object[][] filterTests
           
private static int INVALID_MESSAGE
           
private  javax.jms.Message message1
           
private static javax.jms.Message message2
           
private  java.lang.String[] negativeParseTests
           
private static int VALID_MESSAGE
           
private static boolean VERBOSE
           
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
SelectorTests(java.lang.String name)
           
 
Method Summary
private  void checkDelete()
          Convience method to check to see if all filters have been succssefully deleted.
private  void evaluateFilter(java.lang.String filter, JmsOperand root, javax.jms.Message _message, boolean shouldPass)
           
private  JmsOperand generateRandomFilter()
           
static void main(java.lang.String[] args)
           
private  JmsOperand parseFilter(java.lang.String filter, boolean shouldParse)
           
private  void printTree(JmsOperand root)
           
static junit.framework.Test suite()
           
 void testBasicEvaluations()
          Unit Test #2: Tests both valid parsing and evaluations.
 void testDelete()
          Unit Test #5: First test to see if basic delete function didn't throw any exceptions.
 void testForMemoryLeaks()
          Unit Test #6: Memory leak test.
 void testNegativeParseCases()
          Unit Test #1: Negative parse tests to make sure the parser detects invalid filters properly.
 void testOrTogether()
          Unit Test #4: Test to make sure that when multiple logically equivelant filters are or'd together the resulting filter is the same as the original filter.
 void testUnparse()
          Unit Test #3: Tests unparsing technology.
 void verbose(java.lang.Object output)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, 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

VERBOSE

private static final boolean VERBOSE
See Also:
Constant Field Values

VALID_MESSAGE

private static final int VALID_MESSAGE
See Also:
Constant Field Values

INVALID_MESSAGE

private static final int INVALID_MESSAGE
See Also:
Constant Field Values

message1

private javax.jms.Message message1

message2

private static javax.jms.Message message2

negativeParseTests

private java.lang.String[] negativeParseTests

filterTests

private java.lang.Object[][] filterTests
Constructor Detail

SelectorTests

public SelectorTests(java.lang.String name)
Method Detail

suite

public static junit.framework.Test suite()

testNegativeParseCases

public void testNegativeParseCases()
Unit Test #1: Negative parse tests to make sure the parser detects invalid filters properly. To add more tests modify the array negativeParseTest A runtime exception will be thrown if the test fails


testBasicEvaluations

public void testBasicEvaluations()
Unit Test #2: Tests both valid parsing and evaluations. Add filters to filterTests for additional test cases. A runtime exception will be thrown if the test fails


testUnparse

public void testUnparse()
Unit Test #3: Tests unparsing technology. Every filter in filterTests will be parsed, then unparsed. The unparsed string is then parsed and tested to see if it is the exact same as the original parsed filter. The test will throw a runtime exception if it fails.


testOrTogether

public void testOrTogether()
Unit Test #4: Test to make sure that when multiple logically equivelant filters are or'd together the resulting filter is the same as the original filter. Basically checking to see if duplicates are removed. The test will throw a runtime exception if it fails.


testDelete

public void testDelete()
Unit Test #5: First test to see if basic delete function didn't throw any exceptions.


testForMemoryLeaks

public void testForMemoryLeaks()
Unit Test #6: Memory leak test. Tries to expose any memory leaks by creating random filters and letting them go out of scope. This is a manual test in that you must run the test for an extended period of time and verify that memory usage does not increase.


generateRandomFilter

private JmsOperand generateRandomFilter()

parseFilter

private JmsOperand parseFilter(java.lang.String filter,
                               boolean shouldParse)

evaluateFilter

private void evaluateFilter(java.lang.String filter,
                            JmsOperand root,
                            javax.jms.Message _message,
                            boolean shouldPass)

checkDelete

private void checkDelete()
Convience method to check to see if all filters have been succssefully deleted.


printTree

private void printTree(JmsOperand root)

verbose

public void verbose(java.lang.Object output)

main

public static void main(java.lang.String[] args)