com.dtrules.testsupport
Class ChangeReport

java.lang.Object
  extended by com.dtrules.testsupport.ChangeReport

public class ChangeReport
extends Object

Compares the differences between two versions of a Rule Set. Generally we compare a Rule Set in development against the Rule set currently deployed.


Nested Class Summary
 class ChangeReport.RulesConfig
           
 
Constructor Summary
ChangeReport(String ruleSetName, String path1, String dtRulesConfig1, String description1, String path2, String dtRulesConfig2, String description2)
          Provides a change report between to Rules Engine Configurations.
 
Method Summary
 String compare()
           
 void compare(OutputStream reportStream)
           
 void compare(XMLPrinter report)
           
 String compareDecisionTables()
           
 void compareDecisionTables(OutputStream reportStream)
           
 void compareDecisionTables(XMLPrinter report)
           
 String compareEDD()
           
 void compareEDD(OutputStream reportStream)
           
 void compareEDD(XMLPrinter report)
           
 String compareMapping()
           
 void compareMapping(OutputStream reportStream)
           
 boolean compareMapping(XMLPrinter report)
           
static ArrayList<XMLTree.Node> findentities(XMLTree.Node root)
           
static ArrayList<XMLTree.Node> findMissingNodes(String[] attribs, ArrayList<XMLTree.Node> dts1, ArrayList<XMLTree.Node> dts2)
          It is interesting to find what nodes have been added, and which have been deleted.
static ArrayList<XMLTree.Node> findMissingNodes(String attrib, String tag, ArrayList<XMLTree.Node> dts1, ArrayList<XMLTree.Node> dts2)
          It is interesting to find what nodes have been added, and which have been deleted.
static ArrayList<XMLTree.Node> findnodes(String tag, XMLTree.Node node, ArrayList<XMLTree.Node> list)
          Find all the nodes in a tree with a particular tag
static ArrayList<XMLTree.Node> findtables(XMLTree.Node root)
           
 ChangeReport.RulesConfig getRules1()
           
 ChangeReport.RulesConfig getRules2()
           
 void reset()
          Resets file pointers to all the decision tables, edds, and mapping files.
static void sort(boolean ascending, Object[] array)
          Bubble sort with quick out and a fence ...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeReport

public ChangeReport(String ruleSetName,
                    String path1,
                    String dtRulesConfig1,
                    String description1,
                    String path2,
                    String dtRulesConfig2,
                    String description2)
Provides a change report between to Rules Engine Configurations. The first is the configuration that has presumably changed. The second is the reference configuration, in general.

Parameters:
path1 -
dtRulesConfig1 -
description1 -
path2 -
dtRulesConfig2 -
description2 -
Method Detail

getRules1

public ChangeReport.RulesConfig getRules1()

getRules2

public ChangeReport.RulesConfig getRules2()

reset

public void reset()
Resets file pointers to all the decision tables, edds, and mapping files. This way, users can use this object to do other, unanticipated checks of rule sets and between rulesets.


findtables

public static ArrayList<XMLTree.Node> findtables(XMLTree.Node root)

findnodes

public static ArrayList<XMLTree.Node> findnodes(String tag,
                                                XMLTree.Node node,
                                                ArrayList<XMLTree.Node> list)
Find all the nodes in a tree with a particular tag

Parameters:
tag - The tag to search for
node - The node in the tree to search
list - List of nodes with tag names that match. If null, the list is allocated for you.

findentities

public static ArrayList<XMLTree.Node> findentities(XMLTree.Node root)

findMissingNodes

public static ArrayList<XMLTree.Node> findMissingNodes(String[] attribs,
                                                       ArrayList<XMLTree.Node> dts1,
                                                       ArrayList<XMLTree.Node> dts2)
It is interesting to find what nodes have been added, and which have been deleted. This routine does that for us easily. We look for the nodes that have a matching set of attributes in both lists. If a node in the first list isn't in the second list (i.e. if we are matching on an attribute "name", and a node in list one has a name X, and no node in list2 has a name X, then we remove it from list one). We remove nodes that cannot be compared. It leaves us with only nodes in our lists common to both sources.

Parameters:
t1 -
t2 -
message -

findMissingNodes

public static ArrayList<XMLTree.Node> findMissingNodes(String attrib,
                                                       String tag,
                                                       ArrayList<XMLTree.Node> dts1,
                                                       ArrayList<XMLTree.Node> dts2)
It is interesting to find what nodes have been added, and which have been deleted. This routine does that for us easily. We look for the nodes that have a matching attribute in both lists. If a node in the first list isn't in the second list (i.e. if we are matching on an attribute "name", and a node in list one has a name X, and no node in list2 has a name X, then we remove it from list one). We remove nodes that cannot be compared. It leaves us with only nodes in our lists common to both sources.

Parameters:
t1 -
t2 -
message -

sort

public static void sort(boolean ascending,
                        Object[] array)
Bubble sort with quick out and a fence ... Very fast on previously sorted data and pretty fast on nearly sorted data.

Parameters:
array -

compare

public void compare(XMLPrinter report)
             throws Exception
Throws:
Exception

compare

public void compare(OutputStream reportStream)
             throws Exception
Throws:
Exception

compare

public String compare()
               throws Exception
Throws:
Exception

compareDecisionTables

public String compareDecisionTables()
                             throws Exception
Throws:
Exception

compareDecisionTables

public void compareDecisionTables(OutputStream reportStream)
                           throws Exception
Throws:
Exception

compareDecisionTables

public void compareDecisionTables(XMLPrinter report)
                           throws Exception
Throws:
Exception

compareEDD

public String compareEDD()
                  throws Exception
Throws:
Exception

compareEDD

public void compareEDD(OutputStream reportStream)
                throws Exception
Throws:
Exception

compareEDD

public void compareEDD(XMLPrinter report)
                throws Exception
Throws:
Exception

compareMapping

public String compareMapping()
                      throws Exception
Throws:
Exception

compareMapping

public void compareMapping(OutputStream reportStream)
                    throws Exception
Throws:
Exception

compareMapping

public boolean compareMapping(XMLPrinter report)
                       throws Exception
Throws:
Exception


Copyright © 2011 DTrules Inc. All Rights Reserved.