testing
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -40,10 +42,18 @@ public class ActionStateModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("parent");
|
||||
|
||||
LinkedList actions = new LinkedList();
|
||||
EvaluateModel eval = new EvaluateModel("foo.bar");
|
||||
actions.add(eval);
|
||||
parent.setActions(actions);
|
||||
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
|
||||
assertNotNull(child.getSecured());
|
||||
assertEquals("foo.bar", ((EvaluateModel) child.getActions().get(0)).getExpression());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -42,8 +44,14 @@ public class DecisionStateModelTests extends TestCase {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = new DecisionStateModel("child");
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
|
||||
LinkedList ifs = new LinkedList();
|
||||
ifs.add(new IfModel("test", "foo"));
|
||||
parent.setIfs(ifs);
|
||||
|
||||
child.merge(parent);
|
||||
assertNotNull(child.getSecured());
|
||||
assertNotNull("test", ((IfModel) child.getIfs().get(0)).getTest());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -42,8 +44,14 @@ public class EndStateModelTests extends TestCase {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
EndStateModel parent = new EndStateModel("child");
|
||||
parent.setCommit("true");
|
||||
parent.setView("view");
|
||||
|
||||
LinkedList outputs = new LinkedList();
|
||||
outputs.add(new OutputModel("foo", "bar"));
|
||||
parent.setOutputs(outputs);
|
||||
|
||||
child.merge(parent);
|
||||
assertEquals("true", child.getCommit());
|
||||
assertEquals("bar", ((OutputModel) child.getOutputs().get(0)).getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,10 +39,11 @@ public class SubflowStateModelTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "flow");
|
||||
SubflowStateModel child = new SubflowStateModel("child", null);
|
||||
SubflowStateModel parent = new SubflowStateModel("child", "flow");
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
assertEquals("flow", child.getSubflow());
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -40,10 +42,61 @@ public class ViewStateModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
ViewStateModel parent = new ViewStateModel("child");
|
||||
ViewStateModel parent = new ViewStateModel("parent");
|
||||
|
||||
LinkedList attributes = new LinkedList();
|
||||
attributes.add(new AttributeModel("foo", "bar"));
|
||||
parent.setAttributes(attributes);
|
||||
|
||||
BinderModel binder = new BinderModel();
|
||||
LinkedList bindings = new LinkedList();
|
||||
bindings.add(new BindingModel("foo", "fooConverter", "true"));
|
||||
binder.setBindings(bindings);
|
||||
parent.setBinder(binder);
|
||||
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
|
||||
parent.setRedirect("true");
|
||||
parent.setPopup("true");
|
||||
parent.setModel("fooModel");
|
||||
parent.setView("fooView");
|
||||
|
||||
LinkedList transitions = new LinkedList();
|
||||
TransitionModel tx = new TransitionModel();
|
||||
tx.setOn("submit");
|
||||
tx.setTo("bar");
|
||||
transitions.add(tx);
|
||||
parent.setTransitions(transitions);
|
||||
|
||||
EvaluateModel eval = new EvaluateModel("foo.bar");
|
||||
LinkedList actions = new LinkedList();
|
||||
actions.add(eval);
|
||||
parent.setOnEntryActions(actions);
|
||||
parent.setOnExitActions(actions);
|
||||
parent.setOnRenderActions(actions);
|
||||
|
||||
LinkedList vars = new LinkedList();
|
||||
vars.add(new VarModel("foo", "class"));
|
||||
parent.setVars(vars);
|
||||
|
||||
LinkedList eh = new LinkedList();
|
||||
eh.add(new ExceptionHandlerModel("foo"));
|
||||
parent.setExceptionHandlers(eh);
|
||||
|
||||
child.merge(parent);
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
assertEquals("true", child.getRedirect());
|
||||
assertEquals("true", child.getPopup());
|
||||
assertEquals("fooModel", child.getModel());
|
||||
assertEquals("fooView", child.getView());
|
||||
assertEquals("bar", ((AttributeModel) child.getAttributes().get(0)).getValue());
|
||||
assertEquals("foo", ((BindingModel) child.getBinder().getBindings().get(0)).getProperty());
|
||||
assertEquals("bar", ((TransitionModel) child.getTransitions().get(0)).getTo());
|
||||
assertEquals("foo.bar", ((EvaluateModel) child.getOnEntryActions().get(0)).getExpression());
|
||||
assertEquals("foo.bar", ((EvaluateModel) child.getOnExitActions().get(0)).getExpression());
|
||||
assertEquals("foo.bar", ((EvaluateModel) child.getOnRenderActions().get(0)).getExpression());
|
||||
assertEquals("foo", ((VarModel) child.getVars().get(0)).getName());
|
||||
assertEquals("foo", ((ExceptionHandlerModel) child.getExceptionHandlers().get(0)).getBean());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user