Seam SVN: r12361 - modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 16:03:51 -0400 (Thu, 01 Apr 2010)
New Revision: 12361
Modified:
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
Log:
fixed method name
Modified: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 20:02:17 UTC (rev 12360)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 20:03:51 UTC (rev 12361)
@@ -36,7 +36,7 @@
@Inject KBaseBean kbasebean;
@Test
- public void testBaseBase() {
+ public void testKBaseBean() {
assertNotNull(kbasebean);
}
14 years, 9 months
Seam SVN: r12360 - in modules/drools/trunk/core/src: main/java/org/jboss/seam/drools/old and 2 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 16:02:17 -0400 (Thu, 01 Apr 2010)
New Revision: 12360
Added:
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java
Modified:
modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java
modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java
modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java
modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java
modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml
modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbasetest.drl
Log:
added more tests
Modified: modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/KnowledgeBaseProducer.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -34,9 +34,10 @@
private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseProducer.class);
@Inject BeanManager manager;
- @Produces @ApplicationScoped
+ @Produces //@ApplicationScoped
public KnowledgeBase produceKBase(KnowledgeBaseConfig kbaseConfig) throws Exception
{
+ System.out.println("***KBASEPRODUCER CONFIG IS: " + kbaseConfig);
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(getKnowledgeBuilderConfiguration(kbaseConfig));
for (String nextResource : kbaseConfig.getRuleResources())
Modified: modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManager.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -37,7 +37,7 @@
*/
public class KnowledgeBaseManager
{
- private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseManager.class);
+ /** private static final Logger log = LoggerFactory.getLogger(KnowledgeBaseManager.class);
private KnowledgeBaseManagerConfig kbaseManagerConfig;
@@ -49,8 +49,8 @@
this.kbaseManagerConfig = kbaseManagerConfig;
}
- @Produces
- @ApplicationScoped
+ //@Produces
+ //@ApplicationScoped
public KnowledgeBase createKBase() throws Exception
{
KnowledgeBase kbase;
@@ -84,10 +84,10 @@
return kbase;
}
- public void disposeKBase(@Disposes KnowledgeBase kbase)
- {
- kbase = null;
- }
+ //public void disposeKBase(@Disposes KnowledgeBase kbase)
+ //{
+ // kbase = null;
+ // }
private void addEventListener(org.drools.KnowledgeBase kbase, String eventListener) {
try {
@@ -204,4 +204,4 @@
}
return kbaseconfig;
}
-}
\ No newline at end of file
+**/}
\ No newline at end of file
Modified: modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeBaseManagerConfig.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -10,7 +10,7 @@
*/
public class KnowledgeBaseManagerConfig
{
- private static final Pattern DIVIDER = Pattern.compile(";");
+ /** private static final Pattern DIVIDER = Pattern.compile(";");
private static final int RESOURCE_PATH = 0;
private static final int RESOURCE = 1;
private static final int RESOURCE_TYPE = 2;
@@ -113,4 +113,4 @@
-}
+**/ }
Modified: modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManager.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -39,7 +39,7 @@
*/
public class KnowledgeSessionManager
{
- private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionManager.class);
+ /** private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionManager.class);
private KnowledgeSessionManagerConfig ksessionManagerConfig;
private Map<Integer, KnowledgeRuntimeLogger> statefulKnowledgeLoggers = new Hashtable<Integer, KnowledgeRuntimeLogger>();
@@ -53,8 +53,8 @@
this.ksessionManagerConfig = ksessionManagerConfig;
}
- @Produces
- @Any
+ //@Produces
+ //@Any
public StatefulKnowledgeSession getStatefulSession(InjectionPoint ip, Instance<KnowledgeBase> kbase) throws Exception
{
StatefulKnowledgeSession ksession = kbase.select(ip.getQualifiers().toArray(new Annotation[0])).get().newStatefulKnowledgeSession(getKSessionConfig(), null);
@@ -65,14 +65,14 @@
return ksession;
}
- public void disposeStatefulSession(@Disposes StatefulKnowledgeSession statefulSession)
- {
- if (statefulKnowledgeLoggers.get(statefulSession.getId()) != null)
- {
- statefulKnowledgeLoggers.get(statefulSession.getId()).close();
- }
- statefulSession.dispose();
- }
+ //public void disposeStatefulSession(@Disposes StatefulKnowledgeSession statefulSession)
+ //{
+ // if (statefulKnowledgeLoggers.get(statefulSession.getId()) != null)
+ // {
+ // statefulKnowledgeLoggers.get(statefulSession.getId()).close();
+ // }
+ // statefulSession.dispose();
+ // }
@Produces
@Any
@@ -183,4 +183,4 @@
}
-}
+**/}
Modified: modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java
===================================================================
--- modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/main/java/org/jboss/seam/drools/old/KnowledgeSessionManagerConfig.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -10,7 +10,7 @@
*/
public class KnowledgeSessionManagerConfig
{
- private static final Pattern DIVIDER = Pattern.compile(";");
+ /** private static final Pattern DIVIDER = Pattern.compile(";");
private static final int WORKITEMHANDLER_NAME = 0;
private static final int WORKITEMHANDLER_TYPE = 1;
private static final int AUDIT_LOG_TYPE = 0;
@@ -103,4 +103,4 @@
this.knowledgeSessionConfigProp = knowledgeSessionConfigProp;
}
-}
+**/}
Added: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java (rev 0)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseBean.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -0,0 +1,28 @@
+package org.jboss.seam.drools.kbase;
+
+import org.drools.KnowledgeBase;
+import org.jboss.seam.drools.config.KnowledgeBaseConfig;
+
+public class KBaseBean
+{
+ private KnowledgeBaseConfig kbaseconfig;
+ private KnowledgeBase kbase;
+ public KnowledgeBaseConfig getKbaseconfig()
+ {
+ return kbaseconfig;
+ }
+ public void setKbaseconfig(KnowledgeBaseConfig kbaseconfig)
+ {
+ this.kbaseconfig = kbaseconfig;
+ }
+ public KnowledgeBase getKbase()
+ {
+ return kbase;
+ }
+ public void setKbase(KnowledgeBase kbase)
+ {
+ this.kbase = kbase;
+ }
+
+
+}
Modified: modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java
===================================================================
--- modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/test/java/org/jboss/seam/drools/kbase/KBaseTest.java 2010-04-01 20:02:17 UTC (rev 12360)
@@ -10,7 +10,7 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.drools.KnowledgeBaseProducer;
-import org.jboss.seam.drools.qualifier.KBase;
+import org.jboss.seam.drools.config.KnowledgeBaseConfig;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -23,20 +23,32 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("kbasetest.jar", JavaArchive.class)
+ return Archives.create("test.jar", JavaArchive.class)
.addPackages(true, KnowledgeBaseProducer.class.getPackage())
+ .addClass(KBaseBean.class)
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbasetest.drl")
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbuilderconfig.properties")
.addResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/kbaseconfig.properties")
.addManifestResource(KBaseTest.class.getPackage().getName().replaceAll("\\.", "/") + "/KBaseTest-beans.xml",
ArchivePaths.create("beans.xml"));
}
+
+ @Inject KBaseBean kbasebean;
- @Inject @KBase(name="kbase1") KnowledgeBase kbase;
+ @Test
+ public void testBaseBase() {
+ assertNotNull(kbasebean);
+ }
@Test
+ public void testKBaseConfig() {
+ assertNotNull(kbasebean.getKbaseconfig());
+ }
+
+ //@Test
public void testKBase() {
- assertNotNull(kbase);
+ assertNotNull(kbasebean.getKbase());
+ System.out.println("********* KBASE: " + kbasebean.getKbase());
}
}
Modified: modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml
===================================================================
--- modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/KBaseTest-beans.xml 2010-04-01 20:02:17 UTC (rev 12360)
@@ -1,31 +1,45 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://java.sun.com/xml/ns/javaee"
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:s="urn:java:seam:core"
- xmlns:drools="urn:java:org.jboss.seam.drools"
- xmlns:drools-config="urn:java:org.jboss.seam.drools.config"
- xmlns:drools-qualifier="urn:java:org.jboss.seam.drools.qualifier">
-
- <drools-config:KnowledgeBaseConfig>
- <s:overrides/>
- <drools-qualifier:KBaseConfig name="kbaseconfig1"/>
- <drools-config:knowledgeBuilderConfig>kbuilderconfig.properties</drools-config:knowledgeBuilderConfig>
- <drools-config:knowledgeBaseConfig>kbaseconfig.properties</drools-config:knowledgeBaseConfig>
- <drools-config:ruleResources>
- <s:value>classpath:kbasetest.drl:DRL</s:value>
- </drools-config:ruleResources>
- <drools-config:eventListeners>
- <s:value>org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener</s:value>
- </drools-config:eventListeners>
- </drools-config:KnowledgeBaseConfig>
-
- <drools:KnowledgeBaseProducer>
- <s:specializes/>
- <drools:produceKBase>
- <drools-qualifier:KBase name="kbase1"/>
- <s:Inject/>
- <drools-qualifier:KBaseConfig name="kbaseconfig1"/>
- </drools:produceKBase>
- </drools:KnowledgeBaseProducer>
-
+ xmlns:s="urn:java:seam:core"
+ xmlns:drools="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+ xmlns:drools-qualifier="urn:java:org.jboss.seam.drools.qualifier"
+ xmlns:drools-test="urn:java:org.jboss.seam.drools.kbase">
+
+ <drools:KnowledgeBaseConfig>
+ <drools-qualifier:KBaseConfig name="kbaseconfig1" />
+ <drools:knowledgeBuilderConfig>kbuilderconfig.properties</drools:knowledgeBuilderConfig>
+ <drools:knowledgeBaseConfig>kbaseconfig.properties</drools:knowledgeBaseConfig>
+ <drools:ruleResources>
+ <s:value>classpath:kbasetest.drl:DRL</s:value>
+ </drools:ruleResources>
+ <drools:eventListeners>
+ <s:value>org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener
+ </s:value>
+ </drools:eventListeners>
+ </drools:KnowledgeBaseConfig>
+
+ <drools:KnowledgeBaseProducer>
+ <s:specializes />
+ <drools:produceKBase>
+ <drools-qualifier:KBase name="kbase1" />
+ <s:parameters>
+ <drools:KnowledgeBaseConfig>
+ <s:Inject />
+ <drools-qualifier:KBaseConfig name="kbaseconfig1" />
+ </drools:KnowledgeBaseConfig>
+ </s:parameters>
+ </drools:produceKBase>
+ </drools:KnowledgeBaseProducer>
+
+ <drools-test:KBaseBean>
+ <drools-test:kbaseconfig>
+ <drools-qualifier:KBaseConfig name="kbaseconfig1" />
+ <s:Inject/>
+ </drools-test:kbaseconfig>
+ <drools-test:kbase>
+ <drools-qualifier:KBase name="kbase1" />
+ <s:Inject/>
+ </drools-test:kbase>
+ </drools-test:KBaseBean>
+
</beans>
\ No newline at end of file
Modified: modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbasetest.drl
===================================================================
--- modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbasetest.drl 2010-04-01 16:41:50 UTC (rev 12359)
+++ modules/drools/trunk/core/src/test/resources/org/jboss/seam/drools/kbase/kbasetest.drl 2010-04-01 20:02:17 UTC (rev 12360)
@@ -1,29 +1,6 @@
-#created on: Apr 1, 2010
package org.jboss.seam.drools.kbase
-#list any import classes here.
-
-
-
-#declare any global variables here
-
-
-
-
-rule "Your First Rule"
-
- when
- #conditions
+rule "dummy"
then
- #actions
-
+ System.out.println("in dummy action");
end
-
-rule "Your Second Rule"
- #include attributes such as "salience" here...
- when
- #conditions
- then
- #actions
-
-end
14 years, 9 months
Seam SVN: r12359 - build/trunk/parent.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 12:41:50 -0400 (Thu, 01 Apr 2010)
New Revision: 12359
Modified:
build/trunk/parent/pom.xml
Log:
added repository
<repository>
<id>apache-incubating</id>
<name>Apache Snapshot Repository</name>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
</repository>
needed by drools-workflowitems dependency for drools module to get commons-cli snapshot
Modified: build/trunk/parent/pom.xml
===================================================================
--- build/trunk/parent/pom.xml 2010-04-01 16:40:55 UTC (rev 12358)
+++ build/trunk/parent/pom.xml 2010-04-01 16:41:50 UTC (rev 12359)
@@ -59,6 +59,11 @@
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
+ <repository>
+ <id>apache-incubating</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+ </repository>
</repositories>
<pluginRepositories>
14 years, 9 months
Seam SVN: r12358 - modules/drools/trunk/core.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 12:40:55 -0400 (Thu, 01 Apr 2010)
New Revision: 12358
Modified:
modules/drools/trunk/core/pom.xml
Log:
added back dependency for drools-workitems
Modified: modules/drools/trunk/core/pom.xml
===================================================================
--- modules/drools/trunk/core/pom.xml 2010-04-01 16:39:57 UTC (rev 12357)
+++ modules/drools/trunk/core/pom.xml 2010-04-01 16:40:55 UTC (rev 12358)
@@ -51,12 +51,10 @@
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
</dependency>
- <!-- TODO add back and check where
- org.apache.commons:commons-cli:2.0-SNAPSHOT -->
- <!-- <dependency>
+ <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workitems</artifactId>
- </dependency> -->
+ </dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
14 years, 9 months
Seam SVN: r12357 - modules/drools/trunk.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-04-01 12:39:57 -0400 (Thu, 01 Apr 2010)
New Revision: 12357
Modified:
modules/drools/trunk/pom.xml
Log:
added back dependency for drools-workitems
Modified: modules/drools/trunk/pom.xml
===================================================================
--- modules/drools/trunk/pom.xml 2010-04-01 13:40:29 UTC (rev 12356)
+++ modules/drools/trunk/pom.xml 2010-04-01 16:39:57 UTC (rev 12357)
@@ -100,13 +100,11 @@
<artifactId>drools-decisiontables</artifactId>
<version>5.1.0.M1</version>
</dependency>
- <!-- TODO add back and check where
- org.apache.commons:commons-cli:2.0-SNAPSHOT -->
- <!-- <dependency>
+ <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workitems</artifactId>
<version>5.1.0.M1</version>
- </dependency> -->
+ </dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
14 years, 9 months
Seam SVN: r12356 - branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-01 09:40:29 -0400 (Thu, 01 Apr 2010)
New Revision: 12356
Modified:
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Jms.xml
Log:
JBPAPP-1835 - removed annotation from ejb local interface
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Jms.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Jms.xml 2010-04-01 10:44:03 UTC (rev 12355)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Jms.xml 2010-04-01 13:40:29 UTC (rev 12356)
@@ -81,19 +81,12 @@
</para>
<para>
- For EJB components, we annotate the local interface to specify that a method is processed
+ For EJB components, we annotate the implementation of bean to specify that a method is processed
asynchronously.
</para>
- <programlisting role="JAVA"><![CDATA[@Local
-public interface PaymentHandler
-{
- @Asynchronous
- public void processPayment(Payment payment);
-}]]></programlisting>
-
<para>
- (For JavaBean components we can annotate the component implementation class if we like.)
+ For JavaBean components we annotate the component implementation class.
</para>
<para>
@@ -104,6 +97,7 @@
@Name("paymentHandler")
public class PaymentHandlerBean implements PaymentHandler
{
+ @Asynchronous
public void processPayment(Payment payment)
{
//do some work!
14 years, 9 months
Seam SVN: r12355 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: examples and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-01 06:44:03 -0400 (Thu, 01 Apr 2010)
New Revision: 12355
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/ftest.properties
Log:
Backported support for container management during functional test execution.
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2010-04-01 09:03:49 UTC (rev 12354)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2010-04-01 10:44:03 UTC (rev 12355)
@@ -44,43 +44,28 @@
<include name="selenium-server-standalone.jar" />
</fileset>
</path>
+
+ <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="../../../lib/groovy-all.jar"/>
- <target name="testall.1" description="Run functional testsuite for JBoss 5">
+ <target name="testall" description="Run functional testsuite for EAP 5">
<property name="container" value="jboss5" />
<antcall target="start.selenium.server" />
+ <antcall target="start.container" />
<testexample name="blog" />
<testexample name="booking" />
<testexample name="drools" />
<testexample name="dvdstore" />
<testexample name="contactlist" />
- <antcall target="stop.selenium.server" />
- </target>
-
- <target name="testall.2" description="Run functional testsuite for JBoss 5">
- <property name="container" value="jboss5" />
- <antcall target="start.selenium.server" />
<testexample name="excel" />
<testexample name="groovybooking" />
<testexample name="hibernate" />
<testexample name="itext" />
<testexample name="jee5/booking" />
- <antcall target="stop.selenium.server" />
- </target>
-
- <target name="testall.3" description="Run functional testsuite for JBoss 5">
- <property name="container" value="jboss5" />
- <antcall target="start.selenium.server" />
<testexample name="jpa" />
<testexample name="mail" />
<testexample name="messages" />
<testexample name="nestedbooking" />
<testexample name="numberguess" />
- <antcall target="stop.selenium.server" />
- </target>
-
- <target name="testall.4" description="Run functional testsuite for JBoss 5">
- <property name="container" value="jboss5" />
- <antcall target="start.selenium.server" />
<testexample name="openid" />
<testexample name="quartz" />
<testexample name="registration" />
@@ -88,12 +73,6 @@
<testexample name="remoting/helloworld" />
<testexample name="remoting/gwt" />
<testexample name="seambay" />
- <antcall target="stop.selenium.server" />
- </target>
-
- <target name="testall.5" description="Run functional testsuite for JBoss 5">
- <property name="container" value="jboss5" />
- <antcall target="start.selenium.server" />
<testexample name="seamdiscs" />
<testexample name="seampay" />
<testexample name="seamspace" />
@@ -101,9 +80,11 @@
<testexample name="tasks" />
<testexample name="todo" />
<testexample name="ui" />
+ <antcall target="stop.container"/>
<antcall target="stop.selenium.server" />
</target>
-
+
+
<target name="test" description="Run tests for single example. Container selection is based on the value of container property">
<fail unless="container">Please set container property.</fail>
<antcall target="test.${container}" />
@@ -221,6 +202,17 @@
<attribute name="path" default="examples/@{name}" />
<attribute name="message" default="Running functional tests on @{name} example" />
<sequential>
+ <groovy>
+ <![CDATA[
+ def testExamplesRunSoFar = properties['testExamplesRunSoFar'] == null ? 0 : Integer.valueOf(properties['testExamplesRunSoFar']);
+ def jbossDeploymentsRestart = properties['jboss.deployments.restart'] == null ? 0 : Integer.valueOf(properties['jboss.deployments.restart']);
+ if (jbossDeploymentsRestart > 0 && testExamplesRunSoFar > 0 && testExamplesRunSoFar % jbossDeploymentsRestart == 0 ) {
+ ant.antcall(target:"restart.container");
+ }
+ testExamplesRunSoFar++;
+ properties['testExamplesRunSoFar'] = testExamplesRunSoFar;
+ ]]>
+ </groovy>
<echo>@{message}</echo>
<callExample path="@{path}" target="test" />
</sequential>
@@ -255,11 +247,25 @@
</sequential>
</macrodef>
- <target name="start.container.before.suite" if="run.container.per.suite">
+ <target name="restart.container" if="run.container.per.suite">
+ <echo>Restarting container</echo>
+ <antcall target="stop.container" >
+ </antcall>
+ <antcall target="start.container" >
+ </antcall>
+ </target>
+
+ <target name="stop.container" if="run.container.per.suite">
+ <echo>Stopping container</echo>
+ <ant antfile="examples/build.xml" target="stop.container.jboss" inheritall="false">
+ <property name="container" value="${container}" />
+ </ant>
+ </target>
+ <target name="start.container" if="run.container.per.suite">
<echo>Starting container</echo>
<ant antfile="examples/build.xml" target="start.container.jboss" inheritall="false">
<property name="container" value="${container}" />
- </ant>
+ </ant>
</target>
</project>
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml 2010-04-01 09:03:49 UTC (rev 12354)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/build.xml 2010-04-01 10:44:03 UTC (rev 12355)
@@ -251,6 +251,44 @@
<propertyset id="jboss5.deploy.properties" />
</target>
+ <target name="start.container.jboss" depends="container.properties">
+ <echo message="Starting JBoss server" />
+ <java classname="org.jboss.Main" fork="true" spawn="true" dir="${container.home}/bin">
+ <classpath>
+ <pathelement location="${container.home}/bin/run.jar" />
+ </classpath>
+ <sysproperty key="java.endorsed.dirs" value="${container.home}/lib/endorsed" />
+ <jvmarg line="${container.jvm.arguments}" />
+ <arg line="-c ${jboss.domain} -b ${jboss.host}" />
+ </java>
+ <waitfor maxwait="2" maxwaitunit="minute">
+ <socket server="localhost" port="8080" />
+ </waitfor>
+ </target>
+
+ <target name="stop.container.jboss" depends="container.properties" >
+ <sequential>
+ <echo message="Shutting down JBoss server"/>
+ <java classname="org.jboss.Shutdown" fork="false" dir="${container.home}/bin">
+ <classpath>
+ <pathelement location="${container.home}/bin/shutdown.jar" />
+ <!--<pathelement location="${container.home}/client/jbossall-client.jar" />-->
+ </classpath>
+ <arg value="--shutdown"/>
+ <arg value="-u"/>
+ <arg value="${jboss.jmx.username}"/>
+ <arg value="-p"/>
+ <arg value="${jboss.jmx.password}"/>
+ </java>
+ <waitfor maxwait="300" maxwaitunit="second">
+ <not>
+ <socket server="localhost" port="1099" />
+ </not>
+ </waitfor>
+ <sleep seconds="3"/>
+ </sequential>
+ </target>
+
<!-- Target for obtaining htmlunit -->
<target name="copy.htmlunit" if="depends.htmlunit" unless="copy.htmlunit.done">
<copyInlineDependencies id="allexamples" scope="compile" todir="${ftest.lib.dir}">
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/ftest.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/ftest.properties 2010-04-01 09:03:49 UTC (rev 12354)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/ftest.properties 2010-04-01 10:44:03 UTC (rev 12355)
@@ -54,8 +54,18 @@
# container settings
jboss5.profile=default
-jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512 -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
+jboss5.jvm.arguments=-Xms512m -Xmx1024m -XX:MaxPermSize=512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true"
+run.container.per.suite=true
+jboss.deployments.restart=10
+jboss.domain=default
+jboss.host=localhost
+
+# These credentials are needed for JBoss restart. See ${JBOSS_HOME}/server/${jboss.profile}/conf/props/jmx-console-users.properties
+jboss.jmx.username=admin
+jboss.jmx.password=admin
+
+
# seam-gen specific properties
#seamgen.delete.project=true
14 years, 9 months
Seam SVN: r12354 - in branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen: utils and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-04-01 05:03:49 -0400 (Thu, 01 Apr 2010)
New Revision: 12354
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
Log:
JBPAPP-3861
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java 2010-04-01 08:06:43 UTC (rev 12353)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java 2010-04-01 09:03:49 UTC (rev 12354)
@@ -37,14 +37,12 @@
@Override
protected void prepareData()
{
- if (WAR)
- {
- newComponentProperties = new String[] { "hi", "Hi", "hi", "hiPage" };
- }
+ // war version
+ if(SeamGenTest.WAR)
+ newComponent = new ComponentHolder("hi", null, "Hi", "hi", "hiPage");
+ // ear version
else
- {
- newComponentProperties = new String[] { "hi", "HiLocal", "Hi", "hi", "hiPage" };
- }
+ newComponent = new ComponentHolder("hi", "HiLocal", "Hi", "hi", "hiPage");
}
@Override
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java 2010-04-01 08:06:43 UTC (rev 12353)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java 2010-04-01 09:03:49 UTC (rev 12354)
@@ -21,11 +21,14 @@
*/
package org.jboss.seam.test.functional.seamgen;
+import static org.testng.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
-
/**
* This class verifies functionality of "new-action command".
* @author Jozef Hartinger
@@ -34,7 +37,7 @@
public class NewActionTest extends SeleniumSeamGenTest
{
- protected String[] newComponentProperties;
+ protected ComponentHolder newComponent;
@BeforeClass
public void createNewAction() throws InterruptedException {
@@ -48,8 +51,8 @@
@Test(groups = { "newActionGroup" }, dependsOnGroups = { "newProjectGroup" })
public void testNewComponent()
{
- String form = "id=" + newComponentProperties[0] + "Form";
- String button = form + ":" + newComponentProperties[newComponentProperties.length - 2];
+ String form = "id=" + newComponent.name + "Form";
+ String button = form + ":" + newComponent.actionMethod;
browser.open(getComponentPath());
@@ -60,30 +63,72 @@
browser.clickAndWait(button);
assertTrue(browser.isElementPresent(MESSAGES));
- assertTrue(browser.getText(MESSAGES).contains(newComponentProperties[newComponentProperties.length - 2]));
+ assertTrue(browser.getText(MESSAGES).contains(newComponent.actionMethod));
}
public void generateNewComponent()
{
- seamGen.newAction(newComponentProperties);
+ seamGen.newAction(newComponent.asArray());
}
protected void prepareData() {
- if (WAR)
- {
- newComponentProperties = new String[]{ "ping", "Ping", "ping", "pingPage" };
- }
+ // war version
+ if(SeamGenTest.WAR)
+ newComponent = new ComponentHolder("ping", null, "Ping", "ping", "pingPage");
+ // ear version
else
- {
- newComponentProperties = new String[]{ "ping", "PingLocal", "Ping", "ping", "pingPage" };
- }
+ newComponent = new ComponentHolder("ping", "PingLocal", "Ping", "ping", "pingPage");
}
public String getComponentPath() {
- return "/" + APP_NAME + "/" + newComponentProperties[newComponentProperties.length - 1] + ".seam";
+ return "/" + APP_NAME + "/" + newComponent.pageName + ".seam";
}
protected void deployNewComponent() {
seamGen.restart();
+ }
+}
+
+/**
+ * Holds component input for seam-gen
+ * @author kpiwko
+ *
+ */
+class ComponentHolder {
+ String name;
+ String localInterface;
+ String beanClass;
+ String actionMethod;
+ String pageName;
+
+ /**
+ * Constructs new component holder
+ * @param name Name of component
+ * @param localInterface Name of local interface
+ * @param beanClass Name of bean class
+ * @param actionMethod Name of action method
+ * @param pageName Name of Seam page
+ */
+ public ComponentHolder(String name, String localInterface, String beanClass, String actionMethod, String pageName) {
+ this.name = name;
+ this.localInterface = localInterface;
+ this.beanClass = beanClass;
+ this.actionMethod = actionMethod;
+ this.pageName = pageName;
}
+
+ /**
+ * Return properties set in holder as array of strings
+ * @return Constructed array
+ */
+ public String[] asArray() {
+ List<String> list = new ArrayList<String>();
+ if(name!=null) list.add(name);
+ if(localInterface!=null) list.add(localInterface);
+ if(beanClass!=null) list.add(beanClass);
+ if(actionMethod!=null) list.add(actionMethod);
+ if(pageName!=null) list.add(pageName);
+
+ return list.toArray(new String[] {});
+ }
}
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java 2010-04-01 08:06:43 UTC (rev 12353)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java 2010-04-01 09:03:49 UTC (rev 12354)
@@ -39,8 +39,8 @@
public void testNewComponent()
{
- String form = "id=" + newComponentProperties[0] + "Form";
- String button = form + ":" + newComponentProperties[newComponentProperties.length - 2];
+ String form = "id=" + newComponent.name + "Form";
+ String button = form + ":" + newComponent.actionMethod;
String field = form + ":" + "valueField:value";
String value = "world";
@@ -55,24 +55,22 @@
browser.clickAndWait(button);
assertTrue(browser.isElementPresent(MESSAGES), "Message not found.");
- assertEquals(browser.getText(MESSAGES), newComponentProperties[newComponentProperties.length - 2] + " " + value, "Unexpected form output.");
+ assertEquals(browser.getText(MESSAGES), newComponent.actionMethod + " " + value, "Unexpected form output.");
}
@Override
protected void prepareData() {
- if (WAR)
- {
- newComponentProperties = new String[]{ "hello", "Hello", "hello", "helloPage" };
- }
+ // war version
+ if (SeamGenTest.WAR)
+ newComponent = new ComponentHolder("hello", null, "Hello", "hello", "helloPage");
+ // ear version
else
- {
- newComponentProperties = new String[]{ "hello", "HelloLocal", "Hello", "hello", "helloPage" };
- }
+ newComponent = new ComponentHolder("hello", "HelloLocal", "Hello", "hello", "helloPage");
}
@Override
public void generateNewComponent()
{
- seamGen.newForm(newComponentProperties);
+ seamGen.newForm(newComponent.asArray());
}
}
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-01 08:06:43 UTC (rev 12353)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-01 09:03:49 UTC (rev 12354)
@@ -197,7 +197,7 @@
*/
class InputStreamEater extends Thread
{
- private static final String INPUT_CHALLENGE = "[input]";
+ private static final String INPUT_CHALLENGE = "[input] Enter";
private static final String FALSE_INPUT_CHALLENGE = "skipping input";
private BufferedReader stream;
private OutputStreamFeeder feederToNotify;
14 years, 9 months
Seam SVN: r12353 - tags.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-01 04:06:43 -0400 (Thu, 01 Apr 2010)
New Revision: 12353
Added:
tags/JBPAPP_4_3_CP08/
Log:
tagged Seam 2.0.2.FP for EAP 4.3.8
Copied: tags/JBPAPP_4_3_CP08 (from rev 12352, branches/enterprise/JBPAPP_4_3_FP01)
14 years, 9 months
Seam SVN: r12352 - in modules/security/trunk/examples/seamspace/src/main: webapp and 2 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-04-01 03:29:22 -0400 (Thu, 01 Apr 2010)
New Revision: 12352
Added:
modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/security-rules.drl
Modified:
modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java
modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/classes/seam-beans.xml
modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/rolemanager.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/security.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml
modules/security/trunk/examples/seamspace/src/main/webapp/usermanager.xhtml
Log:
fixed user and role management views, added config for security rules, minor
Modified: modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/java/org/jboss/seam/security/examples/seamspace/util/EntityManagerProducer.java 2010-04-01 07:29:22 UTC (rev 12352)
@@ -2,6 +2,7 @@
import java.io.Serializable;
+import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
@@ -13,7 +14,7 @@
@PersistenceContext EntityManager entityManager;
- public @Produces @Dependent EntityManager getEntityManager()
+ public @Produces @ConversationScoped EntityManager getEntityManager()
{
return entityManager;
}
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/classes/seam-beans.xml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/classes/seam-beans.xml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/classes/seam-beans.xml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -4,8 +4,12 @@
xmlns:s="urn:java:seam:core"
xmlns:security="urn:java:org.jboss.seam.security"
xmlns:idm="urn:java:org.jboss.seam.security.management"
- xmlns:pm="urn:java:org.jboss.seam.security.permission"
+ xmlns:permission="urn:java:org.jboss.seam.security.permission"
+ xmlns:drools="urn:java:org.jboss.seam.drools"
xmlns:seamspace="urn:java:org.jboss.seam.security.examples.seamspace"
+ xmlns:drools="urn:java:org.jboss.seam.drools"
+ xmlns:drools-config="urn:java:org.jboss.seam.drools.config"
+ xmlns:drools-qualifier="urn:java:org.jboss.seam.drools.qualifier"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
@@ -18,16 +22,46 @@
</s:type>
</idm:identityStore>
</idm:IdentityManager>
-
+
<idm:JpaIdentityStore>
<s:specializes/>
<idm:userEntityClass>org.jboss.seam.security.examples.seamspace.model.MemberAccount</idm:userEntityClass>
<idm:roleEntityClass>org.jboss.seam.security.examples.seamspace.model.MemberRole</idm:roleEntityClass>
</idm:JpaIdentityStore>
- <pm:JpaPermissionStore>
+ <permission:JpaPermissionStore>
<s:specializes/>
- <pm:userPermissionClass>org.jboss.seam.security.examples.seamspace.model.AccountPermission</pm:userPermissionClass>
- </pm:JpaPermissionStore>
+ <permission:userPermissionClass>org.jboss.seam.security.examples.seamspace.model.AccountPermission</permission:userPermissionClass>
+ </permission:JpaPermissionStore>
+ <drools-config:KnowledgeBaseConfig>
+ <s:overrides/>
+ <drools-qualifier:KBaseConfig name="security-rules-config"/>
+ <drools-config:knowledgeBuilderConfig>kbuilderconfig.properties</drools-config:knowledgeBuilderConfig>
+ <drools-config:knowledgeBaseConfig>kbaseconfig.properties</drools-config:knowledgeBaseConfig>
+ <drools-config:ruleResources>
+ <s:value>classpath:security-rules.drl:DRL</s:value>
+ </drools-config:ruleResources>
+ <drools-config:eventListeners>
+ <s:value>org.drools.event.knowledgebase.DefaultKnowledgeBaseEventListener</s:value>
+ </drools-config:eventListeners>
+ </drools-config:KnowledgeBaseConfig>
+
+ <drools:KnowledgeBaseProducer>
+ <s:specializes/>
+ <drools:produceKBase>
+ <drools-qualifier:KBase name="permission-rules"/>
+ <s:Inject/>
+ <drools-qualifier:KBaseConfig name="security-rules-config"/>
+ </drools:produceKBase>
+ </drools:KnowledgeBaseProducer>
+
+ <permission:RuleBasedPermissionResolver>
+ <s:specializes/>
+ <permission:securityRules>
+ <s:Inject/>
+ <drools-qualifier:KBase name="permission-rules"/>
+ </permission:securityRules>
+ </permission:RuleBasedPermissionResolver>
+
</beans>
\ No newline at end of file
Added: modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/security-rules.drl
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/security-rules.drl (rev 0)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/WEB-INF/security-rules.drl 2010-04-01 07:29:22 UTC (rev 12352)
@@ -0,0 +1,247 @@
+package SeamSpacePermissions;
+
+dialect 'mvel'
+
+import java.security.Principal;
+
+import org.jboss.seam.security.permission.PermissionCheck;
+import org.jboss.seam.security.permission.RoleCheck;
+import org.jboss.seam.security.Role;
+
+import org.jboss.seam.example.seamspace.BlogComment;
+import org.jboss.seam.example.seamspace.Member;
+import org.jboss.seam.example.seamspace.MemberAccount;
+import org.jboss.seam.example.seamspace.MemberBlog;
+import org.jboss.seam.example.seamspace.MemberFriend;
+import org.jboss.seam.example.seamspace.MemberImage;
+
+# These rules allow members to manage permissions on their own images
+
+rule ManageImagePermissions
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.memberId.equals(acct.member.memberId)))
+ check: PermissionCheck(target == image, action == "seam.read-permissions", granted == false)
+then
+ check.grant();
+end
+
+rule GrantImagePermissions
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.memberId.equals(acct.member.memberId)))
+ check: PermissionCheck(target == image, action == "seam.grant-permission", granted == false)
+then
+ check.grant();
+end
+
+# Allow all users to read the available roles
+
+rule ReadRoles
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "seam.role", action == "read", granted == false)
+ Role(name == "user")
+then
+ check.grant();
+end
+
+# This rule allows a member to delete their own images
+
+rule DeleteImage
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.memberId.equals(acct.member.memberId)))
+ check: PermissionCheck(target == image, action == "delete", granted == false)
+then
+ check.grant();
+end
+
+# This rule allows members to revoke permissions on their images to other users/roles
+
+rule RevokeImagePermissions
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.memberId.equals(acct.member.memberId)))
+ check: PermissionCheck(target == image, action == "seam.revoke-permission", granted == false)
+then
+ check.grant();
+end
+
+rule ViewProfileImage
+ no-loop
+ activation-group "permissions"
+when
+ image: MemberImage()
+ check: PermissionCheck(target == image, action == "view", granted == false)
+ eval( image.getMember().getPicture() == image )
+then
+ check.grant();
+end
+
+rule FriendViewImage
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.isFriend(acct.member)))
+ PermissionCheck(target == image, action == "view")
+ role: RoleCheck(name == "friends")
+then
+ role.grant();
+end
+
+rule GuestViewImage
+ no-loop
+ activation-group "permissions"
+when
+ image: MemberImage()
+ PermissionCheck(target == image, action == "view")
+ role: RoleCheck(name == "guest")
+then
+ role.grant();
+end
+
+rule ViewMyImages
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ image: MemberImage(mbr : member -> (mbr.memberId.equals(acct.member.memberId)))
+ check: PermissionCheck(target == image, action == "view")
+then
+ check.grant();
+end
+
+rule RestrictCommentPage
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "/comment.xhtml", granted == false)
+ Role(name == "user")
+then
+ check.grant();
+end
+
+rule CanCreateBlogComment
+ no-loop
+ activation-group "permissions"
+when
+ blog: MemberBlog()
+ check: PermissionCheck(target == blog, action == "create", granted == false)
+ Role(name == "user")
+then
+ check.grant();
+end
+
+rule CreateBlogComment
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "blogComment", action == "insert", granted == false)
+ Role(name == "user")
+then
+ check.grant();
+end
+
+# This rule grants permission for users to create their own blog entries
+rule CreateBlog
+ no-loop
+ activation-group "permissions"
+when
+ mbr: Member()
+ acct: MemberAccount(member.memberId == mbr.memberId)
+ check: PermissionCheck(target.memberId == mbr.memberId, action == "createBlog", granted == false)
+then
+ check.grant();
+end
+
+# This rule grants permission for users to upload pictures to their profile
+rule UploadImage
+ no-loop
+ activation-group "permissions"
+when
+ mbr: Member()
+ acct: MemberAccount(member.memberId == mbr.memberId)
+ check: PermissionCheck(target.memberId == mbr.memberId, action == "uploadImage", granted == false)
+then
+ check.grant();
+end
+
+rule InsertMemberBlog
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ blog: MemberBlog(member == acct.member)
+ check: PermissionCheck(target == blog, action == "insert", granted == false)
+then
+ check.grant();
+end
+
+rule CreateFriendComment
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ member: Member() //friends contains acct.member)
+ check: PermissionCheck(target == member, action == "createFriendComment", granted == false)
+then
+ check.grant();
+end
+
+rule CreateFriendRequest
+ no-loop
+ activation-group "permissions"
+when
+ acct: MemberAccount()
+ member: Member() //friends not contains acct.member)
+ check: PermissionCheck(target == member, action == "createFriendRequest", granted == false)
+then
+ check.grant();
+end
+
+rule CreateAccount
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "seam.account", action == "create", granted == false)
+ Role(name == "admin")
+then
+ check.grant();
+end
+
+/*****************************************************************************************
+
+ The Following Rules are for Identity Management
+
+******************************************************************************************/
+
+rule ManageUsers
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "seam.user", granted == false)
+ Role(name == "admin")
+then
+ check.grant();
+end
+
+rule ManageRoles
+ no-loop
+ activation-group "permissions"
+when
+ check: PermissionCheck(target == "seam.role", granted == false)
+ Role(name == "admin")
+then
+ check.grant();
+end
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/home.xhtml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -76,7 +76,7 @@
<ui:repeat value="#{memberSearch.newMembers}" var="newMember">
<div class="newMember">
- <h:link view="/profile.seam" propagation="none">
+ <h:link outcome="/profile.xhtml">
<f:param name="name" value="#{newMember.memberName}"/>
#{newMember.memberName}<br/>
<h:graphicImage value="/content/images?id=#{newMember.picture.imageId}&width=90"/>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/rolemanager.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/rolemanager.xhtml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/rolemanager.xhtml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -14,8 +14,7 @@
<ui:define name="content">
<script type="text/javascript">
- function confirmDelete()
- {
+ function confirmDelete() {
return confirm("Are you sure you wish to delete this role? This action cannot be undone.");
}
</script>
@@ -24,7 +23,7 @@
<h2>Role Manager</h2>
- <s:button id="newRole" action="#{roleAction.createRole}" styleClass="newrole" rendered="#{s:hasPermission('seam.account', 'create', null)}"/>
+ <h:button id="newRole" action="#{roleAction.createRole}" styleClass="newrole" rendered="#{identity.hasPermission('seam.account', 'create')}"/>
<h:dataTable
id="threads"
@@ -45,11 +44,11 @@
</h:column>
<h:column width="auto">
<f:facet name="header">Action</f:facet>
- <s:fragment rendered="#{s:hasPermission('seam.role', 'update')}">
+ <s:fragment rendered="#{identity.hasPermission('seam.role', 'update')}">
<s:link id="edit" value="Edit" action="#{roleAction.editRole(roleSearch.selectedRole)}"/><span> | </span>
</s:fragment>
<s:link id="delete" value="Delete" action="#{identityManager.deleteRole(roleSearch.selectedRole)}"
- rendered="#{s:hasPermission('seam.role', 'delete')}"
+ rendered="#{identity.hasPermission('seam.role', 'delete')}"
onclick="return confirmDelete()"/>
</h:column>
</h:dataTable>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/security.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/security.xhtml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/security.xhtml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -17,8 +17,8 @@
<h2>Security</h2>
- <s:button id="manageUsers" view="/usermanager.xhtml" styleClass="manageusers" value="Manage Users"/><br/>
- <s:button id="manageRoles" view="/rolemanager.xhtml" styleClass="manageroles" value="Manage Roles"/>
+ <h:button id="manageUsers" outcome="/usermanager.xhtml" styleClass="manageusers" value="Manage Users"/><br/>
+ <h:button id="manageRoles" outcome="/rolemanager.xhtml" styleClass="manageroles" value="Manage Roles"/>
</div>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/template.xhtml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -26,7 +26,7 @@
</ui:fragment>
<ui:fragment rendered="#{identity.hasRole('admin')}">
- <h:link id="security" view="/security.xhtml" value="Security" propagation="none"/>
+ <h:link id="security" outcome="/security.xhtml" value="Security" propagation="none"/>
<h:outputText styleClass="divider" value=" | "/>
</ui:fragment>
Modified: modules/security/trunk/examples/seamspace/src/main/webapp/usermanager.xhtml
===================================================================
--- modules/security/trunk/examples/seamspace/src/main/webapp/usermanager.xhtml 2010-04-01 06:25:35 UTC (rev 12351)
+++ modules/security/trunk/examples/seamspace/src/main/webapp/usermanager.xhtml 2010-04-01 07:29:22 UTC (rev 12352)
@@ -2,8 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
+ xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="template.xhtml">
@@ -14,8 +13,7 @@
<ui:define name="content">
<script type="text/javascript">
- function confirmDelete()
- {
+ function confirmDelete() {
return confirm("Are you sure you wish to delete this user? This action cannot be undone.");
}
</script>
@@ -24,7 +22,7 @@
<h2>User Manager</h2>
- <s:button id="newUser" action="#{userAction.createUser}" styleClass="newuser" rendered="#{s:hasPermission('seam.account', 'create')}"/>
+ <h:button id="newUser" action="#{userAction.createUser}" styleClass="newuser" rendered="#{identity.hasPermission('seam.account', 'create')}"/>
<h:dataTable
id="threads"
@@ -58,11 +56,11 @@
Action
</f:facet>
- <s:fragment rendered="#{s:hasPermission('seam.user', 'update')}">
- <s:link id="edit" value="Edit" action="#{userAction.editUser(userSearch.selectedUser)}"/><span> | </span>
- </s:fragment>
- <s:link id="delete" value="Delete" action="#{identityManager.deleteUser(userSearch.selectedUser)}"
- rendered="#{s:hasPermission('seam.user', 'delete')}"
+ <ui:fragment rendered="#{identity.hasPermission('seam.user', 'update')}">
+ <h:link id="edit" value="Edit" action="#{userAction.editUser(userSearch.selectedUser)}"/><span> | </span>
+ </ui:fragment>
+ <h:link id="delete" value="Delete" action="#{identityManager.deleteUser(userSearch.selectedUser)}"
+ rendered="#{identity.hasPermission('seam.user', 'delete')}"
onclick="return confirmDelete()"/>
</h:column>
</h:dataTable>
14 years, 9 months