Permalink
Browse files

the behaviour model itself should not be executable: removed behaviou…

…r#perform()
  • Loading branch information...
heiko-braun committed Nov 21, 2012
1 parent 2738861 commit d8f55de00a66f4587805a9677e72a4213109bf95
@@ -49,15 +49,6 @@ public void setCondition(Condition condition) {
this.condition = condition;
}
- public void execute() {
-
- if(condition.isMet())
- {
- for(Transition action : transitions)
- action.perform();
- }
- }
-
public void addTransition(Transition transition) {
transitions.add(transition);
}
@@ -76,4 +67,5 @@ public void setInputs(Trigger<TriggerType>... trigger) {
public boolean isTriggeredBy(Trigger<TriggerType> type) {
return eventConsumption.isTriggeredBy(type);
}
+
}
@@ -1,16 +1,12 @@
package org.jboss.as.console.client.mbui.aui.aim;
-import java.util.Set;
-
/**
* @author Heiko Braun
* @date 10/31/12
*/
public class FunctionCall extends Transition {
- @Override
- public void perform() {
-
+ protected FunctionCall(QName id) {
+ super(id);
}
-
}
@@ -5,8 +5,7 @@
* @date 11/1/12
*/
public class Navigation extends Transition {
- @Override
- public void perform() {
-
+ protected Navigation(QName id) {
+ super(id);
}
}
@@ -10,13 +10,19 @@
*/
public abstract class Transition implements TriggerSource {
- private String id;
+ private QName id;
+
+ protected Transition(QName id) {
+ this.id = id;
+ }
+
+ public QName getId() {
+ return id;
+ }
private EventProduction eventProduction =
new EventProduction(TriggerType.Transition);
- public abstract void perform();
-
@Override
public boolean doesTrigger() {
return eventProduction.doesTrigger();
@@ -30,11 +30,11 @@
import java.util.Set;
import static org.jboss.as.console.client.mbui.TestNamespace.NAMESPACE;
+import static org.jboss.as.console.client.mbui.aui.aim.TemporalOperator.Choice;
+import static org.jboss.as.console.client.mbui.aui.aim.TemporalOperator.OrderIndependance;
import static org.jboss.as.console.client.mbui.aui.aim.TriggerType.*;
import static org.jboss.as.console.client.mbui.aui.aim.TriggerType.System;
import static org.jboss.as.console.client.mbui.aui.aim.TriggerType.Transition;
-import static org.jboss.as.console.client.mbui.aui.aim.TemporalOperator.Choice;
-import static org.jboss.as.console.client.mbui.aui.aim.TemporalOperator.OrderIndependance;
import static org.jboss.as.console.client.mbui.aui.mapping.MappingType.RESOURCE;
import static org.junit.Assert.*;
@@ -126,31 +126,6 @@ public void behaviourResolution()
assertFalse("Behaviour should not be triggered by deviceRotation", behaviour.isTriggeredBy(deviceRotation));
assertFalse("Behaviour should not be triggered by loadData", behaviour.isTriggeredBy(loadData));
- final StringBuffer sharedState = new StringBuffer("");
-
- behaviour.setCondition(new Condition()
- {
- @Override
- public boolean isMet()
- {
- return true;
- }
- });
-
- behaviour.addTransition(new FunctionCall()
- {
- @Override
- public void perform()
- {
- sharedState.append("updated");
- }
- });
-
- if (behaviour.isTriggeredBy(loadData))
- {
- behaviour.execute();
- assertTrue("sharedState should be updated", sharedState.toString().equals("updated"));
- }
}
@Test

0 comments on commit d8f55de

Please sign in to comment.