[overlord-commits] Overlord SVN: r661 - in sam/trunk: modules/core/src/main/java/org/jboss/sam/internal/drools and 9 other directories.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Wed Jul 15 04:40:00 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-07-15 04:39:59 -0400 (Wed, 15 Jul 2009)
New Revision: 661
Modified:
sam/trunk/SAMM.iws
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java
sam/trunk/modules/sim/pom.xml
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
sam/trunk/modules/sim/src/test/resources/simulation/sam-cfg.xml
Log:
Create entry-point callbacks when adding stream inputs. Fix simulation test case
Modified: sam/trunk/SAMM.iws
===================================================================
--- sam/trunk/SAMM.iws 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/SAMM.iws 2009-07-15 08:39:59 UTC (rev 661)
@@ -17,32 +17,33 @@
</component>
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
- <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/resources/drools/simple.drl" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/adapter/invm/Alert.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/pom.xml" afterPath="$PROJECT_DIR$/modules/core/pom.xml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/modules/core/src/test/resources/drools/standalone.drl" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/StreamInput.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/StreamInput.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/drools/ApiTestCase.java" afterPath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/drools/ApiTestCase.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/resources/drools/forward.drl" afterPath="" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/modules/core/src/test/resources/drools/stream-input.drl" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/modules/core/src/test/resources/drools/stream-forward.drl" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/config/Configurator.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/config/Configurator.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/adapter" afterPath="" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/drools/StandaloneTestCase.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/resources/simulation/test.drl" afterPath="$PROJECT_DIR$/modules/sim/src/test/resources/simulation/test.drl" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java" afterPath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/test/resources/database/triggerPull.drl" afterPath="$PROJECT_DIR$/modules/core/src/test/resources/database/triggerPull.drl" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/sim.iml" afterPath="$PROJECT_DIR$/modules/sim/sim.iml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/resources/simulation/sam-cfg.xml" afterPath="$PROJECT_DIR$/modules/sim/src/test/resources/simulation/sam-cfg.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/pom.xml" afterPath="$PROJECT_DIR$/modules/sim/pom.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAMM.iws" afterPath="$PROJECT_DIR$/SAMM.iws" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" afterPath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/EventProcessor.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/EventProcessor.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java" afterPath="$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DefaultCallback.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/test/java/org/jboss/test/sam/adapter/invm" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java" afterPath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -114,7 +115,7 @@
</component>
<component name="DebuggerManager">
<line_breakpoints>
- <breakpoint url="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java" line="251" class="Class at DroolsEventProcessorImpl.java:251" package="org.jboss.sam.internal.drools">
+ <breakpoint url="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/StreamOutputAdapter.java" line="48" class="org.jboss.sam.internal.drools.StreamOutputAdapter" package="org.jboss.sam.internal.drools">
<option name="ENABLED" value="true" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="LOG_ENABLED" value="false" />
@@ -127,7 +128,7 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/StreamOutputAdapter.java" line="48" class="org.jboss.sam.internal.drools.StreamOutputAdapter" package="org.jboss.sam.internal.drools">
+ <breakpoint url="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" line="129" class="org.jboss.sam.simulation.EventSourceEntity" package="org.jboss.sam.simulation">
<option name="ENABLED" value="true" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="LOG_ENABLED" value="false" />
@@ -140,7 +141,7 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" line="131" class="org.jboss.sam.simulation.EventSourceEntity" package="org.jboss.sam.simulation">
+ <breakpoint url="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java" line="153" class="org.jboss.sam.simulation.EventSimulation" package="org.jboss.sam.simulation">
<option name="ENABLED" value="true" />
<option name="SUSPEND_POLICY" value="SuspendAll" />
<option name="LOG_ENABLED" value="false" />
@@ -153,6 +154,19 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
+ <breakpoint url="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" line="78" class="org.jboss.test.sam.simulation.SimulationTestCase" package="org.jboss.test.sam.simulation">
+ <option name="ENABLED" value="true" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
</line_breakpoints>
<breakpoint_any>
<breakpoint>
@@ -224,57 +238,7 @@
</subPane>
</component>
<component name="FileEditorManager">
- <leaf>
- <file leaf-file-name="EventSourceEntity.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="47" column="14" selection-start="1805" selection-end="1805" vertical-scroll-proportion="-0.9306931">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="DroolsEventProcessorImpl.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="202" column="51" selection-start="6140" selection-end="6162" vertical-scroll-proportion="0.09079445">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EventSimulation.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="120" column="47" selection-start="4643" selection-end="4643" vertical-scroll-proportion="0.33291298">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="SimulationTestCase.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="63" column="43" selection-start="2373" selection-end="2373" vertical-scroll-proportion="0.33663365">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EventSinkEntity.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="24" column="0" selection-start="1102" selection-end="1136" vertical-scroll-proportion="-1.1386138">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- </leaf>
+ <leaf />
</component>
<component name="FindManager">
<FindUsagesManager>
@@ -414,10 +378,6 @@
<option name="myItemId" value="SAMM.ipr" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -425,256 +385,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/resources" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/resources/simulation" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/resources" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAMM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
<option name="myItemId" value="core" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
@@ -1278,16 +988,16 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
- <frame x="331" y="46" width="1320" height="955" extended-state="0" />
- <editor active="true" />
+ <frame x="346" y="40" width="1328" height="965" extended-state="0" />
+ <editor active="false" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="14" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.27773407" order="0" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32750583" order="1" />
- <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24862313" order="1" />
+ <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.30414388" order="0" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32718894" order="1" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24706802" order="1" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="9" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="6" />
@@ -1299,7 +1009,7 @@
<window_info id="Maven" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="12" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24862313" order="2" />
<window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="5" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3986014" order="4" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39746544" order="4" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="0" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="13" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
@@ -1383,117 +1093,117 @@
</component>
<component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="0.52098763,0.5" version="1">
<option name="myPlainMode" value="false" />
- <option name="myLastEditedConfigurable" value="core" />
+ <option name="myLastEditedConfigurable" value="sim" />
</component>
<component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
<option name="myLastEditedConfigurable" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/modules/core/src/test/resources/drools/stream-forward.drl">
+ <entry file="file://$PROJECT_DIR$/modules/sim/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="12" column="1" selection-start="81" selection-end="245" vertical-scroll-proportion="0.23762377">
+ <state line="12" column="54" selection-start="479" selection-end="479" vertical-scroll-proportion="0.24211854">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/test/resources/drools/standalone.drl">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="9" column="10" selection-start="113" selection-end="169" vertical-scroll-proportion="0.17821783">
+ <state line="59" column="26" selection-start="2010" selection-end="2010" vertical-scroll-proportion="0.6860025">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/sim.iml">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
+ <state line="24" column="0" selection-start="1102" selection-end="1136" vertical-scroll-proportion="-1.103912">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/StreamOutputAdapter.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="57" column="57" selection-start="1762" selection-end="1762" vertical-scroll-proportion="0.65346533">
+ <state line="42" column="9" selection-start="1461" selection-end="1461" vertical-scroll-proportion="0.33251834">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///Users/hbraun/dev/env/drools-5.0-examples/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/events/EventSource.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/EventProcessor.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="24" column="17" selection-start="728" selection-end="728" vertical-scroll-proportion="0.17821783">
+ <state line="49" column="7" selection-start="1726" selection-end="1726" vertical-scroll-proportion="0.2117061">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/EventProcessor.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="56" column="7" selection-start="1842" selection-end="1842" vertical-scroll-proportion="0.33291298">
+ <state line="30" column="65" selection-start="1253" selection-end="1265" vertical-scroll-proportion="0.1992528">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/pom.xml">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="12" column="54" selection-start="479" selection-end="479" vertical-scroll-proportion="0.24211854">
- <folding />
+ <state line="144" column="33" selection-start="4161" selection-end="4161" vertical-scroll-proportion="0.56723714">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/resources/simulation/test.drl">
<provider selected="true" editor-type-id="text-editor">
- <state line="59" column="26" selection-start="2010" selection-end="2010" vertical-scroll-proportion="0.6860025">
+ <state line="17" column="0" selection-start="381" selection-end="381" vertical-scroll-proportion="0.33251834">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="53" column="0" selection-start="1839" selection-end="1839" vertical-scroll-proportion="0.66582596">
+ <state line="125" column="60" selection-start="4292" selection-end="4292" vertical-scroll-proportion="0.44582814">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/src/test/resources/simulation/test.drl">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="13" column="62" selection-start="320" selection-end="320" vertical-scroll-proportion="0.25742576">
+ <state line="79" column="19" selection-start="2728" selection-end="2728" vertical-scroll-proportion="0.64792174">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="120" column="47" selection-start="4643" selection-end="4643" vertical-scroll-proportion="0.33291298">
+ <state line="173" column="23" selection-start="5886" selection-end="5886" vertical-scroll-proportion="0.7895392">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="63" column="43" selection-start="2373" selection-end="2373" vertical-scroll-proportion="0.33663365">
+ <state line="128" column="29" selection-start="4103" selection-end="4143" vertical-scroll-proportion="0.6014944">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="24" column="0" selection-start="1102" selection-end="1136" vertical-scroll-proportion="-1.1386138">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="180" column="55" selection-start="5566" selection-end="5566" vertical-scroll-proportion="0.7210461">
+ <folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="47" column="14" selection-start="1805" selection-end="1805" vertical-scroll-proportion="-0.9306931">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="149" column="52" selection-start="4682" selection-end="4682" vertical-scroll-proportion="0.66748166">
+ <folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="202" column="51" selection-start="6140" selection-end="6162" vertical-scroll-proportion="0.09079445">
+ <state line="173" column="58" selection-start="5252" selection-end="5252" vertical-scroll-proportion="0.8630807">
<folding />
</state>
</provider>
Modified: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/drools/DroolsEventProcessorImpl.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -24,6 +24,7 @@
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
+import org.drools.common.NamedEntryPoint;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
@@ -50,7 +51,7 @@
implements EventProcessor<KnowledgeBase>, Globals
{
private String name;
- private SAMRuntime runtime;
+ private SAMRuntime runtime;
private boolean started;
private KnowledgeBase kbase;
@@ -80,11 +81,21 @@
public void start()
{
this.session = kbase.newStatefulKnowledgeSession();
- this.session.getGlobals().setDelegate(this);
+ this.session.getGlobals().setDelegate(this);
//KnowledgeRuntimeLoggerFactory.newConsoleLogger(session);
//System.out.println("3. Created session");
+ System.out.println("Known entry-points:");
+ for(WorkingMemoryEntryPoint entryPoint : session.getWorkingMemoryEntryPoints())
+ {
+ if(entryPoint instanceof NamedEntryPoint)
+ {
+ NamedEntryPoint nep = (NamedEntryPoint)entryPoint;
+ System.out.println("-> " + nep.getEntryPoint().getEntryPointId());
+ }
+ }
+
this.started = true;
}
@@ -121,6 +132,28 @@
if(isStarted())
throw new IllegalStateException("EventProcessor already started");
+ // bind stream to drools entry-point
+ streamInput.registerCallback(
+ new StreamInputCallback()
+ {
+
+ public void onEvent(Object args)
+ {
+ if(!isStarted())
+ throw new IllegalStateException("EventProcessor not started");
+
+ WorkingMemoryEntryPoint entryPoint =
+ getSession().getWorkingMemoryEntryPoint(streamInput.getStreamName());
+
+ if(null==entryPoint)
+ throw new IllegalArgumentException("Unable to resolve entry point: "+streamInput.getStreamName());
+
+ entryPoint.insert(args);
+ getSession().fireAllRules();
+ }
+ }
+ );
+
this.streamInputs.put(streamInput.getStreamName(), streamInput);
}
@@ -133,7 +166,7 @@
{
if(isStarted())
throw new IllegalStateException("EventProcessor already started");
-
+
this.streamOutputs.put(streamOutput.getStreamName(), streamOutput);
// Create a drools adapter
@@ -163,10 +196,6 @@
DataSourceManager dsMgr = this.runtime.getDataSourceManager();
global = new SAMAdapter(this.session, this.outputAdapters, dsMgr);
}
- else if("results".equals(key))
- {
- global = new ArrayList();
- }
else
{
// It may be a adapter output
@@ -192,7 +221,7 @@
* @deprecated
*/
public ProcessingStatement registerStatement(String statementName, String epl)
- {
+ {
throw new RuntimeException("Obsolete");
}
@@ -204,7 +233,7 @@
{
if(isStarted())
throw new IllegalStateException("EventProcessor already started");
-
+
final StreamOutput out = this.streamOutputs.get(streamName);
final StreamInput in = this.streamInputs.get(streamName);
@@ -236,41 +265,7 @@
//System.out.println("2. Build packages");
// -----------------------
- // register mapping to either input or output stream
- if(in!=null)
- {
- // bind to input stream
- in.registerCallback(
- new StreamInputCallback()
- {
- public void onEvent(Object args)
- {
- if(!isStarted())
- throw new IllegalStateException("EventProcessor not started");
-
- WorkingMemoryEntryPoint entryPoint =
- getSession().getWorkingMemoryEntryPoint(in.getStreamName());
-
- if(null==entryPoint)
- throw new IllegalArgumentException("Unable to resolve entry point: "+in.getStreamName());
-
- entryPoint.insert(args);
- getSession().fireAllRules();
- }
- }
- );
-
- }
- else
- {
- // bind to output stream
- StreamOutputAdapter outputAdapter = new StreamOutputAdapter(out);
- this.outputAdapters.put(out.getStreamName(), outputAdapter);
- }
-
- // -----------------------
-
DroolsProcessingStatement stmt =
new DroolsProcessingStatement(statementName, null, null);
this.statements.put(statementName, stmt);
Modified: sam/trunk/modules/sim/pom.xml
===================================================================
--- sam/trunk/modules/sim/pom.xml 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/pom.xml 2009-07-15 08:39:59 UTC (rev 661)
@@ -1,100 +1,103 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <name>SAM - Sim</name>
- <groupId>org.jboss.sam</groupId>
- <artifactId>sim</artifactId>
- <packaging>jar</packaging>
+ <name>SAM - Sim</name>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sim</artifactId>
+ <packaging>jar</packaging>
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.sam</groupId>
- <artifactId>sam</artifactId>
- <version>1.0.0.SNAPSHOT</version>
- </parent>
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sam</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ </parent>
- <!-- Properties -->
- <properties>
- <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
- <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
- </properties>
+ <!-- Properties -->
+ <properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy
+ </surefire.security.args>
+ <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE
+ -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
+ </surefire.jdwp.args>
+ </properties>
- <!-- Dependencies -->
- <dependencies>
+ <!-- Dependencies -->
+ <dependencies>
- <dependency>
- <groupId>org.jboss.sam</groupId>
- <artifactId>core</artifactId>
- <version>${version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>core</artifactId>
+ <version>${version}</version>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
- <dependency>
- <groupId>javasim</groupId>
- <artifactId>javasim</artifactId>
- </dependency>
+ <dependency>
+ <groupId>javasim</groupId>
+ <artifactId>javasim</artifactId>
+ </dependency>
- </dependencies>
+ </dependencies>
- <!-- Plugins -->
- <build>
- <resources>
- <resource>
- <targetPath>../etc</targetPath>
- <directory>src/main/etc</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
+ <!-- Plugins -->
+ <build>
+ <resources>
+ <resource>
+ <targetPath>../etc</targetPath>
+ <directory>src/main/etc</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
- <plugins>
+ <plugins>
<plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/jboss/test/sam/samples/pattern/PatternTestCase.java</exclude>
- <exclude>org/jboss/test/sam/samples/aggregation/FilteringTestCase.java</exclude>
- <exclude>org/jboss/test/sam/samples/falloff/FalloffTestCase.java</exclude>
- <exclude>org/jboss/test/sam/samples/aggregation/AggregationTestCase.java</exclude>
- </excludes>
- </configuration>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/jboss/test/sam/samples/pattern/PatternTestCase.java</exclude>
+ <exclude>org/jboss/test/sam/samples/aggregation/FilteringTestCase.java</exclude>
+ <exclude>org/jboss/test/sam/samples/falloff/FalloffTestCase.java</exclude>
+ <exclude>org/jboss/test/sam/samples/aggregation/AggregationTestCase.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
- </plugins>
+ </plugins>
- </build>
+ </build>
- <profiles>
- <!-- Name: debug
- Descr: Enable remote debuging for tests
- -->
- <profile>
- <id>debug</id>
- <activation>
- <property>
- <name>debug</name>
- </property>
- </activation>
- <properties>
- <surefire.jvm.args>${surefire.security.args} ${surefire.jdwp.args}</surefire.jvm.args>
- </properties>
- </profile>
- <profile>
- <id>no-debug</id>
- <activation>
- <property>
- <name>!debug</name>
- </property>
- </activation>
- <properties>
- <surefire.jvm.args>${surefire.security.args}</surefire.jvm.args>
- </properties>
- </profile>
+ <profiles>
+ <!-- Name: debug
+ Descr: Enable remote debuging for tests
+ -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args} ${surefire.jdwp.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-debug</id>
+ <activation>
+ <property>
+ <name>!debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args}</surefire.jvm.args>
+ </properties>
+ </profile>
- </profiles>
+ </profiles>
</project>
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -25,10 +25,10 @@
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public interface ContextAwareEntity
-{
- public void begin();
+{
+ public void begin();
- public void end();
+ public void end();
- void setContext(SimulationContext ctx);
+ void setContext(SimulationContext ctx);
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -23,10 +23,11 @@
/**
* Creates event messages for {@link org.jboss.sam.simulation.EventSourceEntity}'s
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public interface EventMessageFactory
-{
- Object createEventMessage(SimulationContext context);
-
+{
+ Object createEventMessage(SimulationContext context);
+
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -33,10 +33,7 @@
import org.jboss.sam.internal.stream.InVMDispatcher;
import org.jboss.sam.internal.stream.InVMStreamInput;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -46,21 +43,21 @@
/**
* Simulations are created from global configuration,
* which will be available to any simulation entity and a URL to
- * {@link #bootstrap(java.util.Properties, java.net.URL)} the {@link org.jboss.sam.EventProcessor}:
- * <p>
- *
+ * {@link #bootstrap(java.util.Properties,java.net.URL)} the {@link org.jboss.sam.EventProcessor}:
+ * <p/>
+ * <p/>
* <b>Event sources</b><br>
- * {@link org.jboss.sam.simulation.EventSourceEntity}'s drive the whole simulation by creating and dispatching
+ * {@link org.jboss.sam.simulation.EventSourceEntity}'s drive the whole simulation by creating and dispatching
* typed event messages. They need to be added to a simulation ({@link #addSource(EventSourceEntity)})
* in order to emit events to the event processor.
- * <p>
- *
+ * <p/>
+ * <p/>
* <b>Event sinks</b><br>
* {@link org.jboss.sam.simulation.EventSinkEntity}'s processes event messages that have been forwarded
* from an event processor. They need to be added ({@link #addSink(EventSinkEntity)}) to a simualtion
- * and bound to a processing statement ({@link #bindStatement(String, EventSinkEntity)})
- * <p>
- *
+ * and bound to a processing statement ({@link #bindStatement(String,EventSinkEntity)})
+ * <p/>
+ * <p/>
* <b>Shared context</b><br>
* The {@link org.jboss.sam.simulation.SimulationContext} is shared between all simulation
* entities and acts as a blackboard where any entity can read and write simulation data and configuration.
@@ -86,16 +83,16 @@
private EventSimulation(Properties config, URL bootstrap)
{
- assert bootstrap!=null : "Bootstrap config is null!";
+ assert bootstrap != null : "Bootstrap config is null!";
// thread setup
- setName("EventSimulation {" + getName()+ "}");
+ setName("EventSimulation {" + getName() + "}");
setPriority(1);
this.context = new SimulationContext(config);
// setup SAM runtime
- Configurator configurator = new Configurator( ConfigFactory.newInstance().unmarshall(bootstrap) );
+ Configurator configurator = new Configurator(ConfigFactory.newInstance().unmarshall(bootstrap));
this.runtime = SAMRuntimeFactory.newInstance().createRuntime(configurator);
this.eventProcessor = runtime.getEventProcessor();
@@ -103,7 +100,7 @@
this.streamInput = new InVMStreamInput(InVMDispatcher.DEFAULT_CHANNEL_NAME);
// create a dispatcher used within event source
- this.dispatcher = new InVMDispatcher(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+ this.dispatcher = new InVMDispatcher(InVMDispatcher.DEFAULT_CHANNEL_NAME);
// register in/out with hub
this.eventProcessor.addInput(streamInput);
@@ -130,6 +127,7 @@
/**
* Create a aggregation/filtering statement
+ *
* @param stmt
*/
public void createStatement(String stmt)
@@ -141,13 +139,11 @@
/**
* Bind a statment that forwards to an EventSink
- * @param stmt
- * @param sink
*/
- public void bindStatement(String stmt, EventSinkEntity sink)
+ public void bindStatement(InputStream in, EventSinkEntity sink)
{
this.eventProcessor.registerBoundStatement(
- sink.getStreamName(), UUID.randomUUID().toString(), new ByteArrayInputStream(stmt.getBytes())
+ sink.getStreamName(), UUID.randomUUID().toString(), in
);
}
@@ -157,7 +153,7 @@
*/
public void singleRun()
{
- if(!eventProcessor.isStarted())
+ if (!eventProcessor.isStarted())
{
System.out.println("WARN: Force start EventProcessor. Did you forget to start it?");
eventProcessor.start();
@@ -178,7 +174,7 @@
this.terminate();
Scheduler.reset();
}
- catch(SimulationException e)
+ catch (SimulationException e)
{
e.printStackTrace();
}
@@ -186,12 +182,12 @@
private void begin()
{
- for(EventSinkEntity sink : eventSinks)
+ for (EventSinkEntity sink : eventSinks)
{
sink.begin();
}
- for(EventSourceEntity source : eventSources)
+ for (EventSourceEntity source : eventSources)
{
source.begin();
}
@@ -199,12 +195,12 @@
private void end()
{
- for(EventSinkEntity sink : eventSinks)
+ for (EventSinkEntity sink : eventSinks)
{
sink.end();
}
- for(EventSourceEntity source : eventSources)
+ for (EventSourceEntity source : eventSources)
{
source.end();
}
@@ -263,7 +259,8 @@
// [HB] System.out.println("Return control to main thread");
SimulationProcess.mainResume();
this.suspendProcess();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
e.printStackTrace();
System.exit(-1);
@@ -275,26 +272,9 @@
return new EventSimulation(config, bootstrap);
}
- public static String getDRLFromResource(String resourceName)
+ public static InputStream loadDRL(String resourceName)
{
- try
- {
- URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(url.openStream())
- );
- StringBuffer sb = new StringBuffer();
- String line;
- while((line = reader.readLine()) != null)
- {
- sb.append(line);
- }
-
- return sb.toString();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Failed to load DRL", e);
- }
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
}
+
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -27,100 +27,100 @@
/**
* Simulates an event sink.<br>
* Event sink's process messages that have been forwarded by an event processor.
- * <p>
+ * <p/>
* <b>EventSinkHandler</b><br>
* The actual processing is done a {@link org.jboss.sam.simulation.EventSinkHandler}
* that needs to be associated with an event sink entity:
- *
+ * <p/>
* <pre>
- *
+ * <p/>
* EventSinkEntity sink = new EventSinkEntity("foo.bar-EventSink");
* sink.setEventHandler(
* new EventSinkHandler()
* {
- *
+ * <p/>
* public void handle(EventMessage[] events, SimulationContext context)
* {
* // dome something here
* }
* }
* );
- *
+ * <p/>
* </pre>
- *
+ * <p/>
* <br>
* <b>EPL Statements and event forwarding</b><br>
* In order to invoke an event sink, you need to register a statement
- * through {@link org.jboss.sam.simulation.EventSimulation#bindStatement(String, EventSinkEntity)}
- *
+ * through {@link org.jboss.sam.simulation.EventSimulation#bindStatement(String,EventSinkEntity)}
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class EventSinkEntity implements StreamOutput, ContextAwareEntity
{
- private String streamName;
- private SimulationContext context;
- private EventSinkHandler handler = null;
-
- public EventSinkEntity(String streamName)
- {
- this.streamName = streamName;
- }
+ private String streamName;
+ private SimulationContext context;
+ private EventSinkHandler handler = null;
- public void setEventHandler(EventSinkHandler handler)
- {
- this.handler = handler;
- }
+ public EventSinkEntity(String streamName)
+ {
+ this.streamName = streamName;
+ }
- public StreamOutput start()
- {
- return this;
- }
+ public void setEventHandler(EventSinkHandler handler)
+ {
+ this.handler = handler;
+ }
- public StreamOutput stop()
- {
- return this;
- }
+ public StreamOutput start()
+ {
+ return this;
+ }
- public boolean isStarted()
- {
- return true;
- }
+ public StreamOutput stop()
+ {
+ return this;
+ }
- public String getStreamName()
- {
- return this.streamName;
- }
+ public boolean isStarted()
+ {
+ return true;
+ }
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
- public void setStreamName(String name)
- {
- this.streamName = name;
- }
- public void write(EventMessage[] events)
- {
- if(null==this.context)
- throw new IllegalStateException("Simulation context not set");
-
- if(handler!=null)
- handler.handle(events, context);
- }
+ public void setStreamName(String name)
+ {
+ this.streamName = name;
+ }
+ public void write(EventMessage[] events)
+ {
+ if (null == this.context)
+ throw new IllegalStateException("Simulation context not set");
- public void begin()
- {
+ if (handler != null)
+ handler.handle(events, context);
+ }
- }
- public void end()
- {
+ public void begin()
+ {
- }
+ }
- public void setContext(SimulationContext ctx)
- {
- this.context = ctx;
- }
+ public void end()
+ {
+ }
+
+ public void setContext(SimulationContext ctx)
+ {
+ this.context = ctx;
+ }
+
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -30,5 +30,5 @@
*/
public interface EventSinkHandler
{
- void handle(EventMessage[] events, SimulationContext context);
+ void handle(EventMessage[] events, SimulationContext context);
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -22,17 +22,17 @@
package org.jboss.sam.simulation;
import org.javasim.RestartException;
+import org.javasim.SimulationEntity;
import org.javasim.SimulationException;
-import org.javasim.SimulationEntity;
import org.jboss.sam.internal.stream.InVMDispatcher;
/**
* Simulates an event source.<br>
- * <p>
+ * <p/>
* <b>EventMessageFactories</b><br>
* An event source leverages an {@link org.jboss.sam.simulation.EventMessageFactory}
* to create event messages and dispatch them to the event processor:
- *
+ * <p/>
* <pre>
* EventSourceEntity source = new EventSourceEntity("foo.bar-EventSource", 0.1);
* source.setEventMessageFactory(
@@ -46,7 +46,7 @@
* }
* );
* </pre>
- *
+ * <p/>
* <br>
* <b>Event ratio</b><br>
* Specifies the ratio with regard to the total simulation time (between 0.01-1)
@@ -64,20 +64,19 @@
private EventMessageFactory factory = null;
/**
- *
- * @param name the event source name
+ * @param name the event source name
* @param eventRatio event creation ratio wrt the total simulation time. Value between 0-1
*/
public EventSourceEntity(String name, double eventRatio)
{
// thread setup
setPriority(5);
- setName("EventSourceEntity {" + getName()+"}");
+ setName("EventSourceEntity {" + getName() + "}");
this.name = name;
- if(eventRatio<=0 || eventRatio>1)
+ if (eventRatio <= 0 || eventRatio > 1)
throw new IllegalArgumentException("Invalid event ratio: " + eventRatio);
this.eventMessageType = eventMessageType;
@@ -106,7 +105,7 @@
try
{
double totalSim = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
- double holdTime = (totalSim*eventRatio);
+ double holdTime = (totalSim * eventRatio);
hold(holdTime);
}
catch (SimulationException e)
@@ -119,13 +118,13 @@
}
- if(null==context)
+ if (null == context)
throw new IllegalStateException("Simulation context not set");
- if(null==factory)
+ if (null == factory)
throw new IllegalStateException("EventMessageFactory not set");
- if(null==dispatcher)
+ if (null == dispatcher)
throw new IllegalStateException("EventDispatcher not set");
// Create and dispatch event
@@ -142,11 +141,13 @@
try
{
this.activate();
- } catch (SimulationException e)
+ }
+ catch (SimulationException e)
{
e.printStackTrace();
- } catch (RestartException e)
+ }
+ catch (RestartException e)
{
e.printStackTrace();
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -23,51 +23,51 @@
/**
* A simulation measurement helper
- *
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class Measurement
{
- private Double current = 0.0;
+ private Double current = 0.0;
- public Double getCurrent()
- {
- return current;
- }
+ public Double getCurrent()
+ {
+ return current;
+ }
- public Double increase(Double d)
- {
- this.current += d;
- return this.current;
- }
+ public Double increase(Double d)
+ {
+ this.current += d;
+ return this.current;
+ }
- public Double decrease(Double d)
- {
- this.current -= d;
- return this.current;
- }
+ public Double decrease(Double d)
+ {
+ this.current -= d;
+ return this.current;
+ }
- public Double setCurrent(Double d)
- {
- this.current = d;
- return this.current;
- }
+ public Double setCurrent(Double d)
+ {
+ this.current = d;
+ return this.current;
+ }
- public Double increment()
- {
- this.current += 1;
- return this.current;
- }
+ public Double increment()
+ {
+ this.current += 1;
+ return this.current;
+ }
- public Double decrement()
- {
- this.current -= 1;
- return this.current;
- }
+ public Double decrement()
+ {
+ this.current -= 1;
+ return this.current;
+ }
- public String toString()
- {
- return String.valueOf(getCurrent());
- }
+ public String toString()
+ {
+ return String.valueOf(getCurrent());
+ }
}
Modified: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -23,74 +23,73 @@
import org.javasim.Scheduler;
+import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import java.io.PrintStream;
/**
* Shared context between simulation entities and their implementation.
* The context is used collect simulation data and pass it along.<br>
* It propagates:
* <ul>
- * <li>the event simulation configuration
- * <li>measurements from event sinks, event sources and associated delegates
- * <li>arbitrary attachments
+ * <li>the event simulation configuration
+ * <li>measurements from event sinks, event sources and associated delegates
+ * <li>arbitrary attachments
* <ul>
*
- * @see org.jboss.sam.simulation.Measurement
- *
* @author Heiko.Braun <heiko.braun at jboss.com>
+ * @see org.jboss.sam.simulation.Measurement
*/
public class SimulationContext
{
- private Properties config = null;
- private Map<String, Measurement> measurements = new HashMap<String, Measurement>();
- private Map<Class, Object> attachments = new HashMap<Class, Object>();
+ private Properties config = null;
+ private Map<String, Measurement> measurements = new HashMap<String, Measurement>();
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
- public SimulationContext(Properties config)
- {
- this.config = config;
- }
+ public SimulationContext(Properties config)
+ {
+ this.config = config;
+ }
- public Object getConfig(String key)
- {
- if(null == config.get(key))
- throw new IllegalArgumentException("No such config: " + key);
- return config.get(key);
- }
+ public Object getConfig(String key)
+ {
+ if (null == config.get(key))
+ throw new IllegalArgumentException("No such config: " + key);
+ return config.get(key);
+ }
- public Measurement getMeasurement(String key)
- {
- Measurement measurement = measurements.get(key);
- if(null == measurement)
- {
- measurement = new Measurement();
- measurements.put(key, measurement);
- }
- return measurement;
- }
+ public Measurement getMeasurement(String key)
+ {
+ Measurement measurement = measurements.get(key);
+ if (null == measurement)
+ {
+ measurement = new Measurement();
+ measurements.put(key, measurement);
+ }
+ return measurement;
+ }
- public <T> T getAttachment(Class<T> clazz)
- {
- return (T)attachments.get(clazz);
- }
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T) attachments.get(clazz);
+ }
- public <T> T addAttachment(Class<T> clazz, Object obj)
- {
- return (T)attachments.put(clazz, obj);
- }
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T) attachments.put(clazz, obj);
+ }
- public double getCurrentSimulationTime()
- {
- return Scheduler.currentTime();
- }
+ public double getCurrentSimulationTime()
+ {
+ return Scheduler.currentTime();
+ }
- public void dump(PrintStream out)
- {
- for(String key : measurements.keySet())
- {
- out.println(key + ": " + measurements.get(key));
- }
- }
+ public void dump(PrintStream out)
+ {
+ for (String key : measurements.keySet())
+ {
+ out.println(key + ": " + measurements.get(key));
+ }
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -36,147 +36,147 @@
*/
public class BufferedStreamOutput implements StreamOutput
{
- private List<EventMessage[]> newDataLists;
- private List<EventMessage[]> oldDataLists;
+ private List<EventMessage[]> newDataLists;
+ private List<EventMessage[]> oldDataLists;
- private EventMessage[] lastNewDatas;
- private EventMessage[] lastOldDatas;
- private boolean isInvoked;
+ private EventMessage[] lastNewDatas;
+ private EventMessage[] lastOldDatas;
+ private boolean isInvoked;
- private String streamName;
+ private String streamName;
- private boolean started;
+ private boolean started;
- public static String NAME = "InVM";
-
- public BufferedStreamOutput()
- {
- this(UUID.randomUUID().toString());
- }
+ public static String NAME = "InVM";
- public BufferedStreamOutput(String name)
- {
- this.streamName = name;
- newDataLists = new LinkedList<EventMessage[]>();
- oldDataLists = new LinkedList<EventMessage[]>();
- }
+ public BufferedStreamOutput()
+ {
+ this(UUID.randomUUID().toString());
+ }
+ public BufferedStreamOutput(String name)
+ {
+ this.streamName = name;
+ newDataLists = new LinkedList<EventMessage[]>();
+ oldDataLists = new LinkedList<EventMessage[]>();
+ }
- public BufferedStreamOutput start()
- {
- this.started = true;
- return this;
- }
- public BufferedStreamOutput stop()
- {
- this.started = false;
- return this;
- }
+ public BufferedStreamOutput start()
+ {
+ this.started = true;
+ return this;
+ }
- public boolean isStarted()
- {
- return this.started;
- }
+ public BufferedStreamOutput stop()
+ {
+ this.started = false;
+ return this;
+ }
- public String getStreamName()
- {
- return this.streamName;
- }
+ public boolean isStarted()
+ {
+ return this.started;
+ }
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
- public void setStreamName(String name)
- {
- this.streamName = name;
- }
- public void write(EventMessage[] args)
- {
- update(args, new EventMessage[]{});
- }
+ public void setStreamName(String name)
+ {
+ this.streamName = name;
+ }
- public void update(EventMessage[] newDatas, EventMessage[] oldDatas)
- {
- this.oldDataLists.add(oldDatas);
- this.newDataLists.add(newDatas);
+ public void write(EventMessage[] args)
+ {
+ update(args, new EventMessage[]{});
+ }
- this.lastNewDatas = newDatas;
- this.lastOldDatas = oldDatas;
+ public void update(EventMessage[] newDatas, EventMessage[] oldDatas)
+ {
+ this.oldDataLists.add(oldDatas);
+ this.newDataLists.add(newDatas);
- isInvoked = true;
- }
+ this.lastNewDatas = newDatas;
+ this.lastOldDatas = oldDatas;
- public void reset()
- {
- this.oldDataLists.clear();
- this.newDataLists.clear();
- this.lastNewDatas = null;
- this.lastOldDatas = null;
- isInvoked = false;
- }
+ isInvoked = true;
+ }
- public EventMessage[] getLastNewData()
- {
- return lastNewDatas;
- }
+ public void reset()
+ {
+ this.oldDataLists.clear();
+ this.newDataLists.clear();
+ this.lastNewDatas = null;
+ this.lastOldDatas = null;
+ isInvoked = false;
+ }
- public EventMessage[] getAndResetLastNewData()
- {
- EventMessage[] lastNews = lastNewDatas;
- lastNewDatas = null;
- return lastNews;
- }
+ public EventMessage[] getLastNewData()
+ {
+ return lastNewDatas;
+ }
- public EventMessage[] getLastOldData()
- {
- return lastOldDatas;
- }
+ public EventMessage[] getAndResetLastNewData()
+ {
+ EventMessage[] lastNews = lastNewDatas;
+ lastNewDatas = null;
+ return lastNews;
+ }
- public List<EventMessage[]> getNewDataList()
- {
- return newDataLists;
- }
+ public EventMessage[] getLastOldData()
+ {
+ return lastOldDatas;
+ }
- public List<EventMessage[]> getOldDataList()
- {
- return oldDataLists;
- }
+ public List<EventMessage[]> getNewDataList()
+ {
+ return newDataLists;
+ }
- public boolean isInvoked()
- {
- return isInvoked;
- }
+ public List<EventMessage[]> getOldDataList()
+ {
+ return oldDataLists;
+ }
- public boolean getAndClearIsInvoked()
- {
- boolean invoked = isInvoked;
- isInvoked = false;
- return invoked;
- }
+ public boolean isInvoked()
+ {
+ return isInvoked;
+ }
- public void setLastNewData(EventMessage[] lastNewDatas)
- {
- this.lastNewDatas = lastNewDatas;
- }
+ public boolean getAndClearIsInvoked()
+ {
+ boolean invoked = isInvoked;
+ isInvoked = false;
+ return invoked;
+ }
- public void setLastOldData(EventMessage[] lastOldDatas)
- {
- this.lastOldDatas = lastOldDatas;
- }
+ public void setLastNewData(EventMessage[] lastNewDatas)
+ {
+ this.lastNewDatas = lastNewDatas;
+ }
- public EventMessage assertOneGetNewAndReset()
- {
- Assert.assertTrue(isInvoked);
+ public void setLastOldData(EventMessage[] lastOldDatas)
+ {
+ this.lastOldDatas = lastOldDatas;
+ }
- Assert.assertEquals(1, newDataLists.size());
- Assert.assertEquals(1, oldDataLists.size());
+ public EventMessage assertOneGetNewAndReset()
+ {
+ Assert.assertTrue(isInvoked);
- Assert.assertEquals(1, lastNewDatas.length);
- Assert.assertNull(lastOldDatas);
+ Assert.assertEquals(1, newDataLists.size());
+ Assert.assertEquals(1, oldDataLists.size());
- EventMessage lastNew = lastNewDatas[0];
- reset();
- return lastNew;
- }
+ Assert.assertEquals(1, lastNewDatas.length);
+ Assert.assertNull(lastOldDatas);
+ EventMessage lastNew = lastNewDatas[0];
+ reset();
+ return lastNew;
+ }
+
}
\ No newline at end of file
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -22,148 +22,154 @@
package org.jboss.test.sam.samples.aggregation;
import junit.framework.TestCase;
+import org.javasim.streams.UniformStream;
+import org.jboss.sam.EventMessage;
import org.jboss.sam.simulation.*;
-import org.jboss.sam.EventMessage;
-import org.javasim.streams.UniformStream;
-import java.util.*;
import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
/**
* An aggregation example.
- *
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class AggregationTestCase extends TestCase
{
- EventSimulation simulation;
- SimulationContext context;
+ EventSimulation simulation;
+ SimulationContext context;
- EventSourceEntity source;
- EventSinkEntity sink;
+ EventSourceEntity source;
+ EventSinkEntity sink;
- protected void setUp() throws Exception
- {
- // config
- Properties config = new Properties();
- config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
- // init
- simulation = EventSimulation.bootstrap(config,
+ // init
+ simulation = EventSimulation.bootstrap(config,
Thread.currentThread().getContextClassLoader().getResource("simulation/sam-cfg.xml")
- );
+ );
- // shared between all entities
- context = simulation.getContext();
+ // shared between all entities
+ context = simulation.getContext();
- // create an event source and sink
- source = new EventSourceEntity("RetailStoreEventSource", 0.05);
- sink = new EventSinkEntity("SalesVolumeMonitor");
+ // create an event source and sink
+ source = new EventSourceEntity("RetailStoreEventSource", 0.05);
+ sink = new EventSinkEntity("SalesVolumeMonitor");
- }
+ }
- protected void tearDown() throws Exception
- {
- simulation.done();
- }
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
- @SuppressWarnings({"unchecked"})
- public void testEventAggregation()
- {
- // associate a source factory
- source.setEventMessageFactory(
+ @SuppressWarnings({"unchecked"})
+ public void testEventAggregation()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
new EventMessageFactory()
{
- String[] stores = new String[] {"London", "Paris", "Mailand"};
+ String[] stores = new String[]{"London", "Paris", "Mailand"};
- UniformStream rndStore = new UniformStream(1,3);
- UniformStream salesVolume = new UniformStream(1,100);
+ UniformStream rndStore = new UniformStream(1, 3);
+ UniformStream salesVolume = new UniformStream(1, 100);
- public Object createEventMessage(SimulationContext context)
- {
- context.getMeasurement("dispatched").increment();
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
- // we need at least a single match for the test case
- String store = randomStore();
- SalesEventMessage salesEvent = new SalesEventMessage(
+ // we need at least a single match for the test case
+ String store = randomStore();
+ SalesEventMessage salesEvent = new SalesEventMessage(
store,
getVolumen(),
System.currentTimeMillis()
- );
+ );
- return salesEvent;
- }
+ return salesEvent;
+ }
- public String randomStore()
- {
- try
- {
- double value = Math.round(rndStore.getNumber());
- int l = new Double(value).intValue();
- return stores[l-1];
- }
- catch (IOException e)
- {
- return stores[0];
- }
- }
+ public String randomStore()
+ {
+ try
+ {
+ double value = Math.round(rndStore.getNumber());
+ int l = new Double(value).intValue();
+ return stores[l - 1];
+ }
+ catch (IOException e)
+ {
+ return stores[0];
+ }
+ }
- public double getVolumen()
- {
- try
- {
- return salesVolume.getNumber();
- } catch (IOException e)
- {
- return 10.00;
- }
- }
+ public double getVolumen()
+ {
+ try
+ {
+ return salesVolume.getNumber();
+ }
+ catch (IOException e)
+ {
+ return 10.00;
+ }
+ }
}
- );
+ );
- // associate a sink handler
- sink.setEventHandler(
+ // associate a sink handler
+ sink.setEventHandler(
new EventSinkHandler()
{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- if(null==context.getAttachment(List.class))
- context.addAttachment(List.class, new ArrayList<EventMessage>());
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if (null == context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
- context.getAttachment(List.class).addAll(Arrays.asList(events));
- context.getMeasurement("processed").increment();
- }
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
}
- );
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // Filters high value orders with amount>5
- simulation.createStatement("insert into AverageSalesVolume " +
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into AverageSalesVolume " +
"select s.store as location, sum(s.salesVolume) as avg " +
"from org.jboss.test.sam.samples.aggregation.SalesEventMessage.win:length_batch(10) as s " +
"group by s.store");
- // Forward any highvalue order to the HighValueMonitor
- simulation.bindStatement("select * from AverageSalesVolume", sink);
+ // Forward any highvalue order to the HighValueMonitor
+ String epl = "select * from AverageSalesVolume";
+ simulation.bindStatement(new ByteArrayInputStream(epl.getBytes()), sink);
- // start simulation
- simulation.singleRun();
+ // start simulation
+ simulation.singleRun();
- // display status
- context.dump(System.out);
+ // display status
+ context.dump(System.out);
- // evaluate results
- List<EventMessage> eventMessages = context.getAttachment(List.class);
- assertNotNull(eventMessages);
- assertTrue(eventMessages.size()>=1);
-
- for(EventMessage e : eventMessages)
- {
- System.out.println(e.getProperty("location")+", " + e.getProperty("avg"));
- }
- }
-
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size() >= 1);
+
+ for (EventMessage e : eventMessages)
+ {
+ System.out.println(e.getProperty("location") + ", " + e.getProperty("avg"));
+ }
+ }
+
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -21,37 +21,35 @@
*/
package org.jboss.test.sam.samples.aggregation;
-import java.util.Date;
-
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public final class SalesEventMessage
{
- private String store;
- private double salesVolume;
- private long timestamp;
+ private String store;
+ private double salesVolume;
+ private long timestamp;
- public SalesEventMessage(String store, double salesVolume, long timestamp)
- {
- this.store = store;
- this.salesVolume = salesVolume;
- this.timestamp = timestamp;
- }
+ public SalesEventMessage(String store, double salesVolume, long timestamp)
+ {
+ this.store = store;
+ this.salesVolume = salesVolume;
+ this.timestamp = timestamp;
+ }
- public String getStore()
- {
- return store;
- }
+ public String getStore()
+ {
+ return store;
+ }
- public double getSalesVolume()
- {
- return salesVolume;
- }
+ public double getSalesVolume()
+ {
+ return salesVolume;
+ }
- public long getTimestamp()
- {
- return timestamp;
- }
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -25,6 +25,7 @@
import org.jboss.sam.EventMessage;
import org.jboss.sam.simulation.*;
+import java.io.ByteArrayInputStream;
import java.util.*;
/**
@@ -34,110 +35,113 @@
*/
public class FalloffTestCase extends TestCase
{
- EventSimulation simulation;
- SimulationContext context;
+ EventSimulation simulation;
+ SimulationContext context;
- EventSourceEntity source;
- EventSinkEntity sink;
+ EventSourceEntity source;
+ EventSinkEntity sink;
- protected void setUp() throws Exception
- {
- // config
- Properties config = new Properties();
- config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
- // init
- simulation = EventSimulation.bootstrap(config,
+ // init
+ simulation = EventSimulation.bootstrap(config,
Thread.currentThread().getContextClassLoader().getResource("simulation/sam-cfg.xml")
- );
+ );
- // shared between all entities
- context = simulation.getContext();
+ // shared between all entities
+ context = simulation.getContext();
- // create an event source and sink
- source = new EventSourceEntity("FactoryLine", 0.03);
- sink = new EventSinkEntity("ProductionRateMonitor");
+ // create an event source and sink
+ source = new EventSourceEntity("FactoryLine", 0.03);
+ sink = new EventSinkEntity("ProductionRateMonitor");
- }
+ }
- protected void tearDown() throws Exception
- {
- simulation.done();
- }
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
- @SuppressWarnings({"unchecked"})
- public void testEventFiltering()
- {
- // associate a source factory
- source.setEventMessageFactory(
+ @SuppressWarnings({"unchecked"})
+ public void testEventFiltering()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
new EventMessageFactory()
{
- Calendar c = new GregorianCalendar();
- int numMessages = 0;
+ Calendar c = new GregorianCalendar();
+ int numMessages = 0;
- public Object createEventMessage(SimulationContext context)
- {
- context.getMeasurement("dispatched").increment();
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
- // simulate a falloff after 20 messages. Production goes down 50%...
- if(numMessages<20)
- c.add(Calendar.SECOND, 3);
- else
- c.add(Calendar.SECOND, 6);
+ // simulate a falloff after 20 messages. Production goes down 50%...
+ if (numMessages < 20)
+ c.add(Calendar.SECOND, 3);
+ else
+ c.add(Calendar.SECOND, 6);
- long ts = c.getTimeInMillis();
+ long ts = c.getTimeInMillis();
- ProductionEventMessage productionRate = new ProductionEventMessage("Assembly Line-A", ts);
- numMessages++;
- return productionRate;
- }
+ ProductionEventMessage productionRate = new ProductionEventMessage("Assembly Line-A", ts);
+ numMessages++;
+ return productionRate;
+ }
}
- );
+ );
- // associate a sink handler
- sink.setEventHandler(
+ // associate a sink handler
+ sink.setEventHandler(
new EventSinkHandler()
{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- if(null==context.getAttachment(List.class))
- context.addAttachment(List.class, new ArrayList<EventMessage>());
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if (null == context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
- context.getAttachment(List.class).addAll(Arrays.asList(events));
- context.getMeasurement("processed").increment();
- }
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
}
- );
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // Filters high value orders with amount>5
- simulation.createStatement("insert into RatePerTenSeconds " +
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into RatePerTenSeconds " +
"select line, count(*) as cnt " +
"from org.jboss.test.sam.samples.falloff.ProductionEventMessage" +
".win:ext_timed(timestamp, 10 seconds)");
- // Forward any highvalue order to the monitor
- simulation.bindStatement("select line, avg(cnt) as avgCnt " +
+ // Forward any highvalue order to the monitor
+
+ String epl = "select line, avg(cnt) as avgCnt " +
"from RatePerTenSeconds.win:length(6) " +
"group by line " +
- "having cnt < avg(cnt) * 0.75", sink);
-
- // start simulation
- simulation.singleRun();
+ "having cnt < avg(cnt) * 0.75";
- // display status
- context.dump(System.out);
+ simulation.bindStatement(new ByteArrayInputStream(epl.getBytes()), sink);
- // evaluate results
- List<EventMessage> eventMessages = context.getAttachment(List.class);
- assertNotNull(eventMessages);
- assertTrue(eventMessages.size()>=1);
+ // start simulation
+ simulation.singleRun();
- for(EventMessage e : eventMessages)
- {
- System.out.println(e.getProperty("line")+": " + e.getProperty("avgCnt"));
- }
- }
+ // display status
+ context.dump(System.out);
+
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size() >= 1);
+
+ for (EventMessage e : eventMessages)
+ {
+ System.out.println(e.getProperty("line") + ": " + e.getProperty("avgCnt"));
+ }
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -26,23 +26,23 @@
*/
public final class ProductionEventMessage
{
- String line;
- long timestamp;
+ String line;
+ long timestamp;
- public ProductionEventMessage(String line, long timestamp)
- {
- this.line = line;
- this.timestamp = timestamp;
- }
+ public ProductionEventMessage(String line, long timestamp)
+ {
+ this.line = line;
+ this.timestamp = timestamp;
+ }
- public String getLine()
- {
- return line;
- }
-
- public long getTimestamp()
- {
- return timestamp;
- }
+ public String getLine()
+ {
+ return line;
+ }
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -28,6 +28,7 @@
import org.jboss.test.sam.samples.filtering.OrderEventMessage;
import java.io.IOException;
+import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -39,121 +40,122 @@
* <li>One statement to filter high value orders (unbound)
* <li>Anotherone that forwards the results to a monitor (bound)
* </ul>
- *
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class FilteringTestCase extends TestCase
{
- EventSimulation simulation;
- SimulationContext context;
+ EventSimulation simulation;
+ SimulationContext context;
- EventSourceEntity source;
- EventSinkEntity sink;
+ EventSourceEntity source;
+ EventSinkEntity sink;
- protected void setUp() throws Exception
- {
- // config
- Properties config = new Properties();
- config.put(EventSimulation.TOTAL_SIM_TIME, 75.00);
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 75.00);
- // init
- simulation = EventSimulation.bootstrap(config,
+ // init
+ simulation = EventSimulation.bootstrap(config,
Thread.currentThread().getContextClassLoader().getResource("simulation/sam-cfg.xml")
- );
+ );
- // shared between all entities
- context = simulation.getContext();
+ // shared between all entities
+ context = simulation.getContext();
- // create an event source and sink
- source = new EventSourceEntity("OrderEventSource", 0.10);
- sink = new EventSinkEntity("HighValueMonitor");
+ // create an event source and sink
+ source = new EventSourceEntity("OrderEventSource", 0.10);
+ sink = new EventSinkEntity("HighValueMonitor");
- }
+ }
- protected void tearDown() throws Exception
- {
- simulation.done();
- }
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
- @SuppressWarnings({"unchecked"})
- public void testEventFiltering()
- {
- // associate a source factory
- source.setEventMessageFactory(
+ @SuppressWarnings({"unchecked"})
+ public void testEventFiltering()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
new EventMessageFactory()
{
- boolean singleMatchEnforced;
- UniformStream unitStream = new UniformStream(1,10);
+ boolean singleMatchEnforced;
+ UniformStream unitStream = new UniformStream(1, 10);
- public Object createEventMessage(SimulationContext context)
- {
- context.getMeasurement("dispatched").increment();
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
- // we need at least a single match for the test case
- long amount = singleMatchEnforced ? calcAmount() : 10;
- if(!singleMatchEnforced) singleMatchEnforced = true;
+ // we need at least a single match for the test case
+ long amount = singleMatchEnforced ? calcAmount() : 10;
+ if (!singleMatchEnforced) singleMatchEnforced = true;
- OrderEventMessage order = new OrderEventMessage("Stereo", amount);
- return order;
- }
+ OrderEventMessage order = new OrderEventMessage("Stereo", amount);
+ return order;
+ }
- public long calcAmount()
- {
- try
- {
- double value = Math.floor(unitStream.getNumber());
- return new Double(value).longValue();
- }
- catch (IOException e)
- {
- return 1;
- }
- }
+ public long calcAmount()
+ {
+ try
+ {
+ double value = Math.floor(unitStream.getNumber());
+ return new Double(value).longValue();
+ }
+ catch (IOException e)
+ {
+ return 1;
+ }
+ }
}
- );
+ );
- // associate a sink handler
- sink.setEventHandler(
+ // associate a sink handler
+ sink.setEventHandler(
new EventSinkHandler()
{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- if(null==context.getAttachment(List.class))
- context.addAttachment(List.class, new ArrayList<EventMessage>());
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if (null == context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
- context.getAttachment(List.class).addAll(Arrays.asList(events));
- context.getMeasurement("processed").increment();
- }
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
}
- );
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // Filters high value orders with amount>5
- simulation.createStatement("insert into HighValueOrders " +
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into HighValueOrders " +
"select * from org.jboss.test.sam.samples.filtering.OrderEventMessage as o " +
"where o.amount>5");
- // Forward any highvalue order to the HighValueMonitor
- simulation.bindStatement("select * from HighValueOrders", sink);
+ // Forward any highvalue order to the HighValueMonitor
+ String epl = "select * from HighValueOrders";
+ simulation.bindStatement(new ByteArrayInputStream(epl.getBytes()), sink);
- // start simulation
- simulation.singleRun();
+ // start simulation
+ simulation.singleRun();
- // display status
- printStatus();
+ // display status
+ printStatus();
- // evaluate results
- List<EventMessage> eventMessages = context.getAttachment(List.class);
- assertNotNull(eventMessages);
- assertTrue(eventMessages.size()>=1);
- }
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size() >= 1);
+ }
- private void printStatus()
- {
- System.out.println("Dispatched: "+context.getMeasurement("dispatched"));
- System.out.println("Processed: "+context.getMeasurement("processed"));
- }
+ private void printStatus()
+ {
+ System.out.println("Dispatched: " + context.getMeasurement("dispatched"));
+ System.out.println("Processed: " + context.getMeasurement("processed"));
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -26,32 +26,32 @@
*/
public final class OrderEventMessage
{
- private String product;
- private long amount;
+ private String product;
+ private long amount;
- public OrderEventMessage(String product, long amount)
- {
- this.product = product;
- this.amount = amount;
- }
+ public OrderEventMessage(String product, long amount)
+ {
+ this.product = product;
+ this.amount = amount;
+ }
- public String getProduct()
- {
- return product;
- }
+ public String getProduct()
+ {
+ return product;
+ }
- public void setProduct(String product)
- {
- this.product = product;
- }
+ public void setProduct(String product)
+ {
+ this.product = product;
+ }
- public long getAmount()
- {
- return amount;
- }
+ public long getAmount()
+ {
+ return amount;
+ }
- public void setAmount(long amount)
- {
- this.amount = amount;
- }
+ public void setAmount(long amount)
+ {
+ this.amount = amount;
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -26,21 +26,21 @@
*/
public final class LightSwitchEventMessage
{
- boolean enabled;
+ boolean enabled;
- public LightSwitchEventMessage(boolean enabled)
- {
- this.enabled = enabled;
- }
+ public LightSwitchEventMessage(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
- public boolean getEnabled()
- {
- return enabled;
- }
+ public boolean getEnabled()
+ {
+ return enabled;
+ }
- public String toString()
- {
- return "LightSwitch{enabled="+this.enabled+"}";
- }
+ public String toString()
+ {
+ return "LightSwitch{enabled=" + this.enabled + "}";
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -26,162 +26,165 @@
import org.jboss.sam.simulation.*;
import java.util.Properties;
+import java.io.ByteArrayInputStream;
/**
* A simple pattern example.
- *
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class PatternTestCase extends TestCase
{
- EventSimulation simulation;
- SimulationContext context;
+ EventSimulation simulation;
+ SimulationContext context;
- EventSourceEntity source;
- EventSinkEntity sink;
+ EventSourceEntity source;
+ EventSinkEntity sink;
- protected void setUp() throws Exception
- {
- // config
- Properties config = new Properties();
- config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
- // init
- simulation = EventSimulation.bootstrap(
+ // init
+ simulation = EventSimulation.bootstrap(
config,
Thread.currentThread().getContextClassLoader().getResource("samples/pattern/esper-cfg.xml")
- );
+ );
- // shared between all entities
- context = simulation.getContext();
+ // shared between all entities
+ context = simulation.getContext();
- // create an event source and sink
- source = new EventSourceEntity("LightSwitch", 0.10);
- sink = new EventSinkEntity("LightMonitor");
+ // create an event source and sink
+ source = new EventSourceEntity("LightSwitch", 0.10);
+ sink = new EventSinkEntity("LightMonitor");
- }
+ }
- protected void tearDown() throws Exception
- {
- simulation.done();
- }
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
- public void testRegularLightSwitch()
- {
- // associate a source factory
- source.setEventMessageFactory(
+ public void testRegularLightSwitch()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
new EventMessageFactory()
{
- private boolean lastState;
+ private boolean lastState;
- public Object createEventMessage(SimulationContext context)
- {
- context.getMeasurement("dispatched").increment();
- LightSwitchEventMessage message = new LightSwitchEventMessage(lastState);
- lastState = !lastState;
- return message;
- }
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
+ LightSwitchEventMessage message = new LightSwitchEventMessage(lastState);
+ lastState = !lastState;
+ return message;
+ }
}
- );
+ );
- // associate a sink handler
- sink.setEventHandler(
+ // associate a sink handler
+ sink.setEventHandler(
new EventSinkHandler()
{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- context.getMeasurement("processed").increment();
- context.addAttachment(EventMessage.class, events[0]);
- }
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.getMeasurement("processed").increment();
+ context.addAttachment(EventMessage.class, events[0]);
+ }
}
- );
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // forward single event messages
- simulation.bindStatement("select B.* from pattern [every (A=LightSwitchEventMessage(enabled=true) -> B=LightSwitchEventMessage(enabled=false))]", sink);
+ // forward single event messages
+ String epl = "select B.* from pattern [every (A=LightSwitchEventMessage(enabled=true) -> B=LightSwitchEventMessage(enabled=false))]";
+ simulation.bindStatement(new ByteArrayInputStream(epl.getBytes()), sink);
- // start simulation
- simulation.singleRun();
+ // start simulation
+ simulation.singleRun();
- // display status
- printStatus();
+ // display status
+ printStatus();
- // evaluate results
- EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
- assertNotNull(lastEventMessage);
- assertEquals(false, lastEventMessage.getProperty("enabled"));
- }
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(false, lastEventMessage.getProperty("enabled"));
+ }
- private void printStatus()
- {
- System.out.println("Dispatched: "+context.getMeasurement("dispatched"));
- System.out.println("Processed: "+context.getMeasurement("processed"));
- }
+ private void printStatus()
+ {
+ System.out.println("Dispatched: " + context.getMeasurement("dispatched"));
+ System.out.println("Processed: " + context.getMeasurement("processed"));
+ }
- public void testDetectLightSwitchFailure()
- {
- // associate a source factory
- source.setEventMessageFactory(
+ public void testDetectLightSwitchFailure()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
new EventMessageFactory()
{
- private boolean lastState;
+ private boolean lastState;
- public Object createEventMessage(SimulationContext context)
- {
- LightSwitchEventMessage message = null;
+ public Object createEventMessage(SimulationContext context)
+ {
+ LightSwitchEventMessage message = null;
- double d = context.getMeasurement("dispatched").getCurrent();
- if(d!=3)
- {
- // create a regular light switch condition
- message = new LightSwitchEventMessage(lastState);
- }
- else
- {
- // create an error condition: two times same enabled value
- message = new LightSwitchEventMessage(!lastState);
- }
+ double d = context.getMeasurement("dispatched").getCurrent();
+ if (d != 3)
+ {
+ // create a regular light switch condition
+ message = new LightSwitchEventMessage(lastState);
+ }
+ else
+ {
+ // create an error condition: two times same enabled value
+ message = new LightSwitchEventMessage(!lastState);
+ }
- lastState = !lastState;
- context.getMeasurement("dispatched").increment();
- return message;
- }
+ lastState = !lastState;
+ context.getMeasurement("dispatched").increment();
+ return message;
+ }
}
- );
+ );
- // associate a sink handler
- sink.setEventHandler(
+ // associate a sink handler
+ sink.setEventHandler(
new EventSinkHandler()
{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- context.getMeasurement("processed").increment();
- context.addAttachment(EventMessage.class, events[0]);
- }
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.getMeasurement("processed").increment();
+ context.addAttachment(EventMessage.class, events[0]);
+ }
}
- );
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // forward single event messages
- simulation.bindStatement("select A.enabled as firstEnabled, B.enabled as secondEnabled "+
- "from pattern [every (A=LightSwitchEventMessage(enabled=false) -> B=LightSwitchEventMessage(enabled=false))]", sink);
+ // forward single event messages
+ String epl = "select A.enabled as firstEnabled, B.enabled as secondEnabled " +
+ "from pattern [every (A=LightSwitchEventMessage(enabled=false) -> B=LightSwitchEventMessage(enabled=false))]";
+ simulation.bindStatement(new ByteArrayInputStream(epl.getBytes()), sink);
- // start simulation
- simulation.singleRun();
+ // start simulation
+ simulation.singleRun();
- // display status
- printStatus();
+ // display status
+ printStatus();
- // evaluate results
- EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
- assertNotNull(lastEventMessage);
- assertEquals(false, lastEventMessage.getProperty("firstEnabled"));
- assertEquals(false, lastEventMessage.getProperty("secondEnabled"));
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(false, lastEventMessage.getProperty("firstEnabled"));
+ assertEquals(false, lastEventMessage.getProperty("secondEnabled"));
- }
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -26,34 +26,34 @@
*/
public class SensorEventMessage
{
- private String source;
- private double surveyValue;
- private double simTime;
+ private String source;
+ private double surveyValue;
+ private double simTime;
- public SensorEventMessage(String source, double surveyValue, double simTime)
- {
- this.source = source;
- this.surveyValue = surveyValue;
- this.simTime = simTime;
- }
+ public SensorEventMessage(String source, double surveyValue, double simTime)
+ {
+ this.source = source;
+ this.surveyValue = surveyValue;
+ this.simTime = simTime;
+ }
- public String getSource()
- {
- return source;
- }
+ public String getSource()
+ {
+ return source;
+ }
- public double getSurveyValue()
- {
- return surveyValue;
- }
+ public double getSurveyValue()
+ {
+ return surveyValue;
+ }
- public double getSimTime()
- {
- return simTime;
- }
+ public double getSimTime()
+ {
+ return simTime;
+ }
- public String toString()
- {
- return "[@"+simTime+": "+source+"->"+surveyValue+"]";
- }
+ public String toString()
+ {
+ return "[@" + simTime + ": " + source + "->" + surveyValue + "]";
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -21,9 +21,9 @@
*/
package org.jboss.test.sam.simulation;
+import org.javasim.streams.ExponentialStream;
import org.jboss.sam.simulation.EventMessageFactory;
import org.jboss.sam.simulation.SimulationContext;
-import org.javasim.streams.ExponentialStream;
import java.io.IOException;
@@ -32,23 +32,23 @@
*/
public class SensorMessageFactory implements EventMessageFactory
{
- private ExponentialStream STime = new ExponentialStream(1,5);
+ private ExponentialStream STime = new ExponentialStream(1, 5);
- public Object createEventMessage(SimulationContext context)
- {
- context.getMeasurement("numDispatched").increment();
- return new SensorEventMessage("source-A", getSurveyValue(), context.getCurrentSimulationTime() );
- }
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("numDispatched").increment();
+ return new SensorEventMessage("source-A", getSurveyValue(), context.getCurrentSimulationTime());
+ }
- public double getSurveyValue()
- {
- try
- {
- return STime.getNumber();
- }
- catch (IOException e)
- {
- return 0.0;
- }
- }
+ public double getSurveyValue()
+ {
+ try
+ {
+ return STime.getNumber();
+ }
+ catch (IOException e)
+ {
+ return 0.0;
+ }
+ }
}
Modified: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java 2009-07-15 08:39:59 UTC (rev 661)
@@ -34,59 +34,58 @@
*/
public class SimulationTestCase extends TestCase
{
- public void testSimulationAPI()
- {
- // config
- Properties config = new Properties();
- config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+ public void testSimulationAPI()
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
- // init
- EventSimulation simulation = EventSimulation.bootstrap(config,
+ // init
+ EventSimulation simulation = EventSimulation.bootstrap(config,
Thread.currentThread().getContextClassLoader().getResource("simulation/sam-cfg.xml")
- );
+ );
- // shared between all entities
- SimulationContext context = simulation.getContext();
+ // shared between all entities
+ SimulationContext context = simulation.getContext();
- // create an event source and associate a message factory
- EventSourceEntity source = new EventSourceEntity("EventSource_A", 0.10);
- source.setEventMessageFactory(
- new EventMessageFactory()
- {
- public Object createEventMessage(SimulationContext context)
- {
- return new SensorEventMessage("source-A", 12.00, context.getCurrentSimulationTime() );
- }
- }
- );
-
- // create an event sink and associate handler
- EventSinkEntity sink = new EventSinkEntity("EventSink_B");
- sink.setEventHandler(
- new EventSinkHandler()
- {
- public void handle(EventMessage[] events, SimulationContext context)
- {
- context.addAttachment(EventMessage.class, events[0]);
- }
- }
- );
+ // create an event source and associate a message factory
+ EventSourceEntity source = new EventSourceEntity("EventSource_A", 0.10);
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ public Object createEventMessage(SimulationContext context)
+ {
+ return new SensorEventMessage("source-A", 12.00, context.getCurrentSimulationTime());
+ }
+ }
+ );
- simulation.addSource(source);
- simulation.addSink(sink);
+ // create an event sink and associate handler
+ EventSinkEntity sink = new EventSinkEntity("EventSink_B");
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.addAttachment(EventMessage.class, events[0]);
+ }
+ }
+ );
- // DRL
- String epl = EventSimulation.getDRLFromResource("simulation/test.drl");
+ simulation.addSource(source);
+ simulation.addSink(sink);
- // forward single event messages
- simulation.bindStatement(epl, sink);
+ // DRL
+ // forward single event messages
+ simulation.bindStatement(
+ EventSimulation.loadDRL("simulation/test.drl"), sink);
- // start simulation
- simulation.singleRun();
+ // start simulation
+ simulation.singleRun();
- // evaluate results
- EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
- assertNotNull("No event reveived", lastEventMessage);
- assertEquals(12.00, lastEventMessage.getProperty("surveyValue"));
- }
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull("No event reveived", lastEventMessage);
+ assertEquals(12.00, lastEventMessage.getProperty("surveyValue"));
+ }
}
Modified: sam/trunk/modules/sim/src/test/resources/simulation/sam-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/simulation/sam-cfg.xml 2009-07-14 12:23:58 UTC (rev 660)
+++ sam/trunk/modules/sim/src/test/resources/simulation/sam-cfg.xml 2009-07-15 08:39:59 UTC (rev 661)
@@ -3,14 +3,14 @@
domain="http://org.jboss.sam/test/database"
xmlns:ns2="http://org.jboss.sam/08/2008/">
- <properties/>
+ <properties/>
- <database-references/>
+ <database-references/>
- <inputs/>
+ <inputs/>
- <outputs/>
+ <outputs/>
- <statements/>
+ <statements/>
</ns2:processingNode>
\ No newline at end of file
More information about the overlord-commits
mailing list