[jboss-svn-commits] JBL Code SVN: r10217 - in labs/jbossrules/trunk/drools-jbrms/src: main/java/org/drools/brms/client/ruleeditor and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Mar 15 04:25:35 EDT 2007
Author: michael.neale at jboss.com
Date: 2007-03-15 04:25:35 -0400 (Thu, 15 Mar 2007)
New Revision: 10217
Removed:
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/BREditor.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ChoiceList.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/EditableLine.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/FieldEditor.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ListUtil.java
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/package.html
labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/BREditorTest.java
labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/ChoiceListTest.java
Modified:
labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/ruleeditor/DSLRuleEditor.java
Log:
JBRULES-714 JBRULES-729
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/BREditor.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/BREditor.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/BREditor.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,335 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.drools.brms.client.rpc.MetaData;
-import org.drools.brms.client.rpc.RuleAsset;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * A basic DSL based BUSINESS rule editor.
- *
- * This is the editor for "business" rules via a DSL.
- * This uses the EditableLine widget.
- */
-public class BREditor extends Composite {
-
- final int DESC_COLUMN = 0; // this column in the layout if for descriptions
- final int CONTENT_COLUMN = 1; //this displays the rule contents
- final int ACTION_COLUMN = 2; //this contains "action" buttons
-
-
- private final Panel panel;
-
- /** these lists contain the guts of the rule */
- private List lhs = new ArrayList(); //these will be populated with EditableLine widget
- private List rhs = new ArrayList();
-
- /** these lists contain the "popup data" for the content assistance */
- private List lhsSuggestions = new ArrayList();
- private List rhsSuggestions = new ArrayList();
-
-
- private FlexTable table = null;
- private boolean editMode = false;
- private ChoiceList lhsSuggestionPopup;
- private ChoiceList rhsSuggestionPopup;
- private Image addLhsPopupButton;
- private Image editButton;
- private Image addRhsPopupButton;
-
- private MetaData meta;
-
-
- public BREditor(RuleAsset asset) {
- this.meta = asset.metaData;
- panel = new VerticalPanel();
-
-
- initData();
- initEditorActions();
- refreshLayoutTable();
- initWidget( panel );
- setWidth( "100%" );
-
- }
-
- private void initEditorActions() {
- //DSL suggestions/pick list
- lhsSuggestionPopup = getLHSChoiceList();
- rhsSuggestionPopup = getRhsChoiceList();
-
-
- //button to add a new item for lhs (using the choice list).
- addLhsPopupButton = new Image("images/new_item.gif");
- addLhsPopupButton.addClickListener( new ClickListener() {
- public void onClick(Widget sender) {
- int left = sender.getAbsoluteLeft() - 40;
- int top = sender.getAbsoluteTop() + 10;
- lhsSuggestionPopup.setPopupPosition( left, top );
- lhsSuggestionPopup.show();
- }
- });
- addLhsPopupButton.setVisible( false );
-
- //button to toggle edit mode
- editButton = new Image("images/edit.gif");
- editButton.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- switchModes(lhs, editMode);
- switchModes(rhs, editMode);
- showHideLineEditorWidgets( editMode );
- editMode = !editMode;
- meta.dirty = true;
- }
- });
-
- //the new button for the RHS
- addRhsPopupButton = new Image("images/new_item.gif");
- addRhsPopupButton.addClickListener( new ClickListener() {
-
- public void onClick(Widget sender) {
- int left = sender.getAbsoluteLeft() - 40;
- int top = sender.getAbsoluteTop() + 10;
- rhsSuggestionPopup.setPopupPosition( left, top );
- rhsSuggestionPopup.show();
- }
-
- });
- addRhsPopupButton.setVisible( false );
- }
-
- /** This will populate and refresh the overall layout table. */
- private void refreshLayoutTable() {
-
- resetTableWidget();
- table.setText( 0, DESC_COLUMN, "IF" );
-
- table.setWidget( 0, ACTION_COLUMN, addLhsPopupButton );
- table.setWidget( 0, ACTION_COLUMN + 1, editButton );
-
- int rowOffset = 1;
-
- //setup LHS
- displayEditorWidgets( rowOffset, lhs );
- rowOffset = lhs.size() + 1;
- table.setText( rowOffset, DESC_COLUMN, "THEN" );
-
-
- table.setWidget( rowOffset, ACTION_COLUMN, addRhsPopupButton );
-
- rowOffset++;
-
- //setup RHS
- displayEditorWidgets( rowOffset, rhs );
- }
-
- private ChoiceList getRhsChoiceList() {
- final ChoiceList rhsSuggestionPopup = new ChoiceList(rhsSuggestions);
- rhsSuggestionPopup.setOKClickListener( new ClickListener() {
- public void onClick(Widget popup) {
- //need up add to the LHS list
- ChoiceList c = (ChoiceList) popup;
- EditableLine editLine = new EditableLine(c.getSelectedItem());
- if (editMode) editLine.makeEditable();
-
- rhs.add( editLine );
- refreshLayoutTable();
- }
- } );
- return rhsSuggestionPopup;
- }
-
- private ChoiceList getLHSChoiceList() {
- final ChoiceList lhsSuggestionPopup = new ChoiceList(lhsSuggestions);
- lhsSuggestionPopup.setOKClickListener( new ClickListener() {
- public void onClick(Widget popup) {
- //need up add to the LHS list
- ChoiceList c = (ChoiceList) popup;
- EditableLine editLine = new EditableLine(c.getSelectedItem());
- if (editMode) editLine.makeEditable();
-
- lhs.add( editLine );
- refreshLayoutTable();
- }
- } );
- return lhsSuggestionPopup;
- }
-
-
- private void switchModes(List list, boolean readOnly) {
-
-
- for ( int i = 0; i < list.size(); i++ ) {
- EditableLine line = (EditableLine) list.get( i );
- if (readOnly) {
- line.makeReadOnly();
- } else {
- line.makeEditable();
- }
- }
-
- }
-
- /** Switch all the line editor widgets on or off */
- private void showHideLineEditorWidgets(boolean readOnly) {
-
- this.addLhsPopupButton.setVisible(!readOnly);
- this.addRhsPopupButton.setVisible( !readOnly );
-
- for (int row = 1; row <= lhs.size(); row++ ) {
- showHideLineEditorWidget( readOnly, row );
- }
- int rhsStart = lhs.size() + 2;
- int rhsEnd = rhs.size() + rhsStart;
- for (int row = rhsStart; row < rhsEnd; row++ ) {
- showHideLineEditorWidget( readOnly, row );
- }
- }
-
- /** Show or hide all the widgets for a line */
- private void showHideLineEditorWidget(boolean readOnly, int row) {
- Image img = (Image) table.getWidget( row, ACTION_COLUMN );
- img.setVisible( !readOnly );
- img = (Image) table.getWidget( row, ACTION_COLUMN + 1 );
- img.setVisible( !readOnly );
- img = (Image) table.getWidget( row, ACTION_COLUMN + 2 );
- img.setVisible( !readOnly );
- }
-
- /**
- * This processes the individual LHS or RHS items.
- */
- private void displayEditorWidgets(int rowOffset, final List dataList) {
- final BREditor editor = this;
- for ( int i = 0; i < dataList.size(); i++ ) {
- EditableLine w = (EditableLine) dataList.get( i );
- int row = i + rowOffset;
-
- table.setWidget( row, CONTENT_COLUMN, w );
-
- Image removeButton = new Image("images/clear_item.gif");
- Image shuffleUpButton = new Image("images/shuffle_up.gif");
- Image shuffleDownButton = new Image("images/shuffle_down.gif");
- removeButton.setVisible( editMode);
- shuffleUpButton.setVisible( editMode );
- shuffleDownButton.setVisible( editMode );
- table.setWidget( row, ACTION_COLUMN, removeButton );
- table.setWidget( row, ACTION_COLUMN + 1, shuffleUpButton);
- table.setWidget( row, ACTION_COLUMN + 2, shuffleDownButton );
- final int idx = i;
-
-
-
- removeButton.addClickListener( new ClickListener() {
- public void onClick(Widget wid) {
- dataList.remove( idx );
- editor.refreshLayoutTable();
- }
-
- });
-
- //setup shuffle button up
- shuffleUpButton.addClickListener( new ClickListener() {
- public void onClick(Widget wid) {
- shuffle( dataList, idx, true );
- editor.refreshLayoutTable();
- }
- });
-
- //setup shuffle button down
- shuffleDownButton.addClickListener( new ClickListener() {
- public void onClick(Widget wid) {
- shuffle( dataList, idx, false );
- editor.refreshLayoutTable();
- }
- });
-
-
- }
- }
-
-
- private void resetTableWidget() {
- //remove old if refreshing
- if (table != null) {
- panel.remove( table );
- }
-
- //now add the new
- table = new FlexTable();
- table.setWidth( "100%" );
-
- table.setStyleName( "rule-breditor-Table" );
- panel.add( table );
- }
-
- /**
- * This will setup the data
- * TODO: this is only mockup data.
- * TODO: When populading the lhs and rhs lists, need to have "{" stuffed in there
- * so that the text fields will be created for you. When reading the value out of the
- * EditableLine, they will be removed (as they won't actually show up on screen,
- * they are just place holders).
- */
- private void initData() {
-
- //the suggestion data
- lhsSuggestions.add("There is a Driver");
- lhsSuggestions.add("- age less than {age} years old");
- lhsSuggestions.add("- age greater than {age} years old");
- lhsSuggestions.add("- has had more than {number} prior claims");
- lhsSuggestions.add("- has a location risk profile of '{risk}'");
- lhsSuggestions.add("- age is at least {age}");
- lhsSuggestions.add("- age is between {lower} and {upper} years old");
- lhsSuggestions.add("- has had exactly {number} prior claims");
- lhsSuggestions.add("Policy type is '{type}'");
- lhsSuggestions.add("Policy has not been rejected");
-
- rhsSuggestions.add("Reject Policy with explanation : '{reason}'");
- rhsSuggestions.add("Approve Policy with the reason : '{reason}'");
- rhsSuggestions.add( "Log '{message}'" );
-
- //now the actual data, which in reality would have to be parsed out
-// lhs.add( new EditableLine("this is a {bam}"));
-// lhs.add( new EditableLine("this is a {bam}"));
-// rhs.add( new EditableLine("this is a {bam}"));
-
- }
-
- /** Adjust items up and down in a list.
- *
- * @param lst The list to adjust.
- * @param idx The item to move.
- * @param up The direction to move (true == up, false == down ).
- */
- public static void shuffle(List lst,
- int idx, boolean up) {
- int targetIdx;
- if (up) {
- targetIdx = idx - 1;
- } else {
- targetIdx = idx + 1;
- }
-
- if (targetIdx < 0 || targetIdx >= lst.size()) {
- return;
- }
- Object target = lst.get( targetIdx );
- Object source = lst.get( idx );
-
- lst.set( targetIdx, source );
- lst.set( idx, target );
- }
-
-
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ChoiceList.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ChoiceList.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ChoiceList.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,102 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.List;
-
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.KeyboardListener;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This is a popup list for "content assistance" - although on the web,
- * its not assistance - its mandatory ;)
- */
-public class ChoiceList extends PopupPanel {
-
- private ListBox list;
- private ClickListener okClickListener;
- private TextBox filter;
-
- public void setOKClickListener(ClickListener listener) {
- this.okClickListener = listener;
- }
-
- /**
- * Pass in a list of suggestions for the popup lists.
- * Set a click listener to get notified when the OK button is clicked.
- */
- public ChoiceList(final List data) {
- super( true );
-
-
- filter = new TextBox();
- filter.addKeyboardListener( new KeyboardListener() {
-
- public void onKeyDown(Widget arg0,
- char arg1,
- int arg2) {
-
- }
-
- public void onKeyPress(Widget arg0,
- char arg1,
- int arg2) {
-
- }
-
- public void onKeyUp(Widget arg0,
- char arg1,
- int arg2) {
- populateList( ListUtil.filter(data, filter.getText()) );
- }
-
- });
- filter.setFocus( true );
-
-
- VerticalPanel panel = new VerticalPanel();
- panel.add( filter );
-
- list = new ListBox();
- list.setVisibleItemCount( 5 );
-
- populateList( data );
-
-
- panel.add( list );
-
- Button ok = new Button("ok");
- ok.addClickListener( new ClickListener() {
- public void onClick(Widget btn) {
- onOkClicked();
- }
-
- });
- panel.add( ok );
- add( panel );
- setStyleName( "ks-popups-Popup" );
-
- }
-
- private void populateList(List data) {
- list.clear();
- for (int i = 0; i < data.size(); i++) {
- list.addItem((String) data.get( i ));
- }
- }
-
- private void onOkClicked() {
- this.okClickListener.onClick( this );
- this.hide();
- }
-
- public String getSelectedItem() {
- return list.getItemText( list.getSelectedIndex() );
- }
-
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/EditableLine.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/EditableLine.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/EditableLine.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,104 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.Widget;
-
-/** This encapsulates a DSL line component of a rule. */
-public class EditableLine extends Composite {
-
- /** The main panel of the composite. */
- private Panel panel;
-
- /**
- * This is the list of widgets that are used to display/capture data
- * Should be Label, TextBox or Button (for editing mode).
- */
- private Widget[] widgets;
-
- public EditableLine(String dslLine) {
- widgets = makeWidgets( dslLine );
- //widgets = items;
- panel = new HorizontalPanel();
- initWidget( panel );
- makeReadOnly();
-
- }
-
- public void makeReadOnly() {
- panel.clear();
- panel.add( new Label(toString()) );
- }
-
- public void makeEditable() {
- panel.clear();
- for ( int i = 0; i < widgets.length; i++ ) {
- panel.add( widgets[i] );
- }
- }
-
- /**
- * Returns the content.
- */
- public String toString() {
- String result = "";
- for ( int i=0; i < widgets.length; i++ ) {
- Widget element = widgets[i];
- if (element instanceof Label) {
- result = result + ((Label) element).getText();
- } else if (element instanceof FieldEditor){
- result = result + ((FieldEditor) element).getText();
- }
- }
- return result;
- }
-
-
- /**
- * This will take a DSL line item, and split it into widget thingamies for displaying.
- * One day, if this is too complex, this will have to be done on the server side.
- */
- public static Widget[] makeWidgets(String dslLine) {
- List widgets = new ArrayList();
- char[] chars = dslLine.toCharArray();
- FieldEditor currentBox = null;
- Label currentLabel = null;
- for ( int i = 0; i < chars.length; i++ ) {
- char c = chars[i];
- if (c == '{') {
- currentLabel = null;
- currentBox = new FieldEditor();
- widgets.add( currentBox );
-
- } else if (c == '}') {
- currentBox.setVisibleLength( currentBox.getText().length() );
- currentBox = null;
- } else {
- if (currentBox == null && currentLabel == null) {
- currentLabel = new Label();
- widgets.add( currentLabel );
- }
- if (currentLabel != null) {
- currentLabel.setText( currentLabel.getText() + c );
- } else if (currentBox != null) {
- currentBox.setText( currentBox.getText() + c );
- }
-
- }
- }
- Widget[] result = new Widget[widgets.size()];
- for(int i=0; i < result.length; i++) {
- result[i] = (Widget) widgets.get( i );
- }
- return result;
- }
-
-
-
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/FieldEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/FieldEditor.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/FieldEditor.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,39 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.TextBox;
-
-/**
- * This is a single field editor for the DSL based business rule editor.
- * @author Michael Neale
- */
-public class FieldEditor extends Composite {
-
- private TextBox box;
- private HorizontalPanel panel = new HorizontalPanel();
-
- public FieldEditor() {
- box = new TextBox();
- box.setStyleName( "dsl-field-TextBox" );
-
- panel.add( new HTML(" ") );
- panel.add( box );
- panel.add( new HTML(" ") );
- initWidget( panel );
- }
-
-
- public void setText(String t) {
- box.setText( t );
- }
-
- public void setVisibleLength(int l) {
- box.setVisibleLength( l );
- }
-
- public String getText() {
- return box.getText();
- }
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ListUtil.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ListUtil.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/ListUtil.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,24 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class ListUtil {
-
- public static List filter(List source,
- String filterVal) {
- if (filterVal == null || "".equals( filterVal.trim() )) {
- return source;
- }
- ArrayList filteredList = new ArrayList();
- for ( Iterator iter = source.iterator(); iter.hasNext(); ) {
- String item = (String) iter.next();
- if (item.startsWith( filterVal )) {
- filteredList.add( item );
- }
- }
- return filteredList;
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/package.html
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/package.html 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/breditor/package.html 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,8 +0,0 @@
-<body>
-This package was a first attempt at a business rule editor.
-
-The functionality here has basically been rolled into the rule modeller.
-Some useful items are to be able to move expressions up and down, and also to have a list box
-selected for DSL sentences.
-
-</body>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/ruleeditor/DSLRuleEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/ruleeditor/DSLRuleEditor.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/ruleeditor/DSLRuleEditor.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -141,58 +141,6 @@
this.data.content = text.getText();
}
- /**
- * The popup content assistance. Can be dragged around.
- */
- static class PickList extends DialogBox {
- public PickList(String message, String[] items, final DSLRuleEditor self) {
- setStyleName( "ks-popups-Popup" );
- final ListBox list = new ListBox();
- for ( int i = 0; i < items.length; i++ ) {
- list.addItem( items[i] );
- }
-
-
- setText( message );
-
- VerticalPanel vert = new VerticalPanel();
- list.setVisibleItemCount( 6 );
- vert.add( list );
-
-
-
- FlexTable buttons = new FlexTable();
-
-
- Image ok = new Image("images/tick.gif");
- ok.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- self.insertText( list.getItemText( list.getSelectedIndex() ) );
- hide();
- }
- } );
- buttons.setWidget( 0, 0, ok );
- buttons.getFlexCellFormatter().setAlignment( 0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE );
-
-
-
- Image close = new Image("images/close.gif");
- close.addClickListener( new ClickListener() {
- public void onClick(Widget w) {
- hide();
- }
- } );
-
- buttons.setWidget( 0, 1, close);
- buttons.getFlexCellFormatter().setAlignment( 0, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE );
-
- buttons.setWidth( "100%" );
- vert.add( buttons );
-
- setWidget( vert );
- }
- }
-
}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/BREditorTest.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/BREditorTest.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/BREditorTest.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,51 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class BREditorTest extends TestCase {
-
- public void testRearrange() {
- List l = new ArrayList();
- l.add( "foo" );
- l.add( "bar" );
- int idx = 1;
- BREditor.shuffle(l, idx, true);
-
- assertEquals("bar", l.get( 0 ));
- assertEquals("foo", l.get( 1 ));
-
- l = new ArrayList();
-
- l.add( "a" );
- l.add( "b" );
- l.add( "c" );
-
- BREditor.shuffle( l, 0, true );
- assertEquals("a", l.get( 0 ));
- assertEquals("b", l.get( 1 ));
- assertEquals("c", l.get( 2 ));
-
-
- BREditor.shuffle( l, 0, false );
- assertEquals("b", l.get( 0 ));
- assertEquals("a", l.get( 1 ));
- assertEquals("c", l.get( 2 ));
-
-
- BREditor.shuffle( l, 2, true );
- assertEquals("b", l.get( 0 ));
- assertEquals("c", l.get( 1 ));
- assertEquals("a", l.get( 2 ));
-
-
- BREditor.shuffle( l, 2, false );
- assertEquals("b", l.get( 0 ));
- assertEquals("c", l.get( 1 ));
- assertEquals("a", l.get( 2 ));
-
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/ChoiceListTest.java
===================================================================
--- labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/ChoiceListTest.java 2007-03-15 08:04:58 UTC (rev 10216)
+++ labs/jbossrules/trunk/drools-jbrms/src/test/java/org/drools/brms/client/breditor/ChoiceListTest.java 2007-03-15 08:25:35 UTC (rev 10217)
@@ -1,30 +0,0 @@
-package org.drools.brms.client.breditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class ChoiceListTest extends TestCase {
-
- public void testFilter() {
-
- List source = new ArrayList();
- source.add("foo bar");
- source.add( "baz" );
- source.add( "barry" );
-
- List result = ListUtil.filter(source, null);
-
- assertEquals(3, result.size());
-
- result = ListUtil.filter(source, "ba");
- assertEquals(2, result.size());
-
- assertEquals(0, ListUtil.filter(source, "xx").size());
-
- assertEquals(1, ListUtil.filter(source, "barry").size());
-
- }
-
-}
More information about the jboss-svn-commits
mailing list