Overlord SVN: r114 - /.
by overlord-commits@lists.jboss.org
Author: mark.little(a)jboss.com
Date: 2008-07-04 07:18:16 -0400 (Fri, 04 Jul 2008)
New Revision: 114
Added:
example.txt
Log:
created
Added: example.txt
===================================================================
15 years, 10 months
Overlord SVN: r113 - in sam/trunk: src/test/java/org/jboss/test/sam/simulation and 1 other directory.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-04 05:43:48 -0400 (Fri, 04 Jul 2008)
New Revision: 113
Added:
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
Modified:
sam/trunk/SAM.iws
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
Log:
Add simlation API unit test
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-03 20:29:27 UTC (rev 112)
+++ sam/trunk/SAM.iws 2008-07-04 09:43:48 UTC (rev 113)
@@ -19,7 +19,8 @@
<list default="true" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.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="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -137,8 +138,8 @@
<property name="field_breakpoints_groupByClasses" value="true" />
<property name="method_breakpoints_groupByClasses" value="true" />
<property name="exception_breakpoints_viewId" value="TABLE" />
- <property name="field_breakpoints_viewId" value="TABLE" />
<property name="exception_breakpoints_groupByClasses" value="true" />
+ <property name="field_breakpoints_viewId" value="TABLE" />
<property name="method_breakpoints_groupByMethods" value="false" />
</ui_properties>
</component>
@@ -161,10 +162,19 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="EventSimulation.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <file leaf-file-name="SimulationMain.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="57" column="28" selection-start="2531" selection-end="2531" vertical-scroll-proportion="0.5041322">
+ <state line="87" column="40" selection-start="1389" selection-end="3318" vertical-scroll-proportion="0.86540735">
+ <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">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="91" column="30" selection-start="3145" selection-end="3145" vertical-scroll-proportion="0.95513576">
<folding>
<element signature="imports" expanded="true" />
</folding>
@@ -172,10 +182,10 @@
</provider>
</entry>
</file>
- <file leaf-file-name="SimulationMain.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
+ <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">
<provider selected="true" editor-type-id="text-editor">
- <state line="42" column="61" selection-start="1521" selection-end="1576" vertical-scroll-proportion="0.38134593">
+ <state line="32" column="62" selection-start="1308" selection-end="1308" vertical-scroll-proportion="0.26918536">
<folding />
</state>
</provider>
@@ -490,41 +500,7 @@
<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>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/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="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- </PATH>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -538,7 +514,7 @@
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
- <showStructure Favorites="false" PackagesPane="false" Scope="false" ProjectPane="false" />
+ <showStructure ProjectPane="false" PackagesPane="false" Scope="false" Favorites="false" />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
@@ -548,13 +524,13 @@
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
- <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="RunManagerConfig.compileBeforeRunning" value="false" />
+ <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
- <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
+ <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" />
</component>
@@ -611,21 +587,15 @@
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
- <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
- <module name="" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" />
+ <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ADDITIONAL_CLASS_PATH" />
- <option name="TEST_SEARCH_SCOPE">
- <value defaultName="wholeProject" />
- </option>
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <module name="" />
<method>
<option name="Make" value="true" />
</method>
@@ -637,36 +607,21 @@
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
- <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
- <option name="MAIN_CLASS_NAME" />
- <option name="VM_PARAMETERS" />
- <option name="PROGRAM_PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+ <module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
- <option name="ENABLE_SWING_INSPECTOR" value="false" />
- <module name="" />
- <method>
- <option name="Make" value="true" />
- </method>
- </configuration>
- <configuration default="false" name="SimulationMain" type="Application" factoryName="Application" enabled="false" merge="false">
- <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.simulation.SimulationMain" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
- <option name="PROGRAM_PARAMETERS" />
+ <option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="ENABLE_SWING_INSPECTOR" value="false" />
- <module name="sam-trunk" />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="32888" />
- <option name="TRANSPORT" value="0" />
- <option name="LOCAL" value="true" />
- </RunnerSettings>
- <RunnerSettings RunnerId="Run" />
- <ConfigurationWrapper RunnerId="Debug" />
- <ConfigurationWrapper RunnerId="Run" />
+ <option name="ADDITIONAL_CLASS_PATH" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="wholeProject" />
+ </option>
<method>
<option name="Make" value="true" />
</method>
@@ -878,20 +833,6 @@
<option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <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="121" column="16" selection-start="4154" selection-end="4154" vertical-scroll-proportion="0.2545825">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="34" column="6" selection-start="1420" selection-end="1420" vertical-scroll-proportion="0.33197555">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="59" column="13" selection-start="2120" selection-end="2120" vertical-scroll-proportion="0.33293125">
@@ -966,16 +907,39 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="57" column="28" selection-start="2531" selection-end="2531" vertical-scroll-proportion="0.5041322">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="42" column="61" selection-start="1521" selection-end="1576" vertical-scroll-proportion="0.38134593">
+ <state line="87" column="40" selection-start="1389" selection-end="3318" vertical-scroll-proportion="0.86540735">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.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="57" column="28" selection-start="2531" selection-end="2531" vertical-scroll-proportion="0.5041322">
+ <state line="32" column="62" selection-start="1308" selection-end="1308" vertical-scroll-proportion="0.26918536">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/pom.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="37" column="73" selection-start="1380" selection-end="1380" vertical-scroll-proportion="0.52884614">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <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="91" column="30" selection-start="3145" selection-end="3145" vertical-scroll-proportion="0.95513576">
<folding>
<element signature="imports" expanded="true" />
</folding>
Modified: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2008-07-03 20:29:27 UTC (rev 112)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2008-07-04 09:43:48 UTC (rev 113)
@@ -30,10 +30,10 @@
private double surveyValue;
private double simTime;
- public SensorEventMessage(String source, double threshold, double simTime)
+ public SensorEventMessage(String source, double surveyValue, double simTime)
{
this.source = source;
- this.surveyValue = threshold;
+ this.surveyValue = surveyValue;
this.simTime = simTime;
}
Modified: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java 2008-07-03 20:29:27 UTC (rev 112)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java 2008-07-04 09:43:48 UTC (rev 113)
@@ -47,7 +47,7 @@
// shared between all entities
SimulationContext context = simulation.getContext();
-
+
// create an event source and associate a message factory
EventSourceEntity source = new EventSourceEntity("source-A", 0.10);
source.setEventMessageFactory( new SensorMessageFactory() );
Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java 2008-07-04 09:43:48 UTC (rev 113)
@@ -0,0 +1,91 @@
+/*
+ * 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.simulation;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+
+import java.util.Properties;
+
+/**
+ * A simple test case that shows how to use the simulation API
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SimulationTestCase extends TestCase
+{
+
+ public void testSimulationAPI()
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+
+ // init
+ EventSimulation simulation = EventSimulation.bootstrap(
+ config,
+ Thread.currentThread().getContextClassLoader().getResource("simulation/esper-cfg.xml")
+ );
+
+ // shared between all entities
+ SimulationContext context = simulation.getContext();
+
+ // create an event source and associate a message factory
+ EventSourceEntity source = new EventSourceEntity("source-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("sink-B");
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.addAttachment(EventMessage.class, events[0]);
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // forward single event messages
+ simulation.bindStatement("select * from SensorEventMessage", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(12.00, lastEventMessage.getProperty("surveyValue"));
+ }
+}
Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 10 months
Overlord SVN: r112 - in sam/trunk: src/main/java/org/jboss/sam/simulation and 1 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-03 16:29:27 -0400 (Thu, 03 Jul 2008)
New Revision: 112
Modified:
sam/trunk/SAM.iws
sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
Log:
Update EventSimulation javadoc
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-03 20:09:31 UTC (rev 111)
+++ sam/trunk/SAM.iws 2008-07-03 20:29:27 UTC (rev 112)
@@ -17,28 +17,9 @@
</component>
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSourceEntity.java" afterPath="" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSink.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java" afterPath="" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/resources/simulation" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" afterPath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventProcessorEntity.java" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim/esper-cfg.xml" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.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" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -180,10 +161,21 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="SimulationMain.java" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="EventSimulation.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="57" column="28" selection-start="2531" selection-end="2531" vertical-scroll-proportion="0.5041322">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="SimulationMain.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
+ <state line="42" column="61" selection-start="1521" selection-end="1576" vertical-scroll-proportion="0.38134593">
<folding />
</state>
</provider>
@@ -532,79 +524,7 @@
<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>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/src/main/java/org/jboss/sam/internal" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream" />
- <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>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/src/main/java/org/jboss/sam/internal" />
- <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>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -1014,15 +934,6 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="70" column="58" selection-start="2819" selection-end="2819" vertical-scroll-proportion="0.2026538">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/Measurement.java">
<provider selected="true" editor-type-id="text-editor">
<state line="27" column="37" selection-start="1160" selection-end="1160" vertical-scroll-proportion="0.16043426">
@@ -1057,11 +968,20 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
+ <state line="42" column="61" selection-start="1521" selection-end="1576" vertical-scroll-proportion="0.38134593">
<folding />
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="57" column="28" selection-start="2531" selection-end="2531" vertical-scroll-proportion="0.5041322">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
</component>
</project>
Modified: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2008-07-03 20:09:31 UTC (rev 111)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2008-07-03 20:29:27 UTC (rev 112)
@@ -39,6 +39,27 @@
import java.util.UUID;
/**
+ * 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>
+ *
+ * <b>Event sources</b><br>
+ * {@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>
+ *
+ * <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>
+ *
+ * <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.
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class EventSimulation extends SimulationProcess
@@ -210,7 +231,7 @@
}
}
- public static EventSimulation createSimulation(Properties config, URL bootstrap)
+ public static EventSimulation bootstrap(Properties config, URL bootstrap)
{
return new EventSimulation(config, bootstrap);
}
Modified: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java 2008-07-03 20:09:31 UTC (rev 111)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java 2008-07-03 20:29:27 UTC (rev 112)
@@ -40,7 +40,7 @@
config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
// init
- EventSimulation simulation = EventSimulation.createSimulation (
+ EventSimulation simulation = EventSimulation.bootstrap(
config,
Thread.currentThread().getContextClassLoader().getResource("simulation/esper-cfg.xml")
);
15 years, 10 months
Overlord SVN: r111 - in sam/trunk: src/main/java/org/jboss/sam and 6 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-03 16:09:31 -0400 (Thu, 03 Jul 2008)
New Revision: 111
Added:
sam/trunk/src/main/java/org/jboss/sam/simulation/
sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/
sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
sam/trunk/src/test/resources/simulation/
sam/trunk/src/test/resources/simulation/esper-cfg.xml
Removed:
sam/trunk/src/test/java/org/jboss/test/sam/sim/
sam/trunk/src/test/resources/sim/
Modified:
sam/trunk/SAM.iws
sam/trunk/sam-trunk.iml
sam/trunk/src/main/java/org/jboss/sam/StreamInput.java
sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
Log:
Simulation API, first cut
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/SAM.iws 2008-07-03 20:09:31 UTC (rev 111)
@@ -16,7 +16,30 @@
<option name="USER" value="" />
</component>
<component name="ChangeListManager">
- <list default="true" name="Default" comment="" />
+ <list default="true" name="Default" comment="">
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSourceEntity.java" afterPath="" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSink.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java" afterPath="" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/resources/simulation" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" afterPath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventProcessorEntity.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim/esper-cfg.xml" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="" />
+ </list>
</component>
<component name="ChangeListSynchronizer" />
<component name="ChangesViewManager" flattened_view="true" />
@@ -86,21 +109,6 @@
<disable_hints />
</component>
<component name="DebuggerManager">
- <line_breakpoints>
- <breakpoint url="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java" line="50" class="org.jboss.sam.internal.esper.StreamOutputAdapter" package="org.jboss.sam.internal.esper">
- <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>
<option name="NOTIFY_CAUGHT" value="true" />
@@ -148,8 +156,8 @@
<property name="field_breakpoints_groupByClasses" value="true" />
<property name="method_breakpoints_groupByClasses" value="true" />
<property name="exception_breakpoints_viewId" value="TABLE" />
+ <property name="field_breakpoints_viewId" value="TABLE" />
<property name="exception_breakpoints_groupByClasses" value="true" />
- <property name="field_breakpoints_viewId" value="TABLE" />
<property name="method_breakpoints_groupByMethods" value="false" />
</ui_properties>
</component>
@@ -172,71 +180,15 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="ProcessingStatement.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
+ <file leaf-file-name="SimulationMain.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
+ <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
<folding />
</state>
</provider>
</entry>
</file>
- <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="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EsperProcessingStatement.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="StreamInputCallback.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="StreamOutput.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EventMessage.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EventProcessor.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
</leaf>
</component>
<component name="FindManager">
@@ -249,6 +201,9 @@
<option name="SORT_ALPHABETICALLY" value="false" />
<option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
</component>
+ <component name="HighlightingSettingsPerFile">
+ <setting file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" root0="SKIP_INSPECTION" />
+ </component>
<component name="InspectionManager">
<option name="AUTOSCROLL_TO_SOURCE" value="false" />
<option name="SPLITTER_PROPORTION" value="0.5" />
@@ -365,6 +320,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>
@@ -388,6 +347,36 @@
<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_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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="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_ELEMENT>
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -414,6 +403,62 @@
<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/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/simulation" />
+ <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>
@@ -453,7 +498,113 @@
<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>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/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="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>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/src/main/java/org/jboss/sam/internal" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream" />
+ <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>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/src/main/java/org/jboss/sam/internal" />
+ <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>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -467,7 +618,7 @@
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
- <showStructure PackagesPane="false" ProjectPane="false" Scope="false" Favorites="false" />
+ <showStructure Favorites="false" PackagesPane="false" Scope="false" ProjectPane="false" />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
@@ -477,13 +628,13 @@
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
+ <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="RunManagerConfig.compileBeforeRunning" value="false" />
- <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
+ <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
- <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" />
</component>
@@ -491,10 +642,14 @@
<option name="SHOW_DIALOG" value="true" />
</component>
<component name="RecentsManager">
+ <key name="CopyClassDialog.RECENTS_KEY">
+ <recent name="" />
+ </key>
<key name="IntroduceConstantDialog.RECENTS_KEY">
<recent name="" />
</key>
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
+ <recent name="org.jboss.sam.sim" />
<recent name="org.jboss.test.sam" />
<recent name="org.jboss.sam.chart" />
<recent name="org.jboss.sam.chart.internal" />
@@ -503,13 +658,27 @@
</component>
<component name="RestoreUpdateTree" />
<component name="RunManager" selected="Application.SimulationMain">
- <configuration default="true" type="Remote" factoryName="Remote">
- <option name="USE_SOCKET_TRANSPORT" value="true" />
- <option name="SERVER_MODE" value="false" />
- <option name="SHMEM_ADDRESS" value="javadebug" />
- <option name="HOST" value="localhost" />
- <option name="PORT" value="5005" />
- </configuration>
+ <tempConfiguration default="false" name="SimulationMain" type="Application" factoryName="Application" enabled="false" merge="false">
+ <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.simulation.SimulationMain" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <module name="sam-trunk" />
+ <RunnerSettings RunnerId="Debug">
+ <option name="DEBUG_PORT" value="32888" />
+ <option name="TRANSPORT" value="0" />
+ <option name="LOCAL" value="true" />
+ </RunnerSettings>
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Debug" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </tempConfiguration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
@@ -541,6 +710,13 @@
<option name="Make" value="true" />
</method>
</configuration>
+ <configuration default="true" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true" />
+ <option name="SERVER_MODE" value="false" />
+ <option name="SHMEM_ADDRESS" value="javadebug" />
+ <option name="HOST" value="localhost" />
+ <option name="PORT" value="5005" />
+ </configuration>
<configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
@@ -554,24 +730,8 @@
<option name="Make" value="true" />
</method>
</configuration>
- <configuration default="false" name="client" type="Remote" factoryName="Remote">
- <option name="USE_SOCKET_TRANSPORT" value="true" />
- <option name="SERVER_MODE" value="false" />
- <option name="SHMEM_ADDRESS" value="javadebug" />
- <option name="HOST" value="localhost" />
- <option name="PORT" value="5005" />
- <RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="5005" />
- <option name="TRANSPORT" value="0" />
- <option name="LOCAL" value="false" />
- </RunnerSettings>
- <ConfigurationWrapper RunnerId="Debug" />
- <method>
- <option name="Make" value="true" />
- </method>
- </configuration>
<configuration default="false" name="SimulationMain" type="Application" factoryName="Application" enabled="false" merge="false">
- <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.sim.SimulationMain" />
+ <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.simulation.SimulationMain" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
@@ -580,7 +740,7 @@
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<module name="sam-trunk" />
<RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="53589" />
+ <option name="DEBUG_PORT" value="32888" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
@@ -591,6 +751,22 @@
<option name="Make" value="true" />
</method>
</configuration>
+ <configuration default="false" name="client" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true" />
+ <option name="SERVER_MODE" value="false" />
+ <option name="SHMEM_ADDRESS" value="javadebug" />
+ <option name="HOST" value="localhost" />
+ <option name="PORT" value="5005" />
+ <RunnerSettings RunnerId="Debug">
+ <option name="DEBUG_PORT" value="5005" />
+ <option name="TRANSPORT" value="0" />
+ <option name="LOCAL" value="false" />
+ </RunnerSettings>
+ <ConfigurationWrapper RunnerId="Debug" />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
<configuration name="<template>" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
@@ -678,8 +854,8 @@
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32915717" order="1" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39863327" order="3" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.55580866" order="1" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39749432" order="3" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<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="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
@@ -695,7 +871,7 @@
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27774373" order="0" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.15757205" order="2" />
<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="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.47038725" order="2" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4692483" order="2" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="5" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
@@ -725,7 +901,7 @@
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
<option name="ERROR_OCCURED" value="false" />
- <option name="ACTIVE_VCS_NAME" />
+ <option name="ACTIVE_VCS_NAME" value="" />
<option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
@@ -778,113 +954,110 @@
<option name="myPlainMode" value="false" />
<option name="myLastEditedConfigurable" value="Modules" />
</component>
- <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
- <option name="myLastEditedConfigurable" />
+ <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="0.16666667" version="1">
+ <option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.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="34" column="13" selection-start="1418" selection-end="1418" vertical-scroll-proportion="0.1794569">
+ <state line="121" column="16" selection-start="4154" selection-end="4154" vertical-scroll-proportion="0.2545825">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="13" selection-start="1133" selection-end="1133" vertical-scroll-proportion="0.13459268">
+ <state line="34" column="6" selection-start="1420" selection-end="1420" vertical-scroll-proportion="0.33197555">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/pom.xml">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="65" selection-start="1109" selection-end="1109" vertical-scroll-proportion="-4.594952">
+ <state line="59" column="13" selection-start="2120" selection-end="2120" vertical-scroll-proportion="0.33293125">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="37" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.022432113">
+ <state line="50" column="6" selection-start="1949" selection-end="1949" vertical-scroll-proportion="0.4571773">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="38" column="13" selection-start="1528" selection-end="1528" vertical-scroll-proportion="0.022432113">
+ <state line="28" column="17" selection-start="1180" selection-end="1180" vertical-scroll-proportion="0.1794569">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="37" column="19" selection-start="1563" selection-end="1563" vertical-scroll-proportion="0.33293977">
+ <state line="34" column="0" selection-start="1360" selection-end="1360" vertical-scroll-proportion="0.32086852">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="47" column="64" selection-start="1705" selection-end="1705" vertical-scroll-proportion="0.60566705">
+ <state line="32" column="0" selection-start="1309" selection-end="1309" vertical-scroll-proportion="0.27503017">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="30" column="13" selection-start="1274" selection-end="1274" vertical-scroll-proportion="0.044864226">
+ <state line="31" column="3" selection-start="1272" selection-end="1272" vertical-scroll-proportion="0.252111">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.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="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
- <folding />
+ <state line="70" column="58" selection-start="2819" selection-end="2819" vertical-scroll-proportion="0.2026538">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/Measurement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
+ <state line="27" column="37" selection-start="1160" selection-end="1160" vertical-scroll-proportion="0.16043426">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/SimulationContext.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
+ <state line="53" column="19" selection-start="1941" selection-end="1941" vertical-scroll-proportion="0.13027744">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
- <folding />
+ <state line="119" column="45" selection-start="3754" selection-end="3754" vertical-scroll-proportion="0.15199035">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.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="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
- <folding />
+ <state line="32" column="13" selection-start="1329" selection-end="1329" vertical-scroll-proportion="0.27503017">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
+ <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
<folding />
</state>
</provider>
Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml 2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/sam-trunk.iml 2008-07-03 20:09:31 UTC (rev 111)
@@ -92,43 +92,11 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: cglib:cglib-nodep:jar:2.1_3:compile">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: log4j:log4j:jar:1.2.14:compile">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: mysql:mysql-connector-java:jar:3.1.14:compile">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/mysql/mysql-connector-java/3.1.14/mysql-connector-java-3.1.14.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library name="M2 Dep: commons-logging:commons-logging:jar:1.1.1:compile">
- <CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
<orderEntryProperties />
</component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn" />
+ <option name="USE_PROJECT_VCS" value="false" />
+ </component>
</module>
Modified: sam/trunk/src/main/java/org/jboss/sam/StreamInput.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/StreamInput.java 2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/src/main/java/org/jboss/sam/StreamInput.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -24,7 +24,7 @@
/**
* Stream inputs are registered with {@link org.jboss.sam.EventProcessor}'s
* and notify registered {@link org.jboss.sam.StreamInputCallback}'s when new events arrive.
- * Typically the CEP runtime itself act's as such a listener in order to process events.
+ * Typically the CEP runtime itself act's as such a listener in order to finished events.
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
Modified: sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java 2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -28,6 +28,8 @@
*/
public class InVMDispatcher
{
+ public final static String DEFAULT_CHANNEL_NAME = "InVM-Channel";
+
private InVMStreamRegistry channelRegistry;
private String streamName;
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,34 @@
+/*
+ * 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.sam.simulation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ContextAwareEntity
+{
+ public void begin();
+
+ public void end();
+
+ void setContext(SimulationContext ctx);
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,32 @@
+/*
+ * 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.sam.simulation;
+
+/**
+ * Creates event messages for {@link org.jboss.sam.simulation.EventSourceEntity}'s
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventMessageFactory
+{
+ Object createEventMessage(SimulationContext context);
+
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,217 @@
+/*
+ * 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.sam.simulation;
+
+import arjuna.JavaSim.Simulation.Scheduler;
+import arjuna.JavaSim.Simulation.SimulationProcess;
+import com.espertech.esper.client.UnmatchedListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventProcessor;
+import org.jboss.sam.EventProcessorFactory;
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.internal.esper.EsperRuntimeImpl;
+import org.jboss.sam.internal.stream.InVMStreamInput;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSimulation extends SimulationProcess
+{
+ // simulation properties
+ private List<EventSinkEntity> eventSinks = new ArrayList<EventSinkEntity>();
+ private List<EventSourceEntity> eventSources = new ArrayList<EventSourceEntity>();
+ private SimulationContext context;
+ private InVMDispatcher dispatcher;
+
+ // SAM properties
+ private EventProcessor eventProcessor;
+ private StreamInput streamInput;
+
+ // Constants
+ public final static String TOTAL_SIM_TIME = "sam.total-sim-time";
+ public final static String NUM_UNMATCHED_EVENTS = "sam.unmatched-events";
+
+ private EventSimulation(Properties config, URL bootstrap)
+ {
+ this.context = new SimulationContext(config);
+
+ // setup SAM processor
+ this.eventProcessor = EventProcessorFactory.newInstance().createRuntime( "EventSimulation", bootstrap );
+
+ // create input for the default in-vm channel
+ this.streamInput = new InVMStreamInput(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // create a dispatcher used within event source
+ this.dispatcher = new InVMDispatcher(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // register in/out with hub
+ this.eventProcessor.addInput(streamInput);
+
+ ((EsperRuntimeImpl) eventProcessor).getUnderlying().getEPRuntime()
+ .setUnmatchedListener(
+ new UnmatchedListener()
+ {
+
+ public void update(EventBean event)
+ {
+ System.out.println("! Unmatched event: " + event);
+ context.getMeasurement(NUM_UNMATCHED_EVENTS).increment();
+ }
+ }
+ );
+
+ }
+
+ public EventSinkEntity addSink(EventSinkEntity sink)
+ {
+ sink.setContext(this.context);
+
+ this.eventSinks.add(sink);
+ this.eventProcessor.addOutput(sink);
+ return sink;
+ }
+
+ public EventSourceEntity addSource(EventSourceEntity source)
+ {
+ source.setContext(this.context);
+ source.setDispatcher(this.dispatcher);
+
+ this.eventSources.add(source);
+ return source;
+ }
+
+ public void bindStatement(String stmt, EventSinkEntity sink)
+ {
+ // bind the results to a stream output (EventSink)
+ this.eventProcessor.registerBoundStatement(
+ sink.getStreamName(), UUID.randomUUID().toString(), stmt
+ );
+ }
+
+ /**
+ * Execute a single run of this simulation
+ */
+ public void singleRun()
+ {
+ takeControl();
+ }
+
+ public void begin()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.begin();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.begin();
+ }
+ }
+
+ public void end()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.end();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.end();
+ }
+ }
+
+ public SimulationContext getContext()
+ {
+ return context;
+ }
+
+ public Measurement measurement(String key)
+ {
+ return context.getMeasurement(key);
+ }
+
+ public void run()
+ {
+ try
+ {
+ // begin
+ begin();
+ Scheduler.startSimulation();
+
+ Double totalSimTime = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ double end = Scheduler.CurrentTime()+ totalSimTime;
+ while(Scheduler.CurrentTime()<end)
+ Hold(totalSimTime+1);
+
+ // cleanup
+ Scheduler.stopSimulation();
+ end();
+
+ returnControl();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ /**
+ * Suspends the test class thread and gives
+ * control to the simulation
+ */
+ private void takeControl()
+ {
+ this.Resume();
+ SimulationProcess.mainSuspend();
+ }
+
+ /**
+ * Returns control to the test class thread
+ */
+ private void returnControl()
+ {
+ try
+ {
+ SimulationProcess.mainResume();
+ Suspend();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ public static EventSimulation createSimulation(Properties config, URL bootstrap)
+ {
+ return new EventSimulation(config, bootstrap);
+ }
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,124 @@
+/*
+ * 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+import org.jboss.sam.chart.Chart;
+import org.jfree.chart.JFreeChart;
+
+/**
+ * Simulates an event sink.<br>
+ * Event sink's process messages that have been forwarded by an event processor.
+ * <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:
+ *
+ * <pre>
+ *
+ * EventSinkEntity sink = new EventSinkEntity("foo.bar-EventSink");
+ * sink.setEventHandler(
+ * new EventSinkHandler()
+ * {
+ *
+ * public void handle(EventMessage[] events, SimulationContext context)
+ * {
+ * // dome something here
+ * }
+ * }
+ * );
+ *
+ * </pre>
+ *
+ * <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)}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSinkEntity implements StreamOutput, ContextAwareEntity
+{
+
+ private String streamName;
+ private SimulationContext context;
+ private EventSinkHandler handler = null;
+
+ public static Chart<JFreeChart> currentChart = null;
+
+ public EventSinkEntity(String streamName)
+ {
+ this.streamName = streamName;
+ }
+
+ public void setEventHandler(EventSinkHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public StreamOutput start()
+ {
+ return this;
+ }
+
+ public StreamOutput stop()
+ {
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return true;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ 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 begin()
+ {
+
+ }
+
+ public void end()
+ {
+
+ }
+
+ public void setContext(SimulationContext ctx)
+ {
+ this.context = ctx;
+ }
+
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,34 @@
+/*
+ * 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Represents the actual business logic of an {@link org.jboss.sam.simulation.EventSinkEntity}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventSinkHandler
+{
+ void handle(EventMessage[] events, SimulationContext context);
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,150 @@
+/*
+ * 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.sam.simulation;
+
+import arjuna.JavaSim.Simulation.RestartException;
+import arjuna.JavaSim.Simulation.SimulationException;
+import arjuna.JavaSim.Simulation.SimulationEntity;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+
+/**
+ * Simulates an event source.<br>
+ * <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:
+ *
+ * <pre>
+ * EventSourceEntity source = new EventSourceEntity("foo.bar-EventSource", 0.1);
+ * source.setEventMessageFactory(
+ * new EventMessageFactory()
+ * {
+ * public Object createEventMessage(SimulationContext context)
+ * {
+ * // Create an event message here
+ * return ...;
+ * }
+ * }
+ * );
+ * </pre>
+ *
+ * <br>
+ * <b>Event ratio</b><br>
+ * Specifies the ratio with regard to the total simulation time:
+ * <ul>
+ * <li>1.00: A single event per simulation
+ * <li>0.01: An event per each simulation time sample
+ * </ul>
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSourceEntity extends SimulationEntity implements ContextAwareEntity
+{
+ private String name;
+ private Class eventMessageType;
+ private double eventRatio;
+ private InVMDispatcher dispatcher = null;
+ private SimulationContext context = null;
+ private EventMessageFactory factory = null;
+
+ /**
+ *
+ * @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)
+ {
+ this.name = name;
+ this.eventMessageType = eventMessageType;
+ this.eventRatio = eventRatio;
+ }
+
+ public void setContext(SimulationContext controller)
+ {
+ this.context = controller;
+ }
+
+ void setDispatcher(InVMDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ public void setEventMessageFactory(EventMessageFactory factory)
+ {
+ this.factory = factory;
+ }
+
+ public void run()
+ {
+ for (; ;)
+ {
+ try
+ {
+ double totalSim = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ double holdTime = (totalSim / 100.00) * (100.00*eventRatio);
+ Hold(holdTime);
+ }
+ catch (SimulationException e)
+ {
+ }
+ catch (RestartException e)
+ {
+ }
+
+ if(null==context)
+ throw new IllegalStateException("Simulation context not set");
+
+ if(null==factory)
+ throw new IllegalStateException("EventMessageFactory not set");
+
+ if(null==dispatcher)
+ throw new IllegalStateException("EventDispatcher not set");
+
+ // Create and dispatch event
+ Object event = factory.createEventMessage(this.context);
+ this.dispatcher.dispatch(event);
+
+ }
+ }
+
+ public void begin()
+ {
+ try
+ {
+ super.Activate();
+ } catch (SimulationException e)
+ {
+ e.printStackTrace();
+
+ } catch (RestartException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void end()
+ {
+ super.terminate();
+ }
+
+
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,67 @@
+/*
+ * 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.sam.simulation;
+
+/**
+ * A simulation measurement helper
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class Measurement
+{
+ private Double current = 0.0;
+
+ public Double getCurrent()
+ {
+ return 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 setCurrent(Double d)
+ {
+ this.current = d;
+ return this.current;
+ }
+
+ public Double increment()
+ {
+ this.current += 1;
+ return this.current;
+ }
+
+ public Double decrement()
+ {
+ this.current -= 1;
+ return this.current;
+ }
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,87 @@
+/*
+ * 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.sam.simulation;
+
+import arjuna.JavaSim.Simulation.Scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * 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
+ * <ul>
+ *
+ * @see org.jboss.sam.simulation.Measurement
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+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>();
+
+ 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 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 addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(clazz, obj);
+ }
+
+ public double getCurrentSimulationTime()
+ {
+ return Scheduler.CurrentTime();
+ }
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,89 @@
+/*
+ * 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.simulation;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.PropertyMapping;
+import org.jboss.sam.chart.internal.jfree.BarChartBuilder;
+import org.jboss.sam.simulation.EventSinkHandler;
+import org.jboss.sam.simulation.SimulationContext;
+import org.jfree.chart.JFreeChart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ChartGenerationHandler implements EventSinkHandler
+{
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ double numEvents = events.length;
+ context.getMeasurement("numProcessed").increase(numEvents);
+ for(EventMessage e : events)
+ {
+ System.out.println(e.getUnderlying());
+ }
+
+ Chart<JFreeChart> currentChart = buildChart(events);
+ context.addAttachment(Chart.class, currentChart);
+ }
+
+ private Chart<JFreeChart> buildChart(EventMessage[] events)
+ {
+ ChartMapping mapping = valuePerSampleMapping();
+
+ Chart chart = new BarChartBuilder(
+ "Sensor simulation", "Sample", "Survey value")
+ .buildChart(events, mapping);
+
+ return chart;
+ }
+
+ private ChartMapping valuePerSampleMapping()
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_1, null).constant("Sensor data"));
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_2, "simTime"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(BarChartBuilder.PROP_1, "surveyValue"));
+
+ ChartMapping mapping = new ChartMapping("Sensor value per sample", index, data); // could be serialzed
+ return mapping;
+ }
+
+ /*private ChartMapping sinkDistributionMapping()
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(PieChartBuilder.INDEX_1, "source"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(PieChartBuilder.DATA_1, "numEvents"));
+
+ ChartMapping mapping = new ChartMapping("Sensor event per EventSink", index, data);
+ return mapping;
+ } */
+}
Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,59 @@
+/*
+ * 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.simulation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SensorEventMessage
+{
+ private String source;
+ private double surveyValue;
+ private double simTime;
+
+ public SensorEventMessage(String source, double threshold, double simTime)
+ {
+ this.source = source;
+ this.surveyValue = threshold;
+ this.simTime = simTime;
+ }
+
+ public String getSource()
+ {
+ return source;
+ }
+
+ public double getSurveyValue()
+ {
+ return surveyValue;
+ }
+
+ public double getSimTime()
+ {
+ return simTime;
+ }
+
+ public String toString()
+ {
+ return "[@"+simTime+": "+source+"->"+surveyValue+"]";
+ }
+}
Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,54 @@
+/*
+ * 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.simulation;
+
+import arjuna.JavaSim.Distributions.ExponentialStream;
+import org.jboss.sam.simulation.EventMessageFactory;
+import org.jboss.sam.simulation.SimulationContext;
+
+import java.io.IOException;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SensorMessageFactory implements EventMessageFactory
+{
+ 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 double getSurveyValue()
+ {
+ try
+ {
+ return STime.getNumber();
+ }
+ catch (IOException e)
+ {
+ return 0.0;
+ }
+ }
+}
Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,91 @@
+/*
+ * 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.simulation;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.simulation.*;
+import org.jboss.test.sam.JFreeChartViewer;
+import org.jfree.chart.JFreeChart;
+
+import java.util.Properties;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SimulationMain
+{
+ public static void main(String[] args)
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+
+ // init
+ EventSimulation simulation = EventSimulation.createSimulation (
+ config,
+ Thread.currentThread().getContextClassLoader().getResource("simulation/esper-cfg.xml")
+ );
+
+ // shared between all entities
+ SimulationContext context = simulation.getContext();
+
+ // create an event source and associate a message factory
+ EventSourceEntity source = new EventSourceEntity("source-A", 0.10);
+ source.setEventMessageFactory( new SensorMessageFactory() );
+
+ // create an event sink
+ EventSinkEntity sink = new EventSinkEntity("sensor-events-viz");
+ sink.setEventHandler( new ChartGenerationHandler() );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // bind statements to test
+ simulation.bindStatement("select * from SensorEventMessage.win:length_batch(10)", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // context results
+ double dispatched = context.getMeasurement("numDispatched").getCurrent();
+ double processed = context.getMeasurement("numProcessed").getCurrent();
+ double unmatched = context.getMeasurement(EventSimulation.NUM_UNMATCHED_EVENTS).getCurrent();
+
+ System.out.println("Dispatched: " +dispatched);
+ System.out.println("Processed: " +processed);
+ System.out.println("Unmatched: " +unmatched);
+
+ // chart generation handler results
+ if(context.getAttachment(Chart.class)!=null)
+ {
+ Chart<JFreeChart> chart = context.getAttachment(Chart.class);
+ new JFreeChartViewer().setChart(chart.getUnderlying()).display();
+ }
+ else
+ {
+ System.out.println("* No chart rendered *");
+ System.exit(0);
+ }
+
+
+ }
+}
Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/src/test/resources/simulation/esper-cfg.xml
===================================================================
--- sam/trunk/src/test/resources/simulation/esper-cfg.xml (rev 0)
+++ sam/trunk/src/test/resources/simulation/esper-cfg.xml 2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.simulation"/>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/src/test/resources/simulation/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 10 months
Overlord SVN: r110 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src: java/org/jboss/tools/overlord/jbossesb/model/actions and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-07-03 15:06:57 -0400 (Thu, 03 Jul 2008)
New Revision: 110
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/AbstractESBAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ParallelAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
Log:
Applied some fixes resulting from sorting out conformance checking problem. Modified create session validation to take into account conversation type specified on referenced business object.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/Messages.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/Messages.properties 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/Messages.properties 2008-07-03 19:06:57 UTC (rev 110)
@@ -16,7 +16,6 @@
# * MA 02110-1301, USA.
# */
-_MISMATCH_SESSION_CLASS=Session class mismatch with service descriptor for category '{0}' and name '{1}'
_NOT_FOUND_BUSINESS_OBJECT_TYPE=Business object type '{0}' could not be found
_NOT_FOUND_SERVICE_DESCRIPTOR=Service descriptor for category '{0}' and name '{1}' not found
_NOT_SPECIFIED_PROPERTY=Property '{0}' must be specified
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/AbstractESBAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/AbstractESBAction.java 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/AbstractESBAction.java 2008-07-03 19:06:57 UTC (rev 110)
@@ -168,13 +168,13 @@
new String[]{link.getCategory(),link.getName()}), null);
}
} else if (getService().getSessionName() != null &&
- isPerform() == false &&
+ isPerform() == false && link.isRemote() == false &&
getService().getSessionName().equals(
link.getService().getSessionName()) == false) {
l.error(this, org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
- "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
"_MISMATCH_SESSION_CLASS",
new String[]{link.getCategory(),link.getName()}), null);
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionAction.java 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionAction.java 2008-07-03 19:06:57 UTC (rev 110)
@@ -69,7 +69,7 @@
// If service is root, then need to defined conversation type
if (getService().isRoot() &&
- getPropertyValue(CONVERSATION_TYPE) == null) {
+ getService().getConversationType() == null) {
l.error(this, org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
"org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties 2008-07-03 19:06:57 UTC (rev 110)
@@ -19,6 +19,7 @@
_CANNOT_INITIATE_NON_ROOT=Cannot 'initiate' non-root service descriptor for category '{0}' and name '{1}'
_CANNOT_SESSION_BASED_ACTIONS_WITH_ROUTER=Cannot define MessageRouterAction with session based actions in service descriptor
_IF_ORDER_WRONG=IfAction must have an 'if' path, followed by zero or more 'elseif' paths and ending with an optional 'else' path
+_MISMATCH_SESSION_CLASS=Session class mismatch with service descriptor for category '{0}' and name '{1}'
_MULTIPLE_JOINS=Action has multiple joins
_MUST_DEFINE_SINGLE_WHILE_PATH=While action must have a single 'while' path
_MUST_DEFINE_SINGLE_WHILE_EXIT=While action must have a single 'exit' path
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ParallelAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ParallelAction.java 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ParallelAction.java 2008-07-03 19:06:57 UTC (rev 110)
@@ -221,16 +221,16 @@
// TODO: Only temporary check while conformance
// check does not handle
- if (block.getContents().size() > 0) {
+ //if (block.getContents().size() > 0) {
parallel.getBlocks().add(block);
- }
+ //}
}
// TODO: Only temporary check while conformance
// check does not handle
- if (parallel.getBlocks().size() == 0) {
- activities.remove(parallel);
- }
+ //if (parallel.getBlocks().size() == 0) {
+ // activities.remove(parallel);
+ //}
if (m_joinService != null) {
m_joinService.convert(activities, context);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/CreateSessionActionTest.java 2008-07-03 19:06:57 UTC (rev 110)
@@ -96,15 +96,22 @@
TestESBService service=new TestESBService();
service.setRoot(true);
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(service);
+
java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
props.put("conversationType", "test.Type");
+ service.setConversationType("test.Type");
+
org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
CreateSessionAction action=new CreateSessionAction(service, elem);
service.getActions().add(action);
+ service.setModel(model);
+
TestModelListener l=new TestModelListener();
action.validate(l);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 15:36:42 UTC (rev 109)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 19:06:57 UTC (rev 110)
@@ -48,9 +48,12 @@
return(m_category);
}
+ public void setConversationType(String type) {
+ m_conversationType = type;
+ }
+
public String getConversationType() {
- // TODO Auto-generated method stub
- return null;
+ return(m_conversationType);
}
public void setName(String name) {
@@ -149,5 +152,6 @@
private boolean m_sessionBased=false;
private boolean m_createSession=false;
private Class<?> m_sessionClass=null;
+ private String m_conversationType=null;
private List<Activity> m_contents=new java.util.Vector<Activity>();
}
15 years, 10 months
Overlord SVN: r109 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src: test/org/jboss/tools/overlord/jbossesb/model/actions and 1 other directory.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-07-03 11:36:42 -0400 (Thu, 03 Jul 2008)
New Revision: 109
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestActivity.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/IfAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/WhenAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/IfActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ParallelActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/SwitchActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhenActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhileActionTest.java
Log:
Unit tests for conversion of the grouping constructs.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/IfAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/IfAction.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/IfAction.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -188,22 +188,34 @@
org.w3c.dom.Node n=nl.item(i);
- if (n instanceof org.w3c.dom.Element &&
- (n.getNodeName().equals(IF) ||
- n.getNodeName().equals(ELSEIF) ||
- n.getNodeName().equals(ELSE))) {
- String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
- String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
-
- // TODO: Convert the conditional expression if defined
-
- ConditionalBlock cond=new ConditionalBlock();
- choice.getConditionalBlocks().add(cond);
-
- ESBService service=getService().getModel().getService(category, name);
-
- if (service != null) {
- service.convert(cond.getContents(), context);
+ if (n instanceof org.w3c.dom.Element) {
+ if (n.getNodeName().equals(IF) ||
+ n.getNodeName().equals(ELSEIF)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ // TODO: Convert the conditional expression if defined
+
+ ConditionalBlock cond=new ConditionalBlock();
+ choice.getConditionalBlocks().add(cond);
+
+ ESBService service=getService().getModel().getService(category, name);
+
+ if (service != null) {
+ service.convert(cond.getContents(), context);
+ }
+ } else if (n.getNodeName().equals(ELSE)) {
+ String category=((org.w3c.dom.Element)n).getAttribute(SERVICE_CATEGORY);
+ String name=((org.w3c.dom.Element)n).getAttribute(SERVICE_NAME);
+
+ Block block=new Block();
+ choice.setElseBlock(block);
+
+ ESBService service=getService().getModel().getService(category, name);
+
+ if (service != null) {
+ service.convert(block.getContents(), context);
+ }
}
}
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/WhenAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/WhenAction.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/WhenAction.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -215,9 +215,7 @@
m_services.get(i).convert(block.getContents(), context);
- if (block.getContents().size() > 0) {
- elem.getConditionalBlocks().add(block);
- }
+ elem.getConditionalBlocks().add(block);
}
if (m_joinService != null) {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/IfActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/IfActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/IfActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -18,6 +18,8 @@
package org.jboss.tools.overlord.jbossesb.model.actions;
import junit.framework.TestCase;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
public class IfActionTest extends TestCase {
@@ -289,4 +291,162 @@
fail(l.invalidMessage());
}
}
+
+ public void testConvert() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><if service-category=\"cat1\" " +
+ "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
+ "service-name=\"name2\" /><else service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ IfAction action=new IfAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof If) == false) {
+ fail("Expecting an 'If' activity");
+ }
+
+ If ifAction=(If)act;
+
+ if (ifAction.getConditionalBlocks().size() != 2) {
+ fail("Expecting two conditional blocks: "+ifAction.getConditionalBlocks().size());
+ }
+
+ if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (ifAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
+ fail("Second conditional block should have 1 activity = act2");
+ }
+
+ if (ifAction.getElseBlock() == null) {
+ fail("Else block not defined");
+ }
+
+ if (ifAction.getElseBlock().getContents().size() != 1 ||
+ ifAction.getElseBlock().getContents().get(0) != act3) {
+ fail("Else block should have 1 activity = act3");
+ }
+ }
+
+ public void testConvertNotExcludingEmptyPaths() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><if service-category=\"cat1\" " +
+ "service-name=\"name1\" /><elseif service-category=\"cat2\" " +
+ "service-name=\"name2\" /><else service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ IfAction action=new IfAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof If) == false) {
+ fail("Expecting an 'If' activity");
+ }
+
+ If ifAction=(If)act;
+
+ if (ifAction.getConditionalBlocks().size() != 2) {
+ fail("Expecting two conditional blocks: "+ifAction.getConditionalBlocks().size());
+ }
+
+ if (ifAction.getConditionalBlocks().get(0).getContents().size() != 0) {
+ fail("First conditional block should be empty");
+ }
+
+ if (ifAction.getConditionalBlocks().get(1).getContents().size() != 0) {
+ fail("Second conditional block should be empty");
+ }
+
+ if (ifAction.getElseBlock() == null) {
+ fail("Else block not defined");
+ }
+
+ if (ifAction.getElseBlock().getContents().size() != 0) {
+ fail("Else block should have be empty");
+ }
+ }
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ParallelActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ParallelActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ParallelActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -17,6 +17,10 @@
*/
package org.jboss.tools.overlord.jbossesb.model.actions;
+import org.scribble.conversation.model.*;
+import org.scribble.model.Activity;
+import org.jboss.tools.overlord.jbossesb.model.*;
+
import junit.framework.TestCase;
public class ParallelActionTest extends TestCase {
@@ -291,4 +295,164 @@
fail(l.invalidMessage());
}
}
+
+ public void testConvert() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><path service-category=\"cat1\" " +
+ "service-name=\"name1\" /><path service-category=\"cat2\" " +
+ "service-name=\"name2\" /><join service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ ParallelAction action=new ParallelAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, new DefaultConversionContext());
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof Parallel) == false) {
+ fail("Expecting an 'Parallel' activity");
+ }
+
+ Parallel parallelAction=(Parallel)act;
+
+ if (parallelAction.getBlocks().size() != 2) {
+ fail("Expecting two blocks: "+parallelAction.getBlocks().size());
+ }
+
+ if (parallelAction.getBlocks().get(0).getContents().size() != 1 ||
+ parallelAction.getBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (parallelAction.getBlocks().get(1).getContents().size() != 1 ||
+ parallelAction.getBlocks().get(1).getContents().get(0) != act2) {
+ fail("Second conditional block should have 1 activity = act2");
+ }
+
+ if (activities.get(1) != act3) {
+ fail("Activity after parallel should be act3");
+ }
+ }
+
+ /* Miss out test for now, until conformance checking fixed
+ * so that it ignores 'invisible' activities
+ *
+ public void testConvertNotExcludingEmptyPaths() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><path service-category=\"cat1\" " +
+ "service-name=\"name1\" /><path service-category=\"cat2\" " +
+ "service-name=\"name2\" /><join service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ ParallelAction action=new ParallelAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, new DefaultConversionContext());
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof Parallel) == false) {
+ fail("Expecting an 'Parallel' activity");
+ }
+
+ Parallel parallelAction=(Parallel)act;
+
+ if (parallelAction.getBlocks().size() != 2) {
+ fail("Expecting two blocks: "+parallelAction.getBlocks().size());
+ }
+
+ if (parallelAction.getBlocks().get(0).getContents().size() != 1 ||
+ parallelAction.getBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (parallelAction.getBlocks().get(1).getContents().size() != 0) {
+ fail("Second conditional block should be empty");
+ }
+
+ if (activities.get(1) != act3) {
+ fail("Activity after parallel should be act3");
+ }
+ }
+ */
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/SwitchActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/SwitchActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/SwitchActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -17,6 +17,9 @@
*/
package org.jboss.tools.overlord.jbossesb.model.actions;
+import org.scribble.conversation.model.If;
+import org.scribble.model.Activity;
+
import junit.framework.TestCase;
public class SwitchActionTest extends TestCase {
@@ -186,4 +189,170 @@
fail(l.invalidMessage());
}
}
+
+ public void testConvert() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><case service-category=\"cat1\" " +
+ "service-name=\"name1\" /><case service-category=\"cat2\" " +
+ "service-name=\"name2\" /><case service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ SwitchAction action=new SwitchAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof If) == false) {
+ fail("Expecting an 'If' activity");
+ }
+
+ If ifAction=(If)act;
+
+ if (ifAction.getConditionalBlocks().size() != 3) {
+ fail("Expecting three conditional blocks: "+ifAction.getConditionalBlocks().size());
+ }
+
+ if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (ifAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
+ fail("Second conditional block should have 1 activity = act2");
+ }
+
+ if (ifAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
+ fail("Third conditional block should have 1 activity = act3");
+ }
+
+ if (ifAction.getElseBlock() != null) {
+ fail("Else block should not be defined");
+ }
+ }
+
+ public void testConvertNotExcludingEmptyPaths() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><case service-category=\"cat1\" " +
+ "service-name=\"name1\" /><case service-category=\"cat2\" " +
+ "service-name=\"name2\" /><case service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ SwitchAction action=new SwitchAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof If) == false) {
+ fail("Expecting an 'If' activity");
+ }
+
+ If ifAction=(If)act;
+
+ if (ifAction.getConditionalBlocks().size() != 3) {
+ fail("Expecting three conditional blocks: "+ifAction.getConditionalBlocks().size());
+ }
+
+ if (ifAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (ifAction.getConditionalBlocks().get(1).getContents().size() != 0) {
+ fail("Second conditional block should be empty");
+ }
+
+ if (ifAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
+ ifAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
+ fail("Third conditional block should have 1 activity = act3");
+ }
+
+ if (ifAction.getElseBlock() != null) {
+ fail("Else block should not be defined");
+ }
+ }
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestActivity.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestActivity.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.actions;
+
+public class TestActivity extends org.scribble.model.Activity {
+
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -29,9 +29,12 @@
public class TestESBService implements org.jboss.tools.overlord.jbossesb.model.ESBService {
public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
+ activities.addAll(m_contents);
}
+
+ public List<Activity> getContents() {
+ return(m_contents);
+ }
public List<ESBAction> getActions() {
return(m_actions);
@@ -146,4 +149,5 @@
private boolean m_sessionBased=false;
private boolean m_createSession=false;
private Class<?> m_sessionClass=null;
+ private List<Activity> m_contents=new java.util.Vector<Activity>();
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhenActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhenActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhenActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -17,6 +17,9 @@
*/
package org.jboss.tools.overlord.jbossesb.model.actions;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+
import junit.framework.TestCase;
public class WhenActionTest extends TestCase {
@@ -289,4 +292,162 @@
fail(l.invalidMessage());
}
}
+
+ public void testConvert() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><when service-category=\"cat1\" " +
+ "service-name=\"name1\" /><when service-category=\"cat2\" " +
+ "service-name=\"name2\" /><when service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ WhenAction action=new WhenAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof When) == false) {
+ fail("Expecting an 'When' activity");
+ }
+
+ When whenAction=(When)act;
+
+ if (whenAction.getConditionalBlocks().size() != 3) {
+ fail("Expecting three conditional blocks: "+whenAction.getConditionalBlocks().size());
+ }
+
+ if (whenAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
+ whenAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (whenAction.getConditionalBlocks().get(1).getContents().size() != 1 ||
+ whenAction.getConditionalBlocks().get(1).getContents().get(0) != act2) {
+ fail("Second conditional block should have 1 activity = act2");
+ }
+
+ if (whenAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
+ whenAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
+ fail("Second conditional block should have 1 activity = act3");
+ }
+ }
+
+ public void testConvertNotExcludingEmptyPath() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><when service-category=\"cat1\" " +
+ "service-name=\"name1\" /><when service-category=\"cat2\" " +
+ "service-name=\"name2\" /><when service-category=\"cat3\" " +
+ "service-name=\"name3\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBService other3=new TestESBService();
+ other3.setCategory("cat3");
+ other3.setName("name3");
+
+ TestActivity act3=new TestActivity();
+ other3.getContents().add(act3);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(other3);
+ model.addService(service);
+
+ service.setModel(model);
+
+ WhenAction action=new WhenAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, null);
+
+ if (activities.size() != 1) {
+ fail("Expecting one activity, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof When) == false) {
+ fail("Expecting an 'When' activity");
+ }
+
+ When whenAction=(When)act;
+
+ if (whenAction.getConditionalBlocks().size() != 3) {
+ fail("Expecting three conditional blocks: "+whenAction.getConditionalBlocks().size());
+ }
+
+ if (whenAction.getConditionalBlocks().get(0).getContents().size() != 1 ||
+ whenAction.getConditionalBlocks().get(0).getContents().get(0) != act1) {
+ fail("First conditional block should have 1 activity = act1");
+ }
+
+ if (whenAction.getConditionalBlocks().get(1).getContents().size() != 0) {
+ fail("Second conditional block should be empty");
+ }
+
+ if (whenAction.getConditionalBlocks().get(2).getContents().size() != 1 ||
+ whenAction.getConditionalBlocks().get(2).getContents().get(0) != act3) {
+ fail("Third conditional block should have 1 activity = act3");
+ }
+ }
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhileActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhileActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/WhileActionTest.java 2008-07-03 15:36:42 UTC (rev 109)
@@ -17,6 +17,10 @@
*/
package org.jboss.tools.overlord.jbossesb.model.actions;
+import org.scribble.conversation.model.*;
+import org.scribble.model.*;
+import org.jboss.tools.overlord.jbossesb.model.*;
+
import junit.framework.TestCase;
public class WhileActionTest extends TestCase {
@@ -324,4 +328,127 @@
fail(l.invalidMessage());
}
}
+
+ public void testConvert() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><while service-category=\"cat1\" " +
+ "service-name=\"name1\" /><exit service-category=\"cat2\" " +
+ "service-name=\"name2\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestActivity act1=new TestActivity();
+ other1.getContents().add(act1);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ WhileAction action=new WhileAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, new DefaultConversionContext());
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof While) == false) {
+ fail("Expecting an 'While' activity");
+ }
+
+ While whileAction=(While)act;
+
+ if (whileAction.getBlock().getContents().size() != 1) {
+ fail("Expecting one entry in while block: "+whileAction.getBlock().getContents().size());
+ }
+
+ if (whileAction.getBlock().getContents().get(0) != act1) {
+ fail("While block should have 1 activity = act1");
+ }
+
+ if (activities.get(1) != act2) {
+ fail("Activity following while should be act2");
+ }
+ }
+
+ public void testConvertNotExcludingEmptyBody() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("paths", "<property><while service-category=\"cat1\" " +
+ "service-name=\"name1\" /><exit service-category=\"cat2\" " +
+ "service-name=\"name2\" /></property>");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, null, props);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestActivity act2=new TestActivity();
+ other2.getContents().add(act2);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ WhileAction action=new WhileAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ java.util.List<Activity> activities=new java.util.Vector<Activity>();
+
+ action.convert(activities, new DefaultConversionContext());
+
+ if (activities.size() != 2) {
+ fail("Expecting two activities, but got: "+activities.size());
+ }
+
+ Activity act=activities.get(0);
+
+ if ((act instanceof While) == false) {
+ fail("Expecting an 'While' activity");
+ }
+
+ While whileAction=(While)act;
+
+ if (whileAction.getBlock().getContents().size() != 0) {
+ fail("Expecting zero entries in while block: "+whileAction.getBlock().getContents().size());
+ }
+
+ if (activities.get(1) != act2) {
+ fail("Activity following while should be act2");
+ }
+ }
}
15 years, 10 months
Overlord SVN: r108 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-07-03 06:13:24 -0400 (Thu, 03 Jul 2008)
New Revision: 108
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java
Log:
Validation unit tests for RetrieveSessionAction.
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/RetrieveSessionActionTest.java 2008-07-03 10:13:24 UTC (rev 108)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.actions;
+
+import junit.framework.TestCase;
+
+public class RetrieveSessionActionTest extends TestCase {
+
+ public void testValidateFirstAction() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("identities", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ UnsupportedAction unsupported=new UnsupportedAction(service, null);
+
+ RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+
+ service.getActions().add(action);
+ service.getActions().add(unsupported);
+
+ TestModelListener l=new TestModelListener();
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateNotFirstAction() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("identities", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ UnsupportedAction unsupported=new UnsupportedAction(service, null);
+
+ RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+
+ service.getActions().add(unsupported);
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
+ "_MUST_BE_FIRST_ACTION",
+ new String[]{"RetrieveSession"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateNoIdentities() {
+ TestESBService service=new TestESBService();
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ RetrieveSessionAction action=new RetrieveSessionAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"identities"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+}
15 years, 10 months
Overlord SVN: r107 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src: java/org/jboss/tools/overlord/jbossesb/model/actions and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-07-03 06:06:31 -0400 (Thu, 03 Jul 2008)
New Revision: 107
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/PerformActionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateActionTest.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
Log:
Unit tests for PerformAction and ScheduleStateAction validation.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java 2008-07-03 07:30:56 UTC (rev 106)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -232,17 +232,8 @@
*/
public boolean isLoop() {
boolean ret=false;
+ ESBAction action=getFirstSessionBasedAction();
- ESBAction action=null;
-
- for (int i=0; action == null && i < m_actions.size(); i++) {
- action=m_actions.get(i);
-
- if (action.isSessionBased() == false) {
- action = null;
- }
- }
-
if (action != null) {
ret = action.isLoop();
}
@@ -258,16 +249,8 @@
*/
public boolean isRoot() {
boolean ret=false;
- ESBAction action=null;
+ ESBAction action=getFirstSessionBasedAction();
- for (int i=0; action == null && i < m_actions.size(); i++) {
- action=m_actions.get(i);
-
- if (action.isSessionBased() == false) {
- action = null;
- }
- }
-
if (action != null && action.getActionClass() != null) {
if (action.getActionClass().equals(CREATE_SESSION_ACTION_CLASS)) {
String bool=action.getPropertyValue(ROOT_PROPERTY);
@@ -302,6 +285,45 @@
}
/**
+ * This method determines whether the ESB service descriptor
+ * starts with a CreateSessionAction.
+ *
+ * @return Whether the service has a CreateSessionAction
+ */
+ public boolean isCreateSession() {
+ boolean ret=false;
+ ESBAction action=getFirstSessionBasedAction();
+
+ if (action != null && action.getActionClass() != null) {
+ if (action.getActionClass().equals(CREATE_SESSION_ACTION_CLASS)) {
+ ret = true;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the first session based action in the
+ * service descriptor.
+ *
+ * @return The first session based action, or null if none exist
+ */
+ protected ESBAction getFirstSessionBasedAction() {
+ ESBAction ret=null;
+
+ for (int i=0; ret == null && i < m_actions.size(); i++) {
+ ret=m_actions.get(i);
+
+ if (ret.isSessionBased() == false) {
+ ret = null;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
* This method returns the service description name associated with the
* ESB service.
*
@@ -309,16 +331,8 @@
*/
public String getServiceName() {
String ret=null;
- ESBAction action=null;
+ ESBAction action=getFirstSessionBasedAction();
- for (int i=0; action == null && i < m_actions.size(); i++) {
- action=m_actions.get(i);
-
- if (action.isSessionBased() == false) {
- action = null;
- }
- }
-
if (action != null) {
if (action.getActionClass().equals(CREATE_SESSION_ACTION_CLASS) ||
action.getActionClass().equals(RETRIEVE_SESSION_ACTION_CLASS)) {
@@ -360,16 +374,8 @@
*/
public String getConversationType() {
String ret=null;
- ESBAction action=null;
+ ESBAction action=getFirstSessionBasedAction();
- for (int i=0; action == null && i < m_actions.size(); i++) {
- action=m_actions.get(i);
-
- if (action.isSessionBased() == false) {
- action = null;
- }
- }
-
if (action != null) {
if (action.getActionClass().equals(CREATE_SESSION_ACTION_CLASS)) {
ret = action.getPropertyValue(CONVERSATION_TYPE_PROPERTY);
@@ -410,16 +416,8 @@
*/
public String getSessionName() {
String ret=null;
- ESBAction action=null;
+ ESBAction action=getFirstSessionBasedAction();
- for (int i=0; action == null && i < m_actions.size(); i++) {
- action=m_actions.get(i);
-
- if (action.isSessionBased() == false) {
- action = null;
- }
- }
-
if (action != null &&
action.getActionClass().startsWith(ACTION_PACKAGE)) {
ret = action.getPropertyValue(BUSINESS_OBJECT_TYPE_PROPERTY);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBService.java 2008-07-03 07:30:56 UTC (rev 106)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBService.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -93,6 +93,14 @@
public boolean isRoot();
/**
+ * This method determines whether the ESB service descriptor
+ * starts with a CreateSessionAction.
+ *
+ * @return Whether the service has a CreateSessionAction
+ */
+ public boolean isCreateSession();
+
+ /**
* This method returns the service description name associated with the
* ESB service.
*
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java 2008-07-03 07:30:56 UTC (rev 106)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -106,9 +106,7 @@
// Check if performed state starts with a create session action
if (m_service != null) {
- if (m_service.getActions().size() == 0 ||
- m_service.getActions().get(0).getActionClass().
- endsWith("CreateSessionAction") == false) {
+ if (m_service.isCreateSession() == false) {
l.error(this, org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
"org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/PerformActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/PerformActionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/PerformActionTest.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -0,0 +1,205 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.actions;
+
+import junit.framework.TestCase;
+
+public class PerformActionTest extends TestCase {
+
+ public void testValidateNoServiceCategory() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceName", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ PerformAction action=new PerformAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceCategory"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateNoServiceName() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ PerformAction action=new PerformAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceName"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateService() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "cat1");
+ props.put("serviceName", "name1");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{"cat1", "name1"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateJoinService() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "cat1");
+ props.put("serviceName", "name1");
+ props.put("joinServiceCategory", "cat2");
+ props.put("joinServiceName", "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(true);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{"cat2", "name2"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateServiceCreatesSession() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "cat1");
+ props.put("serviceName", "name1");
+ props.put("joinServiceCategory", "cat2");
+ props.put("joinServiceName", "name2");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBService other1=new TestESBService();
+ other1.setCategory("cat1");
+ other1.setName("name1");
+ other1.setCreateSession(false);
+
+ TestESBService other2=new TestESBService();
+ other2.setCategory("cat2");
+ other2.setName("name2");
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(other1);
+ model.addService(other2);
+ model.addService(service);
+
+ service.setModel(model);
+
+ PerformAction action=new PerformAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
+ "_NOT_FOUND_PERFORM_CREATE_SESSION",
+ new String[]{}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateActionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateActionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateActionTest.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.actions;
+
+import junit.framework.TestCase;
+
+public class ScheduleStateActionTest extends TestCase {
+
+ public void testValidateNoServiceCategory() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceName", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ ScheduleStateAction action=new ScheduleStateAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceCategory"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateNoServiceName() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ ScheduleStateAction action=new ScheduleStateAction(service, elem);
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_SPECIFIED_PROPERTY",
+ new String[]{"serviceName"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+
+ public void testValidateService() {
+ TestESBService service=new TestESBService();
+ service.setRoot(true);
+
+ java.util.Map<String,String> props=new java.util.Hashtable<String,String>();
+ props.put("serviceCategory", "cat1");
+ props.put("serviceName", "name1");
+
+ org.w3c.dom.Element elem=ESBActionTestUtil.getAction(null, props, null);
+
+ TestESBLanguageModel model=new TestESBLanguageModel();
+ model.addService(service);
+
+ service.setModel(model);
+
+ ScheduleStateAction action=new ScheduleStateAction(service, elem);
+ action.initializeLinks();
+
+ service.getActions().add(action);
+
+ TestModelListener l=new TestModelListener();
+
+ l.addExpectedError(org.scribble.util.MessageUtil.format(
+ java.util.PropertyResourceBundle.getBundle(
+ "org.jboss.tools.overlord.jbossesb.model.Messages"),
+ "_NOT_FOUND_SERVICE_DESCRIPTOR",
+ new String[]{"cat1", "name1"}));
+
+ action.validate(l);
+
+ if (l.isValid() == false) {
+ fail(l.invalidMessage());
+ }
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 07:30:56 UTC (rev 106)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/actions/TestESBService.java 2008-07-03 10:06:31 UTC (rev 107)
@@ -117,6 +117,14 @@
return(m_root);
}
+ public void setCreateSession(boolean bool) {
+ m_createSession = bool;
+ }
+
+ public boolean isCreateSession() {
+ return(m_createSession);
+ }
+
public void setSessionBased(boolean bool) {
m_sessionBased = bool;
}
@@ -136,5 +144,6 @@
private List<ESBAction> m_actions=new java.util.Vector<ESBAction>();
private boolean m_root=false;
private boolean m_sessionBased=false;
+ private boolean m_createSession=false;
private Class<?> m_sessionClass=null;
}
15 years, 10 months
Overlord SVN: r106 - in sam/trunk: src/main/java/org/jboss/sam and 3 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-03 03:30:56 -0400 (Thu, 03 Jul 2008)
New Revision: 106
Added:
sam/trunk/src/main/java/org/jboss/sam/ProcessingStatement.java
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
Removed:
sam/trunk/src/main/java/org/jboss/sam/Statement.java
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java
Modified:
sam/trunk/SAM.iws
sam/trunk/src/main/java/org/jboss/sam/EventProcessor.java
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
sam/trunk/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java
sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
Log:
Rename Statement to ProcessingStatement
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/SAM.iws 2008-07-03 07:30:56 UTC (rev 106)
@@ -172,10 +172,10 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="Statement.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/Statement.java">
+ <file leaf-file-name="ProcessingStatement.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="23" selection-start="1400" selection-end="1400" vertical-scroll-proportion="0.2413793">
+ <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
<folding />
</state>
</provider>
@@ -184,16 +184,16 @@
<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="122" column="53" selection-start="4202" selection-end="4202" vertical-scroll-proportion="0.36660618">
+ <state line="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="EsperStatement.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java">
+ <file leaf-file-name="EsperProcessingStatement.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="32" column="0" selection-start="1303" selection-end="1303" vertical-scroll-proportion="0.41379312">
+ <state line="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
<folding>
<element signature="imports" expanded="true" />
</folding>
@@ -201,19 +201,37 @@
</provider>
</entry>
</file>
+ <file leaf-file-name="StreamInputCallback.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
<file leaf-file-name="StreamOutput.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="30" column="17" selection-start="1321" selection-end="1321" vertical-scroll-proportion="0.3448276">
+ <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
<folding />
</state>
</provider>
</entry>
</file>
+ <file leaf-file-name="EventMessage.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
<file leaf-file-name="EventProcessor.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="45" selection-start="1436" selection-end="1436" vertical-scroll-proportion="0.03448276">
+ <state line="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
<folding />
</state>
</provider>
@@ -660,7 +678,7 @@
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32915717" order="1" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32915717" order="1" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39863327" order="3" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@@ -764,13 +782,6 @@
<option name="myLastEditedConfigurable" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="36" column="19" selection-start="1386" selection-end="1386" vertical-scroll-proportion="-0.39806998">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="34" column="13" selection-start="1418" selection-end="1418" vertical-scroll-proportion="0.1794569">
@@ -792,13 +803,6 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.1794569">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="37" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.022432113">
@@ -836,41 +840,55 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="45" selection-start="1436" selection-end="1436" vertical-scroll-proportion="0.03448276">
+ <state line="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.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="30" column="17" selection-start="1321" selection-end="1321" vertical-scroll-proportion="0.3448276">
+ <state line="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="122" column="53" selection-start="4202" selection-end="4202" vertical-scroll-proportion="0.36660618">
+ <state line="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/Statement.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="23" selection-start="1400" selection-end="1400" vertical-scroll-proportion="0.2413793">
+ <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="32" column="0" selection-start="1303" selection-end="1303" vertical-scroll-proportion="0.41379312">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
+ <state line="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
+ <folding />
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
+ <folding />
+ </state>
+ </provider>
+ </entry>
</component>
</project>
Modified: sam/trunk/src/main/java/org/jboss/sam/EventProcessor.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/EventProcessor.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/main/java/org/jboss/sam/EventProcessor.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -25,7 +25,7 @@
/**
* An event processor glues together {@link org.jboss.sam.StreamInput} and {@link org.jboss.sam.StreamOutput}
- * and provides a way to register {@link org.jboss.sam.Statement}'s,
+ * and provides a way to register {@link org.jboss.sam.ProcessingStatement}'s,
* both bound (event forwarding) and unbound (event aggregation and filtering).
* <p>
* Instances are created through {@link org.jboss.sam.EventProcessorFactory}
@@ -77,7 +77,7 @@
* @param epl
* @return
*/
- Statement registerStatement(String statementName, String epl);
+ ProcessingStatement registerStatement(String statementName, String epl);
/**
* Creates a statement and binds it to an output stream.
@@ -87,7 +87,7 @@
* @param epl
* @return
*/
- Statement registerBoundStatement(String streamOutputName, String statementName, String epl);
+ ProcessingStatement registerBoundStatement(String streamOutputName, String statementName, String epl);
/**
* Cleanup a statement and remove it
Added: sam/trunk/src/main/java/org/jboss/sam/ProcessingStatement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/ProcessingStatement.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/ProcessingStatement.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -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.sam;
+
+/**
+ * Represents an EPL (event processing languge) statement.
+ * Statements are associated with a {@link org.jboss.sam.EventProcessor}
+ * and can be bound to a {@link org.jboss.sam.StreamOutput} to forward events,
+ * or used unbound to aggregate and filter events.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ProcessingStatement<T>
+{
+ /**
+ * Statements are managed by name
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the EPL expression this statement was created from
+ * @return
+ */
+ String getExpression();
+
+ /**
+ * Check wether the statement is bound to a {@link org.jboss.sam.StreamOutput}
+ * @return
+ */
+ boolean isBound();
+
+ /**
+ * Access the underlying implementation
+ * @return
+ */
+ T getUnderlying();
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/ProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: sam/trunk/src/main/java/org/jboss/sam/Statement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/Statement.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/main/java/org/jboss/sam/Statement.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -1,57 +0,0 @@
-/*
- * 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.sam;
-
-/**
- * Represents an EPL (event processing languge) statement.
- * Statements are associated with a {@link org.jboss.sam.EventProcessor}
- * and can be bound to a {@link org.jboss.sam.StreamOutput} to forward events,
- * or used unbound to aggregate and filter events.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface Statement<T>
-{
- /**
- * Statements are managed by name
- * @return
- */
- String getName();
-
- /**
- * Get the EPL expression this statement was created from
- * @return
- */
- String getExpression();
-
- /**
- * Check wether the statement is bound to a {@link org.jboss.sam.StreamOutput}
- * @return
- */
- boolean isBound();
-
- /**
- * Access the underlying implementation
- * @return
- */
- T getUnderlying();
-}
Added: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -0,0 +1,69 @@
+/*
+ * 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.sam.internal.esper;
+
+import com.espertech.esper.client.EPStatement;
+import org.jboss.sam.ProcessingStatement;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EsperProcessingStatement implements ProcessingStatement<EPStatement>
+{
+ private EPStatement delegate;
+
+ protected String name;
+
+ private boolean bound;
+
+ public EsperProcessingStatement(EPStatement delegate)
+ {
+ this(delegate, false);
+ }
+
+ public EsperProcessingStatement(EPStatement delegate, boolean isBound)
+ {
+ this.bound = isBound;
+ this.delegate = delegate;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public boolean isBound()
+ {
+ return this.bound;
+ }
+
+ public String getExpression()
+ {
+ return delegate.getText();
+ }
+
+ public EPStatement getUnderlying()
+ {
+ return delegate;
+ }
+
+}
Property changes on: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -44,7 +44,7 @@
private Map<String, StreamInput> inputStreams = new ConcurrentHashMap<String, StreamInput>();
private Map<String, StreamOutput> outputStreams = new ConcurrentHashMap<String, StreamOutput>();
- private Map<String, Statement> statements = new ConcurrentHashMap<String, Statement>();
+ private Map<String, ProcessingStatement> statements = new ConcurrentHashMap<String, ProcessingStatement>();
public EsperRuntimeImpl(String name, URL config)
{
@@ -105,20 +105,20 @@
epService.getEPRuntime().sendEvent(args);
}
- public Statement registerStatement(String statementName, String epl)
+ public ProcessingStatement registerStatement(String statementName, String epl)
{
EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
- return new EsperStatement(epStatement);
+ return new EsperProcessingStatement(epStatement);
}
- public Statement registerBoundStatement(String outputStreamName, String statementName, String epl)
+ public ProcessingStatement registerBoundStatement(String outputStreamName, String statementName, String epl)
{
StreamOutput streamOutput = this.outputStreams.get(outputStreamName);
if(null == streamOutput)
throw new IllegalArgumentException("No such output stream: " + outputStreamName);
EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
- EsperStatement statement = new EsperStatement(epStatement);
+ EsperProcessingStatement statement = new EsperProcessingStatement(epStatement);
StreamOutputAdapter adapter = new StreamOutputAdapter(streamOutput);
statement.getUnderlying().addListener(adapter);
return statement;
@@ -132,7 +132,7 @@
public void clearStatement(String statementName)
{
- Statement stmt = statements.get(statementName);
+ ProcessingStatement stmt = statements.get(statementName);
if(null==stmt)
throw new IllegalArgumentException("No such statement: " + statementName);
Deleted: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -1,69 +0,0 @@
-/*
- * 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.sam.internal.esper;
-
-import com.espertech.esper.client.EPStatement;
-import org.jboss.sam.Statement;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class EsperStatement implements Statement<EPStatement>
-{
- private EPStatement delegate;
-
- protected String name;
-
- private boolean bound;
-
- public EsperStatement(EPStatement delegate)
- {
- this(delegate, false);
- }
-
- public EsperStatement(EPStatement delegate, boolean isBound)
- {
- this.bound = isBound;
- this.delegate = delegate;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public boolean isBound()
- {
- return this.bound;
- }
-
- public String getExpression()
- {
- return delegate.getText();
- }
-
- public EPStatement getUnderlying()
- {
- return delegate;
- }
-
-}
Modified: sam/trunk/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -21,7 +21,7 @@
*/
package org.jboss.test.sam.adapter.invm;
-import org.jboss.sam.Statement;
+import org.jboss.sam.ProcessingStatement;
import org.jboss.test.sam.SamTestSetup;
/**
@@ -38,7 +38,7 @@
{
// setup
String stmt = "select * from Alert.win:length(1)";
- Statement view = eventProcessor.registerBoundStatement("InVM","AlertTest", stmt);
+ ProcessingStatement view = eventProcessor.registerBoundStatement("InVM","AlertTest", stmt);
// fire event
generateInVMEvent( new Alert("sensor1", "Threshold exceeded") );
Modified: sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java 2008-07-03 07:27:35 UTC (rev 105)
+++ sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java 2008-07-03 07:30:56 UTC (rev 106)
@@ -25,7 +25,7 @@
import com.espertech.esper.client.EPStatement;
import com.espertech.esper.client.StatementAwareUpdateListener;
import com.espertech.esper.event.EventBean;
-import org.jboss.sam.Statement;
+import org.jboss.sam.ProcessingStatement;
import org.jboss.sam.EventMessage;
import org.jboss.test.sam.SamTestSetup;
import org.jboss.test.sam.InMemoryDatabase;
@@ -87,7 +87,7 @@
String epl = "select symbol, price from Query.win:length(1) as query," +
" sql:SamTestDB ['SELECT symbol, price FROM quotes WHERE symbol like (${query.criteria})']";
- Statement view = eventProcessor.registerBoundStatement("InVM","TriggerSQL", epl);
+ ProcessingStatement view = eventProcessor.registerBoundStatement("InVM","TriggerSQL", epl);
// trigger
generateInVMEvent( new Query("%") );
15 years, 10 months
Overlord SVN: r105 - in sam/trunk: src/main/java/org/jboss/sam and 1 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-03 03:27:35 -0400 (Thu, 03 Jul 2008)
New Revision: 105
Modified:
sam/trunk/SAM.iws
sam/trunk/sam-trunk.iml
sam/trunk/src/main/java/org/jboss/sam/Statement.java
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java
Log:
Remove statement->stream output association. It's implementation detail
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-03 07:27:00 UTC (rev 104)
+++ sam/trunk/SAM.iws 2008-07-03 07:27:35 UTC (rev 105)
@@ -148,8 +148,8 @@
<property name="field_breakpoints_groupByClasses" value="true" />
<property name="method_breakpoints_groupByClasses" value="true" />
<property name="exception_breakpoints_viewId" value="TABLE" />
- <property name="field_breakpoints_viewId" value="TABLE" />
<property name="exception_breakpoints_groupByClasses" value="true" />
+ <property name="field_breakpoints_viewId" value="TABLE" />
<property name="method_breakpoints_groupByMethods" value="false" />
</ui_properties>
</component>
@@ -172,15 +172,53 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="ChartServer.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
+ <file leaf-file-name="Statement.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/Statement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="47" column="64" selection-start="1705" selection-end="1705" vertical-scroll-proportion="0.60566705">
+ <state line="31" column="23" selection-start="1400" selection-end="1400" vertical-scroll-proportion="0.2413793">
<folding />
</state>
</provider>
</entry>
</file>
+ <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="122" column="53" selection-start="4202" selection-end="4202" vertical-scroll-proportion="0.36660618">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="EsperStatement.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="32" column="0" selection-start="1303" selection-end="1303" vertical-scroll-proportion="0.41379312">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="StreamOutput.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="30" column="17" selection-start="1321" selection-end="1321" vertical-scroll-proportion="0.3448276">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="EventProcessor.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="31" column="45" selection-start="1436" selection-end="1436" vertical-scroll-proportion="0.03448276">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
</leaf>
</component>
<component name="FindManager">
@@ -358,40 +396,6 @@
<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/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/sim" />
- <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>
@@ -431,41 +435,7 @@
<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>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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$/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$/src/main/java/org/jboss/sam/chart" />
- <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>
</subPane>
</component>
<component name="ProjectReloadState">
@@ -479,7 +449,7 @@
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
- <showStructure ProjectPane="false" PackagesPane="false" Scope="false" Favorites="false" />
+ <showStructure PackagesPane="false" ProjectPane="false" Scope="false" Favorites="false" />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
@@ -489,13 +459,13 @@
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
- <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="RunManagerConfig.compileBeforeRunning" value="false" />
+ <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
- <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
+ <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" />
</component>
@@ -534,19 +504,6 @@
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
</configuration>
- <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
- <option name="MAIN_CLASS_NAME" />
- <option name="VM_PARAMETERS" />
- <option name="PROGRAM_PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
- <option name="ALTERNATIVE_JRE_PATH" />
- <option name="ENABLE_SWING_INSPECTOR" value="false" />
- <module name="" />
- <method>
- <option name="Make" value="true" />
- </method>
- </configuration>
<configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -566,6 +523,19 @@
<option name="Make" value="true" />
</method>
</configuration>
+ <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <module name="" />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
<configuration default="false" name="client" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
@@ -690,7 +660,7 @@
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32915717" order="1" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32915717" order="1" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39863327" order="3" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
@@ -788,114 +758,116 @@
</component>
<component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="0.16666667" version="1">
<option name="myPlainMode" value="false" />
- <option name="myLastEditedConfigurable" value="javasim-samples" />
+ <option name="myLastEditedConfigurable" value="Modules" />
</component>
<component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
<option name="myLastEditedConfigurable" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="36" column="0" selection-start="1357" selection-end="1357" vertical-scroll-proportion="0.36670688">
+ <state line="36" column="19" selection-start="1386" selection-end="1386" vertical-scroll-proportion="-0.39806998">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="22" selection-start="1139" selection-end="1139" vertical-scroll-proportion="0.13751508">
+ <state line="34" column="13" selection-start="1418" selection-end="1418" vertical-scroll-proportion="0.1794569">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMetadata.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="30" column="17" selection-start="1253" selection-end="1253" vertical-scroll-proportion="0.2291918">
+ <state line="26" column="13" selection-start="1133" selection-end="1133" vertical-scroll-proportion="0.13459268">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServerFactory.java">
+ <entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="22" selection-start="1139" selection-end="1139" vertical-scroll-proportion="0.13751508">
+ <state line="26" column="65" selection-start="1109" selection-end="1109" vertical-scroll-proportion="-4.594952">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="36" column="19" selection-start="1386" selection-end="1386" vertical-scroll-proportion="-0.39806998">
+ <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.1794569">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/Statement.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.24675325">
+ <state line="37" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.022432113">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="34" column="13" selection-start="1418" selection-end="1418" vertical-scroll-proportion="0.1794569">
+ <state line="38" column="13" selection-start="1528" selection-end="1528" vertical-scroll-proportion="0.022432113">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="13" selection-start="1133" selection-end="1133" vertical-scroll-proportion="0.13459268">
+ <state line="37" column="19" selection-start="1563" selection-end="1563" vertical-scroll-proportion="0.33293977">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/pom.xml">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="65" selection-start="1109" selection-end="1109" vertical-scroll-proportion="-4.594952">
+ <state line="47" column="64" selection-start="1705" selection-end="1705" vertical-scroll-proportion="0.60566705">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.1794569">
+ <state line="30" column="13" selection-start="1274" selection-end="1274" vertical-scroll-proportion="0.044864226">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="30" column="13" selection-start="1274" selection-end="1274" vertical-scroll-proportion="0.022432113">
+ <state line="31" column="45" selection-start="1436" selection-end="1436" vertical-scroll-proportion="0.03448276">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="37" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.022432113">
+ <state line="30" column="17" selection-start="1321" selection-end="1321" vertical-scroll-proportion="0.3448276">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.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="38" column="13" selection-start="1528" selection-end="1528" vertical-scroll-proportion="0.022432113">
+ <state line="122" column="53" selection-start="4202" selection-end="4202" vertical-scroll-proportion="0.36660618">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/Statement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="37" column="19" selection-start="1563" selection-end="1563" vertical-scroll-proportion="0.33293977">
+ <state line="31" column="23" selection-start="1400" selection-end="1400" vertical-scroll-proportion="0.2413793">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="47" column="64" selection-start="1705" selection-end="1705" vertical-scroll-proportion="0.60566705">
- <folding />
+ <state line="32" column="0" selection-start="1303" selection-end="1303" vertical-scroll-proportion="0.41379312">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml 2008-07-03 07:27:00 UTC (rev 104)
+++ sam/trunk/sam-trunk.iml 2008-07-03 07:27:35 UTC (rev 105)
@@ -92,6 +92,42 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: cglib:cglib-nodep:jar:2.1_3:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: log4j:log4j:jar:1.2.14:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: mysql:mysql-connector-java:jar:3.1.14:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/mysql/mysql-connector-java/3.1.14/mysql-connector-java-3.1.14.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: commons-logging:commons-logging:jar:1.1.1:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
</module>
Modified: sam/trunk/src/main/java/org/jboss/sam/Statement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/Statement.java 2008-07-03 07:27:00 UTC (rev 104)
+++ sam/trunk/src/main/java/org/jboss/sam/Statement.java 2008-07-03 07:27:35 UTC (rev 105)
@@ -38,18 +38,15 @@
String getName();
/**
- * Bind to a stream output
- * @param stream
+ * Get the EPL expression this statement was created from
+ * @return
*/
- void bindTo(StreamOutput stream);
-
+ String getExpression();
+
/**
- * Remove a stream output binding
- * @param name
+ * Check wether the statement is bound to a {@link org.jboss.sam.StreamOutput}
* @return
*/
- StreamOutput unbind(String name);
-
boolean isBound();
/**
Modified: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-03 07:27:00 UTC (rev 104)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-03 07:27:35 UTC (rev 105)
@@ -76,7 +76,7 @@
this.inputStreams.remove(streamName);
}
- public Iterator<String> getInputStreamNames()
+ public Iterator<String> getStreamInputNames()
{
return this.inputStreams.keySet().iterator();
}
@@ -91,7 +91,7 @@
this.outputStreams.remove(streamName);
}
- public Iterator<String> getOutputStreamNames()
+ public Iterator<String> getStreamOutputNames()
{
return this.outputStreams.keySet().iterator();
}
@@ -119,8 +119,8 @@
EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
EsperStatement statement = new EsperStatement(epStatement);
- statement.bindTo(streamOutput);
-
+ StreamOutputAdapter adapter = new StreamOutputAdapter(streamOutput);
+ statement.getUnderlying().addListener(adapter);
return statement;
}
Modified: sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java 2008-07-03 07:27:00 UTC (rev 104)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/esper/EsperStatement.java 2008-07-03 07:27:35 UTC (rev 105)
@@ -23,20 +23,13 @@
import com.espertech.esper.client.EPStatement;
import org.jboss.sam.Statement;
-import org.jboss.sam.StreamOutput;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class EsperStatement implements Statement<EPStatement>
{
private EPStatement delegate;
-
- // Registered listener, 1:n
- protected Map<String, StreamOutputAdapter> listener = new HashMap<String, StreamOutputAdapter>();
protected String name;
@@ -63,20 +56,14 @@
return this.bound;
}
- public void bindTo(StreamOutput stream)
+ public String getExpression()
{
- StreamOutputAdapter adapter = new StreamOutputAdapter(stream);
- delegate.addListener(adapter);
- this.listener.put(stream.getStreamName(), adapter);
+ return delegate.getText();
}
- public StreamOutput unbind(String name)
- {
- return null;
- }
-
public EPStatement getUnderlying()
{
return delegate;
}
+
}
15 years, 10 months