[jboss-svn-commits] JBL Code SVN: r8261 - in labs/jbossrules/trunk/drools-repository/src: main/java/org/drools/repository test/java/org/drools/repository

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 12 12:38:14 EST 2006


Author: michael.neale at jboss.com
Date: 2006-12-12 12:38:03 -0500 (Tue, 12 Dec 2006)
New Revision: 8261

Removed:
   labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/DslItem.java
   labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/FunctionItem.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/DslItemTestCase.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/FunctionItemTestCase.java
Modified:
   labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/PackageItem.java
   labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/AssetItemTestCase.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulePackageItemTestCase.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTestCase.java
   labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/ScalabilityTest.java
Log:
JBRULES-584 - major refactor and cleanup

Deleted: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/DslItem.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/DslItem.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/DslItem.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -1,183 +0,0 @@
-package org.drools.repository;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionIterator;
-
-import org.apache.log4j.Logger;
-
-/**
- * The DslItem is used to abstract away details of the JCR repository 
- * 
- * @author btruitt
- */
-public class DslItem extends VersionableItem {
-    private Logger log = Logger.getLogger(DslItem.class);
-    
-    /**
-     * The name of the DSL node type
-     */
-    public static final String DSL_NODE_TYPE_NAME = "drools:dslNodeType";
-
-    public static final String DSL_CONTENT = "drools:dslContent";
-    
-    /**
-     * Constructs a DslItem object with the specified node as its node attribute
-     * 
-     * @param rulesRepository the rulesRepository that instantiated this object
-     * @param node
-     * @throws RulesRepositoryException 
-     */
-    public DslItem(RulesRepository rulesRepository, Node node) throws RulesRepositoryException {
-        super(rulesRepository, node);
-        
-        try {
-            //make sure this node is a dsl node       
-            if(!(this.node.getPrimaryNodeType().getName().equals(DSL_NODE_TYPE_NAME) ||
-                 this.node.getPrimaryNodeType().getName().equals("nt:version"))) {
-                String message = this.node.getName() + " is not a node of type " + DSL_NODE_TYPE_NAME + " nor nt:version. It is a node of type: " + this.node.getPrimaryNodeType().getName();
-                log.error(message);
-                throw new RulesRepositoryException(message);
-            }    
-        }
-        catch(Exception e) {
-            log.error("Caught exception: " + e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * returns the content of this object's dsl node
-     * 
-     * @return the content of this object's dsl node
-     * @throws RulesRepositoryException
-     */
-    public String getContent() throws RulesRepositoryException {
-        try {            
-            Node dslNode;
-            if(this.node.getPrimaryNodeType().getName().equals("nt:version")) {
-                dslNode = this.node.getNode("jcr:frozenNode");
-            }
-            else {
-                dslNode = this.node;
-            }
-            
-            Property data = dslNode.getProperty( DSL_CONTENT );
-            return data.getValue().getString();
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * Creates a new version of this object's dsl node, using the content and attributes of the
-     * specified file.
-     * 
-     * @param file the file from which to get the content and attributes for the new version of the
-     *             dsl node
-     * @throws RulesRepositoryException
-     */
-    public void updateContent(String content) throws RulesRepositoryException {
-        try {
-            this.node.checkout();
-        }
-        catch(UnsupportedRepositoryOperationException e) {
-            String message = "";
-            try {
-                message = "Error: Caught UnsupportedRepositoryOperationException when attempting to checkout node: " + this.node.getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error(message + e);
-            }
-            catch (RepositoryException e1) {
-                log.error("Caught Exception", e);
-                throw new RulesRepositoryException(e1);
-            }
-            throw new RulesRepositoryException(message, e);
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-        
-        try {
-            
-            Calendar lastModified = Calendar.getInstance();
-            this.node.setProperty(LAST_MODIFIED_PROPERTY_NAME, lastModified);
-            this.node.setProperty( DSL_CONTENT, content );
-            
-            this.node.getSession().save();                      
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-        finally {
-            try {
-                this.node.checkin();
-            }
-            catch(Exception e) {
-                log.error("Caught Exception: " + e);
-                throw new RulesRepositoryException(e);
-            }
-        }
-    }
-    
-    /**
-     * Nicely formats the information contained by the node that this object encapsulates
-     */
-    public String toString() {                
-        try {
-            StringBuffer returnString = new StringBuffer();
-            returnString.append("Content of DSL node named " + this.node.getName() + ":\n");
-            returnString.append(this.getContent() + "\n");
-            returnString.append("--------------\n");
-            return returnString.toString();
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            return null;
-        }
-    }
-    
-    public VersionableItem getPrecedingVersion() throws RulesRepositoryException {
-        try {
-            Node precedingVersionNode = this.getPrecedingVersionNode();
-            if(precedingVersionNode != null) {
-                return new DslItem(this.rulesRepository, precedingVersionNode);
-            }
-            else {
-                return null;
-            }
-        }        
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }               
-    }
-
-    public VersionableItem getSucceedingVersion() throws RulesRepositoryException {
-        try {
-            Node succeedingVersionNode = this.getSucceedingVersionNode();
-            if(succeedingVersionNode != null) {
-                return new DslItem(this.rulesRepository, succeedingVersionNode);
-            }
-            else {
-                return null;
-            }
-        }        
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }          
-}

Deleted: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/FunctionItem.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/FunctionItem.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/FunctionItem.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -1,299 +0,0 @@
-package org.drools.repository;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.Value;
-
-import org.apache.log4j.Logger;
-
-/**
- * The FunctionItem class is used to abstract away the details of the underlying JCR repository.
- * It is used to pass information about functions stored in the repository.
- * 
- * @author btruitt
- */
-public class FunctionItem extends VersionableItem {
-    private Logger log = Logger.getLogger(FunctionItem.class);    
-    
-    /**
-     * The name of the tag property on the function node type
-     */
-    public static final String TAG_PROPERTY_NAME = "drools:categoryReference";
-    
-    /**
-     * The name of the function node type
-     */
-    public static final String FUNCTION_NODE_TYPE_NAME = "drools:functionNodeType";
-    
-    /**
-     * The name of the state property on the function node type
-     */
-    public static final String STATE_PROPERTY_NAME = "drools:stateReference";                 
-    
-    /**
-     * The name of the content property on the function node type
-     */
-    public static final String CONTENT_PROPERTY_NAME = "drools:content";            
-    
-    /**
-     * The name of the function language property on the function node type
-     */
-    public static final String FUNCTION_LANGUAGE_PROPERTY_NAME = "drools:functionLanguage";
-    
-    /**
-     * Constructs a FunctionItem object, setting its node attribute to the specified node.
-     * 
-     * @param rulesRepository the rulesRepository that instantiated this object
-     * @param node the node in the repository that this FunctionItem corresponds to
-     * @throws RulesRepositoryException 
-     */
-    public FunctionItem(RulesRepository rulesRepository, Node node) throws RulesRepositoryException {
-        super(rulesRepository, node);
-        
-        try {
-            //make sure this node is a function node       
-            if(!(this.node.getPrimaryNodeType().getName().equals(FUNCTION_NODE_TYPE_NAME) ||
-                 this.node.getPrimaryNodeType().getName().equals("nt:version"))) {
-                String message = this.node.getName() + " is not a node of type " + FUNCTION_NODE_TYPE_NAME + " nor nt:version. It is a node of type: " + this.node.getPrimaryNodeType().getName();
-                log.error(message);
-                throw new RulesRepositoryException(message);
-            }    
-        }
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * returns the content of this object's function node
-     * 
-     * @return the content of this object's function node
-     * @throws RulesRepositoryException
-     */
-    public String getContent() throws RulesRepositoryException {
-        try {                        
-            Node functionNode;
-            if(this.node.getPrimaryNodeType().getName().equals("nt:version")) {
-                functionNode = this.node.getNode("jcr:frozenNode");
-            }
-            else {
-                functionNode = this.node;
-            }
-                        
-            Property data = functionNode.getProperty(CONTENT_PROPERTY_NAME);
-            return data.getValue().getString();
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }                
-    
-    /**
-     * @return the function language of this object's function node
-     * @throws RulesRepositoryException
-     */
-    public String getFunctionLanguage() throws RulesRepositoryException {
-        try {                        
-            Node functionNode;
-            if(this.node.getPrimaryNodeType().getName().equals("nt:version")) {
-                functionNode = this.node.getNode("jcr:frozenNode");
-            }
-            else {
-                functionNode = this.node;
-            }
-                        
-            Property languageProperty = functionNode.getProperty(FUNCTION_LANGUAGE_PROPERTY_NAME);
-            return languageProperty.getValue().getString();
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * Creates a new version of this object's function node, updating th content for the
-     * function node. 
-     * 
-     * @param newContent the new content for the function
-     * @throws RulesRepositoryException
-     */
-    public void updateContent(String newContent) throws RulesRepositoryException {
-        try {
-            this.node.checkout();
-        }
-        catch(UnsupportedRepositoryOperationException e) {
-            String message = "";
-            try {
-                message = "Error: Caught UnsupportedRepositoryOperationException when attempting to checkout rule: " + this.node.getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error(message, e);
-            }
-            catch (RepositoryException e1) {
-                log.error("Caught Exception", e);
-                throw new RulesRepositoryException(e1);
-            }
-            throw new RulesRepositoryException(message, e);
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-        
-        try {                                    
-            this.node.setProperty(CONTENT_PROPERTY_NAME, newContent);
-            
-            Calendar lastModified = Calendar.getInstance();
-            this.node.setProperty(LAST_MODIFIED_PROPERTY_NAME, lastModified);
-            
-            this.node.getSession().save();
-            
-            this.node.checkin();
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }            
-    
-    
-    /**
-     * Sets this object's function node's state property to refer to the specified state node
-     * 
-     * @param stateName the name of the state to set the function node to
-     * @throws RulesRepositoryException 
-     */
-    public void setState(String stateName) throws RulesRepositoryException {
-        try {
-            StateItem stateItem = this.rulesRepository.getState(stateName);
-            this.setState(stateItem);
-        }
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * Sets this object's function node's state property to refer to the specified StateItem's node
-     * 
-     * @param stateItem the StateItem encapsulating the node to refer to from this object's node's state 
-     *                  property
-     * @throws RulesRepositoryException 
-     */
-    public void setState(StateItem stateItem) throws RulesRepositoryException {
-        try {
-            //make sure this node is a function node
-            if(this.node.getPrimaryNodeType().getName().equals("nt:version")) {
-                String message = "Error. States can only be set for the head version of a function node";
-                log.error(message);
-                throw new RulesRepositoryException(message);
-            } 
-            
-            //now set the state property of the rule                              
-            this.node.checkout();
-            this.node.setProperty(STATE_PROPERTY_NAME, stateItem.getNode());
-            this.node.getSession().save();
-            this.node.checkin();        
-        }
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-    
-    /**
-     * Gets StateItem object corresponding to the state property of this object's node
-     * 
-     * @return a StateItem object corresponding to the state property of this object's node, or null
-     *         if the state property is not set
-     * @throws RulesRepositoryException
-     */
-    public StateItem getState() throws RulesRepositoryException {
-        try {
-            Property stateProperty = this.node.getProperty(STATE_PROPERTY_NAME);
-            Node stateNode = this.node.getSession().getNodeByUUID(stateProperty.getString());
-            return new StateItem(this.rulesRepository, stateNode);
-        }
-        catch(PathNotFoundException e) {
-            //not set
-            return null;
-        }
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
-
-    /**
-     * Nicely formats the information contained by the node that this object encapsulates
-     */
-    public String toString() {                
-        try {
-            StringBuffer returnString = new StringBuffer();
-            returnString.append("Content of function item named '" + this.getName() + "':\n");
-            returnString.append(this.getContent() + "\n");
-            returnString.append("------\n");
-                        
-            returnString.append("Function Language: " + this.getFunctionLanguage() + "\n");
-            returnString.append("------\n");
-            
-            returnString.append("Function state: ");
-            StateItem stateItem = this.getState();
-            if(stateItem != null) {
-                returnString.append(this.getState().getName() + "\n");
-            }
-            else {
-                returnString.append("NO STATE SET FOR THIS NODE\n");
-            }            
-            returnString.append("------\n");
-            
-            return returnString.toString();
-        }
-        catch(Exception e) {         
-            log.error("Caught Exception", e);
-            return null;
-        }
-    }
-        
-    public VersionableItem getPrecedingVersion() throws RulesRepositoryException {
-        try {
-            Node precedingVersionNode = this.getPrecedingVersionNode();
-            if(precedingVersionNode != null) {
-                return new FunctionItem(this.rulesRepository, precedingVersionNode);
-            }
-            else {
-                return null;
-            }
-        }        
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }               
-    }
-
-    public VersionableItem getSucceedingVersion() throws RulesRepositoryException {
-        try {
-            Node succeedingVersionNode = this.getSucceedingVersionNode();
-            if(succeedingVersionNode != null) {
-                return new FunctionItem(this.rulesRepository, succeedingVersionNode);
-            }
-            else {
-                return null;
-            }
-        }        
-        catch(Exception e) {
-            log.error("Caught exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }           
-}
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/PackageItem.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/PackageItem.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/PackageItem.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -157,7 +157,7 @@
     
     
     // The following should be kept for reference on how to add a reference that 
-    //is either locked to a version or follows head - FOR SHARING RULES
+    //is either locked to a version or follows head - FOR SHARING ASSETS
     //    /**
     //     * Adds a rule to the rule package node this object represents.  The reference to the rule
     //     * will optionally follow the head version of the specified rule's node or the specific 
@@ -226,199 +226,57 @@
     //        }
     //    }
 
-    /**
-     * Adds a function to the rule package node this object represents.  The reference to the 
-     * function node will follow the head version of the specified node.
-     * 
-     * @param functionItem the functionItem corresponding to the node to add to the rule package this
-     *                 object represents
-     * @throws RulesRepositoryException
-     */
-    public void addFunction(FunctionItem functionItem) throws RulesRepositoryException {
-        this.addFunction( functionItem,
-                          true );
-    }
 
-    /**
-     * Adds a function to the rule package node this object represents.  The reference to the function
-     * will optionally follow the head version of the specified node or the specific current version.
-     * 
-     * @param functionItem the functionItem corresponding to the node to add to the rule package this 
-     *                 object represents
-     * @param followRuleHead if true, the reference to the function node will follow the head version 
-     *                       of the node, even if new versions are added. If false, will refer 
-     *                       specifically to the current version.
-     * @throws RulesRepositoryException
-     */
-    public void addFunction(FunctionItem functionItem,
-                            boolean followFunctionHead) throws RulesRepositoryException {
-        try {
-            ValueFactory factory = this.node.getSession().getValueFactory();
-            int i = 0;
-            Value[] newValueArray = null;
+//MN: The following should be kept as a reference on how to remove a version tracking reference
+//as a compliment to the above method (which is also commented out !).     
+//    /**
+//     * Removes the specified rule from the rule package node this object represents.  
+//     * 
+//     * @param ruleItem the ruleItem corresponding to the node to remove from the rule package 
+//     *                 this object represents
+//     * @throws RulesRepositoryException
+//     */
+//    public void removeRuleReference(AssetItem ruleItem) throws RulesRepositoryException {
+//        try {
+//            Value[] oldValueArray = this.node.getProperty( RULE_REFERENCE_PROPERTY_NAME ).getValues();
+//            Value[] newValueArray = new Value[oldValueArray.length - 1];
+//
+//            boolean wasThere = false;
+//
+//            int j = 0;
+//            for ( int i = 0; i < oldValueArray.length; i++ ) {
+//                Node ruleNode = this.node.getSession().getNodeByUUID( oldValueArray[i].getString() );
+//                AssetItem currentRuleItem = new AssetItem( this.rulesRepository,
+//                                                         ruleNode );
+//                if ( currentRuleItem.equals( ruleItem ) ) {
+//                    wasThere = true;
+//                } else {
+//                    newValueArray[j] = oldValueArray[i];
+//                    j++;
+//                }
+//            }
+//
+//            if ( !wasThere ) {
+//                return;
+//            } else {
+//                this.node.checkout();
+//                this.node.setProperty( RULE_REFERENCE_PROPERTY_NAME,
+//                                       newValueArray );
+//                this.node.getSession().save();
+//                this.node.checkin();
+//            }
+//        } catch ( PathNotFoundException e ) {
+//            //the property has not been created yet. 
+//            return;
+//        } catch ( Exception e ) {
+//            log.error( "Caught exception",
+//                       e );
+//            throw new RulesRepositoryException( e );
+//        }
+//    }
 
-            try {
-                Value[] oldValueArray = this.node.getProperty( FUNCTION_REFERENCE_PROPERTY_NAME ).getValues();
-                newValueArray = new Value[oldValueArray.length + 1];
 
-                for ( i = 0; i < oldValueArray.length; i++ ) {
-                    newValueArray[i] = oldValueArray[i];
-                }
-            } catch ( PathNotFoundException e ) {
-                //the property has not been created yet. do so now
-                newValueArray = new Value[1];
-            } finally {
-                if ( newValueArray != null ) { //just here to make the compiler happy
-                    if ( followFunctionHead ) {
-                        newValueArray[i] = factory.createValue( functionItem.getNode() );
-                    } else {
-                        newValueArray[i] = factory.createValue( functionItem.getNode().getBaseVersion() );
-                    }
-                    this.node.checkout();
-                    this.node.setProperty( FUNCTION_REFERENCE_PROPERTY_NAME,
-                                           newValueArray );
-                    this.node.getSession().save();
-                    this.node.checkin();
-                } else {
-                    throw new RulesRepositoryException( "Unexpected null pointer for newValueArray" );
-                }
-            }
-        } catch ( UnsupportedRepositoryOperationException e ) {
-            String message = "";
-            try {
-                message = "Error: Caught UnsupportedRepositoryOperationException when attempting to get base version for function: " + functionItem.getNode().getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error( message + e );
-            } catch ( RepositoryException e1 ) {
-                log.error( "Caught exception: " + e1 );
-                throw new RulesRepositoryException( message,
-                                                    e1 );
-            }
-            log.error( "Caught exception: " + e );
-            throw new RulesRepositoryException( e );
-        } catch ( Exception e ) {
-            log.error( "Caught exception: " + e );
-            throw new RulesRepositoryException( e );
-        }
-    }
-
-    /**
-     * Removes the specified rule from the rule package node this object represents.  
-     * 
-     * @param ruleItem the ruleItem corresponding to the node to remove from the rule package 
-     *                 this object represents
-     * @throws RulesRepositoryException
-     */
-    public void removeRuleReference(AssetItem ruleItem) throws RulesRepositoryException {
-        try {
-            Value[] oldValueArray = this.node.getProperty( RULE_REFERENCE_PROPERTY_NAME ).getValues();
-            Value[] newValueArray = new Value[oldValueArray.length - 1];
-
-            boolean wasThere = false;
-
-            int j = 0;
-            for ( int i = 0; i < oldValueArray.length; i++ ) {
-                Node ruleNode = this.node.getSession().getNodeByUUID( oldValueArray[i].getString() );
-                AssetItem currentRuleItem = new AssetItem( this.rulesRepository,
-                                                         ruleNode );
-                if ( currentRuleItem.equals( ruleItem ) ) {
-                    wasThere = true;
-                } else {
-                    newValueArray[j] = oldValueArray[i];
-                    j++;
-                }
-            }
-
-            if ( !wasThere ) {
-                return;
-            } else {
-                this.node.checkout();
-                this.node.setProperty( RULE_REFERENCE_PROPERTY_NAME,
-                                       newValueArray );
-                this.node.getSession().save();
-                this.node.checkin();
-            }
-        } catch ( PathNotFoundException e ) {
-            //the property has not been created yet. 
-            return;
-        } catch ( Exception e ) {
-            log.error( "Caught exception",
-                       e );
-            throw new RulesRepositoryException( e );
-        }
-    }
-
-    /**
-     * Removes the specified function from the rule package node this object represents.  
-     * 
-     * @param functionItem the functionItem corresponding to the node to remove from the rule package 
-     *                 this object represents
-     * @throws RulesRepositoryException
-     */
-    public void removeFunction(FunctionItem functionItem) throws RulesRepositoryException {
-        try {
-            Value[] oldValueArray = this.node.getProperty( FUNCTION_REFERENCE_PROPERTY_NAME ).getValues();
-            Value[] newValueArray = new Value[oldValueArray.length - 1];
-
-            boolean wasThere = false;
-
-            int j = 0;
-            for ( int i = 0; i < oldValueArray.length; i++ ) {
-                Node functionNode = this.node.getSession().getNodeByUUID( oldValueArray[i].getString() );
-                FunctionItem currentFunctionItem = new FunctionItem( this.rulesRepository,
-                                                                     functionNode );
-                if ( currentFunctionItem.equals( functionItem ) ) {
-                    wasThere = true;
-                } else {
-                    newValueArray[j] = oldValueArray[i];
-                    j++;
-                }
-            }
-
-            if ( !wasThere ) {
-                return;
-            } else {
-                this.node.checkout();
-                this.node.setProperty( FUNCTION_REFERENCE_PROPERTY_NAME,
-                                       newValueArray );
-                this.node.getSession().save();
-                this.node.checkin();
-            }
-        } catch ( PathNotFoundException e ) {
-            //the property has not been created yet. 
-            return;
-        } catch ( Exception e ) {
-            log.error( "Caught exception",
-                       e );
-            throw new RulesRepositoryException( e );
-        }
-    }
-
-    /**
-     * Gets a list of FunctionItem objects for each function node in this rule package
-     * 
-     * @return the List object holding the FunctionItem objects in this rule package
-     * @throws RulesRepositoryException 
-     */
-    public List getFunctions() throws RulesRepositoryException {
-        try {
-            Value[] valueArray = this.node.getProperty( FUNCTION_REFERENCE_PROPERTY_NAME ).getValues();
-            List returnList = new ArrayList();
-
-            for ( int i = 0; i < valueArray.length; i++ ) {
-                Node functionNode = this.node.getSession().getNodeByUUID( valueArray[i].getString() );
-                returnList.add( new FunctionItem( this.rulesRepository,
-                                                  functionNode ) );
-            }
-            return returnList;
-        } catch ( PathNotFoundException e ) {
-            //the property has not been created yet. 
-            return new ArrayList();
-        } catch ( Exception e ) {
-            log.error( "Caught exception: " + e );
-            throw new RulesRepositoryException( e );
-        }
-    }
-
+    //MN: This should be kept as a reference for 
     //    /**
     //     * Gets a list of RuleItem objects for each rule node in this rule package
     //     * 

Modified: labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/main/java/org/drools/repository/RulesRepository.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -260,91 +260,8 @@
         }
     }
     
-    /**
-     * Adds a DSL node in the repository using the content and attributes of the specified file
-     * 
-     * @param file the file to use to import the DSL content and attributes
-     * @return a DslItem object encapsulating the node that gets added
-     * @throws RulesRepositoryException 
-     */
-    public DslItem addDsl(String name, String content) throws RulesRepositoryException { 
-        Node folderNode = this.getAreaNode(DSL_AREA);            
-        
-        try {
-            //create the node - see section 6.7.22.6 of the spec
-            Node dslNode = folderNode.addNode(name, DslItem.DSL_NODE_TYPE_NAME);
-            
-            dslNode.setProperty(DslItem.TITLE_PROPERTY_NAME, name);
-            
-                        
-            dslNode.setProperty(DslItem.DESCRIPTION_PROPERTY_NAME, "");
-            dslNode.setProperty(DslItem.FORMAT_PROPERTY_NAME, DslItem.DSL_FORMAT);
-            
-            dslNode.setProperty( DslItem.DSL_CONTENT, content );
-            dslNode.setProperty(DslItem.LAST_MODIFIED_PROPERTY_NAME, Calendar.getInstance());
-            
-            this.session.save();
-            
-            try {
-                dslNode.checkin();
-            }
-            catch(UnsupportedRepositoryOperationException e) {
-                String message = "Error: Caught UnsupportedRepositoryOperationException when attempting to checkin dsl: " + dslNode.getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error(message + e);
-                throw new RulesRepositoryException(message, e);
-            }
-            
-            return new DslItem(this, dslNode);
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }                
-    }    
+  
     
-    /**
-     * Adds a Function node in the repository using the content specified.
-     * 
-     * @param functionName the name of the function
-     * @param content the content of the function
-     * @return a FunctionItem object encapsulating the node that gets added
-     * @throws RulesRepositoryException
-     */
-    public FunctionItem addFunction(String functionName, String content) throws RulesRepositoryException {
-        Node folderNode = this.getAreaNode(FUNCTION_AREA);        
-        
-        try {        
-            //create the node - see section 6.7.22.6 of the spec
-            Node functionNode = folderNode.addNode(functionName, FunctionItem.FUNCTION_NODE_TYPE_NAME);
-                        
-            functionNode.setProperty(FunctionItem.TITLE_PROPERTY_NAME, functionName);
-            functionNode.setProperty(FunctionItem.CONTENT_PROPERTY_NAME, content);
-            functionNode.setProperty(FunctionItem.DESCRIPTION_PROPERTY_NAME, "");
-            
-            
-            functionNode.setProperty(FunctionItem.FORMAT_PROPERTY_NAME, FunctionItem.FUNCTION_FORMAT);
-            
-            Calendar lastModified = Calendar.getInstance();
-            functionNode.setProperty(FunctionItem.LAST_MODIFIED_PROPERTY_NAME, lastModified);
-            
-            session.save();
-            
-            try {
-                functionNode.checkin();
-            }
-            catch(UnsupportedRepositoryOperationException e) {
-                String message = "Error: Caught UnsupportedRepositoryOperationException when attempting to checkin node: " + functionNode.getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error(message + e);
-                throw new RulesRepositoryException(message, e);
-            }
-            
-            return new FunctionItem(this, functionNode);
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
     
     /**
      * Optionally override the default version number generator with a custom
@@ -355,49 +272,11 @@
         this.versionNumberGenerator = gen;
     }
     
-    /**
-     * Adds a Function node in the repository using the content specified.
-     * 
-     * @param functionName the name of the function
-     * @param content the content of the function
-     * @param description the description of the function
-     * @return a FunctionItem object encapsulating the node that gets added
-     * @throws RulesRepositoryException
-     */
-    public FunctionItem addFunction(String functionName, String content, String description) throws RulesRepositoryException {
-        Node folderNode = this.getAreaNode(FUNCTION_AREA);        
-        
-        try {        
-            //create the node - see section 6.7.22.6 of the spec
-            Node functionNode = folderNode.addNode(functionName, FunctionItem.FUNCTION_NODE_TYPE_NAME);
-                        
-            functionNode.setProperty(FunctionItem.TITLE_PROPERTY_NAME, functionName);
-            functionNode.setProperty(FunctionItem.CONTENT_PROPERTY_NAME, content);
-            functionNode.setProperty(FunctionItem.DESCRIPTION_PROPERTY_NAME, description);
-            functionNode.setProperty(FunctionItem.FORMAT_PROPERTY_NAME, FunctionItem.FUNCTION_FORMAT);
-            
-            Calendar lastModified = Calendar.getInstance();
-            functionNode.setProperty(FunctionItem.LAST_MODIFIED_PROPERTY_NAME, lastModified);
-            
-            session.save();
-            
-            try {
-                functionNode.checkin();
-            }
-            catch(UnsupportedRepositoryOperationException e) {
-                String message = "Error: Caught UnsupportedRepositoryOperationException when attempting to checkin node: " + functionNode.getName() + ". Are you sure your JCR repository supports versioning? ";
-                log.error(message + e);
-                throw new RulesRepositoryException(message, e);
-            }
-            
-            return new FunctionItem(this, functionNode);
-        }
-        catch(Exception e) {
-            log.error("Caught Exception", e);
-            throw new RulesRepositoryException(e);
-        }
-    }
+
     
+//  MN: This is kept for future reference showing how to tie references to a specific version when 
+//      sharing assets.
+//    
 //    /**
 //     * Adds a Rule node in the repository using the content specified, associating it with
 //     * the specified DSL node
@@ -509,7 +388,7 @@
      * @param name the name of the package to load 
      * @return a RulePackageItem object
      */
-    public PackageItem loadRulePackage(String name) throws RulesRepositoryException {
+    public PackageItem loadPackage(String name) throws RulesRepositoryException {
         try {
             Node folderNode = this.getAreaNode(RULE_PACKAGE_AREA);
             Node rulePackageNode = folderNode.getNode(name);
@@ -529,13 +408,13 @@
     /**
      * This will return or create the default package for rules that have no home yet.
      */
-    public PackageItem loadDefaultRulePackage() throws RulesRepositoryException {
+    public PackageItem loadDefaultPackage() throws RulesRepositoryException {
         Node folderNode = this.getAreaNode( RULE_PACKAGE_AREA );
         try {
             if (folderNode.hasNode( DEFAULT_PACKAGE )) {
-                return loadRulePackage( DEFAULT_PACKAGE );
+                return loadPackage( DEFAULT_PACKAGE );
             } else {
-                return createRulePackage( DEFAULT_PACKAGE, "" );
+                return createPackage( DEFAULT_PACKAGE, "" );
             }
         } catch ( RepositoryException e ) {
             throw new RulesRepositoryException(e);
@@ -550,7 +429,7 @@
      * @return a RulePackageItem object
      * @throws RulesRepositoryException
      */
-    public PackageItem loadRulePackageByUUID(String uuid) throws RulesRepositoryException {
+    public PackageItem loadPackageByUUID(String uuid) throws RulesRepositoryException {
         try {
             Node rulePackageNode = this.session.getNodeByUUID(uuid);
             return new PackageItem(this, rulePackageNode);
@@ -569,7 +448,7 @@
     /**
      * Loads a rule by its UUID (generally the fastest way to load something).
      */
-    public AssetItem loadRuleByUUID(String uuid) {
+    public AssetItem loadAssetByUUID(String uuid) {
         try {
             Node rulePackageNode = this.session.getNodeByUUID(uuid);
             return new AssetItem(this, rulePackageNode);
@@ -593,7 +472,7 @@
      * @return a RulePackageItem, encapsulating the created node
      * @throws RulesRepositoryException
      */
-    public PackageItem createRulePackage(String name, String description) throws RulesRepositoryException {
+    public PackageItem createPackage(String name, String description) throws RulesRepositoryException {
         Node folderNode = this.getAreaNode(RULE_PACKAGE_AREA);
                  
         try {
@@ -694,7 +573,7 @@
      * Only the latest versions of each RuleItem will be returned (you will have 
      * to delve into the rules deepest darkest history yourself... mahahahaha).
      */
-    public List findRulesByCategory(String categoryTag) throws RulesRepositoryException {
+    public List findAssetsByCategory(String categoryTag) throws RulesRepositoryException {
         
         CategoryItem item = this.loadCategory( categoryTag );
         List results = new ArrayList();
@@ -722,7 +601,7 @@
 
         try {
             if (!folderNode.hasNode(DEFAULT_PACKAGE)) {
-                createRulePackage( DEFAULT_PACKAGE, "" );
+                createPackage( DEFAULT_PACKAGE, "" );
                 folderNode = this.getAreaNode( RULE_PACKAGE_AREA );
             }            
             return new RulePackageIterator(this, folderNode.getNodes());
@@ -766,10 +645,10 @@
      */
     public void moveRuleItemPackage(String newPackage, String uuid, String explanation) {
         try {
-            AssetItem item = loadRuleByUUID( uuid );
+            AssetItem item = loadAssetByUUID( uuid );
             String oldPackage = item.getPackageName();
-            PackageItem sourcePkg = loadRulePackage( oldPackage );
-            PackageItem destPkg = loadRulePackage( newPackage );
+            PackageItem sourcePkg = loadPackage( oldPackage );
+            PackageItem destPkg = loadPackage( newPackage );
             
             String sourcePath = item.node.getPath();
             String destPath = destPkg.node.getPath() + "/" + PackageItem.RULES_FOLDER_NAME + "/" + item.getName(); 

Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/AssetItemTestCase.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/AssetItemTestCase.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/AssetItemTestCase.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -14,7 +14,7 @@
     }
     
     private PackageItem getDefaultPackage() {
-        return getRepo().loadDefaultRulePackage();
+        return getRepo().loadDefaultPackage();
     }
     
     public void testRuleItemCreation() throws Exception {
@@ -41,12 +41,12 @@
         //try constructing with node of wrong type
         try {
             
-            DslItem dslItem = getRepo().addDsl("testRuleItem", "content here");
-            new AssetItem(getRepo(), dslItem.getNode());
-            fail("Exception not thrown for node of type: " + dslItem.getNode().getPrimaryNodeType().getName());
+            PackageItem pitem = getRepo().loadDefaultPackage();
+            new AssetItem(getRepo(), pitem.getNode());
+            fail("Exception not thrown for node of wrong type");
         }
         catch(RulesRepositoryException e) {
-            //this is good
+            assertNotNull(e.getMessage());
         }
         catch(Exception e) {
             fail("Caught unexpected exception: " + e);
@@ -55,7 +55,7 @@
 
     public void testGetContent() {
             
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetContent", "test content");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetContent", "test content");
             ruleItem1.updateContent( "test content" );
             
             assertNotNull(ruleItem1);
@@ -114,7 +114,7 @@
             ruleItem1.checkin( "woot" );
             
             //now test retrieve by tags
-            List result = getRepo().findRulesByCategory("testAddTagTestTag");            
+            List result = getRepo().findAssetsByCategory("testAddTagTestTag");            
             assertEquals(1, result.size());            
             AssetItem retItem = (AssetItem) result.get( 0 );
             assertEquals("testAddTag", retItem.getName());
@@ -122,7 +122,7 @@
             ruleItem1.updateContent( "foo" );
             ruleItem1.checkin( "latest" );
             
-            result = getRepo().findRulesByCategory( "testAddTagTestTag" );
+            result = getRepo().findAssetsByCategory( "testAddTagTestTag" );
             
             assertEquals(1, result.size());
 
@@ -142,7 +142,7 @@
         getDefaultPackage().addAsset( "testFindRulesByCategory2", "ya", "testFindRulesByCat" ).checkin( "version0" );
   
         
-        List rules = getRepo().findRulesByCategory( "testFindRulesByCat" );
+        List rules = getRepo().findAssetsByCategory( "testFindRulesByCat" );
         assertEquals(2, rules.size());
         
         for ( Iterator iter = rules.iterator(); iter.hasNext(); ) {
@@ -282,7 +282,7 @@
     
     public void testGetDateExpired() {
         try {
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetDateExpired", "test content");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetDateExpired", "test content");
            
             //it should be initialized to null
             assertTrue(ruleItem1.getDateExpired() == null);
@@ -301,7 +301,7 @@
     
     
     public void testSaveAndCheckinDescriptionAndTitle() throws Exception {
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetDescription", "");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetDescription", "");
             ruleItem1.checkin( "version0" );
             
             //it should be "" to begin with
@@ -338,7 +338,7 @@
     public void testGetPrecedingVersion() {
         
             getRepo().loadCategory( "/" ).addCategory( "foo", "ka" );
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetPrecedingVersion", "descr");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetPrecedingVersion", "descr");
             ruleItem1.checkin( "version0" );
             assertTrue(ruleItem1.getPrecedingVersion() == null);
             
@@ -386,7 +386,7 @@
     }
     
     public void testGetSucceedingVersion() {
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetSucceedingVersion", "test description");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetSucceedingVersion", "test description");
             ruleItem1.checkin( "version0" );
 
             assertEquals("1", ruleItem1.getVersionNumber());
@@ -408,7 +408,7 @@
     
     public void testGetSuccessorVersionsIterator() {
         try {
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetSuccessorVersionsIterator", "test content");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetSuccessorVersionsIterator", "test content");
             ruleItem1.checkin( "version0" );
             
             Iterator iterator = ruleItem1.getSuccessorVersionsIterator();            
@@ -449,7 +449,7 @@
     }
     
     public void testGetPredecessorVersionsIterator() {
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetPredecessorVersionsIterator", "test description");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetPredecessorVersionsIterator", "test description");
             ruleItem1.checkin( "version0" );
             
             Iterator iterator = ruleItem1.getPredecessorVersionsIterator();            
@@ -492,13 +492,13 @@
     }
     
     public void testGetTitle() {    
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetTitle", "test content");            
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetTitle", "test content");            
                         
             assertEquals("testGetTitle", ruleItem1.getTitle());
     }
     
     public void testDublinCoreProperties() {
-        PackageItem pkg = getRepo().createRulePackage( "testDublinCore", "wa" );
+        PackageItem pkg = getRepo().createPackage( "testDublinCore", "wa" );
         
         AssetItem ruleItem = pkg.addAsset( "testDublinCoreProperties", "yeah yeah yeah" );
         ruleItem.updateCoverage( "b" );
@@ -507,7 +507,7 @@
         ruleItem.updateLastContributor( "me" );
         ruleItem.checkin( "woo" );
         
-        pkg = getRepo().loadRulePackage( "testDublinCore" );
+        pkg = getRepo().loadPackage( "testDublinCore" );
         ruleItem = (AssetItem) pkg.getRules().next();
         
         assertEquals("b", ruleItem.getCoverage());
@@ -519,7 +519,7 @@
     }
     
     public void testGetFormat() {        
-            AssetItem ruleItem1 = getRepo().loadDefaultRulePackage().addAsset("testGetFormat", "test content");
+            AssetItem ruleItem1 = getRepo().loadDefaultPackage().addAsset("testGetFormat", "test content");
             
             assertEquals("DRL", ruleItem1.getFormat());     
             
@@ -528,7 +528,7 @@
     }        
     
     public void testAnonymousProperties() {
-        AssetItem item = getRepo().loadDefaultRulePackage().addAsset( "anonymousproperty", "lalalalala" );
+        AssetItem item = getRepo().loadDefaultPackage().addAsset( "anonymousproperty", "lalalalala" );
         item.updateUserProperty( "fooBar", "value");
         assertEquals("value", item.getUserProperty("fooBar"));
         

Deleted: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/DslItemTestCase.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/DslItemTestCase.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/DslItemTestCase.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -1,58 +0,0 @@
-package org.drools.repository;
-
-
-import junit.framework.TestCase;
-
-import org.drools.repository.DslItem;
-import org.drools.repository.AssetItem;
-import org.drools.repository.RulesRepository;
-import org.drools.repository.RulesRepositoryException;
-
-public class DslItemTestCase extends TestCase {
-
-    private RulesRepository getRepo() {
-        return RepositorySession.getRepository();
-    }
-    
-    public void testDslItem() {
-        
-        try {
-            //This calls the constructor
-            String meth = StackUtil.getCurrentMethodName();
-            DslItem dslItem1 = getRepo().addDsl(meth, "blah");
-            
-            assertNotNull(dslItem1);
-            assertNotNull(dslItem1.getNode());         
-            assertEquals(meth, dslItem1.getName());
-        }
-        catch(Exception e) {
-            fail("Unexpected Exception caught: " + e);
-        }
-        
-        //try constructing a DslItem object with the wrong node type
-        try {
-            //Get a reference to a node of the incorrect type
-            AssetItem ruleItem1 = this.getRepo().loadDefaultRulePackage().addAsset("test rule", "test guts");
-            
-            //this should fail
-            DslItem dslItem2 = new DslItem(getRepo(), ruleItem1.getNode());
-            fail("Exception not thrown by constructor for node of type: " + ruleItem1.getNode().getPrimaryNodeType().getName());            
-        }
-        catch(RulesRepositoryException e) {
-            //this is what we expect
-        }
-        catch(Exception e) {
-            fail("Unexpected Exception caught: " + e);
-        }
-    }
-
-    public void testGetContent() {
-            DslItem dslItem1 = getRepo().addDsl(StackUtil.getCurrentMethodName(), "[then]Send escalation email=sendEscalationEmail( customer, ticket );");
-            
-            assertNotNull(dslItem1);
-            assertEquals("[then]Send escalation email=sendEscalationEmail( customer, ticket );", dslItem1.getContent());
-            assertEquals("DSL", dslItem1.getFormat());        
-    }
-       
-    
-}

Deleted: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/FunctionItemTestCase.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/FunctionItemTestCase.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/FunctionItemTestCase.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -1,228 +0,0 @@
-package org.drools.repository;
-
-import java.io.File;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.drools.repository.*;
-
-public class FunctionItemTestCase extends TestCase {
-
-    
-    
-
-    public void testFunctionItem() {
-        try {            
-            //calls constructor
-            FunctionItem functionItem1 = this.getRepo().addFunction("testFunctionItem", "test content");
-            
-            assertNotNull(functionItem1);
-            assertNotNull(functionItem1.getNode());
-            assertEquals("testFunctionItem", functionItem1.getName());            
-        }
-        catch(Exception e) {
-            fail("Caught unexpected exception: " + e);
-        }
-        
-        //try constructing with node of wrong type
-        try {
-            
-            DslItem dslItem = getRepo().addDsl("testFunctionItem", "content here");
-            FunctionItem functionItem = new FunctionItem(this.getRepo(), dslItem.getNode());
-            fail("Exception not thrown for node of type: " + dslItem.getNode().getPrimaryNodeType().getName());
-        }
-        catch(RulesRepositoryException e) {
-            //this is good
-        }
-        catch(Exception e) {
-            fail("Caught unexpected exception: " + e);
-        }
-    }
-
-    public void testGetContent() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetContent", "test content");
-            
-            assertNotNull(functionItem1);
-            assertNotNull(functionItem1.getNode());
-            assertEquals("test content", functionItem1.getContent());
-    }
-    
-    public void testUpdateContent() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testUpdateContent", "test content");
-                        
-            functionItem1.updateContent("new content");
-            
-            assertEquals("new content", functionItem1.getContent());
-    }
-
-
-    public void testSetStateString() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testSetStateString", "test content");
-           
-            functionItem1.setState("TestState1");
-            assertNotNull(functionItem1.getState());
-            assertEquals("TestState1", functionItem1.getState().getName());
-            
-            functionItem1.setState("TestState2");
-            assertNotNull(functionItem1.getState());
-            assertEquals("TestState2", functionItem1.getState().getName());            
-    }
-
-    public void testSetStateStateItem() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testSetStateStateItem", "test content");
-           
-            StateItem stateItem1 = getRepo().getState("TestState1");
-            functionItem1.setState(stateItem1);            
-            assertNotNull(functionItem1.getState());
-            assertEquals(functionItem1.getState().getName(), "TestState1");
-            
-            StateItem stateItem2 = getRepo().getState("TestState2");
-            functionItem1.setState(stateItem2);
-            assertNotNull(functionItem1.getState());
-            assertEquals("TestState2", functionItem1.getState().getName());            
-    }
-
-    public void testGetState() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetState", "test content");
-           
-            StateItem stateItem1 = functionItem1.getState();
-            assertNull(stateItem1);
-            
-            functionItem1.setState("TestState1");
-            assertNotNull(functionItem1.getState());
-            assertEquals("TestState1", functionItem1.getState().getName());                        
-    }
-
-    public void testToString() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testToString", "test content");           
-            assertNotNull(functionItem1.toString());                        
-    }
-    
-        
-    public void testFunctionRuleLanguage() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testFunctionRuleLanguage", "test content");
-           
-            //it should be initialized to 'Java'
-            assertEquals("Java", functionItem1.getFunctionLanguage());                        
-    }
-    
-    
-    public void testGetPrecedingVersion() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetPrecedingVersion", "test content");
-            
-            FunctionItem predecessorFunctionItem = (FunctionItem) functionItem1.getPrecedingVersion();
-            assertTrue(predecessorFunctionItem == null);            
-            
-            functionItem1.updateContent("new content");
-            
-            predecessorFunctionItem = (FunctionItem) functionItem1.getPrecedingVersion();
-            assertNotNull(predecessorFunctionItem);
-            assertEquals("test content", predecessorFunctionItem.getContent());
-            
-            functionItem1.updateContent("newer content");
-            
-            predecessorFunctionItem = (FunctionItem) functionItem1.getPrecedingVersion();
-            assertNotNull(predecessorFunctionItem);
-            assertEquals("new content", predecessorFunctionItem.getContent());
-            predecessorFunctionItem = (FunctionItem) predecessorFunctionItem.getPrecedingVersion();
-            assertNotNull(predecessorFunctionItem);
-            assertEquals("test content", predecessorFunctionItem.getContent());
-    }
-    
-    public void testGetSucceedingVersion() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetSucceedingVersion", "test content");
-            
-            FunctionItem succeedingFunctionItem = (FunctionItem) functionItem1.getSucceedingVersion();
-            assertTrue(succeedingFunctionItem == null);            
-            
-            functionItem1.updateContent("new content");
-            
-            FunctionItem predecessorFunctionItem = (FunctionItem) functionItem1.getPrecedingVersion();
-            assertEquals("test content", predecessorFunctionItem.getContent());
-            succeedingFunctionItem = (FunctionItem) predecessorFunctionItem.getSucceedingVersion();
-            assertNotNull(succeedingFunctionItem);
-            assertEquals(functionItem1.getContent(), succeedingFunctionItem.getContent());                       
-    } 
-    
-    public void testGetSuccessorVersionsIterator() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetSuccessorVersionsIterator", "test content");                        
-            
-            Iterator iterator = functionItem1.getSuccessorVersionsIterator();            
-            assertNotNull(iterator);
-            assertFalse(iterator.hasNext());
-            
-            functionItem1.updateContent("new content");
-            
-            iterator = functionItem1.getSuccessorVersionsIterator();            
-            assertNotNull(iterator);
-            assertFalse(iterator.hasNext());
-            
-            FunctionItem predecessorFunctionItem = (FunctionItem) functionItem1.getPrecedingVersion();
-            iterator = predecessorFunctionItem.getSuccessorVersionsIterator();
-            assertNotNull(iterator);
-            assertTrue(iterator.hasNext());
-            FunctionItem nextFunctionItem = (FunctionItem) iterator.next();
-            assertEquals("new content", nextFunctionItem.getContent());
-            assertFalse(iterator.hasNext());
-            
-            functionItem1.updateContent("newer content");
-                        
-            iterator = predecessorFunctionItem.getSuccessorVersionsIterator();
-            assertNotNull(iterator);
-            assertTrue(iterator.hasNext());
-            nextFunctionItem = (FunctionItem) iterator.next();
-            assertEquals("new content", nextFunctionItem.getContent());
-            assertTrue(iterator.hasNext());
-            nextFunctionItem = (FunctionItem)iterator.next();
-            assertEquals("newer content", nextFunctionItem.getContent());
-            assertFalse(iterator.hasNext());            
-    }
-    
-    public void testGetPredecessorVersionsIterator() {
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetPredecessorVersionsIterator", "test content");                        
-            
-            Iterator iterator = functionItem1.getPredecessorVersionsIterator();            
-            assertNotNull(iterator);
-            assertFalse(iterator.hasNext());
-            
-            functionItem1.updateContent("new content");
-            
-            iterator = functionItem1.getPredecessorVersionsIterator();            
-            assertNotNull(iterator);
-            assertTrue(iterator.hasNext());
-            FunctionItem nextFunctionItem = (FunctionItem) iterator.next();
-            assertFalse(iterator.hasNext());
-            assertEquals("test content", nextFunctionItem.getContent());
-            
-            functionItem1.updateContent("newer content");
-            
-            iterator = functionItem1.getPredecessorVersionsIterator();            
-            assertNotNull(iterator);
-            assertTrue(iterator.hasNext());
-            nextFunctionItem = (FunctionItem) iterator.next();
-            assertTrue(iterator.hasNext());            
-            assertEquals("new content", nextFunctionItem.getContent());
-            nextFunctionItem = (FunctionItem) iterator.next();
-            assertFalse(iterator.hasNext());
-            assertEquals("test content", nextFunctionItem.getContent());
-    }
-    
-    public void testGetTitle() {    
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetTitle", "test content");            
-            assertEquals("testGetTitle", functionItem1.getTitle());
-    }
-    
-    
-    public void testGetFormat() {        
-            FunctionItem functionItem1 = this.getRepo().addFunction("testGetFormat", "test content");
-            assertEquals("Function", functionItem1.getFormat());            
-    }
-
-    private RulesRepository getRepo() {
-
-        return RepositorySession.getRepository();
-    }        
-}

Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulePackageItemTestCase.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulePackageItemTestCase.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulePackageItemTestCase.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -10,11 +10,11 @@
 
     public void testListPackages() throws Exception {
         RulesRepository repo = getRepo();
-        repo.createRulePackage( "testListPackages1", "lalalala" );
+        repo.createPackage( "testListPackages1", "lalalala" );
         
         List list = iteratorToList( repo.listPackages() );
         int prevSize = list.size();
-        repo.createRulePackage( "testListPackages2", "abc" );
+        repo.createPackage( "testListPackages2", "abc" );
         
         list = iteratorToList( repo.listPackages() );
         
@@ -26,7 +26,7 @@
         try {
             
             //calls constructor
-            PackageItem rulePackageItem1 = repo.createRulePackage("testRulePackage", "desc");
+            PackageItem rulePackageItem1 = repo.createPackage("testRulePackage", "desc");
             assertNotNull(rulePackageItem1);
             assertEquals("testRulePackage", rulePackageItem1.getName());
             
@@ -46,19 +46,6 @@
             fail("Caught unexpected exception: " + e);
         }
         
-        //try constructing with node of wrong type
-        try {            
-            DslItem dslItem = repo.addDsl("testRulePackageItem", "content");
-            PackageItem rulePackageItem2 = new PackageItem(repo, dslItem.getNode());
-            fail("Exception not thrown for node of type: " + dslItem.getNode().getPrimaryNodeType().getName());
-        }
-        catch(RulesRepositoryException e) {
-            //this is good
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            fail("Caught unexpected exception: " + e);
-        }
     }
     
     /**
@@ -69,7 +56,7 @@
     public void testBaselinePackage() throws Exception {
         RulesRepository repo = getRepo();
         
-        PackageItem pack = repo.createRulePackage( "testBaselinePackage", "for testing baselines" );
+        PackageItem pack = repo.createPackage( "testBaselinePackage", "for testing baselines" );
         
         AssetItem rule1 = pack.addAsset( "rule 1", "yeah" );
         AssetItem rule2 = pack.addAsset( "rule 2", "foobar" );
@@ -84,7 +71,7 @@
         pack.createBaseline("commit comment", state);
         
         //check head
-        pack = repo.loadRulePackage( "testBaselinePackage" );
+        pack = repo.loadPackage( "testBaselinePackage" );
         assertEquals(2, iteratorToList(pack.getRules()).size());
         
         //now remove a rule from head
@@ -102,7 +89,7 @@
     /** Continues to show how multi dimensional versioning works */
     public void testPackageBaselineWithRuleChanges() throws Exception {
         String packName = StackUtil.getCurrentMethodName();
-        PackageItem pack = getRepo().createRulePackage( packName, "yeah" );
+        PackageItem pack = getRepo().createPackage( packName, "yeah" );
         
         AssetItem rule = pack.addAsset( "foobar", "waah" );        
         rule.updateContent( "this is something" );        
@@ -112,7 +99,7 @@
         
         pack.createBaseline( "another one", state );
         
-        pack = getRepo().loadRulePackage( packName );
+        pack = getRepo().loadPackage( packName );
         
         rule = (AssetItem) pack.getRules().next();
         rule.updateContent( "blah" );
@@ -120,7 +107,7 @@
         
         pack.createBaseline( "yeah", state );
         
-        pack = getRepo().loadRulePackage( packName );
+        pack = getRepo().loadPackage( packName );
         rule = (AssetItem) pack.getRules().next();
         assertEquals("blah", rule.getContent());
         
@@ -136,16 +123,16 @@
 
     public void testLoadRulePackageItem() {
 
-        PackageItem rulePackageItem = getRepo().createRulePackage("testLoadRuleRuleItem", "desc");
+        PackageItem rulePackageItem = getRepo().createPackage("testLoadRuleRuleItem", "desc");
 
-        rulePackageItem = getRepo().loadRulePackage("testLoadRuleRuleItem");
+        rulePackageItem = getRepo().loadPackage("testLoadRuleRuleItem");
         assertNotNull(rulePackageItem);
         assertEquals("testLoadRuleRuleItem", rulePackageItem.getName());
         
         assertEquals("desc", rulePackageItem.getDescription());
         // try loading rule package that was not created 
         try {
-            rulePackageItem = getRepo().loadRulePackage("anotherRuleRuleItem");
+            rulePackageItem = getRepo().loadPackage("anotherRuleRuleItem");
             fail("Exception not thrown loading rule package that was not created.");
         } catch (RulesRepositoryException e) {
             // that is OK!
@@ -157,7 +144,7 @@
      * This will test getting rules of specific versions out of a package.
      */
     public void testPackageRuleVersionExtraction() throws Exception {
-        PackageItem pack = getRepo().createRulePackage( "package extractor", "foo" );
+        PackageItem pack = getRepo().createPackage( "package extractor", "foo" );
         
         
         AssetItem rule1 = pack.addAsset( "rule number 1", "yeah man" );
@@ -171,7 +158,7 @@
         
         getRepo().save();
         
-        pack = getRepo().loadRulePackage( "package extractor" );
+        pack = getRepo().loadPackage( "package extractor" );
         List rules = iteratorToList( pack.getRules() );
         assertEquals(3, rules.size());
         
@@ -180,7 +167,7 @@
         rule1.updateState( "foobar" );
         rule1.checkin( "yeah" );
         
-        pack = getRepo().loadRulePackage( "package extractor" );
+        pack = getRepo().loadPackage( "package extractor" );
         
         rules = iteratorToList( pack.getRules(state) );
         
@@ -216,11 +203,11 @@
     }
     
     public void testDuplicatePackageName() throws Exception {
-        PackageItem pack = getRepo().createRulePackage( "dupePackageTest", "testing for dupe" );        
+        PackageItem pack = getRepo().createPackage( "dupePackageTest", "testing for dupe" );        
         assertNotNull(pack.getName());
         
         try {
-            getRepo().createRulePackage( "dupePackageTest", "this should fail" );
+            getRepo().createPackage( "dupePackageTest", "this should fail" );
             fail("Should not be able to add a package of the same name.");
         } catch (RulesRepositoryException e) {
             assertNotNull(e.getMessage());
@@ -230,19 +217,19 @@
     
     public void testLoadRulePackageItemByUUID() throws Exception {
 
-        PackageItem rulePackageItem = getRepo().createRulePackage("testLoadRuleRuleItemByUUID", "desc");
+        PackageItem rulePackageItem = getRepo().createPackage("testLoadRuleRuleItemByUUID", "desc");
 
         String uuid = null;
             uuid = rulePackageItem.getNode().getUUID();
 
 
-        rulePackageItem = getRepo().loadRulePackageByUUID(uuid);
+        rulePackageItem = getRepo().loadPackageByUUID(uuid);
         assertNotNull(rulePackageItem);
         assertEquals("testLoadRuleRuleItemByUUID", rulePackageItem.getName());
         
         // try loading rule package that was not created 
         try {
-            rulePackageItem = getRepo().loadRulePackageByUUID("01010101-0101-0101-0101-010101010101");
+            rulePackageItem = getRepo().loadPackageByUUID("01010101-0101-0101-0101-010101010101");
             fail("Exception not thrown loading rule package that was not created.");
         } catch (RulesRepositoryException e) {
             // that is OK!
@@ -251,7 +238,7 @@
     }    
     
     public void testAddRuleRuleItem() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testAddRuleRuleItem","desc");
+            PackageItem rulePackageItem1 = getRepo().createPackage("testAddRuleRuleItem","desc");
 
             
             AssetItem ruleItem1 = rulePackageItem1.addAsset("testAddRuleRuleItem", "test description");
@@ -292,88 +279,14 @@
         return list;
     }
 
-    public void testAddFunctionFunctionItem() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testAddFunctionFunctionItem", "desc");
-            
-            FunctionItem functionItem1 = getRepo().addFunction("test function", "test content");
-            
-            rulePackageItem1.addFunction(functionItem1);
-            
-            List functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("test function", ((FunctionItem)functions.get(0)).getName());
-            
-            //test that it is following the head revision                        
-            functionItem1.updateContent("new content");
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("test function", ((FunctionItem)functions.get(0)).getName());
-            assertEquals("new content", ((FunctionItem)functions.get(0)).getContent());
-                        
-            FunctionItem functionItem2 = getRepo().addFunction("test function 2", "test content");
-            rulePackageItem1.addFunction(functionItem2);
-            
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(2, functions.size());                          
 
-    }
 
-    public void testAddFunctionFunctionItemBoolean() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testAddFunctionFunctionItemBoolean", "desc");
-            
-            FunctionItem functionItem1 = getRepo().addFunction("testAddFunctionFunctionItemBoolean", "test content");
-            
-            rulePackageItem1.addFunction(functionItem1, true);
-            
-            List functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("testAddFunctionFunctionItemBoolean", ((FunctionItem)functions.get(0)).getName());
-            
-            //test that it is following the head revision                        
-            functionItem1.updateContent("new content");
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("testAddFunctionFunctionItemBoolean", ((FunctionItem)functions.get(0)).getName());
-            assertEquals("new content", ((FunctionItem)functions.get(0)).getContent());
-            
-            FunctionItem functionItem2 = getRepo().addFunction("testAddFunctionFunctionItemBoolean2", "test content");
-            rulePackageItem1.addFunction(functionItem2);
-            
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(2, functions.size());
-            
 
-    }
 
-    public void testGetFunctions() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testGetFunctions", "desc");
-                        
-            FunctionItem functionItem1 = getRepo().addFunction("testGetFunctions", "test content");
-            
-            rulePackageItem1.addFunction(functionItem1);
-            
-            List functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("testGetFunctions", ((FunctionItem)functions.get(0)).getName());
-                                  
-            FunctionItem functionItem2 = getRepo().addFunction("testGetFunctions2", "test content");
-            rulePackageItem1.addFunction(functionItem2);
-            
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(2, functions.size());            
 
-    }
     
     public void testGetRules() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testGetRules", "desc");
+            PackageItem rulePackageItem1 = getRepo().createPackage("testGetRules", "desc");
                         
             AssetItem ruleItem1 = rulePackageItem1.addAsset("testGetRules", "desc" );
             ruleItem1.updateContent( "test lhs content" );
@@ -401,7 +314,7 @@
     }
 
     public void testToString() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testToStringPackage", "desc");
+            PackageItem rulePackageItem1 = getRepo().createPackage("testToStringPackage", "desc");
             
             AssetItem ruleItem1 = rulePackageItem1.addAsset("testToStringPackage", "test lhs content" );
             ruleItem1.updateContent( "test lhs content" );
@@ -411,7 +324,7 @@
     }
     
     public void testRemoveRule() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testRemoveRule", "desc");
+            PackageItem rulePackageItem1 = getRepo().createPackage("testRemoveRule", "desc");
             
             AssetItem ruleItem1 = rulePackageItem1.addAsset("testRemoveRule", "test lhs content" );
             ruleItem1.updateContent( "test lhs content" ); 
@@ -449,48 +362,11 @@
             assertEquals(0, rules.size());
 
     }
-    
- 
-    
-    public void testRemoveFunction() {
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testRemoveFunction", "yayayaya");
-            
-            FunctionItem functionItem1 = getRepo().addFunction("testRemoveFunction", "test content");
-            
-            rulePackageItem1.addFunction(functionItem1);
-            
-            List functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("testRemoveFunction", ((FunctionItem)functions.get(0)).getName());
-                                    
-            functionItem1.updateContent("new content");
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(1, functions.size());
-            assertEquals("testRemoveFunction", ((FunctionItem)functions.get(0)).getName());
-            assertEquals("new content", ((FunctionItem)functions.get(0)).getContent());
-            
-            FunctionItem functionItem2 = getRepo().addFunction("testRemoveFunction2", "test content");
-            rulePackageItem1.addFunction(functionItem2);
-            
-            //remove the function, make sure the other function in the package stays around
-            rulePackageItem1.removeFunction(functionItem1);
-            functions = rulePackageItem1.getFunctions();
-            assertEquals(1, functions.size());
-            assertEquals("testRemoveFunction2", ((FunctionItem)functions.get(0)).getName());
-            
-            //remove the function that is following the head revision, make sure the package is now empty
-            rulePackageItem1.removeFunction(functionItem2);
-            functions = rulePackageItem1.getFunctions();
-            assertNotNull(functions);
-            assertEquals(0, functions.size());
 
-    }
     
     
     public void testGetFormat() {        
-            PackageItem rulePackageItem1 = getRepo().createRulePackage("testGetFormat", "woot");
+            PackageItem rulePackageItem1 = getRepo().createPackage("testGetFormat", "woot");
             assertNotNull(rulePackageItem1);
             assertEquals("Rule Package", rulePackageItem1.getFormat());    
 

Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTestCase.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTestCase.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/RulesRepositoryTestCase.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -32,7 +32,7 @@
         }
         assertTrue(foundDefault);
         
-        PackageItem def = repo.loadDefaultRulePackage();
+        PackageItem def = repo.loadDefaultPackage();
         assertNotNull(def);
         assertEquals("default", def.getName());
         
@@ -41,7 +41,7 @@
     
     public void testAddVersionARule() throws Exception {
         RulesRepository repo = RepositorySession.getRepository();
-        PackageItem pack = repo.createRulePackage( "testAddVersionARule", "description" );
+        PackageItem pack = repo.createPackage( "testAddVersionARule", "description" );
         repo.save();
         
         AssetItem rule = pack.addAsset( "my rule", "foobar" );
@@ -55,7 +55,7 @@
         rule.updateContent( "foo bar" );
         rule.checkin( "version1" );
         
-        PackageItem pack2 =  repo.loadRulePackage( "testAddVersionARule" );
+        PackageItem pack2 =  repo.loadPackage( "testAddVersionARule" );
         
         Iterator it =  pack2.getRules();
         
@@ -77,14 +77,14 @@
     public void testLoadRuleByUUID() throws Exception {
         RulesRepository repo = RepositorySession.getRepository();
         
-        PackageItem rulePackageItem = repo.loadDefaultRulePackage();
+        PackageItem rulePackageItem = repo.loadDefaultPackage();
         AssetItem rule = rulePackageItem.addAsset( "testLoadRuleByUUID", "this is a description");
         
         repo.save();
                 
         String uuid = rule.getNode().getUUID();
 
-        AssetItem loaded = repo.loadRuleByUUID(uuid);
+        AssetItem loaded = repo.loadAssetByUUID(uuid);
         assertNotNull(loaded);
         assertEquals("testLoadRuleByUUID", loaded.getName());
         assertEquals( "this is a description", loaded.getDescription());
@@ -97,7 +97,7 @@
         
         
         
-        AssetItem reload = repo.loadRuleByUUID( uuid );
+        AssetItem reload = repo.loadAssetByUUID( uuid );
         assertEquals("testLoadRuleByUUID", reload.getName());
         assertEquals("xxx", reload.getContent());
         System.out.println(reload.getVersionNumber());
@@ -107,7 +107,7 @@
 
         // try loading rule package that was not created 
         try {
-            repo.loadRuleByUUID("01010101-0101-0101-0101-010101010101");
+            repo.loadAssetByUUID("01010101-0101-0101-0101-010101010101");
             fail("Exception not thrown loading rule package that was not created.");
         } catch (RulesRepositoryException e) {
             // that is OK!
@@ -122,7 +122,7 @@
             Calendar effectiveDate = Calendar.getInstance();
             Calendar expiredDate = Calendar.getInstance();
             expiredDate.setTimeInMillis(effectiveDate.getTimeInMillis() + (1000 * 60 * 60 * 24));
-            AssetItem ruleItem1 = rulesRepository.loadDefaultRulePackage().addAsset("testAddRuleCalendarCalendar", "desc");
+            AssetItem ruleItem1 = rulesRepository.loadDefaultPackage().addAsset("testAddRuleCalendarCalendar", "desc");
             ruleItem1.updateDateEffective( effectiveDate );
             ruleItem1.updateDateExpired( expiredDate );
      
@@ -169,34 +169,13 @@
             assertEquals("testGetTag/TestChildTag1", tagItem3.getFullPath());                                   
     }
     
-    public void testAddFunctionStringString() {
-        RulesRepository rulesRepository = RepositorySession.getRepository();
-            FunctionItem functionItem1 = rulesRepository.addFunction("testAddFunctionStringString", "test content");
-            
-            assertNotNull(functionItem1);
-            assertNotNull(functionItem1.getNode());
-            assertEquals("testAddFunctionStringString", functionItem1.getName());
-            assertEquals("test content", functionItem1.getContent());
-            assertEquals("", functionItem1.getDescription());
-    }
+
     
-    public void testAddFunctionStringStringString() {
-        RulesRepository rulesRepository = RepositorySession.getRepository();
-                        
-            FunctionItem functionItem1 = rulesRepository.addFunction("testAddFunctionStringStringString", "test content", "test description");
-            
-            assertNotNull(functionItem1);
-            assertNotNull(functionItem1.getNode());
-            assertEquals("testAddFunctionStringStringString", functionItem1.getName());
-            assertEquals("test content", functionItem1.getContent());
-            assertEquals("test description", functionItem1.getDescription());
-    }
-    
     public void testListPackages() {
         RulesRepository rulesRepository = RepositorySession.getRepository();
         
         
-            PackageItem rulePackageItem1 = rulesRepository.createRulePackage("testListPackages", "desc");
+            PackageItem rulePackageItem1 = rulesRepository.createPackage("testListPackages", "desc");
             
             Iterator it = rulesRepository.listPackages();
             assertTrue(it.hasNext());
@@ -216,7 +195,7 @@
     
     public void testMoveRulePackage() throws Exception {
         RulesRepository repo = RepositorySession.getRepository();
-        PackageItem pkg = repo.createRulePackage( "testMove", "description" );
+        PackageItem pkg = repo.createPackage( "testMove", "description" );
         AssetItem r = pkg.addAsset( "testMove", "description" );
         r.checkin( "version0" );
         
@@ -226,13 +205,13 @@
         
         assertEquals(1, iteratorToList( pkg.getRules()).size());
         
-        repo.createRulePackage( "testMove2", "description" );
+        repo.createPackage( "testMove2", "description" );
         repo.moveRuleItemPackage( "testMove2", r.node.getUUID(), "explanation" );
         
-        pkg = repo.loadRulePackage( "testMove" );
+        pkg = repo.loadPackage( "testMove" );
         assertEquals(0, iteratorToList( pkg.getRules() ).size());
         
-        pkg = repo.loadRulePackage( "testMove2" );
+        pkg = repo.loadPackage( "testMove2" );
         assertEquals(1, iteratorToList( pkg.getRules() ).size());
         
         r = (AssetItem) pkg.getRules().next();

Modified: labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/ScalabilityTest.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/ScalabilityTest.java	2006-12-12 16:26:53 UTC (rev 8260)
+++ labs/jbossrules/trunk/drools-repository/src/test/java/org/drools/repository/ScalabilityTest.java	2006-12-12 17:38:03 UTC (rev 8261)
@@ -68,20 +68,20 @@
 
     private List listACat(RulesRepository repo) {
         long start = System.currentTimeMillis();
-        List results = repo.findRulesByCategory( "HR/CAT_1" );
+        List results = repo.findAssetsByCategory( "HR/CAT_1" );
         System.out.println("Time for listing a cat: " + (System.currentTimeMillis() - start));
         
         start = System.currentTimeMillis();
-        List results2 = repo.findRulesByCategory( "HR/CAT_1" );
+        List results2 = repo.findAssetsByCategory( "HR/CAT_1" );
         System.out.println("Time for listing a cat: " + (System.currentTimeMillis() - start));
 
 
         start = System.currentTimeMillis();
-        results2 = repo.findRulesByCategory( "HR/CAT_100" );
+        results2 = repo.findAssetsByCategory( "HR/CAT_100" );
         System.out.println("Time for listing a cat: " + (System.currentTimeMillis() - start));
 
         start = System.currentTimeMillis();
-        results2 = repo.findRulesByCategory( "HR/CAT_100" );
+        results2 = repo.findAssetsByCategory( "HR/CAT_100" );
         System.out.println("Time for listing a cat: " + (System.currentTimeMillis() - start));
 
         
@@ -128,7 +128,7 @@
             System.out.println("ADDING rule: " + ruleName);
                         
             
-            AssetItem item = repo.loadDefaultRulePackage().addAsset( ruleName, "Foo(bar == " + i + ")panic(" + i + ");" );            
+            AssetItem item = repo.loadDefaultPackage().addAsset( ruleName, "Foo(bar == " + i + ")panic(" + i + ");" );            
             item.addCategory( cat );
             list.add( item );
             




More information about the jboss-svn-commits mailing list