Author: heiko.braun(a)jboss.com
Date: 2008-07-13 08:34:47 -0400 (Sun, 13 Jul 2008)
New Revision: 147
Added:
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java
Modified:
sam/trunk/SAM.iws
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java
Log:
Added simple aggregation example
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-13 12:34:24 UTC (rev 146)
+++ sam/trunk/SAM.iws 2008-07-13 12:34:47 UTC (rev 147)
@@ -21,17 +21,21 @@
<list default="true" name="Default" comment="">
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/internal/SimulationProcessList.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/internal/SimulationProcessList.java"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/Scheduler.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/Scheduler.java"
/>
+ <change type="NEW" beforePath=""
afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Histogram.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Histogram.java"
/>
+ <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java"
afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java"
/>
+ <change type="NEW" beforePath=""
afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java"
/>
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java"
afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java"
/>
+ <change type="NEW" beforePath=""
afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java"
/>
+ <change type="NEW" beforePath=""
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/util"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/SimpleHistogram.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/SimpleHistogram.java"
/>
- <change type="NEW" beforePath=""
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/util"
/>
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java"
afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java"
/>
+ <change type="NEW" beforePath=""
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/util/ThreadUtil.java"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/pom.xml"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/pom.xml" />
- <change type="NEW" beforePath=""
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/util/ThreadUtil.java"
/>
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java"
afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java"
/>
<change type="MODIFICATION"
beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Variance.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Variance.java"
/>
- <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml"
/>
+ <change type="NEW" beforePath=""
afterPath="$PROJECT_DIR$/src/test/resources/samples/esper-default-cfg.xml"
/>
+ <change type="MODIFICATION"
beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java"
afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Mean.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Mean.java"
/>
<change type="MODIFICATION"
beforePath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/SimulationProcess.java"
afterPath="/home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/SimulationProcess.java"
/>
</list>
@@ -175,55 +179,66 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="EventSimulation.java" pinned="false"
current="false" current-in-tab="false">
- <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <file leaf-file-name="AggregationTestCase.java"
pinned="false" current="true" current-in-tab="true">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="108" column="16"
selection-start="4352" selection-end="4352"
vertical-scroll-proportion="0.1381346">
+ <state line="42" column="70"
selection-start="1620" selection-end="1620"
vertical-scroll-proportion="-1.8419783">
+ <folding>
+ <element signature="imports" expanded="true"
/>
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="EventAdapter.java" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java">
+ <provider selected="true"
editor-type-id="text-editor">
+ <state line="101" column="50"
selection-start="2690" selection-end="2690"
vertical-scroll-proportion="0.95416164">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="PrecisionHistogram.java"
pinned="false" current="false" current-in-tab="false">
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/PrecisionHistogram.java">
+ <file leaf-file-name="SensorMessageFactory.java"
pinned="false" current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="243" column="12"
selection-start="6168" selection-end="6168"
vertical-scroll-proportion="0.1570248">
+ <state line="52" column="4"
selection-start="1680" selection-end="1846"
vertical-scroll-proportion="0.64173704">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="Quantile.java" pinned="false"
current="false" current-in-tab="false">
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Quantile.java">
+ <file leaf-file-name="EsperRuntimeImpl.java" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="90" column="8"
selection-start="2393" selection-end="2393"
vertical-scroll-proportion="0.6635183">
+ <state line="109" column="0"
selection-start="3486" selection-end="3486"
vertical-scroll-proportion="0.09408926">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="SimulationTestCase.java"
pinned="false" current="true" current-in-tab="true">
- <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
+ <file leaf-file-name="EventSimulation.java" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="64" column="23"
selection-start="2340" selection-end="2340"
vertical-scroll-proportion="0.25974026">
+ <state line="143" column="38"
selection-start="5178" selection-end="5178"
vertical-scroll-proportion="0.45476478">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="SensorEventMessage.java"
pinned="false" current="false" current-in-tab="false">
- <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java">
+ <file leaf-file-name="OrderEventMessage.java" pinned="false"
current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="21" column="37"
selection-start="1040" selection-end="1069"
vertical-scroll-proportion="0.022432113">
+ <state line="26" column="19"
selection-start="1155" selection-end="1155"
vertical-scroll-proportion="0.13751508">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="pom.xml" pinned="false"
current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/pom.xml">
+ <file leaf-file-name="EventProcessorFactory.java"
pinned="false" current="false" current-in-tab="false">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessorFactory.java">
<provider selected="true"
editor-type-id="text-editor">
- <state line="140" column="16"
selection-start="4601" selection-end="4601"
vertical-scroll-proportion="0.58774036">
+ <state line="41" column="34"
selection-start="1429" selection-end="1429"
vertical-scroll-proportion="0.4354644">
<folding />
</state>
</provider>
@@ -481,6 +496,10 @@
<option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/test" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/test/resources" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -638,6 +657,78 @@
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/test" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/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$/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$/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$/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$/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$/src/test/java/org/jboss/test/sam/samples"
/>
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation"
/>
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SAM.ipr" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sam-trunk" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/test" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SAM.ipr" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sam-trunk" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId"
value="PsiDirectory:$PROJECT_DIR$/src/main" />
<option name="myItemType"
value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -1000,16 +1091,16 @@
</key>
</component>
<component name="RestoreUpdateTree" />
- <component name="RunManager"
selected="JUnit.SimulationTestCase.testSimulationAPI">
- <tempConfiguration default="false"
name="SimulationTestCase.testSimulationAPI" type="JUnit"
factoryName="JUnit" enabled="false" merge="false">
- <pattern value="org.jboss.test.sam.simulation.*" />
+ <component name="RunManager"
selected="JUnit.AggregationTestCase">
+ <tempConfiguration default="false" name="AggregationTestCase"
type="JUnit" factoryName="JUnit" enabled="false"
merge="false">
+ <pattern value="org.jboss.test.sam.samples.aggregation.*" />
<module name="sam-trunk" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false"
/>
<option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME"
value="org.jboss.test.sam.simulation" />
- <option name="MAIN_CLASS_NAME"
value="org.jboss.test.sam.simulation.SimulationTestCase" />
- <option name="METHOD_NAME" value="testSimulationAPI" />
- <option name="TEST_OBJECT" value="method" />
+ <option name="PACKAGE_NAME"
value="org.jboss.test.sam.samples.aggregation" />
+ <option name="MAIN_CLASS_NAME"
value="org.jboss.test.sam.samples.aggregation.AggregationTestCase" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"
/>
@@ -1313,108 +1404,112 @@
<option name="myLastEditedConfigurable" value="IDE Profiles"
/>
</component>
<component name="editorHistoryManager">
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/test/java/org/javasim/examples/basic/Main.java">
+ <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/Scheduler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="42" column="15"
selection-start="1513" selection-end="1513"
vertical-scroll-proportion="0.55006033">
+ <state line="240" column="15"
selection-start="6550" selection-end="6550"
vertical-scroll-proportion="0.54829544">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/test/java/org/javasim/examples/basic/MachineShop.java">
+ <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/PrecisionHistogram.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="40" column="32"
selection-start="1403" selection-end="1403"
vertical-scroll-proportion="0.02291918">
+ <state line="243" column="12"
selection-start="6168" selection-end="6168"
vertical-scroll-proportion="0.1570248">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/test/java/org/javasim/examples/basic/Arrivals.java">
+ <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Quantile.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="13"
selection-start="1211" selection-end="1211"
vertical-scroll-proportion="0.1363088">
+ <state line="90" column="8"
selection-start="2393" selection-end="2393"
vertical-scroll-proportion="0.6635183">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/test/java/org/javasim/examples/basic/Job.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="56" column="16"
selection-start="1749" selection-end="1749"
vertical-scroll-proportion="0.64053077">
+ <state line="21" column="37"
selection-start="1040" selection-end="1069"
vertical-scroll-proportion="0.022432113">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/test/java/org/javasim/examples/basic/Machine.java">
+ <entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="13"
selection-start="1211" selection-end="1211"
vertical-scroll-proportion="0.02291918">
+ <state line="140" column="16"
selection-start="4601" selection-end="4601"
vertical-scroll-proportion="0.58774036">
<folding />
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessorFactory.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="58" column="58"
selection-start="2128" selection-end="2128"
vertical-scroll-proportion="0.0">
+ <state line="41" column="34"
selection-start="1429" selection-end="1429"
vertical-scroll-proportion="0.4354644">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/SimulationProcess.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/resources/samples/esper-default-cfg.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="476" column="33"
selection-start="12195" selection-end="12195"
vertical-scroll-proportion="0.74788904">
+ <state line="7" column="0" selection-start="300"
selection-end="300" vertical-scroll-proportion="0.1570248">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/util/ThreadUtil.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="32" column="32"
selection-start="1263" selection-end="1263"
vertical-scroll-proportion="0.252111">
+ <state line="66" column="24"
selection-start="2151" selection-end="2151"
vertical-scroll-proportion="0.93149036">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/Scheduler.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="240" column="15"
selection-start="6550" selection-end="6550"
vertical-scroll-proportion="0.54829544">
- <folding />
+ <state line="54" column="34"
selection-start="2039" selection-end="2039"
vertical-scroll-proportion="0.76269186">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="108" column="16"
selection-start="4352" selection-end="4352"
vertical-scroll-proportion="0.1381346">
+ <state line="109" column="0"
selection-start="3486" selection-end="3486"
vertical-scroll-proportion="0.09408926">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/PrecisionHistogram.java">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="243" column="12"
selection-start="6168" selection-end="6168"
vertical-scroll-proportion="0.1570248">
+ <state line="143" column="38"
selection-start="5178" selection-end="5178"
vertical-scroll-proportion="0.45476478">
<folding />
</state>
</provider>
</entry>
- <entry
file="file:///home/hbraun/dev/prj/javasim/JavaSim/trunk/src/main/java/org/javasim/stats/Quantile.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="90" column="8"
selection-start="2393" selection-end="2393"
vertical-scroll-proportion="0.6635183">
+ <state line="26" column="19"
selection-start="1155" selection-end="1155"
vertical-scroll-proportion="0.13751508">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/pom.xml">
+ <entry
file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="140" column="16"
selection-start="4601" selection-end="4601"
vertical-scroll-proportion="0.58774036">
+ <state line="101" column="50"
selection-start="2690" selection-end="2690"
vertical-scroll-proportion="0.95416164">
<folding />
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="21" column="37"
selection-start="1040" selection-end="1069"
vertical-scroll-proportion="0.022432113">
+ <state line="52" column="4"
selection-start="1680" selection-end="1846"
vertical-scroll-proportion="0.64173704">
<folding />
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
+ <entry
file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="64" column="23"
selection-start="2340" selection-end="2340"
vertical-scroll-proportion="0.25974026">
- <folding />
+ <state line="42" column="70"
selection-start="1620" selection-end="1620"
vertical-scroll-proportion="-1.8419783">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
Modified: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java 2008-07-13
12:34:24 UTC (rev 146)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java 2008-07-13
12:34:47 UTC (rev 147)
@@ -100,5 +100,11 @@
{
return delegate;
}
+
+
+ public String toString()
+ {
+ return "EventAdapter {"+delegate.toString()+"}";
+ }
}
Added:
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
===================================================================
---
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
(rev 0)
+++
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java 2008-07-13
12:34:47 UTC (rev 147)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.sam.samples.aggregation;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+import org.javasim.streams.UniformStream;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.io.IOException;
+
+/**
+ * A simple aggregation sample that uses two statments:
+ * <ul>
+ * <li>One to aggregate high value orders (unbound)
+ * <li>Anotherone that forwards the aggregated results to a monitor (bound)
+ * </ul>
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class AggregationTestCase extends TestCase
+{
+ EventSimulation simulation;
+ SimulationContext context;
+
+ EventSourceEntity source;
+ EventSinkEntity sink;
+
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 75.00);
+
+ // init
+ simulation = EventSimulation.bootstrap(config);
+
+ // shared between all entities
+ context = simulation.getContext();
+
+ // create an event source and sink
+ source = new EventSourceEntity("OrderEventSource", 0.10);
+ sink = new EventSinkEntity("HighValueMonitor");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
+
+ public void testEventAggregation()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ boolean singleMatchEnforced;
+ UniformStream unitStream = new UniformStream(1,10);
+
+ 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;
+
+ 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;
+ }
+ }
+
+ }
+ );
+
+ // 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>());
+
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // Aggregates high value orders with amount>5
+ simulation.createStatement("insert into HighValueOrders " +
+ "select * from org.jboss.test.sam.samples.aggregation.OrderEventMessage as o
" +
+ "where o.amount>5");
+
+ // Forward any highvalue order to the HighValueMonitor
+ simulation.bindStatement("select * from HighValueOrders", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ printStatus();
+
+ // evaluate results
+ List<EventMessage> aggregatedMessages = context.getAttachment(List.class);
+ assertNotNull(aggregatedMessages);
+
+ for(EventMessage e : aggregatedMessages)
+ {
+ System.out.println("# " + e.getProperty("product") + ",
" + e.getProperty("amount"));
+ }
+
+ }
+
+ private void printStatus()
+ {
+ System.out.println("Dispatched:
"+context.getMeasurement("dispatched"));
+ System.out.println("Processed:
"+context.getMeasurement("processed"));
+ }
+}
Property changes on:
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java
(rev 0)
+++
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java 2008-07-13
12:34:47 UTC (rev 147)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.sam.samples.aggregation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class OrderEventMessage
+{
+ private String product;
+ private long amount;
+
+ public OrderEventMessage(String product, long amount)
+ {
+ this.product = product;
+ this.amount = amount;
+ }
+
+ public String getProduct()
+ {
+ return product;
+ }
+
+ public void setProduct(String product)
+ {
+ this.product = product;
+ }
+
+ public long getAmount()
+ {
+ return amount;
+ }
+
+ public void setAmount(long amount)
+ {
+ this.amount = amount;
+ }
+}
Property changes on:
sam/trunk/src/test/java/org/jboss/test/sam/samples/aggregation/OrderEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF