[seam-commits] Seam SVN: r14421 - in branches/community/Seam_2_3/examples-ee6: drools and 33 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Mar 16 17:33:42 EDT 2012


Author: dhinojosa
Date: 2012-03-16 17:33:41 -0400 (Fri, 16 Mar 2012)
New Revision: 14421

Added:
   branches/community/Seam_2_3/examples-ee6/drools/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/pom.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/application/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/application/pageflow.jpdl.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/pom.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Game.java
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Guess.java
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/RandomNumber.java
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.drl
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.rf
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.xls
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.drl
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.xls
   branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/seam.properties
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/pom.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/test/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/test/DroolsNumberGuessTest.java
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/testng.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-integration/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-integration/testng.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/drools.properties
   branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/seam.properties
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/pom.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/resources/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/resources/messages.properties
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/components.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/faces-config.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/web.xml
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/index.html
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/lose.jsp
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/numberGuess.jsp
   branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/win.jsp
   branches/community/Seam_2_3/examples-ee6/drools/pageflow.jpg
   branches/community/Seam_2_3/examples-ee6/drools/pom.xml
   branches/community/Seam_2_3/examples-ee6/drools/readme.txt
Modified:
   branches/community/Seam_2_3/examples-ee6/pom.xml
Log:
added drools component to examples-ee6

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ear/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ear/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ear/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.jboss.seam.examples-ee6</groupId>
+      <artifactId>drools</artifactId>
+      <version>2.3.0-SNAPSHOT</version>
+      <relativePath>../pom.xml</relativePath>
+   </parent>
+
+   <groupId>org.jboss.seam.examples-ee6</groupId>
+   <artifactId>drools-ear</artifactId>
+   <packaging>ear</packaging>
+   <name>Drools EAR Module (EE6)</name>
+
+   <properties>
+      <jboss.home>${env.JBOSS_HOME}</jboss.home>
+      <jboss.domain>default</jboss.domain>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.seam.examples-ee6</groupId>
+         <artifactId>drools-web</artifactId>
+         <version>${project.version}</version>
+         <type>war</type>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam.examples-ee6</groupId>
+         <artifactId>drools-ejb</artifactId>
+         <version>${project.version}</version>
+         <type>ejb</type>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam</groupId>
+         <artifactId>jboss-seam</artifactId>
+         <type>ejb</type>
+         <scope>compile</scope>
+         <exclusions>
+            <exclusion>
+               <groupId>com.thoughtworks.xstream</groupId>
+               <artifactId>xstream</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>xpp3</groupId>
+               <artifactId>xpp3_min</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <finalName>seam-drools</finalName>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-ear-plugin</artifactId>
+            <version>2.3.2</version>
+            <configuration>
+               <version>5</version>
+               <defaultLibBundleDir>lib</defaultLibBundleDir>
+               <!-- Exclude eclipse generated application.xml and manually modified jboss-app.xml during mvn build  -->
+               <earSourceExcludes>**/application.xml, **/jboss-app.xml</earSourceExcludes>
+               <!-- use maven generated application.xml instead -->
+               <generateApplicationXml>true</generateApplicationXml>
+               <filtering>true</filtering>
+               <jboss>
+                  <version>4.2</version>
+                  <loader-repository>seam.jboss.org:loader=seam-drools</loader-repository>
+               </jboss>
+               <modules>
+                  <webModule>
+                     <groupId>org.jboss.seam.examples-ee6</groupId>
+                     <artifactId>drools-web</artifactId>
+                     <contextRoot>/seam-drools</contextRoot>
+                     <bundleFileName>drools-web.war</bundleFileName>
+                  </webModule>
+                  <ejbModule>
+                     <groupId>org.jboss.seam.examples-ee6</groupId>
+                     <artifactId>drools-ejb</artifactId>
+                     <bundleFileName>drools-ejb.jar</bundleFileName>
+                  </ejbModule>
+               </modules>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>jboss-maven-plugin</artifactId>
+            <configuration>
+               <jbossHome>${jboss.home}</jbossHome>
+               <serverName>${jboss.domain}</serverName>
+               <fileNames>
+                  <param>${project.build.directory}/${project.build.finalName}.${project.packaging}</param>
+               </fileNames>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+   <profiles>
+      <profile>
+         <id>exploded</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-dependency-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>unpack</id>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                           <artifactItems>
+                              <artifactItem>
+                                 <groupId>org.jboss.seam.examples-ee6</groupId>
+                                 <artifactId>drools-ear</artifactId>
+                                 <type>ear</type>
+                                 <overWrite>true</overWrite>
+                                 <outputDirectory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear
+                                 </outputDirectory>
+                              </artifactItem>
+                              <artifactItem>
+                                 <groupId>org.jboss.seam.examples-ee6</groupId>
+                                 <artifactId>drools-web</artifactId>
+                                 <type>war</type>
+                                 <overWrite>true</overWrite>
+                                 <outputDirectory>
+                                    ${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-web.war
+                                 </outputDirectory>
+                              </artifactItem>
+                              <artifactItem>
+                                 <groupId>org.jboss.seam.examples-ee6</groupId>
+                                 <artifactId>drools-ejb</artifactId>
+                                 <type>jar</type>
+                                 <overWrite>true</overWrite>
+                                 <outputDirectory>
+                                    ${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear/${example.name}-ejb.jar
+                                 </outputDirectory>
+                              </artifactItem>
+                           </artifactItems>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>jboss-maven-plugin</artifactId>
+                  <configuration>
+                     <jbossHome>${jboss.home}</jbossHome>
+                     <serverName>${jboss.domain}</serverName>
+                     <fileNames>
+                        <directory>${project.build.directory}/${project.build.finalName}-exploded/${project.build.finalName}.ear</directory>
+                     </fileNames>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+</project>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/application/pageflow.jpdl.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/application/pageflow.jpdl.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ear/src/main/application/pageflow.jpdl.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,47 @@
+<!-- 
+
+   An example of pageflow integrated with rules
+   
+-->
+
+<pageflow-definition	
+	xmlns="http://jboss.com/products/seam/pageflow"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation=
+	    "http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.3.xsd" 
+	name="numberGuess">
+   
+   <start-page name="displayGuess" view-id="/numberGuess.jsp">
+      <redirect/>
+      <transition name="guess" to="drools"/>
+   </start-page>
+  
+   <decision name="drools">
+
+      <handler class="org.jboss.seam.drools.DroolsDecisionHandler">
+         <workingMemoryName>workingMemory</workingMemoryName>
+         <!-- if a ruleflow was added, start a process -->
+         <!-- <startProcessId>numberguessid</startProcessId> -->  
+         <assertObjects>
+            <!-- <element>#{game}</element> -->
+            <element>#{guess}</element>
+         </assertObjects>
+      </handler>
+
+      <transition to="displayGuess"/>
+      <transition name="lose" to="lose"/>
+      <transition name="win" to="win"/>
+      
+   </decision>
+   
+   <page name="win" view-id="/win.jsp">
+   	  <end-conversation />
+      <redirect/>
+   </page>
+   
+   <page name="lose" view-id="/lose.jsp">
+      <end-conversation />
+      <redirect/>
+   </page>
+   
+</pageflow-definition>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.jboss.seam.examples-ee6</groupId>
+      <artifactId>drools</artifactId>
+      <version>2.3.0-SNAPSHOT</version>
+      <relativePath>../pom.xml</relativePath>
+   </parent>
+
+   <groupId>org.jboss.seam.examples-ee6</groupId>
+   <artifactId>drools-ejb</artifactId>
+   <packaging>ejb</packaging>
+   <name>Drools EJB Module (EE6)</name>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>add-resource</id>
+                  <phase>generate-resources</phase>
+                  <goals>
+                     <goal>add-resource</goal>
+                  </goals>
+                  <configuration>
+                     <resources>
+                        <resource>
+                           <directory>${basedir}/../drools-ear/src/main/application</directory>
+                           <targetPath>${build.output.directory}</targetPath>
+                           <includes>
+                              <include>**/pageflow.jpdl.xml</include>
+                           </includes>
+                        </resource>
+                     </resources>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
+      </plugins>
+   </build>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.seam</groupId>
+         <artifactId>jboss-seam</artifactId>
+         <type>ejb</type>
+      </dependency>
+      <dependency>
+         <groupId>javax.persistence</groupId>
+         <artifactId>persistence-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.drools</groupId>
+         <artifactId>drools-core</artifactId>
+         <exclusions>
+            <exclusion>
+               <groupId>joda-time</groupId>
+               <artifactId>joda-time</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+      <dependency>
+         <groupId>org.drools</groupId>
+         <artifactId>drools-compiler</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.drools</groupId>
+         <artifactId>drools-decisiontables</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.drools</groupId>
+         <artifactId>drools-templates</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javax.servlet</groupId>
+         <artifactId>servlet-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.ejb</groupId>
+         <artifactId>ejb-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javax.faces</groupId>
+         <artifactId>jsf-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jbpm</groupId>
+         <artifactId>jbpm-jpdl</artifactId>
+      </dependency>
+   </dependencies>
+
+</project>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Game.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Game.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Game.java	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,56 @@
+package org.jboss.seam.example.numberguess;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+ at Name("game")
+ at Scope(ScopeType.CONVERSATION)
+public class Game
+{
+   
+   private int biggest;
+   private int smallest;
+   private int guessCount;
+   
+   @Create 
+   @Begin(pageflow="numberGuess")
+   public void begin()
+   {
+      guessCount = 0;
+      biggest = 100;
+      smallest = 1;
+   }
+   
+   public void incrementGuessCount()
+   {
+      guessCount++;
+   }
+   
+   public int getBiggest()
+   {
+      return biggest;
+   }
+   
+   public int getSmallest()
+   {
+      return smallest;
+   }
+   
+   public int getGuessCount()
+   {
+      return guessCount;
+   }
+
+   public void setBiggest(int biggest)
+   {
+      this.biggest = biggest;
+   }
+
+   public void setSmallest(int smallest)
+   {
+      this.smallest = smallest;
+   }
+}

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/GameConsequenceExceptionHandler.java	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,37 @@
+package org.jboss.seam.example.numberguess;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.drools.WorkingMemory;
+import org.drools.spi.Activation;
+import org.drools.spi.ConsequenceException;
+import org.drools.spi.ConsequenceExceptionHandler;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+
+ at Scope(ScopeType.APPLICATION)
+ at Startup
+ at Name("gameConsequenceExceptionHandler")
+public class GameConsequenceExceptionHandler implements ConsequenceExceptionHandler, Externalizable {
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+   }
+
+   public void writeExternal(ObjectOutput out) throws IOException {
+   }
+
+   public void handleException(Activation activation,
+                               WorkingMemory workingMemory,
+                               Exception exception) {
+       throw new ConsequenceException( exception,
+                                       activation.getRule() );
+   }
+
+}
+
+

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Guess.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Guess.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/Guess.java	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,26 @@
+package org.jboss.seam.example.numberguess;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+ at Name("guess")
+ at Scope(ScopeType.CONVERSATION)
+ at BypassInterceptors
+public class Guess
+{
+
+   private Integer value;
+
+   public void setValue(Integer guess)
+   {
+      this.value = guess;
+   }
+   
+   public Integer getValue()
+   {
+      return value;
+   }
+
+}

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/RandomNumber.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/RandomNumber.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/java/org/jboss/seam/example/numberguess/RandomNumber.java	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,29 @@
+package org.jboss.seam.example.numberguess;
+
+import java.util.Random;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+
+ at Name("randomNumber")
+ at Scope(ScopeType.CONVERSATION)
+public class RandomNumber
+{
+   private int randomNumber;
+   
+   @Create 
+   public void begin()
+   {
+      randomNumber = new Random().nextInt(100) + 1;
+   }
+   
+   @Unwrap
+   public int getValue() 
+   {
+      return randomNumber;
+   }
+   
+}

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.drl
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.drl	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.drl	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,52 @@
+package org.jboss.seam.example.numberguess
+
+import org.jboss.seam.drools.Decision;
+import java.lang.Integer;
+
+global Decision decision
+global Integer randomNumber
+global Game game
+
+rule High
+   #ruleflow-group "Guess"	
+   when 
+      Guess(guess: value>randomNumber)
+   then 
+      game.setBiggest(guess-1);
+end
+
+rule Low
+   #ruleflow-group "Guess"
+   when
+      Guess(guess: value<randomNumber)
+   then 
+      game.setSmallest(guess+1);
+end
+
+rule Win
+   #ruleflow-group "Decision"
+   when 
+      Guess(value==randomNumber)
+   then 
+      decision.setOutcome("win");
+end
+
+rule Lose
+   #ruleflow-group "Decision"
+   when 
+   	  Guess(value!=randomNumber)
+   then
+      if ( game.getGuessCount() == 9 && decision.getOutcome()==null )
+      {
+         decision.setOutcome("lose");
+      }
+end
+
+rule Increment
+   #ruleflow-group "Increment"
+   salience -10
+   when
+      Guess()
+   then
+      game.incrementGuessCount();
+end

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.rf
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.rf	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.rf	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="numberguess" id="numberguessid" package-name="org.jboss.seam.example.numberguess" version="" routerLayout="2" >
+
+  <header>
+  </header>
+
+  <nodes>
+    <ruleSet id="17" name="Increment" x="336" y="156" width="80" height="40" ruleFlowGroup="Increment" />
+    <ruleSet id="13" name="Decision" x="216" y="156" width="80" height="40" ruleFlowGroup="Decision" />
+    <start id="8" name="Start" x="84" y="24" width="80" height="40" />
+    <end id="21" name="End" x="336" y="264" width="80" height="40" />
+    <ruleSet id="5" name="Guess" x="84" y="156" width="80" height="40" ruleFlowGroup="Guess" />
+  </nodes>
+
+  <connections>
+    <connection from="13" to="17" />
+    <connection from="5" to="13" />
+    <connection from="17" to="21" />
+    <connection from="8" to="5" />
+  </connections>
+
+</process>
\ No newline at end of file


Property changes on: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.rf
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.xls
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguess.xls
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.drl
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.drl	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.drl	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,52 @@
+package org.jboss.seam.example.numberguess
+
+import org.jboss.seam.drools.Decision;
+import java.lang.Integer;
+
+global Decision decision
+global Integer randomNumber
+global Game game
+
+rule High
+   ruleflow-group "Guess"	
+   when 
+      Guess(guess: value>randomNumber)
+   then 
+      game.setBiggest(guess-1);
+end
+
+rule Low
+   ruleflow-group "Guess"
+   when
+      Guess(guess: value<randomNumber)
+   then 
+      game.setSmallest(guess+1);
+end
+
+rule Win
+   ruleflow-group "Decision"
+   when 
+      Guess(value==randomNumber)
+   then 
+      decision.setOutcome("win");
+end
+
+rule Lose
+   ruleflow-group "Decision"
+   when 
+      Game(guessCount==9)
+   then
+      if ( decision.getOutcome()==null )
+      {
+         decision.setOutcome("lose");
+      }
+end
+
+rule Increment
+   ruleflow-group "Increment"
+   salience -10
+   when
+      Guess()
+   then
+      game.incrementGuessCount();
+end

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.xls
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/numberguessforflow.xls
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/seam.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/seam.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-ejb/src/main/resources/seam.properties	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1 @@
+

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.jboss.seam.examples-ee6</groupId>
+      <artifactId>drools</artifactId>
+      <version>2.3.0-SNAPSHOT</version>
+      <relativePath>../pom.xml</relativePath>
+   </parent>
+
+   <groupId>org.jboss.seam.examples-ee6</groupId>
+   <artifactId>drools-tests</artifactId>
+   <name>Drools Integration Tests Module (EE6)</name>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.embedded</groupId>
+         <artifactId>jboss-embedded-all</artifactId>
+         <version>beta3.SP15</version>
+         <exclusions>
+            <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-deployers-client-spi</artifactId>
+            </exclusion>
+            <exclusion>
+               <groupId>org.jboss.microcontainer</groupId>
+               <artifactId>jboss-deployers-core-spi</artifactId>
+            </exclusion>
+         </exclusions>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam.embedded</groupId>
+         <artifactId>thirdparty-all</artifactId>
+         <version>beta3.SP15</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam.embedded</groupId>
+         <artifactId>hibernate-all</artifactId>
+         <version>beta3.SP15</version>
+      </dependency>
+      <dependency>
+         <groupId>org.testng</groupId>
+         <artifactId>testng</artifactId>
+         <classifier>jdk15</classifier>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam.examples-ee6</groupId>
+         <artifactId>drools-ejb</artifactId>
+         <type>ejb</type>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam</groupId>
+         <artifactId>jboss-seam</artifactId>
+         <type>ejb</type>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-log4j12</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>javax.faces</groupId>
+         <artifactId>jsf-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javax.mail</groupId>
+         <artifactId>mail</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.seleniumhq.selenium.server</groupId>
+         <artifactId>selenium-server</artifactId>
+         <classifier>standalone</classifier>
+      </dependency>
+      <dependency>
+         <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+         <artifactId>selenium-java-client-driver</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.seam</groupId>
+         <artifactId>functional-tests</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <testResources>
+         <testResource>
+            <directory>src/test/resources</directory>
+            <filtering>true</filtering>
+         </testResource>
+         <testResource>
+            <directory>src/test/bootstrap</directory>
+            <filtering>false</filtering>
+         </testResource>
+         <testResource>
+            <directory>${basedir}/../drools-ear/src/main/application</directory>
+            <filtering>true</filtering>
+         </testResource>
+      </testResources>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+               <skipTests>false</skipTests>
+               <argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true -Xms512m -Xmx512m</argLine>
+               <additionalClasspathElements>
+                  <additionalClasspathElement>${basedir}/../drools-web/src/main/webapp</additionalClasspathElement>
+                  <additionalClasspathElement>${project.build.directory}/dependency/bootstrap</additionalClasspathElement>
+               </additionalClasspathElements>
+               <suiteXmlFiles>
+                  <suiteXmlFile>src/test/resources-integration/testng.xml</suiteXmlFile>
+               </suiteXmlFiles>
+            </configuration>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>copy-seam-bootstrap</id>
+                  <phase>process-resources</phase>
+                  <goals>
+                     <goal>unpack</goal>
+                  </goals>
+                  <configuration>
+                     <includes>bootstrap/**</includes>
+                     <artifactItems>
+                        <artifactItem>
+                           <groupId>org.jboss.seam</groupId>
+                           <artifactId>jboss-embedded-bootstrap</artifactId>
+                           <version>${project.version}</version>
+                           <type>jar</type>
+                           <overWrite>false</overWrite>
+                        </artifactItem>
+                     </artifactItems>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
+      </plugins>
+   </build>
+
+   <profiles>
+      <profile>
+         <id>ftest-jbossas</id>
+         <properties>
+            <example.context.path>seam-drools</example.context.path>
+         </properties>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>jboss-maven-plugin</artifactId>
+                  <configuration>
+                     <jbossHome>${jboss.home}</jbossHome>
+                     <serverName>${jboss.domain}</serverName>
+                     <fileNames>
+                        <param>${basedir}/../drools-ear/target/seam-drools.ear</param>
+                     </fileNames>
+                  </configuration>
+               </plugin>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>selenium-maven-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>failsafe-maven-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-antrun-plugin</artifactId>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+
+</project>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/test/DroolsNumberGuessTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/test/DroolsNumberGuessTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/java/org/jboss/seam/example/numberguess/test/DroolsNumberGuessTest.java	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,253 @@
+//$Id: DroolsNumberGuessTest.java 6415 2007-10-07 22:27:57Z pmuir $
+package org.jboss.seam.example.numberguess.test;
+
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.pageflow.Pageflow;
+import org.jboss.seam.example.numberguess.Game;
+import org.jboss.seam.example.numberguess.Guess;
+import org.jboss.seam.example.numberguess.RandomNumber;
+import org.jboss.seam.mock.SeamTest;
+import org.testng.annotations.Test;
+
+public class DroolsNumberGuessTest extends SeamTest
+{
+   
+   private int guessedValue;
+   
+   @Test
+   public void testNumberGuessWin() throws Exception
+   {
+      String id = new NonFacesRequest("/numberGuess.jsp")
+      {
+
+         @Override
+         protected void renderResponse() throws Exception {
+            Game game = (Game) getInstance(Game.class);
+            Guess guess = (Guess) getInstance(Guess.class);
+            assert game.getBiggest()==100;
+            assert game.getSmallest()==1;
+            assert guess.getValue()==null;
+            assert game.getGuessCount()==0;
+            assert Manager.instance().isLongRunningConversation();
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+            .getNode().getName().equals("displayGuess");
+         }
+         
+      }.run();
+
+      String id2 = new FacesRequest("/numberGuess.jsp", id)
+      {
+
+         @Override
+         protected void applyRequestValues() throws Exception {
+            Guess guess = (Guess) getInstance(Guess.class); 
+            guessedValue = getRandomNumber() > 50 ? 25 : 75;
+            guess.setValue(guessedValue);
+         }
+
+         @Override
+         protected void invokeApplication() throws Exception {
+            setOutcome("guess");
+            //ng.guess();
+         }
+         
+         @Override
+         protected void afterRequest() {
+            assert !isRenderResponseBegun();
+            assert getViewId().equals("/numberGuess.jsp");
+         }
+         
+      }.run();
+      
+      assert id2.equals(id);
+      
+      new NonFacesRequest("/numberGuess.jsp", id)
+      {
+         
+         @Override
+         protected void renderResponse() throws Exception {
+            Game game = (Game) getInstance(Game.class);
+            Guess guess = (Guess) getInstance(Guess.class);
+            assert ( guessedValue > getRandomNumber() && game.getBiggest()==guessedValue-1 ) 
+                  || ( guessedValue < getRandomNumber() && game.getSmallest()==guessedValue+1 );
+            assert guess.getValue().equals(guessedValue);
+            assert game.getGuessCount()==1;
+            assert Manager.instance().isLongRunningConversation();
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+                  .getNode().getName().equals("displayGuess");
+         }
+         
+      }.run();
+
+      id2 = new FacesRequest("/numberGuess.jsp", id)
+      {
+
+         @Override
+         protected void applyRequestValues() throws Exception {
+            Guess guess = (Guess) getInstance(Guess.class);
+            guessedValue = getRandomNumber();
+            guess.setValue(guessedValue);
+         }
+
+         @Override
+         protected void invokeApplication() throws Exception {
+             Guess guess = (Guess) getInstance(Guess.class);
+            setOutcome("guess");
+            assert guess.getValue().equals(getRandomNumber());
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+            .getNode().getName().equals("displayGuess");
+            //ng.guess();
+         }
+         
+         @Override
+         protected void afterRequest()
+         {
+            assert !isRenderResponseBegun();
+            assert getViewId().equals("/win.jsp");
+         }
+         
+      }.run();
+      
+      assert id2.equals(id);
+      
+      new NonFacesRequest("/win.jsp", id)
+      {
+         @Override
+         protected void renderResponse() throws Exception {
+            Game game = (Game) getInstance(Game.class);
+            Guess guess = (Guess) getInstance(Guess.class);
+            assert guess.getValue().equals(getRandomNumber());
+            assert game.getGuessCount()==2;
+            assert !Manager.instance().isLongRunningConversation();
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+                  .getNode().getName().equals("win");
+         }
+         
+      }.run();
+
+   }
+   
+   @Test
+   public void testNumberGuessLose() throws Exception
+   {
+      String id = new NonFacesRequest("/numberGuess.jsp")
+      {
+
+         @Override
+         protected void renderResponse() throws Exception {
+            Game game = (Game) getInstance(Game.class);
+            Guess guess = (Guess) getInstance(Guess.class);
+            assert game.getBiggest()==100;
+            assert game.getSmallest()==1;
+            assert guess.getValue()==null;
+            assert game.getGuessCount()==0;
+            assert Manager.instance().isLongRunningConversation();
+         }
+         
+      }.run();
+      
+      for (int i=1; i<=9; i++)
+      {
+         
+         final int count = i;
+
+         new FacesRequest("/numberGuess.jsp", id)
+         {
+   
+            @Override
+            protected void applyRequestValues() throws Exception {
+               Guess guess = (Guess) getInstance(Guess.class);
+               guessedValue = getRandomNumber() > 50 ? 25+count : 75-count;
+               guess.setValue(guessedValue);
+            }
+   
+            @Override
+            protected void invokeApplication() throws Exception {
+               setOutcome("guess");
+               //ng.guess();
+               //assert Pageflow.instance().getProcessInstance().getRootToken()
+//                     .getNode().getName().equals("displayGuess");
+            }
+            
+            @Override
+            protected void afterRequest()
+            {
+               assert !isRenderResponseBegun();
+               assert getViewId().equals("/numberGuess.jsp");
+            }
+            
+         }.run();
+         
+         new NonFacesRequest("/numberGuess.jsp", id)
+         {
+   
+            @Override
+            protected void renderResponse() throws Exception {
+               Game game = (Game) getInstance(Game.class);
+               Guess guess = (Guess) getInstance(Guess.class);
+               assert ( guessedValue > getRandomNumber() && game.getBiggest()==guessedValue-1 ) 
+                     || ( guessedValue < getRandomNumber() && game.getSmallest()==guessedValue+1 );
+               assert guess.getValue().equals(guessedValue);
+               assert game.getGuessCount()==count;
+               assert Manager.instance().isLongRunningConversation();
+               assert Pageflow.instance().getProcessInstance().getRootToken()
+                     .getNode().getName().equals("displayGuess");
+            }
+            
+         }.run();
+      
+      }
+
+      new FacesRequest("/numberGuess.jsp", id)
+      {
+
+         @Override
+         protected void applyRequestValues() throws Exception {
+            Guess guess = (Guess) getInstance(Guess.class);
+            guessedValue = getRandomNumber() > 50 ? 49 : 51;
+            guess.setValue(guessedValue);
+         }
+
+         @Override
+         protected void invokeApplication() throws Exception {
+            setOutcome("guess");
+            //ng.guess();
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+                  .getNode().getName().equals("displayGuess");
+         }
+
+         @Override
+         protected void afterRequest()
+         {
+            assert !isRenderResponseBegun();
+            assert getViewId().equals("/lose.jsp");
+         }
+         
+      }.run();
+
+      new NonFacesRequest("/lose.jsp", id)
+      {
+
+         @Override
+         protected void renderResponse() throws Exception {
+            Guess guess = (Guess) getInstance(Guess.class);
+            Game game = (Game) getInstance(Game.class);
+            assert ( guessedValue > getRandomNumber() && game.getBiggest()==guessedValue-1 ) 
+                  || ( guessedValue < getRandomNumber() && game.getSmallest()==guessedValue+1 );
+            assert guess.getValue().equals(guessedValue);
+            assert game.getGuessCount()==10;
+            assert !Manager.instance().isLongRunningConversation();
+            assert Pageflow.instance().getProcessInstance().getRootToken()
+                  .getNode().getName().equals("lose");
+         }
+         
+      }.run();
+
+   }
+   
+   private Integer getRandomNumber()
+   {
+       return (Integer) getInstance(RandomNumber.class);
+   }
+   
+}

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/drools.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/drools.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/drools.properties	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,29 @@
+ #
+ # JBoss, Home of Professional Open Source
+ # Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ # by the @authors tag. See the copyright.txt 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.
+ # 
+MAIN_PAGE /numberGuess.seam
+GUESS_LOCATION numberGuess.seam
+WIN_LOCATION win.seam
+LOSE_LOCATION lose.seam
+GUESS_MAX_VALUE NumberGuessMain:Biggest
+GUESS_MIN_VALUE NumberGuessMain:Smallest
+GUESS_FIELD NumberGuessMain:inputGuess
+GUESS_SUBMIT NumberGuessMain\:GuessButton
\ No newline at end of file

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/seam.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/seam.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources/seam.properties	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,3 @@
+#debug is explicitly disabled in test to avoid JBIDE-3623
+#Thu Dec 31 16:24:37 CET 2009
+org.jboss.seam.core.init.debug=false

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/testng.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/testng.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/testng.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,31 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt 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.
+--> 
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Drools example" verbose="2" parallel="false">
+   <test name="drools_tests">
+      <parameter name="PROPERTY_FILE" value="/drools.properties" />
+      <classes>
+      <class
+            name="org.jboss.seam.example.common.test.numberguess.selenium.CommonNumberGuessTest" />
+      </classes>
+   </test>
+</suite>


Property changes on: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-ftest/testng.xml
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-integration/testng.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-integration/testng.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-tests/src/test/resources-integration/testng.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,11 @@
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+
+<suite name="Drools" verbose="2" parallel="false">
+
+   <test name="Drools ">
+     <classes>
+       <class name="org.jboss.seam.example.numberguess.test.DroolsNumberGuessTest"/>
+     </classes>
+   </test>
+	
+</suite>
\ No newline at end of file

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.jboss.seam.examples-ee6</groupId>
+        <artifactId>drools</artifactId>
+        <version>2.3.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+    <groupId>org.jboss.seam.examples-ee6</groupId>
+    <artifactId>drools-web</artifactId>
+    <packaging>war</packaging>
+    <name>Drools Web Module (EE6)</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.seam.examples-ee6</groupId>
+            <artifactId>drools-ejb</artifactId>
+            <type>ejb</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam</artifactId>
+            <type>ejb</type>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.seam</groupId>
+            <artifactId>jboss-seam-ui</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.jboss.seam</groupId>
+                    <artifactId>jboss-seam-jul</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-collections</groupId>
+                    <artifactId>commons-collections</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <webResources>
+                        <resource>
+                            <directory>src/main/webapp</directory>
+                            <filtering>true</filtering>
+                        </resource>
+                    </webResources>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/resources/messages.properties
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/resources/messages.properties	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/resources/messages.properties	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,4 @@
+javax.faces.component.UIInput.CONVERSION=You must guess a number
+javax.faces.component.UIInput.REQUIRED=You must guess a number
+javax.faces.component.UIInput.REQUIRED_detail=#{messages['javax.faces.component.UIInput.REQUIRED']}
+javax.faces.validator.NOT_IN_RANGE=The number is between {0} and {1}

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/components.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/components.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,35 @@
+<components xmlns="http://jboss.com/products/seam/components" 
+            xmlns:core="http://jboss.com/products/seam/core"
+            xmlns:drools="http://jboss.com/products/seam/drools"
+            xmlns:bpm="http://jboss.com/products/seam/bpm"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation=
+                "http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.3.xsd 
+                 http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd 
+                 http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd 
+                 http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.3.xsd">
+            
+    <drools:rule-base name="ruleBase" rule-files="numberguess.drl"/>
+    <!-- use this in order to load from decision table instead -->        
+    <!-- <drools:rule-base name="ruleBase" rule-files="numberguess.xls"/> -->
+    <!--  use this in order to load from a drl and also add a ruleflow -->
+    <!-- <drools:rule-base name="ruleBase" rule-files="numberguessforflow.drl, numberguess.rf"/>  -->
+    <!--  use this in order to load from a xls and also add a ruleflow -->
+    <!-- <drools:rule-base name="ruleBase" rule-files="numberguessforflow.xls, numberguess.rf"/> -->     
+    <!--  use this if you want to register a custom consequence exception handler -->
+    <!--  <drools:rule-base name="ruleBase" rule-files="numberguess.xls" consequence-exception-handler="#{gameConsequenceExceptionHandler}"/>  -->
+    <drools:managed-working-memory name="workingMemory" rule-base="#{ruleBase}">
+    	<!--  add WM event listeners -->
+    	<!-- <drools:event-listeners>
+           <value>org.drools.event.DebugWorkingMemoryEventListener</value>
+           <value>org.drools.event.DebugAgendaEventListener</value>
+        </drools:event-listeners>  -->
+    </drools:managed-working-memory>
+    
+    <bpm:jbpm>
+        <bpm:pageflow-definitions>
+            <value>pageflow.jpdl.xml</value>
+        </bpm:pageflow-definitions>
+    </bpm:jbpm>
+
+</components>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/faces-config.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/faces-config.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
+              xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+</faces-config>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/web.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/WEB-INF/web.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+    xmlns="http://java.sun.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+    <display-name>Seam Drools Example</display-name>
+
+    <!-- Seam -->
+    
+    <listener>
+        <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+    </listener>
+
+    <filter>
+        <filter-name>Seam Filter</filter-name>
+        <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>Seam Filter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>*.seam</url-pattern>
+    </servlet-mapping>
+    
+    <session-config>
+        <session-timeout>10</session-timeout> 
+    </session-config>
+      
+    <context-param>
+        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+        <param-value>.jsp</param-value>
+    </context-param>
+    
+</web-app>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/index.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/index.html	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/index.html	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,5 @@
+<html>
+<head>
+  <meta http-equiv="Refresh" content="0; URL=numberGuess.seam">
+</head>
+</html>
\ No newline at end of file

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/lose.jsp
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/lose.jsp	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/lose.jsp	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,15 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+<head>
+<title>You lose.</title>
+</head>
+<body>
+<h1>You lose.</h1>
+<f:view>
+    We recommend the 
+    <a href="http://mathworld.wolfram.com/Bisection.html">bisection algorithm</a>.
+    Would you like to <a href="numberGuess.seam">play again</a>?
+  </f:view>
+</body>
+</html>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/numberGuess.jsp
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/numberGuess.jsp	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/numberGuess.jsp	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,29 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+<head>
+<title>Guess a number...</title>
+</head>
+<body>
+<h1>Guess a number...</h1>
+<f:view>
+	<h:form id="NumberGuessMain">
+	    <h:outputText value="Higher!" rendered="#{randomNumber>guess.value}" />
+	    <h:outputText value="Lower!" rendered="#{randomNumber<guess.value}" />
+		<br />
+        I'm thinking of a number between <h:outputText id="Smallest" value="#{game.smallest}" /> and 
+        <h:outputText id="Biggest" value="#{game.biggest}" />.
+        <br />
+        Your guess: 
+        <h:inputText value="#{guess.value}" id="inputGuess" required="true">
+            <f:validateLongRange
+                maximum="#{game.biggest}" 
+                minimum="#{game.smallest}"/>
+        </h:inputText>
+		<h:commandButton id="GuessButton" type="submit" value="Guess" action="guess" />
+		<br/>
+        <h:message for="guess" style="color: red"/>
+	</h:form>
+</f:view>
+</body>
+</html>

Added: branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/win.jsp
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/win.jsp	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/drools-web/src/main/webapp/win.jsp	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,15 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+<head>
+<title>You won!</title>
+</head>
+<body>
+<h1>You won!</h1>
+<f:view>
+    Yes, the answer was <h:outputText value="#{randomNumber}" />.
+    It took you <h:outputText value="#{game.guessCount}" /> guesses.
+    Would you like to <a href="numberGuess.seam">play again</a>?
+  </f:view>
+</body>
+</html>

Added: branches/community/Seam_2_3/examples-ee6/drools/pageflow.jpg
===================================================================
(Binary files differ)


Property changes on: branches/community/Seam_2_3/examples-ee6/drools/pageflow.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: branches/community/Seam_2_3/examples-ee6/drools/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/pom.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <parent>
+      <artifactId>examples-ee6</artifactId>
+      <groupId>org.jboss.seam</groupId>
+      <version>2.3.0-SNAPSHOT</version>
+   </parent>
+
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>org.jboss.seam.examples-ee6</groupId>
+   <artifactId>drools</artifactId>
+   <packaging>pom</packaging>
+   <name>Drools Example (EE6)</name>
+
+   <modules>
+      <module>drools-ejb</module>
+      <module>drools-web</module>
+      <module>drools-ear</module>
+      <module>drools-tests</module>
+   </modules>
+
+   <properties>
+      <example.name>drools</example.name>
+   </properties>
+
+   <dependencyManagement>
+      <dependencies>
+         <dependency>
+            <groupId>org.jboss.seam.examples-ee6</groupId>
+            <artifactId>drools-ejb</artifactId>
+            <version>${project.version}</version>
+            <type>ejb</type>
+         </dependency>
+         <dependency>
+            <groupId>org.jboss.seam.examples-ee6</groupId>
+            <artifactId>drools-web</artifactId>
+            <version>${project.version}</version>
+            <type>war</type>
+         </dependency>
+         <dependency>
+            <groupId>org.jboss.seam.examples-ee6</groupId>
+            <artifactId>drools-ear</artifactId>
+            <version>${project.version}</version>
+         </dependency>
+      </dependencies>
+   </dependencyManagement>
+
+</project>

Added: branches/community/Seam_2_3/examples-ee6/drools/readme.txt
===================================================================
--- branches/community/Seam_2_3/examples-ee6/drools/readme.txt	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/drools/readme.txt	2012-03-16 21:33:41 UTC (rev 14421)
@@ -0,0 +1,20 @@
+Seam Drools Example
+===================
+
+This is a simple example for the Seam tutorial, demonstrating the
+use of jBPM with Drools. It runs on JBoss AS as an EAR.
+
+To deploy the example to JBossAS 4 (5 or 6), follow these steps:
+
+* In the example root directory run:
+
+    mvn clean package
+
+* Set JBOSS_HOME environment property.
+
+* In the drools-ear directory run:
+
+    mvn jboss:hard-deploy
+
+* Open this URL in a web browser: http://localhost:8080/seam-drools
+

Modified: branches/community/Seam_2_3/examples-ee6/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/pom.xml	2012-03-16 21:08:39 UTC (rev 14420)
+++ branches/community/Seam_2_3/examples-ee6/pom.xml	2012-03-16 21:33:41 UTC (rev 14421)
@@ -18,6 +18,7 @@
         <module>blog</module>
         <module>booking</module>
         <module>contactlist</module>
+        <module>drools</module>
 <!--        <module>dvdstore</module> -->
         <module>excel</module>
         <module>mail</module>



More information about the seam-commits mailing list