Seam SVN: r11397 - branches/community/Seam_2_2/seam-gen/resources/WEB-INF.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-18 07:36:14 -0400 (Tue, 18 Aug 2009)
New Revision: 11397
Modified:
branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml
Log:
JBDS-828, JBSEAM-4276
Modified: branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml
===================================================================
--- branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml 2009-08-18 07:54:50 UTC (rev 11396)
+++ branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml 2009-08-18 11:36:14 UTC (rev 11397)
@@ -28,12 +28,15 @@
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<web:hot-deploy-filter url-pattern="*.seam"/>
- <!-- If you are still using JBoss 4, uncomment this to have you PU started -->
+ <!-- If you are still using JBoss 4, uncomment this to have your PU started -->
<!-- <persistence:entity-manager-factory name="entityManagerFactory"-->
<!-- persistence-unit-name="@projectName@"/>-->
+ <!-- If you are still using JBoss 4, uncomment this to have the entityManagerFactory ysed -->
+<!-- <persistence:managed-persistence-context name="entityManager" auto-create="true"-->
+<!-- entity-manager-factory="#{entityManagerFactory}"/>-->
<persistence:managed-persistence-context name="entityManager" auto-create="true"
- entity-manager-factory="#{entityManagerFactory}"/>
+ persistence-unit-jndi-name="@projectName@"/>
<drools:rule-base name="securityRules">
<drools:rule-files><value>/security.drl</value></drools:rule-files>
15 years, 4 months
Seam SVN: r11396 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-18 03:54:50 -0400 (Tue, 18 Aug 2009)
New Revision: 11396
Modified:
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
Log:
JBPAPP-2382 - upgraded jfreechart to 1.0.13
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-17 19:12:10 UTC (rev 11395)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-18 07:54:50 UTC (rev 11396)
@@ -933,7 +933,7 @@
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
- <version>1.0.9</version>
+ <version>1.0.13</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
15 years, 4 months
Seam SVN: r11395 - branches/community/Seam_2_2/build.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-08-17 15:12:10 -0400 (Mon, 17 Aug 2009)
New Revision: 11395
Modified:
branches/community/Seam_2_2/build/root.pom.xml
Log:
JBSEAM-4361
Modified: branches/community/Seam_2_2/build/root.pom.xml
===================================================================
--- branches/community/Seam_2_2/build/root.pom.xml 2009-08-17 18:54:14 UTC (rev 11394)
+++ branches/community/Seam_2_2/build/root.pom.xml 2009-08-17 19:12:10 UTC (rev 11395)
@@ -1029,7 +1029,7 @@
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
- <version>1.0.8a</version>
+ <version>1.0.13</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
15 years, 4 months
Seam SVN: r11394 - in branches/community/Seam_2_2_Drools5: examples/drools/resources/WEB-INF and 3 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2009-08-17 14:54:14 -0400 (Mon, 17 Aug 2009)
New Revision: 11394
Added:
branches/community/Seam_2_2_Drools5/examples/drools/resources/testtemplate.drl
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Item.java
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/ItemCode.java
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateDataProvider.java
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateFactProvider.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/TemplateDataProvider.java
Modified:
branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java
branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java
Log:
Drools5 Integration.
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-17 12:17:03 UTC (rev 11393)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-17 18:54:14 UTC (rev 11394)
@@ -63,6 +63,25 @@
<value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
</drools:event-listeners>
</drools:stateful-knowledge-session>
+
+
+ <drools:knowledge-base name="kbase4" knowledge-builder-config="kbuilderconfig.properties" knowledge-base-config="kbaseconfig.properties">
+ <drools:rule-resources>
+ <value>classpath:testtemplate.drl:DRL:testTemplateDataProvider</value>
+ </drools:rule-resources>
+ </drools:knowledge-base>
+
+ <drools:stateful-knowledge-session name="ksession4"
+ startup="false"
+ auto-create="true"
+ knowledge-base="#{kbase4}"
+ knowledge-session-config="ksessionconfig.properties"
+ fact-provider="#{testTemplateFactProvider}">
+ <drools:event-listeners>
+ <value>org.drools.event.rule.DebugAgendaEventListener</value>
+ <value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
+ </drools:event-listeners>
+ </drools:stateful-knowledge-session>
<drools:query-results name="queries1" ksession="#{ksession3}" query-names="number_of_messages"/>
Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/testtemplate.drl
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/testtemplate.drl (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/testtemplate.drl 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,17 @@
+template header
+field
+lower
+upper
+codes
+
+package org.jboss.seam.example.numbergues;
+import org.jboss.seam.example.numberguess.Item;
+import org.jboss.seam.example.numberguess.ItemCode;
+template "inRange"
+rule "is in range @{row.rowNumber}"
+when
+ Item( $name : name, $v : @{field} >= @{lower} && <= @{upper}, $code : code )
+then
+ System.out.println( "Item " + $name + " @{field} in range: " + $v + " code: " + $code );
+end
+end template
\ No newline at end of file
Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Item.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Item.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/Item.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,58 @@
+package org.jboss.seam.example.numberguess;
+
+public class Item {
+
+ private String name;
+ private int weight;
+ private int price;
+ private ItemCode code;
+
+ public Item(String name, int price, int weight, ItemCode code) {
+ this.name = name;
+ this.price = price;
+ this.weight = weight;
+ this.code = code;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public int getWeight()
+ {
+ return weight;
+ }
+
+ public void setWeight(int weight)
+ {
+ this.weight = weight;
+ }
+
+ public int getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(int price)
+ {
+ this.price = price;
+ }
+
+ public ItemCode getCode()
+ {
+ return code;
+ }
+
+ public void setCode(ItemCode code)
+ {
+ this.code = code;
+ }
+
+
+}
Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/ItemCode.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/ItemCode.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/ItemCode.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,7 @@
+package org.jboss.seam.example.numberguess;
+
+public enum ItemCode {
+ LOCK,
+ STOCK,
+ BARREL;
+}
Modified: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java 2009-08-17 12:17:03 UTC (rev 11393)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -18,6 +18,7 @@
{
@In(create=true) ExecutionResults batch1;
@In(create=true) Map<String, org.drools.runtime.rule.QueryResults> queries1;
+ @In(create=false) org.drools.runtime.StatefulKnowledgeSession ksession4;
private static final LogProvider log = Logging.getLogProvider(RulesTest.class);
private String result;
@@ -49,5 +50,9 @@
this.queryResult = queryResult;
}
+ public String runTemplate() {
+ ksession4.fireAllRules();
+ return null;
+ }
}
Modified: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java 2009-08-17 12:17:03 UTC (rev 11393)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -6,6 +6,7 @@
import java.util.Map;
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;
@@ -19,6 +20,7 @@
private Map<String, Object> allGlobals = new HashMap<String, Object>();
@Create
+ @Begin(join=true)
public void init() {
Message m1 = new Message();
m1.setMessage("message1");
@@ -48,7 +50,7 @@
public Map<String, Object> getGlobals()
{
- return null;
+ return allGlobals;
}
public void setFacts(List<Object> allFacts)
@@ -56,9 +58,9 @@
this.allFacts = allFacts;
}
- public void setGlobals(Map<String, Object> globals)
+ public void setGlobals(Map<String, Object> allGlobals)
{
-
+ this.allGlobals = allGlobals;
}
}
Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateDataProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateDataProvider.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateDataProvider.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,56 @@
+package org.jboss.seam.example.numberguess;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+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;
+import org.jboss.seam.drools.TemplateDataProvider;
+
+@Name("testTemplateDataProvider")
+(a)Scope(ScopeType.CONVERSATION)
+public class TestTemplateDataProvider implements TemplateDataProvider
+{
+
+ Collection<Map<String, Object>> templateData = new ArrayList<Map<String,Object>>();
+
+ @Create
+ @Begin(join=true)
+ public void init()
+ {
+ Map<String, Object> m1 = new HashMap<String, Object>();
+ m1.put("field", "weight");
+ m1.put("lower", 10);
+ m1.put("upper", 99);
+ m1.put("codes", EnumSet.of( ItemCode.LOCK, ItemCode.STOCK ) );
+
+ Map<String, Object> m2 = new HashMap<String, Object>();
+ m2.put("field", "price");
+ m2.put("lower", 10);
+ m2.put("upper", 50);
+ m2.put("codes", EnumSet.of( ItemCode.BARREL ) );
+
+ templateData.add(m1);
+ templateData.add(m2);
+
+ }
+
+ public Collection<Map<String, Object>> getTemplateData()
+ {
+ return templateData;
+ }
+
+ public void setTemplateData(Collection<Map<String, Object>> templateData)
+ {
+ this.templateData = templateData;
+ }
+
+
+
+}
Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateFactProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateFactProvider.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestTemplateFactProvider.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,59 @@
+package org.jboss.seam.example.numberguess;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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;
+import org.jboss.seam.drools.FactProvider;
+
+@Name("testTemplateFactProvider")
+(a)Scope(ScopeType.CONVERSATION)
+public class TestTemplateFactProvider implements FactProvider
+{
+ private List<Object> allFacts = new ArrayList<Object>();
+ private Map<String, Object> allGlobals = new HashMap<String, Object>();
+
+ @Create
+ @Begin(join=true)
+ public void init() {
+ Item item1 = new Item( "A", 130, 42, ItemCode.LOCK );
+ Item item2 = new Item( "B", 44, 100, ItemCode.STOCK );
+ Item item3 = new Item( "C", 123, 180, ItemCode.BARREL );
+ Item item4 = new Item( "D", 85, 9, ItemCode.LOCK );
+
+ allFacts.add(item1);
+ allFacts.add(item2);
+ allFacts.add(item3);
+ allFacts.add(item4);
+
+ }
+
+ public List<Object> getFacts()
+ {
+ return allFacts;
+ }
+
+ public Map<String, Object> getGlobals()
+ {
+ return allGlobals;
+ }
+
+ public void setFacts(List<Object> allFacts)
+ {
+ this.allFacts = allFacts;
+
+ }
+
+ public void setGlobals(Map<String, Object> allGlobals)
+ {
+ this.allGlobals = allGlobals;
+
+ }
+
+}
Modified: branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp 2009-08-17 12:17:03 UTC (rev 11393)
+++ branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp 2009-08-17 18:54:14 UTC (rev 11394)
@@ -15,6 +15,11 @@
<h:outputLabel value="Query Result: " for="output2" />
<h:outputText id="output2" value="#{rulesTest.queryResult}"/>
</h:panelGrid>
+ </h:form>
+ <h:form id="simple2">
+ <h:panelGrid columns="2">
+ <h:commandButton action="#{rulesTest.runTemplate}" value="Run template..." />
+ </h:panelGrid>
</h:form>
</f:view>
</body>
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java 2009-08-17 12:17:03 UTC (rev 11393)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/KnowledgeBase.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -1,6 +1,10 @@
package org.jboss.seam.drools;
import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Collection;
+import java.util.Map;
import java.util.Properties;
import java.util.regex.Pattern;
@@ -13,11 +17,14 @@
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
+import org.drools.template.ObjectDataCompiler;
+import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.ResourceLoader;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -26,7 +33,7 @@
* Manager component for a Drools KnowledgeBase
*
* @author Tihomir Surdilovic
- *
+ *
*/
@Scope(ScopeType.APPLICATION)
@BypassInterceptors
@@ -37,6 +44,7 @@
private static final int RESOURCE_PATH = 0;
private static final int RESOURCE = 1;
private static final int RESOURCE_TYPE = 2;
+ private static final int RESOURCE_TEMPLATE_DATA = 3;
private static final String RESOURCE_TYPE_URL = "url";
private static final String RESOURCE_TYPE_FILE = "file";
private static final String RESOURCE_TYPE_CLASSPATH = "classpath";
@@ -47,12 +55,14 @@
private org.drools.KnowledgeBase kbase;
@Create
- public void createKnowledgeBase() throws Exception {
+ public void createKnowledgeBase() throws Exception
+ {
KnowledgeBuilderConfiguration kbuilderconfig;
- if(knowledgeBaseConfig != null) {
+ if (knowledgeBaseConfig != null)
+ {
Properties kbuilderProp = new Properties();
InputStream stream = ResourceLoader.instance().getResourceAsStream(knowledgeBuilderConfig);
- if (stream==null)
+ if (stream == null)
{
throw new IllegalStateException("could not locate knowledgeBuilder configuration: " + knowledgeBaseConfig);
}
@@ -60,31 +70,38 @@
log.info("loading knowledge builder config properties: " + kbuilderProp.toString());
stream.close();
kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(kbuilderProp, null);
- } else {
+ }
+ else
+ {
kbuilderconfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
}
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderconfig);
- if(ruleResources != null) {
- for(String nextResource : ruleResources) {
+ if (ruleResources != null)
+ {
+ for (String nextResource : ruleResources)
+ {
addResource(kbuilder, nextResource);
}
}
-
+
KnowledgeBuilderErrors kbuildererrors = kbuilder.getErrors();
- if(kbuildererrors.size() > 0) {
- for(KnowledgeBuilderError kbuildererror : kbuildererrors) {
+ if (kbuildererrors.size() > 0)
+ {
+ for (KnowledgeBuilderError kbuildererror : kbuildererrors)
+ {
log.error(kbuildererror.getMessage());
}
- }
+ }
KnowledgeBaseConfiguration kbaseconfig;
- if(knowledgeBaseConfig != null) {
+ if (knowledgeBaseConfig != null)
+ {
Properties kbaseProp = new Properties();
InputStream stream = ResourceLoader.instance().getResourceAsStream(knowledgeBaseConfig);
- if (stream==null)
+ if (stream == null)
{
throw new IllegalStateException("could not locate knowledgeBase configuration: " + knowledgeBaseConfig);
}
@@ -92,17 +109,17 @@
log.info("loading knowledge base config properties: " + kbaseProp.toString());
stream.close();
kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(kbaseProp, null);
- } else {
+ }
+ else
+ {
kbaseconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
}
-
+
kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseconfig);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
-
}
-
@Unwrap
public org.drools.KnowledgeBase getKnowledgeBase()
{
@@ -113,57 +130,85 @@
{
return knowledgeBuilderConfig;
}
-
-
+
public void setKnowledgeBuilderConfig(String knowledgeBuilderConfig)
{
this.knowledgeBuilderConfig = knowledgeBuilderConfig;
}
-
-
+
public String getKnowledgeBaseConfig()
{
return knowledgeBaseConfig;
}
-
-
+
public void setKnowledgeBaseConfig(String knowledgeBaseConfig)
{
this.knowledgeBaseConfig = knowledgeBaseConfig;
}
-
-
+
public String[] getRuleResources()
{
return ruleResources;
}
-
-
+
public void setRuleResources(String[] ruleResources)
{
this.ruleResources = ruleResources;
}
- protected void addResource(KnowledgeBuilder kbuilder, String resource) {
+ protected void addResource(KnowledgeBuilder kbuilder, String resource)
+ {
String[] resourceParts = COLON.split(resource.trim());
- if(resourceParts.length != 3) {
+ if (resourceParts.length < 3)
+ {
log.error("Unable to use resource: " + resource);
- } else {
- log.info("New resource path: " + resourceParts[0]);
- log.info("New resource location: " + resourceParts[1]);
- log.info("New resource type: " + resourceParts[2]);
+ }
+ else
+ {
+ log.info("New resource path: " + resourceParts[RESOURCE_PATH]);
+ log.info("New resource location: " + resourceParts[RESOURCE]);
+ log.info("New resource type: " + resourceParts[RESOURCE_TYPE]);
ResourceType resourceType = ResourceType.getResourceType(resourceParts[RESOURCE_TYPE]);
- if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_URL)) {
- kbuilder.add(ResourceFactory.newUrlResource(resourceParts[RESOURCE]), resourceType);
- } else if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_FILE)) {
- kbuilder.add(ResourceFactory.newFileResource(resourceParts[RESOURCE]), resourceType);
- } else if(resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_CLASSPATH)) {
- kbuilder.add(ResourceFactory.newClassPathResource(resourceParts[RESOURCE]), resourceType);
- } else {
- log.error("Unable to use resource path: " + resourceParts[RESOURCE_PATH]);
+
+ if (resourceParts.length == 4)
+ {
+ log.info("New template data provider: " + resourceParts[RESOURCE_TEMPLATE_DATA]);
+ TemplateDataProvider templateDataProvider = (TemplateDataProvider) Component.getInstance(resourceParts[RESOURCE_TEMPLATE_DATA], true);
+
+ InputStream templateStream = ResourceLoader.instance().getResourceAsStream(resourceParts[RESOURCE]);
+ if (templateStream==null)
+ {
+ throw new IllegalStateException("Could not locate rule file: " + resourceParts[RESOURCE]);
+ }
+
+ ObjectDataCompiler converter = new ObjectDataCompiler();
+ String drl = converter.compile( templateDataProvider.getTemplateData(), templateStream );
+ log.info("Generated DRL from template: " + drl);
+ Reader rdr = new StringReader( drl );
+
+ kbuilder.add( ResourceFactory.newReaderResource( rdr ), resourceType );
}
+ else
+ {
+ if (resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_URL))
+ {
+ kbuilder.add(ResourceFactory.newUrlResource(resourceParts[RESOURCE]), resourceType);
+ }
+ else if (resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_FILE))
+ {
+ kbuilder.add(ResourceFactory.newFileResource(resourceParts[RESOURCE]), resourceType);
+ }
+ else if (resourceParts[RESOURCE_PATH].equals(RESOURCE_TYPE_CLASSPATH))
+ {
+ kbuilder.add(ResourceFactory.newClassPathResource(resourceParts[RESOURCE]), resourceType);
+ }
+ else
+ {
+ log.error("Unable to use resource path: " + resourceParts[RESOURCE_PATH]);
+ }
+ }
}
}
}
\ No newline at end of file
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/TemplateDataProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/TemplateDataProvider.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/TemplateDataProvider.java 2009-08-17 18:54:14 UTC (rev 11394)
@@ -0,0 +1,15 @@
+package org.jboss.seam.drools;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Interface for template data providers.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public interface TemplateDataProvider
+{
+ public Collection<Map<String,Object>> getTemplateData();
+}
15 years, 4 months
Seam SVN: r11393 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: examples/remoting and 10 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-08-17 08:17:03 -0400 (Mon, 17 Aug 2009)
New Revision: 11393
Added:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
Log:
JBPAPP-2513 Added a functional test for gwt example.
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2009-08-17 12:09:36 UTC (rev 11392)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2009-08-17 12:17:03 UTC (rev 11393)
@@ -83,6 +83,7 @@
<testexample name="registration" />
<testexample name="remoting/chatroom" />
<testexample name="remoting/helloworld" />
+ <testexample name="remoting/gwt" />
<testexample name="seambay" />
<antcall target="stop.selenium.server" />
</target>
@@ -138,6 +139,7 @@
<cleanexample name="registration" />
<cleanexample name="remoting/chatroom" />
<cleanexample name="remoting/helloworld" />
+ <cleanexample name="remoting/gwt" />
<cleanexample name="seambay" />
<cleanexample name="seamdiscs" />
<cleanexample name="seampay" />
@@ -169,6 +171,7 @@
<undeployexample name="registration" />
<undeployexample name="remoting/chatroom" />
<undeployexample name="remoting/helloworld" />
+ <undeployexample name="remoting/gwt" />
<undeployexample name="seambay" />
<undeployexample name="seamdiscs" />
<undeployexample name="seampay" />
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml 2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<project name="remoting.gwt.ftest.build" basedir="." default="build">
+ <property name="example.name" value="remoting/gwt" />
+ <property name="context.path" value="/seam-gwt" />
+
+ <import file="../../build.xml" />
+</project>
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml 2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,27 @@
+
+ <!--
+ 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="Gwt example" verbose="2" parallel="false">
+ <test name="remoting_gwt_jboss5">
+ <parameter name="PROPERTY_FILE" value="" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.remoting.gwt.test.selenium.GwtTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java 2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package org.jboss.seam.example.remoting.gwt.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/gwt example.
+ *
+ * @author Martin Gencur
+ *
+ */
+public class GwtTest extends SeamSeleniumTest
+{
+ protected static final String GWT_URL = "/HelloWorld.html";
+ protected static final String GWT_TITLE = "Wrapper HTML for HelloWorld";
+ protected static final String ASK_BUTTON = "dom=document.getElementsByTagName('button')[0]";
+ protected static final String TEXT_FIELD = "dom=document.getElementsByTagName('input')[0]";
+ protected static final Long TIMEOUT = 2000L; //2 seconds
+
+ protected static final String ENTER_TEXT_WITHOUT = "Text without question mark at the end";
+ protected static final String ENTER_TEXT_WITH = "Text WITH question mark at the end?";
+
+ protected static final String MESSAGE_WITHOUT = "A question has to end with a \'?\'";
+ protected static final String MESSAGE_WITH = "Its the real question that you seek now";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + GWT_URL);
+ }
+
+ @Test
+ public void simplePageContentTest()
+ {
+ assertTrue("Home page of Remoting/Gwt Example expected", browser.getLocation().contains(GWT_URL));
+ assertTrue("Different page title expected ale je:"+ browser.getTitle(),browser.getTitle().contains(GWT_TITLE));
+ assertTrue("Home page should contain Text field", browser.isElementPresent(TEXT_FIELD));
+ assertTrue("Home page should contain Ask button", browser.isElementPresent(ASK_BUTTON));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withoutQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITHOUT);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITHOUT + "\"", result.contains(MESSAGE_WITHOUT));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITH);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITH + "\"", result.contains(MESSAGE_WITH));
+ }
+
+ public void waitForAlertPresent(Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isAlertPresent();
+ }
+ }.wait("Timeout while waiting for alert window.", timeout);
+ }
+}
15 years, 4 months
Seam SVN: r11392 - in branches/community/Seam_2_2/src/test/ftest: examples/remoting and 10 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-08-17 08:09:36 -0400 (Mon, 17 Aug 2009)
New Revision: 11392
Added:
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/build.xml
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/jboss5.xml
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/
branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
Modified:
branches/community/Seam_2_2/src/test/ftest/build.xml
Log:
JBSEAM-4359 Added a functional test for gwt example.
Modified: branches/community/Seam_2_2/src/test/ftest/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-17 12:08:47 UTC (rev 11391)
+++ branches/community/Seam_2_2/src/test/ftest/build.xml 2009-08-17 12:09:36 UTC (rev 11392)
@@ -118,6 +118,7 @@
<testexample name="registration" />
<testexample name="remoting/chatroom" />
<testexample name="remoting/helloworld" />
+ <testexample name="remoting/gwt" />
<testexample name="rss" />
<testexample name="seambay" />
<testexample name="seampay" />
@@ -220,6 +221,7 @@
<cleanexample name="registration" />
<cleanexample name="remoting/chatroom" />
<cleanexample name="remoting/helloworld" />
+ <cleanexample name="remoting/gwt" />
<cleanexample name="rss" />
<cleanexample name="seambay" />
<cleanexample name="seamdiscs" />
@@ -260,6 +262,7 @@
<undeployexample name="rss" />
<undeployexample name="remoting/chatroom" />
<undeployexample name="remoting/helloworld" />
+ <undeployexample name="remoting/gwt" />
<undeployexample name="seambay" />
<undeployexample name="seamdiscs" />
<undeployexample name="seampay" />
Added: branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/build.xml (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/build.xml 2009-08-17 12:09:36 UTC (rev 11392)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<project name="remoting.gwt.ftest.build" basedir="." default="build">
+ <property name="example.name" value="remoting/gwt" />
+ <property name="context.path" value="/seam-gwt" />
+
+ <import file="../../build.xml" />
+</project>
Added: branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/jboss5.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/jboss5.xml (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/jboss5.xml 2009-08-17 12:09:36 UTC (rev 11392)
@@ -0,0 +1,27 @@
+
+ <!--
+ 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="Gwt example" verbose="2" parallel="false">
+ <test name="remoting_gwt_jboss5">
+ <parameter name="PROPERTY_FILE" value="" />
+ <classes>
+ <class
+ name="org.jboss.seam.example.remoting.gwt.test.selenium.GwtTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/jboss5.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java (rev 0)
+++ branches/community/Seam_2_2/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java 2009-08-17 12:09:36 UTC (rev 11392)
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package org.jboss.seam.example.remoting.gwt.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/gwt example.
+ *
+ * @author Martin Gencur
+ *
+ */
+public class GwtTest extends SeamSeleniumTest
+{
+ protected static final String GWT_URL = "/HelloWorld.html";
+ protected static final String GWT_TITLE = "Wrapper HTML for HelloWorld";
+ protected static final String ASK_BUTTON = "dom=document.getElementsByTagName('button')[0]";
+ protected static final String TEXT_FIELD = "dom=document.getElementsByTagName('input')[0]";
+ protected static final Long TIMEOUT = 2000L; //2 seconds
+
+ protected static final String ENTER_TEXT_WITHOUT = "Text without question mark at the end";
+ protected static final String ENTER_TEXT_WITH = "Text WITH question mark at the end?";
+
+ protected static final String MESSAGE_WITHOUT = "A question has to end with a \'?\'";
+ protected static final String MESSAGE_WITH = "Its the real question that you seek now";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + GWT_URL);
+ }
+
+ @Test
+ public void simplePageContentTest()
+ {
+ assertTrue("Home page of Remoting/Gwt Example expected", browser.getLocation().contains(GWT_URL));
+ assertTrue("Different page title expected ale je:"+ browser.getTitle(),browser.getTitle().contains(GWT_TITLE));
+ assertTrue("Home page should contain Text field", browser.isElementPresent(TEXT_FIELD));
+ assertTrue("Home page should contain Ask button", browser.isElementPresent(ASK_BUTTON));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withoutQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITHOUT);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITHOUT + "\"", result.contains(MESSAGE_WITHOUT));
+ }
+
+ @Test(dependsOnMethods = {"simplePageContentTest"})
+ public void withQuestionMarkTest(){
+ String result = "";
+ browser.type(TEXT_FIELD, ENTER_TEXT_WITH);
+ browser.click(ASK_BUTTON);
+ waitForAlertPresent(TIMEOUT);
+ result = browser.getAlert();
+ assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITH + "\"", result.contains(MESSAGE_WITH));
+ }
+
+ public void waitForAlertPresent(Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isAlertPresent();
+ }
+ }.wait("Timeout while waiting for alert window.", timeout);
+ }
+}
15 years, 4 months
Seam SVN: r11391 - branches/community/Seam_2_2/seam-gen/resources/WEB-INF.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-17 08:08:47 -0400 (Mon, 17 Aug 2009)
New Revision: 11391
Modified:
branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war-tokenized.xml
branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml
Log:
JBSEAM-4276, JBDS-826
Modified: branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war-tokenized.xml
===================================================================
--- branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war-tokenized.xml 2009-08-17 12:02:26 UTC (rev 11390)
+++ branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war-tokenized.xml 2009-08-17 12:08:47 UTC (rev 11391)
@@ -28,7 +28,7 @@
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<web:hot-deploy-filter url-pattern="*.seam"/>
- <!-- If you are still using JBoss 4, uncomment this to have you PU started -->
+ <!-- If you are still using JBoss 4, uncomment this to have your PU started -->
<!-- <persistence:entity-manager-factory name="entityManagerFactory"
persistence-unit-name="@projectName@"
installed="@seamBootstrapsPu@"/>-->
Modified: branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml
===================================================================
--- branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml 2009-08-17 12:02:26 UTC (rev 11390)
+++ branches/community/Seam_2_2/seam-gen/resources/WEB-INF/components-war.xml 2009-08-17 12:08:47 UTC (rev 11391)
@@ -28,8 +28,9 @@
<!-- Make sure this URL pattern is the same as that used by the Faces Servlet -->
<web:hot-deploy-filter url-pattern="*.seam"/>
- <persistence:entity-manager-factory name="entityManagerFactory"
- persistence-unit-name="@projectName@"/>
+ <!-- If you are still using JBoss 4, uncomment this to have you PU started -->
+<!-- <persistence:entity-manager-factory name="entityManagerFactory"-->
+<!-- persistence-unit-name="@projectName@"/>-->
<persistence:managed-persistence-context name="entityManager" auto-create="true"
entity-manager-factory="#{entityManagerFactory}"/>
15 years, 4 months
Seam SVN: r11389 - branches/enterprise/JBPAPP_5_0/examples/groovybooking.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-16 16:22:57 -0400 (Sun, 16 Aug 2009)
New Revision: 11389
Modified:
branches/enterprise/JBPAPP_5_0/examples/groovybooking/build.properties
Log:
JBPAPP-2506
Modified: branches/enterprise/JBPAPP_5_0/examples/groovybooking/build.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/groovybooking/build.properties 2009-08-14 22:49:05 UTC (rev 11388)
+++ branches/enterprise/JBPAPP_5_0/examples/groovybooking/build.properties 2009-08-16 20:22:57 UTC (rev 11389)
@@ -1,2 +1,2 @@
# Uncomment when deploying to JBoss AS 5
-loadPersistenceUnits=true
+loadPersistenceUnits=false
15 years, 4 months
Seam SVN: r11388 - in branches/community/Seam_2_2_Drools5: examples/drools/resources/WEB-INF and 4 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2009-08-14 18:49:05 -0400 (Fri, 14 Aug 2009)
New Revision: 11388
Added:
branches/community/Seam_2_2_Drools5/examples/drools/resources/test2.drl
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/FactProvider.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/QueryResults.java
Modified:
branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
Log:
Drools5 integration
Modified: branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-14 21:09:04 UTC (rev 11387)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/WEB-INF/components.xml 2009-08-14 22:49:05 UTC (rev 11388)
@@ -47,7 +47,25 @@
<drools:batch-execution name="batch1" ksession="#{ksession2}"
batch-xml-config="testbatch.xml"/>
+
+ <drools:knowledge-base name="kbase3" knowledge-builder-config="kbuilderconfig.properties" knowledge-base-config="kbaseconfig.properties">
+ <drools:rule-resources>
+ <value>classpath:test2.drl:DRL</value>
+ </drools:rule-resources>
+ </drools:knowledge-base>
+
+ <drools:stateful-knowledge-session name="ksession3"
+ knowledge-base="#{kbase3}"
+ knowledge-session-config="ksessionconfig.properties"
+ fact-provider="#{testFactProvider}">
+ <drools:event-listeners>
+ <value>org.drools.event.rule.DebugAgendaEventListener</value>
+ <value>org.drools.event.rule.DebugWorkingMemoryEventListener</value>
+ </drools:event-listeners>
+ </drools:stateful-knowledge-session>
+ <drools:query-results name="queries1" ksession="#{ksession3}" query-names="number_of_messages"/>
+
<!-- <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"/> -->
Added: branches/community/Seam_2_2_Drools5/examples/drools/resources/test2.drl
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/resources/test2.drl (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/resources/test2.drl 2009-08-14 22:49:05 UTC (rev 11388)
@@ -0,0 +1,7 @@
+package org.jboss.seam.example.numberguess
+
+import org.jboss.seam.example.numberguess.Message;
+
+query "number_of_messages"
+ message : Message()
+end
\ No newline at end of file
Modified: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java 2009-08-14 21:09:04 UTC (rev 11387)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/RulesTest.java 2009-08-14 22:49:05 UTC (rev 11388)
@@ -1,8 +1,11 @@
package org.jboss.seam.example.numberguess;
+import java.util.Map;
+
import org.drools.runtime.ExecutionResults;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -13,11 +16,19 @@
@Scope(ScopeType.CONVERSATION)
public class RulesTest
{
- @In(create=true) ExecutionResults batch1;
+ @In(create=true) ExecutionResults batch1;
+ @In(create=true) Map<String, org.drools.runtime.rule.QueryResults> queries1;
+
private static final LogProvider log = Logging.getLogProvider(RulesTest.class);
private String result;
+ private String queryResult;
+ @Create
@Begin(join=true)
+ public void init() {
+
+ }
+
public String getResult()
{
return ((Message) batch1.getValue( "message" )).getMessage();
@@ -27,4 +38,16 @@
{
this.result = result;
}
+
+ public String getQueryResult()
+ {
+ return String.valueOf(queries1.get("number_of_messages").size());
+ }
+
+ public void setQueryResult(String queryResult)
+ {
+ this.queryResult = queryResult;
+ }
+
+
}
Added: branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/examples/drools/src/org/jboss/seam/example/numberguess/TestFactProvider.java 2009-08-14 22:49:05 UTC (rev 11388)
@@ -0,0 +1,64 @@
+package org.jboss.seam.example.numberguess;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.drools.FactProvider;
+
+@Name("testFactProvider")
+(a)Scope(ScopeType.CONVERSATION)
+public class TestFactProvider implements FactProvider
+{
+ private List<Object> allFacts = new ArrayList<Object>();
+ private Map<String, Object> allGlobals = new HashMap<String, Object>();
+
+ @Create
+ public void init() {
+ Message m1 = new Message();
+ m1.setMessage("message1");
+ allFacts.add(m1);
+
+ Message m2 = new Message();
+ m2.setMessage("message2");
+ allFacts.add(m2);
+
+ Message m3 = new Message();
+ m3.setMessage("message3");
+ allFacts.add(m3);
+
+ Message m4 = new Message();
+ m4.setMessage("message4");
+ allFacts.add(m4);
+
+ Message m5 = new Message();
+ m5.setMessage("message5");
+ allFacts.add(m5);
+ }
+
+ public List<Object> getFacts()
+ {
+ return allFacts;
+ }
+
+ public Map<String, Object> getGlobals()
+ {
+ return null;
+ }
+
+ public void setFacts(List<Object> allFacts)
+ {
+ this.allFacts = allFacts;
+ }
+
+ public void setGlobals(Map<String, Object> globals)
+ {
+
+ }
+
+}
Modified: branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp
===================================================================
--- branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp 2009-08-14 21:09:04 UTC (rev 11387)
+++ branches/community/Seam_2_2_Drools5/examples/drools/view/simple.jsp 2009-08-14 22:49:05 UTC (rev 11388)
@@ -8,8 +8,13 @@
<h1>Simple Test</h1>
<f:view>
<h:form id="simples">
- <h:outputLabel value="Rules Result" for="output" />
- <h:outputText id="output" value="#{rulesTest.result}"/>
+ <h:panelGrid columns="2">
+ <h:outputLabel value="Rules Result: " for="output" />
+ <h:outputText id="output" value="#{rulesTest.result}"/>
+
+ <h:outputLabel value="Query Result: " for="output2" />
+ <h:outputText id="output2" value="#{rulesTest.queryResult}"/>
+ </h:panelGrid>
</h:form>
</f:view>
</body>
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/FactProvider.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/FactProvider.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/FactProvider.java 2009-08-14 22:49:05 UTC (rev 11388)
@@ -0,0 +1,20 @@
+package org.jboss.seam.drools;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Interface for fact providers.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public interface FactProvider
+{
+ public List<Object> getFacts();
+ public void setFacts(List<Object> facts);
+
+ public Map<String, Object> getGlobals();
+ public void setGlobals(Map<String, Object> globals);
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/QueryResults.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/QueryResults.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/QueryResults.java 2009-08-14 22:49:05 UTC (rev 11388)
@@ -0,0 +1,39 @@
+package org.jboss.seam.drools;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.core.Expressions.ValueExpression;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * A conversation-scoped component that performs a query lookup against
+ * StatefulKnowledgeSession.
+ *
+ * @author Tihomir Surdilovic
+ *
+ */
+public class QueryResults
+{
+ private static final LogProvider log = Logging.getLogProvider(QueryResults.class);
+
+ private ValueExpression<org.drools.runtime.StatefulKnowledgeSession> ksession;
+ private String[] queryNames;
+
+ @Unwrap
+ public Map<String, org.drools.runtime.rule.QueryResults> getQueryResults() throws Exception {
+ Map<String, org.drools.runtime.rule.QueryResults> queryResultsMap = new HashMap<String, org.drools.runtime.rule.QueryResults>();
+ if(queryNames != null && ksession != null) {
+ for(String queryName : queryNames) {
+ org.drools.runtime.rule.QueryResults results = ksession.getValue().getQueryResults( queryName );
+ queryResultsMap.put(queryName, results);
+ }
+ } else {
+ log.warn("Invalid kseession or queries.");
+ }
+
+ return queryResultsMap;
+ }
+}
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java 2009-08-14 21:09:04 UTC (rev 11387)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java 2009-08-14 22:49:05 UTC (rev 11388)
@@ -2,6 +2,7 @@
import java.io.InputStream;
import java.io.Serializable;
+import java.util.Map;
import java.util.Properties;
import org.drools.KnowledgeBaseFactory;
@@ -34,6 +35,7 @@
private static final LogProvider log = Logging.getLogProvider(org.jboss.seam.drools.StatefulKnowledgeSession.class);
private ValueExpression<org.drools.KnowledgeBase> knowledgeBase;
+ private ValueExpression<org.jboss.seam.drools.FactProvider> factProvider;
private String[] eventListeners;
private String knowledgeSessionConfig;
@@ -61,6 +63,22 @@
ksession.getGlobals().setDelegate(new SeamDelegate());
+ if(factProvider != null) {
+ FactProvider fp = factProvider.getValue();
+ if(fp.getFacts() != null) {
+ for(Object nextFact : fp.getFacts()) {
+ log.info("Inserting next fact : " + nextFact);
+ ksession.insert(nextFact);
+ }
+ }
+ if(fp.getGlobals() != null) {
+ for(Map.Entry<String, Object> nextGlobal : fp.getGlobals().entrySet()) {
+ log.info("Setting next global: " + nextGlobal.getKey() + " with value: " + nextGlobal.getValue());
+ ksession.setGlobal(nextGlobal.getKey(), nextGlobal.getValue());
+ }
+ }
+ }
+
if(eventListeners != null) {
for(String eventListener : eventListeners) {
setEventListener(ksession, eventListener);
@@ -137,5 +155,15 @@
{
this.knowledgeSessionConfig = knowledgeSessionConfig;
}
-
+
+ public ValueExpression<org.jboss.seam.drools.FactProvider> getFactProvider()
+ {
+ return factProvider;
+ }
+
+ public void setFactProvider(ValueExpression<org.jboss.seam.drools.FactProvider> factProvider)
+ {
+ this.factProvider = factProvider;
+ }
+
}
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd 2009-08-14 21:09:04 UTC (rev 11387)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd 2009-08-14 22:49:05 UTC (rev 11388)
@@ -100,6 +100,7 @@
<xs:attribute name="knowledge-base" type="components:expressionType" />
<xs:attribute name="event-listeners" type="components:string" />
<xs:attribute name="knowledge-session-config" type="components:string" />
+ <xs:attribute name="fact-provider" type="components:expressionType"/>
</xs:attributeGroup>
<xs:element name="globals" type="components:multiValuedProperty" />
@@ -141,4 +142,22 @@
<xs:attribute name="batch-xml" type="components:expressionType" />
<xs:attribute name="batch-xml-config" type="components:string" />
</xs:attributeGroup>
+
+ <xs:element name="query-results">
+ <xs:annotation>
+ <xs:documentation>Query Results Component</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element minOccurs="0" maxOccurs="1" ref="drools:query-names" />
+ </xs:choice>
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="drools:attlist.QueryResults" />
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.QueryResults">
+ <xs:attribute name="ksession" type="components:expressionType" />
+ <xs:attribute name="query-names" type="components:string"/>
+ </xs:attributeGroup>
+ <xs:element name="query-names" type="components:multiValuedProperty" />
</xs:schema>
15 years, 4 months
Seam SVN: r11387 - in branches/community/Seam_2_2/examples: metawidget/groovybooking and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-08-14 17:09:04 -0400 (Fri, 14 Aug 2009)
New Revision: 11387
Modified:
branches/community/Seam_2_2/examples/groovybooking/build.properties
branches/community/Seam_2_2/examples/metawidget/groovybooking/build.properties
Log:
set loadPersistenceUnits to false by default since the default target server is now JBoss AS 5
Modified: branches/community/Seam_2_2/examples/groovybooking/build.properties
===================================================================
--- branches/community/Seam_2_2/examples/groovybooking/build.properties 2009-08-14 16:53:31 UTC (rev 11386)
+++ branches/community/Seam_2_2/examples/groovybooking/build.properties 2009-08-14 21:09:04 UTC (rev 11387)
@@ -1,2 +1,2 @@
-# Uncomment when deploying to JBoss AS 5
-#loadPersistenceUnits=false
+# Uncomment when deploying to JBoss AS 5 (the default)
+loadPersistenceUnits=false
Modified: branches/community/Seam_2_2/examples/metawidget/groovybooking/build.properties
===================================================================
--- branches/community/Seam_2_2/examples/metawidget/groovybooking/build.properties 2009-08-14 16:53:31 UTC (rev 11386)
+++ branches/community/Seam_2_2/examples/metawidget/groovybooking/build.properties 2009-08-14 21:09:04 UTC (rev 11387)
@@ -1,2 +1,2 @@
-# Uncomment when deploying to JBoss AS 5
-#loadPersistenceUnits=false
+# Uncomment when deploying to JBoss AS 5 (the default)
+loadPersistenceUnits=false
15 years, 4 months