Seam SVN: r11447 - branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/messaging.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-08-28 17:17:16 -0400 (Fri, 28 Aug 2009)
New Revision: 11447
Modified:
branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java
Log:
JBSEAM-4212
Modified: branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java
===================================================================
--- branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java 2009-08-28 19:45:50 UTC (rev 11446)
+++ branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java 2009-08-28 21:17:16 UTC (rev 11447)
@@ -104,28 +104,60 @@
public RemoteSubscriber subscribe(String topicName)
{
- if (!allowedTopics.contains(topicName))
+ if (!allowedTopics.contains(topicName)) {
throw new IllegalArgumentException(String.format(
"Cannot subscribe to a topic that is not allowed. Topic [%s] is not an " +
"allowed topic.", topicName));
+ }
RemoteSubscriber sub = new RemoteSubscriber(UUID.randomUUID().toString(), topicName);
try {
- sub.subscribe(getTopicConnection());
+ subscribe(sub);
subscriptions.put(sub.getToken(), sub);
// Save the client's token in their session context
getUserTokens().add(sub.getToken());
return sub;
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
log.error(ex);
return null;
}
}
+ private void subscribe(RemoteSubscriber sub)
+ throws JMSException, Exception
+ {
+ try {
+ sub.subscribe(getTopicConnection());
+ } catch (Exception e) {
+ log.debug(e);
+
+ // Clear the topic connection and try again.
+ resetTopic();
+ sub.subscribe(getTopicConnection());
+ }
+ }
+
+ private void resetTopic()
+ {
+ TopicConnection savedTopic = null;
+
+ synchronized(monitor) {
+ if (topicConnection != null) {
+ savedTopic = topicConnection;
+ topicConnection = null;
+ }
+ }
+
+ if (savedTopic != null) {
+ try {
+ savedTopic.close();
+ } catch (Exception ignored) { }
+ }
+ }
+
public UserTokens getUserTokens()
{
return (UserTokens) Component.getInstance(UserTokens.class);
15 years, 4 months
Seam SVN: r11446 - branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2009-08-28 15:45:50 -0400 (Fri, 28 Aug 2009)
New Revision: 11446
Added:
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/FlowProcessInterceptor.java
Modified:
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java
Log:
Drools5 Integration.
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java 2009-08-28 13:47:56 UTC (rev 11445)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java 2009-08-28 19:45:50 UTC (rev 11446)
@@ -1,6 +1,31 @@
package org.jboss.seam.annotations.drools;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a method as causing drools process to be aborted.
+ *
+ * @author Tihomir Surdilovic
+ */
+
+@Target( METHOD )
+@Retention( RUNTIME )
+@Documented
public @interface AbortProcess
{
+ /**
+ * Name of the StatefulKnowledgeSession component.
+ * @return an EL expression
+ */
+ String ksession();
+ /**
+ * The process name to be aborted.
+ */
+ String processName();
}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/FlowProcessInterceptor.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/FlowProcessInterceptor.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/FlowProcessInterceptor.java 2009-08-28 19:45:50 UTC (rev 11446)
@@ -0,0 +1,97 @@
+package org.jboss.seam.annotations.drools;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.drools.runtime.process.ProcessInstance;
+import org.jboss.seam.Component;
+import org.jboss.seam.annotations.intercept.AroundInvoke;
+import org.jboss.seam.annotations.intercept.Interceptor;
+import org.jboss.seam.core.BijectionInterceptor;
+import org.jboss.seam.intercept.InvocationContext;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+/**
+ * Implements annotation-based flow process demarcation.
+ *
+ * @author Tihomir Surdilovic
+ */
+@Interceptor(stateless=true, around=BijectionInterceptor.class)
+public class FlowProcessInterceptor
+{
+ private static final LogProvider log = Logging.getLogProvider( FlowProcessInterceptor.class );
+
+ @AroundInvoke
+ public Object aroundInvoke(InvocationContext invocation) throws Exception
+ {
+ if ( !beforeInvocation(invocation) )
+ {
+ return null;
+ }
+ else
+ {
+ return afterInvocation( invocation, invocation.proceed() );
+ }
+ }
+
+ private boolean beforeInvocation(InvocationContext invocationContext)
+ {
+ Method method = invocationContext.getMethod();
+ if ( method.isAnnotationPresent(StartProcess.class) )
+ {
+ log.info( "encountered @StartProcess" );
+ StartProcess tag = method.getAnnotation(StartProcess.class);
+ org.drools.runtime.StatefulKnowledgeSession ksession =
+ (org.drools.runtime.StatefulKnowledgeSession) Component.getInstance(tag.ksession(), true);
+
+ if(tag.processData() != "") {
+ ksession.startProcess(tag.processName(), (Map<String, Object>) Component.getInstance(tag.processData()));
+ } else {
+ ksession.startProcess(tag.processName());
+ }
+ }
+ else if ( method.isAnnotationPresent(AbortProcess.class) ) {
+ log.info( "encountered @AbortProcess" );
+ AbortProcess tag = method.getAnnotation(AbortProcess.class);
+ org.drools.runtime.StatefulKnowledgeSession ksession =
+ (org.drools.runtime.StatefulKnowledgeSession) Component.getInstance(tag.ksession(), true);
+ ksession.getProcessInstances();
+ for(ProcessInstance processInstance: ksession.getProcessInstances()) {
+ if(processInstance.getProcessName().equals(tag.processName())) {
+ ksession.abortProcessInstance(processInstance.getId());
+ }
+ }
+ }
+ else if ( method.isAnnotationPresent(SignalEvent.class) ) {
+ log.info( "encountered @SignalEvent" );
+ SignalEvent tag = method.getAnnotation(SignalEvent.class);
+ org.drools.runtime.StatefulKnowledgeSession ksession =
+ (org.drools.runtime.StatefulKnowledgeSession) Component.getInstance(tag.ksession(), true);
+
+ if(tag.processName() != "") {
+ for(ProcessInstance processInstance: ksession.getProcessInstances()) {
+ if(processInstance.getProcessName().equals(tag.processName())) {
+ if (tag.eventData() != "") {
+ processInstance.signalEvent(tag.eventType(), Component.getInstance(tag.eventData()));
+ } else {
+ processInstance.signalEvent(tag.eventType(), null);
+ }
+ }
+ }
+ } else {
+ if (tag.eventData() != "") {
+ ksession.signalEvent(tag.eventType(), Component.getInstance(tag.eventData()));
+ } else {
+ ksession.signalEvent(tag.eventType(), null);
+ }
+ }
+ }
+ return true;
+ }
+
+ private Object afterInvocation(InvocationContext invocation, Object result)
+ {
+ return result;
+ }
+}
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java 2009-08-28 13:47:56 UTC (rev 11445)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java 2009-08-28 19:45:50 UTC (rev 11446)
@@ -22,24 +22,23 @@
public @interface SignalEvent
{
/**
- * An EL expression that evaluates to a StatefulKnowledgeSession.
- * @return an EL expression
+ * Name of the StatefulKnowledgeSession component.
*/
- String ksession() default "";
+ String ksession();
/**
- * The process instance id to be started.
+ * The process name.
*/
- String processInstanceId() default "";
+ String processName();
/**
* The event type.
*/
- String eventType() default "";
+ String eventType();
/**
- * An EL expression that evaluates to Event Data.
- * @return an EL expression
+ * Name of the component which unwraps itself to Object
+ * and provides event data.
*/
String eventData() default "";
Modified: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java 2009-08-28 13:47:56 UTC (rev 11445)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java 2009-08-28 19:45:50 UTC (rev 11446)
@@ -18,13 +18,18 @@
public @interface StartProcess
{
/**
- * An EL expression that evaluates to a StatefulKnowledgeSession.
- * @return an EL expression
+ * Name of the StatefulKnowledgeSession. component.
*/
- String ksession() default "";
+ String ksession();
/**
- * The process id to be started.
+ * The process name to be started.
*/
- String processId() default "";
+ String processName();
+
+ /**
+ * Name of the component which unwraps itself to Map<Object, String>
+ * and provides process data.
+ */
+ String processData() default "";
}
15 years, 4 months
Seam SVN: r11445 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-28 09:47:56 -0400 (Fri, 28 Aug 2009)
New Revision: 11445
Modified:
branches/enterprise/JBPAPP_5_0/build/core.pom.xml
branches/enterprise/JBPAPP_5_0/build/debug.pom.xml
branches/enterprise/JBPAPP_5_0/build/excel.pom.xml
branches/enterprise/JBPAPP_5_0/build/ioc.pom.xml
branches/enterprise/JBPAPP_5_0/build/pdf.pom.xml
branches/enterprise/JBPAPP_5_0/build/remoting.pom.xml
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
branches/enterprise/JBPAPP_5_0/build/ui.pom.xml
Log:
JBPAPP-2660
Modified: branches/enterprise/JBPAPP_5_0/build/core.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -72,7 +72,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<optional>true</optional>
<scope>provided</scope>
@@ -334,11 +334,23 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>apache-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
<dependency>
<groupId>org.openid4java</groupId>
<artifactId>openid4java</artifactId>
Modified: branches/enterprise/JBPAPP_5_0/build/debug.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/debug.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/debug.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -39,7 +39,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/excel.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/excel.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/excel.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -48,7 +48,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/ioc.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/ioc.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/ioc.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -67,7 +67,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/pdf.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/pdf.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/pdf.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -53,7 +53,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/remoting.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/remoting.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/remoting.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -39,7 +39,7 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -125,10 +125,15 @@
<version>@seam.version@</version>
</dependency>
+<!-- <dependency>-->
+<!-- <groupId>javax.servlet</groupId>-->
+<!-- <artifactId>servlet-api</artifactId>-->
+<!-- <version>2.5</version>-->
+<!-- </dependency>-->
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <version>2.1.3.GA</version>
</dependency>
<dependency>
@@ -254,6 +259,10 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-core</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -347,6 +356,10 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -379,6 +392,10 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
</exclusions>
</dependency>
@@ -451,7 +468,7 @@
<artifactId>jboss-logging-spi</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
+ <groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
</exclusion>
<exclusion>
@@ -856,12 +873,6 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
<version>2.1.2.GA</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
@@ -871,9 +882,9 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
- <version>2.2.0.GA</version>
+ <version>2.2.14.GA</version>
<exclusions>
<exclusion>
<groupId>apache-xerces</groupId>
@@ -948,6 +959,18 @@
</exclusions>
</dependency>
+ <dependency>
+ <groupId>apache-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+
<dependency>
<groupId>org.openid4java</groupId>
<artifactId>openid4java</artifactId>
@@ -968,18 +991,17 @@
<artifactId>xmlsec</artifactId>
</exclusion>
- <!--
+
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
- -->
- <!--
+
<exclusion>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</exclusion>
- -->
+
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@@ -1081,13 +1103,13 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.4.2</version>
+ <version>1.5.8</version>
</dependency>
<dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/ui.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/ui.pom.xml 2009-08-28 09:39:07 UTC (rev 11444)
+++ branches/enterprise/JBPAPP_5_0/build/ui.pom.xml 2009-08-28 13:47:56 UTC (rev 11445)
@@ -62,7 +62,7 @@
<dependencies>
<dependency>
- <groupId>javax.servlet</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>servlet-api</artifactId>
<optional>true</optional>
<scope>provided</scope>
15 years, 4 months
Seam SVN: r11444 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: examples/ui and 3 other directories.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-08-28 05:39:07 -0400 (Fri, 28 Aug 2009)
New Revision: 11444
Added:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/photo.jpg
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/jboss5.xml
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java
Log:
JBPAPP-2709 Added a functional test for UI example
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2009-08-28 09:25:08 UTC (rev 11443)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml 2009-08-28 09:39:07 UTC (rev 11444)
@@ -36,6 +36,9 @@
<property name="lib.dir" value="${ftest.dir}/lib" />
<property name="log.dir" value="${ftest.dir}/log" />
+ <!-- Build resources -->
+ <import file="${seam.dir}/build/common.build.xml" />
+
<path id="selenium.server.classpath">
<fileset dir="${lib.dir}">
<include name="selenium-server-standalone.jar" />
@@ -233,10 +236,36 @@
</sequential>
</macrodef>
+ <!-- Target for declaring needed libraries for ftest tests -->
+ <target name="importlibraries">
+ <copyInlineDependencies id="allexamples" scope="compile" todir="${lib.dir}">
+ <dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit" version="2.3"/>
+ <dependency groupId="commons-httpclient" artifactId="commons-httpclient" version="3.1"/>
+ <dependency groupId="org.w3c" artifactId="sac" version="1.3"/>
+ <dependency groupId="commons-io" artifactId="commons-io" version="1.3.1"/>
+ <dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+ <dependency groupId="apache-xerces" artifactId="xercesImpl" version="2.9.0"/>
+ <dependency groupId="commons-collections" artifactId="commons-collections" version="3.1"/>
+ <dependency groupId="commons-lang" artifactId="commons-lang" version="2.3"/>
+ <dependency groupId="apache-xalan" artifactId="xalan" version="j_2.7.0"/>
+ <dependency groupId="commons-codec" artifactId="commons-codec" version="1.3"/>
+ <dependency groupId="commons-logging" artifactId="commons-logging" version="1.1.1"/>
+ <dependency groupId="net.sourceforge.cssparser" artifactId="cssparser" version="0.9.5"/>
+ <dependency groupId="net.sourceforge.htmlunit" artifactId="htmlunit-core-js" version="2.4"/>
+ <dependency groupId="net.sourceforge.nekohtml" artifactId="nekohtml" version="1.9.9"/>
+ <dependency groupId="apache-xalan" artifactId="serializer" version="j_2.7.0"/>
+ <dependency groupId="xml-apis" artifactId="xml-apis" version="1.3.03"/>
+ </copyInlineDependencies>
+ </target>
+
<macrodef name="callExample">
<attribute name="path" />
<attribute name="target" />
<sequential>
+
+ <!-- Added for downloading libraries -->
+ <antcall target="importlibraries"> </antcall>
+
<ant dir="@{path}" target="@{target}" inheritall="false">
<property name="container" value="${container}">
</property>
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/jboss5.xml 2009-08-28 09:25:08 UTC (rev 11443)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/jboss5.xml 2009-08-28 09:39:07 UTC (rev 11444)
@@ -1,5 +1,4 @@
-
- <!--
+<!--
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
@@ -14,13 +13,14 @@
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="UI example" verbose="2" parallel="false">
<test name="ui_jboss5">
- <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/ui/test/selenium/ui.properties" />
<classes>
<class name="org.jboss.seam.example.ui.test.selenium.SeleniumUITest" />
+ <class name="org.jboss.seam.example.ui.test.htmlunit.HtmlUnitUITest" />
</classes>
</test>
</suite>
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/photo.jpg
===================================================================
(Binary files differ)
Property changes on: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/photo.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/htmlunit/HtmlUnitUITest.java 2009-08-28 09:39:07 UTC (rev 11444)
@@ -0,0 +1,122 @@
+/*
+ * 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.ui.test.htmlunit;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+
+import java.io.IOException;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.BrowserVersion;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import static org.testng.AssertJUnit.fail;
+import java.net.URL;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Functional test for uploadLink and graphicImage testcases of UI example
+ *
+ * @author mgencur
+ *
+ */
+public class HtmlUnitUITest
+{
+ public static final String PAGE_URL = "http://localhost:8080/seam-ui";
+ public static final String HOME_PAGE_TITLE = "UI Example:";
+ public static final String FILE_UPLOAD_FILE= "//input[@type='file']";
+ public static final String FILE_UPLOAD_UPDATE="//input[@type='submit'][@value='Update']";
+ public static final String IMAGE_TO_UPLOAD = "photo.jpg";
+ public static final String FILE_UPLOAD_RESPONSE="//ul/li[contains(text(),'Successfully updated')]";
+ public static final String FILE_UPLOAD_LINK = "//a[contains(@href,'fileUpload')]";
+ public static final String GRAPHIC_IMAGE_LINK = "//a[contains(@href,'graphicImage')]";
+ public static final String IMAGE = "//img";
+
+ public WebClient wc;
+ public HtmlPage page;
+
+ @BeforeMethod
+ public void setUp() throws Exception{
+ URL url = new URL(PAGE_URL);
+ wc = new WebClient(BrowserVersion.FIREFOX_2);
+ page = (HtmlPage) wc.getPage(url);
+ }
+
+
+ @AfterMethod
+ public void tearDown() {
+ wc.closeAllWindows();
+ }
+
+
+ @Test
+ public void homePageLoadTest()
+ {
+ assertEquals("Unexpected page title.", HOME_PAGE_TITLE, page.getTitleText());
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void fileUploadTest() throws IOException {
+ final HtmlAnchor linkEl = (HtmlAnchor) page.getFirstByXPath(FILE_UPLOAD_LINK);
+
+ final HtmlPage uploadPage = (HtmlPage) linkEl.click();
+ if (uploadPage == null){
+ fail("Could not read page");
+ }
+
+ final HtmlInput el1 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_FILE);
+ if (el1 == null) {
+ fail("Element file upload file doesn't exist");
+ } else {
+ el1.type(IMAGE_TO_UPLOAD);
+ }
+
+ final HtmlInput el2 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_UPDATE);
+ final HtmlPage finishPage = (HtmlPage) el2.click();
+ final HtmlElement el3 = (HtmlElement) finishPage.getFirstByXPath(FILE_UPLOAD_RESPONSE);
+
+ assertFalse("Page should contain \"Successfully updated\"", el3 == null);
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest","fileUploadTest"})
+ public void graphicImageTest() throws IOException {
+ final HtmlAnchor linkEl = (HtmlAnchor) page.getFirstByXPath(GRAPHIC_IMAGE_LINK);
+
+ final HtmlPage graphicPage = (HtmlPage) linkEl.click();
+ if (graphicPage == null){
+ fail("Could not read page");
+ }
+
+ final HtmlImage image = (HtmlImage) graphicPage.getFirstByXPath(IMAGE);
+
+ assertFalse("Page should contain image of Pete Muir", image == null);
+ }
+}
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java 2009-08-28 09:25:08 UTC (rev 11443)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/SeleniumUITest.java 2009-08-28 09:39:07 UTC (rev 11444)
@@ -1,16 +1,51 @@
+/*
+ * 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.ui.test.selenium;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+/**
+ * This class tests functionality of UI example
+ *
+ * @author Martin Gencur
+ *
+ */
public class SeleniumUITest extends SeamSeleniumTest
{
public static final String HOME_PAGE = "/index.seam";
public static final String HOME_PAGE_TITLE = "UI Example:";
-
+ public static final String SELECT_ITEMS_LINK = "xpath=//a[contains(@href,\"selectItems\")]";
+ public static final String FRAGMENT_LINK = "xpath=//a[contains(@href,\"fragment\")]";
+ public static final String FOTMATTED_TEXT_LINK = "xpath=//a[contains(@href,\"formattedText\")]";
+ public static final String BUTTON_AND_SLINK_LINK = "xpath=//a[contains(@href,\"linkAndButton\")]";
+ public static final String CACHE_LINK = "xpath=//a[contains(@href,\"cache\")]";
+ public static final String VALIDATE_EQUALITY_LINK = "xpath=//a[contains(@href,\"equalityValidator\")]";
+ public static final String VALIDATE_EQUALITY2_LINK = "xpath=//a[contains(@href,\"equalityValidatorWConvert\")]";
+
@BeforeMethod
@Override
public void setUp()
@@ -26,5 +61,137 @@
public void homePageLoadTest()
{
assertEquals("Unexpected page title.", HOME_PAGE_TITLE, browser.getTitle());
+ }
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void selectItemsTest(){
+ String title = "Mr.";
+ String name = "Martin Gencur";
+ String continent = "Europe";
+ String age = "24";
+ String pet = "Dog (Needs lots of exercise)";
+ String colour1 = "Green", colour2 = "Yellow";
+ String book = "Pride and Prejudice by Jane Austin (British)";
+ String film = "Blade Runner directed by Ridley Scott";
+ browser.clickAndWait(SELECT_ITEMS_LINK);
+ browser.select(getProperty("SELECT_ITEMS_TITLE"), "label="+title);
+ browser.type(getProperty("SELECT_ITEMS_NAME"), name);
+ browser.select(getProperty("SELECT_ITEMS_CONTINENT"), "label="+continent);
+ browser.check(getProperty("SELECT_ITEMS_USER"));
+ browser.check(getProperty("SELECT_ITEMS_ADMIN"));
+ browser.check(getProperty("SELECT_ITEMS_MANAGER"));
+ browser.check(getProperty("SELECT_ITEMS_SUPERADMIN"));
+ browser.select(getProperty("SELECT_ITEMS_AGE"), "label="+age);
+ browser.select(getProperty("SELECT_ITEMS_PET"), "label="+pet);
+ browser.select(getProperty("SELECT_ITEMS_COLOURS"), "label="+colour1);
+ browser.select(getProperty("SELECT_ITEMS_COLOURS"), "label="+colour2);
+ browser.select(getProperty("SELECT_ITEMS_BOOK"), "label="+book);
+ browser.select(getProperty("SELECT_ITEMS_FILM"), "label="+film);
+ browser.clickAndWait(getProperty("SELECT_ITEMS_APPLY"));
+ browser.check(getProperty("SELECT_ITEMS_COUNTRY"));
+ browser.clickAndWait(getProperty("SELECT_ITEMS_APPLY"));
+ assertTrue("Page should contain \"Successfully updated\"", browser.isTextPresent("Successfully updated"));
}
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void fragmentTest(){
+ browser.clickAndWait(FRAGMENT_LINK);
+ assertTrue("Page should contain \"fragment is rendered\"", browser.isTextPresent("This fragment is rendered whilst"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void formattedTextTest(){
+ browser.clickAndWait(FOTMATTED_TEXT_LINK);
+ assertTrue("Page should contain information about Pete Muir working all the time on Seam", browser.isTextPresent("works on Seam, of course"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void buttonAndLinkTest(){
+ browser.clickAndWait(BUTTON_AND_SLINK_LINK);
+ assertTrue("Page should contain \"A fragment to jump to\"", browser.isTextPresent("A fragment to jump to"));
+ browser.clickAndWait(getProperty("JUMP_LINK"));
+ browser.clickAndWait(getProperty("JUMP_BUTTON"));
+ browser.clickAndWait(getProperty("LINK_LINK"));
+ browser.clickAndWait(getProperty("DO_ACTION_LINK"));
+ assertTrue("Page should contain \"A simple action was performed\"", browser.isTextPresent("A simple action was performed"));
+ browser.clickAndWait(getProperty("DO_ACTION_BUTTON"));
+ assertTrue("Page should contain \"A simple action was performed\"", browser.isTextPresent("A simple action was performed"));
+ assertTrue("Page should contain disabled link", browser.isElementPresent(getProperty("DISABLED_DO_ACTION_LINK")));
+ assertTrue("Page should contain disabled button", browser.isElementPresent(getProperty("DISABLED_DO_ACTION_BUTTON")));
+ browser.clickAndWait(getProperty("BEGIN_CONVERSATION_LINK"));
+ browser.clickAndWait(getProperty("END_CONVERSATION_BUTTON"));
+ assertTrue("Page shouldn't contain \"A simple action was performed\"", !browser.isTextPresent("A simple action was performed"));
+ browser.clickAndWait(getProperty("ADD_PARAMETER_LINK"));
+ browser.clickAndWait(getProperty("ADD_PARAMETER_BUTTON"));
+ assertTrue("Page should contain \"Foo = bar\"", browser.isTextPresent("Foo = bar"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void cacheTest(){
+ browser.clickAndWait(CACHE_LINK);
+ assertTrue("Page should contain some cached text", browser.isTextPresent("Some cached text"));
+ }
+
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void validateEqualityTest(){
+ String name1 = "martin";
+ String name2 = "peter";
+ String age1 = "20";
+ String age2 = "30";
+ browser.clickAndWait(VALIDATE_EQUALITY_LINK);
+
+ browser.type(getProperty("NAME_INPUT"), name1);
+ browser.type(getProperty("NAME_VERIFICATION_INPUT"), name1);
+ browser.clickAndWait(getProperty("CHECK_NAME_BUTTON"));
+ assertTrue("Page should contain \"OK!\""+ "je tam:" + browser.getBodyText(), browser.isTextPresent("OK!"));
+
+ browser.type(getProperty("NAME_INPUT"), name1);
+ browser.type(getProperty("NAME_VERIFICATION_INPUT"), name2);
+ browser.clickAndWait(getProperty("CHECK_NAME_BUTTON"));
+ assertTrue("Page should contain \"Must be the same as name!\"", browser.isTextPresent("Must be the same as name!"));
+
+ browser.type(getProperty("MINIMUM_AGE_INPUT"), age1);
+ browser.type(getProperty("MAXIMUM_AGE_INPUT"), age2);
+ browser.clickAndWait(getProperty("CHECK_AGES_BUTTON"));
+ assertTrue("Page should contain \"OK!\"", browser.isTextPresent("OK!"));
+ browser.type(getProperty("MINIMUM_AGE_INPUT"), age1);
+ browser.type(getProperty("MAXIMUM_AGE_INPUT"), age1);
+ browser.clickAndWait(getProperty("CHECK_AGES_BUTTON"));
+ assertTrue("Page should contain \"Must be larger than minimum!\"", browser.isTextPresent("Must be larger than minimum!"));
+ browser.type(getProperty("MINIMUM_AGE_INPUT"), age2);
+ browser.type(getProperty("MAXIMUM_AGE_INPUT"), age1);
+ browser.clickAndWait(getProperty("CHECK_AGES_BUTTON"));
+ assertTrue("Page should contain \"Must be larger than minimum!\"", browser.isTextPresent("Must be larger than minimum!"));
+ }
+
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void validateEquality2Test(){
+ String date1 = "2009-08-21";
+ String date2 = "2009-08-25";
+ browser.clickAndWait(VALIDATE_EQUALITY2_LINK);
+
+ browser.type(getProperty("DATE_INPUT"), date1);
+ browser.type(getProperty("DATE_VERIFICATION_INPUT"), date1);
+ browser.clickAndWait(getProperty("CHECK_DATE_BUTTON"));
+ assertTrue("Page should contain \"OK!\"", browser.isTextPresent("OK!"));
+
+ browser.type(getProperty("DATE_INPUT"), date1);
+ browser.type(getProperty("DATE_VERIFICATION_INPUT"), date2);
+ browser.clickAndWait(getProperty("CHECK_DATE_BUTTON"));
+ assertTrue("Page should contain \"Value does not equal that in 'date'\"", browser.isTextPresent("Value does not equal that in 'date' "));
+ //assertTrue("Page should contain information about Pete Muir working all the time on Seam", browser.isTextPresent("works on Seam, of course"));
+ }
+
+ /**
+ * Resource download cannot be tested automatically because downloading a file needs user interaction
+ * with a window form
+ *
+ @Test(dependsOnMethods={"homePageLoadTest"})
+ public void resourceDownloadTest(){
+ }*/
}
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/ui/src/org/jboss/seam/example/ui/test/selenium/ui.properties 2009-08-28 09:39:07 UTC (rev 11444)
@@ -0,0 +1,34 @@
+SELECT_ITEMS_TITLE=xpath\=//select[option[contains(@value,'MR')]]
+SELECT_ITEMS_NAME=xpath\=//input[contains(@value,'Peter Muir')]
+SELECT_ITEMS_CONTINENT=xpath\=//select[option[contains(text(),'Europe')]]
+SELECT_ITEMS_USER=xpath\=//input[@type\='checkbox'][@value\='USER']
+SELECT_ITEMS_ADMIN=xpath\=//input[@type\='checkbox'][@value\='ADMIN']
+SELECT_ITEMS_MANAGER=xpath\=//input[@type\='checkbox'][@value\='MANAGER']
+SELECT_ITEMS_SUPERADMIN=xpath\=//input[@type\='checkbox'][@value\='SUPERADMIN']
+SELECT_ITEMS_AGE=xpath\=//select[option[contains(text(),'24')]]
+SELECT_ITEMS_PET=xpath\=//select[option[contains(@value,'Dog')]]
+SELECT_ITEMS_COLOURS=xpath\=//select[option[contains(text(),'Green')]]
+SELECT_ITEMS_BOOK=xpath\=//select[option[contains(text(),'Pride and Prejudice by Jane Austin (British)')]]
+SELECT_ITEMS_FILM=xpath\=//select[option[contains(text(),'Blade Runner directed by Ridley Scott')]]
+SELECT_ITEMS_APPLY=xpath\=//input[@type\='submit'][@value\='Apply']
+SELECT_ITEMS_COUNTRY=xpath\=//input[@type\='radio'][@value\='18']
+JUMP_LINK=xpath\=//a[contains(text(),'Jump')]
+JUMP_BUTTON=xpath\=//input[@type\='button'][@value\='Jump']
+LINK_LINK=xpath\=//a[contains(text(),'Link')]
+DO_ACTION_LINK=xpath\=//a[contains(text(),'Do action')]
+DO_ACTION_BUTTON=xpath\=//input[@type\='button'][@value\='Do action']
+DISABLED_DO_ACTION_LINK=xpath\=//a[contains(text(),'Do action')][not(@href)]
+DISABLED_DO_ACTION_BUTTON=xpath\=//input[@type\='button'][@value\='Do action'][@disabled\='disabled']
+BEGIN_CONVERSATION_LINK=xpath\=//a[contains(text(),'Begin conversation')]
+END_CONVERSATION_BUTTON=xpath\=//input[@type\='button'][@value\='End conversation']
+ADD_PARAMETER_LINK=xpath\=//a[contains(text(),'Add a page parameter')]
+ADD_PARAMETER_BUTTON=xpath\=//input[@type\='button'][@value\='Add a page parameter']
+NAME_INPUT=xpath\=//input[@type\='text'][contains(@name,'name')][not(contains(@name,'nameVerification'))]
+NAME_VERIFICATION_INPUT=xpath\=//input[@type\='text'][contains(@name,'nameVerification')]
+CHECK_NAME_BUTTON=xpath\=//input[@type\='submit'][@value\='Check name']
+MINIMUM_AGE_INPUT=xpath\=//input[@type\='text'][contains(@name,'min')][not(contains(@name,'minVerification'))]
+MAXIMUM_AGE_INPUT=xpath\=//input[@type\='text'][contains(@name,'minVerification')]
+CHECK_AGES_BUTTON=xpath\=//input[@type\='submit'][@value\='Check ages']
+DATE_INPUT=xpath\=//input[@type\='text'][contains(@name,'date')][not(contains(@name,'dateVerification'))]
+DATE_VERIFICATION_INPUT=xpath\=//input[@type\='text'][contains(@name,'dateVerification')]
+CHECK_DATE_BUTTON=xpath\=//input[@type\='submit'][@value\='Check date']
\ No newline at end of file
15 years, 4 months
Seam SVN: r11443 - branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-08-28 05:25:08 -0400 (Fri, 28 Aug 2009)
New Revision: 11443
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
Log:
JBPAPP-2708 Changed a properties file
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-08-28 09:06:25 UTC (rev 11442)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-08-28 09:25:08 UTC (rev 11443)
@@ -53,4 +53,14 @@
BID_HISTORY_COUNT //table[@id='history']/tbody/tr
BID_OUTBID id=outbid
BID_HIGH_BIDDER id\=highBidder
-BID_HISTORY_BACK id\=back
+BID_HISTORY_BACK id\=back
+LIST_CATEGORIES_RESPONSE=<ns2\:listCategoriesResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return><categoryId>1</categoryId><name>Antiques</name></return><return><categoryId>2</categoryId><name>Art</name></return><return><categoryId>3</categoryId><name>Books</name></return><return><categoryId>4</categoryId><name>Cameras and Photography</name></return><return><categoryId>5</categoryId><name>Cars and Boats</name></return><return><categoryId>6</categoryId><name>Cell Phones</name></return><return><categoryId>7</categoryId><name>Clothing and Shoes</name></return><return><categoryId>8</categoryId><name>Computers</name></return><return><categoryId>9</categoryId><name>Music</name></return><return><categoryId>10</categoryId><name>Electronics</name></return><return><categoryId>11</categoryId><name>Home and Garden</name></return><return><categoryId>12</categoryId><name>Musical Instruments</name></return><return><categoryId>13</categoryId><name>Sporting goods</name></!
return><return><categoryId>14</categoryId><name>Toys</name></return><return><categoryId>15</categoryId><name>Video Games</name></return><return><categoryId>1001</categoryId><name>Furniture</name><parent><categoryId>1</categoryId><name>Antiques</name></parent></return><return><categoryId>1002</categoryId><name>Silverware</name><parent><categoryId>1</categoryId><name>Antiques</name></parent></return><return><categoryId>2001</categoryId><name>Paintings</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>2002</categoryId><name>Prints</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>2003</categoryId><name>Sculptures</name><parent><categoryId>2</categoryId><name>Art</name></parent></return><return><categoryId>3001</categoryId><name>Fiction</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>3002</categoryId><name>Non Fiction</name><parent><categoryId>!
3</categoryId><name>Books</name></parent></return><return><cat!
egoryId>
3003</categoryId><name>Comic Books</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>3004</categoryId><name>Children</name><parent><categoryId>3</categoryId><name>Books</name></parent></return><return><categoryId>4001</categoryId><name>Digital Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4002</categoryId><name>Memory Cards</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4003</categoryId><name>Film Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>4004</categoryId><name>Video Cameras</name><parent><categoryId>4</categoryId><name>Cameras and Photography</name></parent></return><return><categoryId>5001</categoryId><name>Cars</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><cate!
goryId>5002</categoryId><name>Motorcycles</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><categoryId>5003</categoryId><name>Car Parts</name><parent><categoryId>5</categoryId><name>Cars and Boats</name></parent></return><return><categoryId>6001</categoryId><name>Mobile Phones</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>6002</categoryId><name>Mobile Accessories</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>6003</categoryId><name>Prepaid cards</name><parent><categoryId>6</categoryId><name>Cell Phones</name></parent></return><return><categoryId>7001</categoryId><name>Women</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7002</categoryId><name>Men</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7003</c!
ategoryId><name>Girls</name><parent><categoryId>7</categoryId>!
<name>Cl
othing and Shoes</name></parent></return><return><categoryId>7004</categoryId><name>Boys</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>7005</categoryId><name>Babies</name><parent><categoryId>7</categoryId><name>Clothing and Shoes</name></parent></return><return><categoryId>8001</categoryId><name>Notebooks</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8002</categoryId><name>Desktop PCs</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8003</categoryId><name>Servers</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8004</categoryId><name>Hardware</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><categoryId>8005</categoryId><name>Software</name><parent><categoryId>8</categoryId><name>Computers</name></parent></return><return><!
categoryId>9001</categoryId><name>CDs</name><parent><categoryId>9</categoryId><name>Music</name></parent></return><return><categoryId>9002</categoryId><name>Records</name><parent><categoryId>9</categoryId><name>Music</name></parent></return><return><categoryId>10001</categoryId><name>Home Audio</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10002</categoryId><name>MP3 Players</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10003</categoryId><name>Television</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>10004</categoryId><name>Home theatre</name><parent><categoryId>10</categoryId><name>Electronics</name></parent></return><return><categoryId>11001</categoryId><name>Kitchen</name><parent><categoryId>11</categoryId><name>Home and Garden</name></parent></return><return><categoryId>11002</categoryId><name>Real Esta!
te</name><parent><categoryId>11</categoryId><name>Home and Gar!
den</nam
e></parent></return><return><categoryId>11003</categoryId><name>Furniture</name><parent><categoryId>11</categoryId><name>Home and Garden</name></parent></return><return><categoryId>12001</categoryId><name>Guitars</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12002</categoryId><name>Pianos and Keyboards</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12003</categoryId><name>Percussion</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>12004</categoryId><name>Orchestral</name><parent><categoryId>12</categoryId><name>Musical Instruments</name></parent></return><return><categoryId>13001</categoryId><name>Golf</name><parent><categoryId>13</categoryId><name>Sporting goods</name></parent></return><return><categoryId>13002</categoryId><name>Fishing</name><parent><categoryId>13</categoryId><name>Spo!
rting goods</name></parent></return><return><categoryId>13003</categoryId><name>Tennis</name><parent><categoryId>13</categoryId><name>Sporting goods</name></parent></return><return><categoryId>14001</categoryId><name>Remote control</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14002</categoryId><name>Cars and trucks</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14003</categoryId><name>Dolls</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>14004</categoryId><name>Educational</name><parent><categoryId>14</categoryId><name>Toys</name></parent></return><return><categoryId>15001</categoryId><name>PC</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return><return><categoryId>15002</categoryId><name>Nintendo Wii</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return><return><categor!
yId>15003</categoryId><name>Sony Playstation 3</name><parent><!
category
Id>15</categoryId><name>Video Games</name></parent></return><return><categoryId>15004</categoryId><name>XBox 360</name><parent><categoryId>15</categoryId><name>Video Games</name></parent></return></ns2\:listCategoriesResponse>
+LOGIN_RIGHT_RESPONSE=<return>true</return>
+CREATE_NEW_AUCTION_RESPONSE=<ns2\:createAuctionResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+FIND_AUCTIONS_RESPONSE=<description>You can buy an animal here</description>
+UPDATE_AUCTION_RESPONSE=<ns2\:updateAuctionDetailsResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+SET_DURATION_RESPONSE=<ns2\:setAuctionDurationResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+SET_STARTING_PRICE_RESPONSE=<ns2\:setAuctionPriceResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/>
+AUCTION_DETAILS_PRICE_RESPONSE=<ns2\:getNewAuctionDetailsResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return><account><accountId>1</accountId><feedbackPercent>0.0</feedbackPercent><feedbackScore>0</feedbackScore><location>Sydney, NSW, Australia</location>
+LOGOUT_RESPONSE=<ns2\:logoutResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"><return>true</return></ns2\:logoutResponse>
+CONFIRMATION_RESPONSE=<env\:Body><ns2\:confirmAuctionResponse xmlns\:ns2\="http\://seambay.example.seam.jboss.org/"/></env\:Body>
15 years, 4 months
Seam SVN: r11442 - in branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay: src/org/jboss/seam/example/seambay/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2009-08-28 05:06:25 -0400 (Fri, 28 Aug 2009)
New Revision: 11442
Added:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/jboss5.xml
Log:
JBPAPP-2708 Added a testcase for web service test page of seambay example
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/jboss5.xml 2009-08-28 07:12:16 UTC (rev 11441)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/jboss5.xml 2009-08-28 09:06:25 UTC (rev 11442)
@@ -26,6 +26,7 @@
<class name="org.jboss.seam.example.seambay.test.selenium.SellTest" />
<class name="org.jboss.seam.example.seambay.test.selenium.SearchTest" />
<class name="org.jboss.seam.example.seambay.test.selenium.BidTest" />
+ <class name="org.jboss.seam.example.seambay.test.selenium.WebServiceTestPageTest" />
</classes>
</test>
</suite>
Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/WebServiceTestPageTest.java 2009-08-28 09:06:25 UTC (rev 11442)
@@ -0,0 +1,273 @@
+/*
+ * 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.seambay.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.assertTrue;
+import static org.testng.AssertJUnit.fail;
+
+import com.thoughtworks.selenium.Wait;
+
+/**
+ * This class tests a functionality of web service test page available directly
+ * from SeamBay home page
+ *
+ * @author Martin Gencur
+ *
+ */
+public class WebServiceTestPageTest extends SeleniumSeamBayTest
+{
+
+ protected static final Long TIMEOUT = 3000L; //3 seconds
+ protected static final String HERE_LINK = "xpath=//a[contains(text(),\"here\")]";
+ protected static final String SERVICE_PAGE_HEADING= "seamBay Web Services - Test Page";
+
+ protected static final String INVOKE_SERVICE_BUTTON = "xpath=//button[contains(@onclick,\"sendRequest\")]";
+ protected static final String REQUEST_AREA = "id=serviceRequest";
+ protected static final String RESPONSE_AREA = "id=serviceResponse";
+
+ protected static final String LOGIN_LINK = "xpath=//a[contains(text(),\"Login\")]";
+ protected static final String LIST_CATEGORIES_LINK = "xpath=//a[contains(text(),\"List Categories\")]";
+ protected static final String CREATE_NEW_AUCTION_LINK = "xpath=//a[contains(text(),\"Create new auction\")]";
+ protected static final String UPDATE_AUCTION_DETAILS_LINK = "xpath=//a[contains(text(),\"Update auction details\")]";
+ protected static final String SET_AUCTION_DURATION_LINK = "xpath=//a[contains(text(),\"Set auction duration\")]";
+ protected static final String SET_STARTING_PRICE_LINK = "xpath=//a[contains(text(),\"Set starting price\")]";
+ protected static final String GET_AUCTION_DETAILS_LINK = "xpath=//a[contains(text(),\"Get the auction details\")]";
+ protected static final String CONFIRM_AUCTION_LINK = "xpath=//a[contains(text(),\"Confirm auction\")]";
+ protected static final String FIND_AUCTIONS_LINK = "xpath=//a[contains(text(),\"Find Auctions\")]";
+ protected static final String LOGOUT_LINK = "xpath=//a[contains(text(),\"Logout\")]";
+
+ /*login parameters*/
+ protected static final String LOGIN_INPUT_USERNAME = "id=username";
+ protected static final String LOGIN_INPUT_PASSWORD = "id=password";
+
+ /*create new auction parameters*/
+ protected static final String AUCTION_TITLE = "id=title";
+ protected static final String AUCTION_DESCRIPTION = "id=description";
+ protected static final String AUCTION_CATEGORY_ID = "id=categoryId";
+
+ /*parameters for other tests*/
+ protected static final String SEARCH_TERM = "id=searchTerm";
+ protected static final String AUCTION_DURATION = "id=duration";
+ protected static final String STARTING_PRICE = "id=price";
+
+ @Test
+ public void simplePageContentTest(){
+ browser.clickAndWait(HERE_LINK);
+ waitForElementPresent(RESPONSE_AREA, TIMEOUT);
+ assertTrue("Page should contain service page heading",browser.isTextPresent(SERVICE_PAGE_HEADING));
+ }
+
+ @Test(dependsOnMethods={"simplePageContentTest"})
+ public void loginTest(){
+ loginService();
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain \"true\"", x.contains(getProperty("LOGIN_RIGHT_RESPONSE")));
+ }
+
+ public void loginService(){
+ String username = "demo";
+ String password = "demo";
+ browser.clickAndWait(HERE_LINK);
+ waitForElementPresent(RESPONSE_AREA, TIMEOUT);
+ waitForElementPresent(LOGIN_LINK, TIMEOUT);
+ browser.click(LOGIN_LINK);
+ waitForElementPresent(LOGIN_INPUT_USERNAME, TIMEOUT);
+ waitForElementPresent(LOGIN_INPUT_PASSWORD, TIMEOUT);
+ browser.type(LOGIN_INPUT_USERNAME, username);
+ browser.type(LOGIN_INPUT_PASSWORD, password);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void listCategoriesTest(){
+ loginService();
+ waitForElementPresent(LIST_CATEGORIES_LINK, TIMEOUT);
+ browser.click(LIST_CATEGORIES_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain a list of categories.", x.contains(getProperty("LIST_CATEGORIES_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void createNewAuctionTest(){
+ loginService();
+ createNewAuctionService();
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about creating the auction.", x.contains(getProperty("CREATE_NEW_AUCTION_RESPONSE")));
+ }
+
+ public void createNewAuctionService(){
+ String title = "Animals";
+ String description = "You can buy an animal here";
+ String categoryId = "6";
+ waitForElementPresent(CREATE_NEW_AUCTION_LINK, TIMEOUT);
+ browser.click(CREATE_NEW_AUCTION_LINK);
+ waitForElementPresent(AUCTION_TITLE, TIMEOUT);
+ waitForElementPresent(AUCTION_DESCRIPTION, TIMEOUT);
+ waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
+ browser.type(AUCTION_TITLE, title);
+ browser.type(AUCTION_DESCRIPTION, description);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void findAuctionsTest(){
+ String searchTerm = "Animals";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(FIND_AUCTIONS_LINK, TIMEOUT);
+ browser.click(FIND_AUCTIONS_LINK);
+ waitForElementPresent(SEARCH_TERM, TIMEOUT);
+ browser.type(SEARCH_TERM, searchTerm);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about finding auction.", x.contains(getProperty("FIND_AUCTIONS_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void updateAuctionTest(){
+ String title = "Animals";
+ String description = "Another description";
+ String categoryId = "5";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(UPDATE_AUCTION_DETAILS_LINK, TIMEOUT);
+ browser.click(UPDATE_AUCTION_DETAILS_LINK);
+ waitForElementPresent(AUCTION_TITLE, TIMEOUT);
+ waitForElementPresent(AUCTION_DESCRIPTION, TIMEOUT);
+ waitForElementPresent(AUCTION_CATEGORY_ID, TIMEOUT);
+ browser.type(AUCTION_TITLE, title);
+ browser.type(AUCTION_DESCRIPTION, description);
+ browser.type(AUCTION_CATEGORY_ID, categoryId);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about updating the auction.", x.contains(getProperty("UPDATE_AUCTION_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void setAuctionDurationTest(){
+ String duration = "20";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(SET_AUCTION_DURATION_LINK, TIMEOUT);
+ browser.click(SET_AUCTION_DURATION_LINK);
+ waitForElementPresent(AUCTION_DURATION, TIMEOUT);
+ browser.type(AUCTION_DURATION, duration);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about setting duration.", x.contains(getProperty("SET_DURATION_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void setStartingPriceTest(){
+ String price = "1000";
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(SET_STARTING_PRICE_LINK, TIMEOUT);
+ browser.click(SET_STARTING_PRICE_LINK);
+ waitForElementPresent(STARTING_PRICE, TIMEOUT);
+ browser.type(STARTING_PRICE, price);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about setting starting price.", x.contains(getProperty("SET_STARTING_PRICE_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void getAuctionDetailsTest(){
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(GET_AUCTION_DETAILS_LINK, TIMEOUT);
+ browser.click(GET_AUCTION_DETAILS_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain auction details.", x.contains(getProperty("AUCTION_DETAILS_PRICE_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest"})
+ public void logOutTest(){
+ loginService();
+ waitForElementPresent(LOGOUT_LINK, TIMEOUT);
+ browser.click(LOGOUT_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain logout confirmation.", x.contains(getProperty("LOGOUT_RESPONSE")));
+ }
+
+ @Test(dependsOnMethods={"loginTest","createNewAuctionTest"})
+ public void confirmAuctionTest(){
+ loginService();
+ createNewAuctionService();
+ waitForElementPresent(CONFIRM_AUCTION_LINK, TIMEOUT);
+ browser.click(CONFIRM_AUCTION_LINK);
+ waitForElementPresent(INVOKE_SERVICE_BUTTON, TIMEOUT);
+ browser.click(INVOKE_SERVICE_BUTTON);
+ waitForElementContent(RESPONSE_AREA, TIMEOUT*5);
+ String x = browser.getValue(RESPONSE_AREA);
+ assertTrue("Response area should contain information about confirmation.", x.contains(getProperty("CONFIRMATION_RESPONSE")));
+ }
+
+ public void waitForElementPresent(final String locator, Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isElementPresent(locator);
+ }
+ }.wait("Timeout while waiting for element "+ locator +" present.", timeout);
+ } //waitForElementPresent
+
+ public void waitForElementContent(final String locator, Long timeout){
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return (browser.getValue(locator).length() != 0);
+ }
+ }.wait("Timeout while waiting for element content."+browser.getValue(locator).length()+","+locator , timeout);
+ } //waitForElementContent
+}
15 years, 4 months
Seam SVN: r11441 - branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium.
by seam-commits@lists.jboss.org
Author: kpiwko(a)redhat.com
Date: 2009-08-28 03:12:16 -0400 (Fri, 28 Aug 2009)
New Revision: 11441
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
Log:
JBPAPP-2705
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-08-28 02:19:41 UTC (rev 11440)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-08-28 07:12:16 UTC (rev 11441)
@@ -34,7 +34,7 @@
SELL_NEXT id=sellForm:next
SELL_CONFIRM id=sellForm:confirm
SELL_CATEGORY_SELECT id=rootCategory
-SELL_CATEGORY_SELECT_SECOND_OPTION xpath=id(\"rootCategory\")/option[2] # availability of second option indicates that category list has been loaded
+SELL_CATEGORY_SELECT_SECOND_OPTION xpath\=id("rootCategory")/option[14] \# availability of second option indicates that category list has been loaded (2)
SELL_SUBCATEGORY_SELECT id\=tier2
SEARCH_FIELD id=search:searchTerm
@@ -53,4 +53,4 @@
BID_HISTORY_COUNT //table[@id='history']/tbody/tr
BID_OUTBID id=outbid
BID_HIGH_BIDDER id\=highBidder
-BID_HISTORY_BACK id\=back
\ No newline at end of file
+BID_HISTORY_BACK id\=back
15 years, 4 months
Seam SVN: r11440 - in branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam: annotations and 2 other directories.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2009-08-27 22:19:41 -0400 (Thu, 27 Aug 2009)
New Revision: 11440
Added:
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java
branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java
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/StatefulKnowledgeSession.java
Log:
Drools5 Integration.
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/AbortProcess.java 2009-08-28 02:19:41 UTC (rev 11440)
@@ -0,0 +1,6 @@
+package org.jboss.seam.annotations.drools;
+
+public @interface AbortProcess
+{
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/SignalEvent.java 2009-08-28 02:19:41 UTC (rev 11440)
@@ -0,0 +1,46 @@
+package org.jboss.seam.annotations.drools;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a method as causing drools process event to be signalled.
+ * You can either enter a specific process instance to be started or
+ * by omitting the process instance id, it uses event correlation
+ * to signal event to all process instance within a StatefulKnowledgeSession
+ * which are listening for the specific event type.
+ *
+ * @author Tihomir Surdilovic
+ */
+@Target( METHOD )
+@Retention( RUNTIME )
+@Documented
+public @interface SignalEvent
+{
+ /**
+ * An EL expression that evaluates to a StatefulKnowledgeSession.
+ * @return an EL expression
+ */
+ String ksession() default "";
+
+ /**
+ * The process instance id to be started.
+ */
+ String processInstanceId() default "";
+
+ /**
+ * The event type.
+ */
+ String eventType() default "";
+
+ /**
+ * An EL expression that evaluates to Event Data.
+ * @return an EL expression
+ */
+ String eventData() default "";
+
+}
Added: branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java
===================================================================
--- branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java (rev 0)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/annotations/drools/StartProcess.java 2009-08-28 02:19:41 UTC (rev 11440)
@@ -0,0 +1,30 @@
+package org.jboss.seam.annotations.drools;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a method as causing drools process to be started.
+ *
+ * @author Tihomir Surdilovic
+ */
+@Target( METHOD )
+@Retention( RUNTIME )
+@Documented
+public @interface StartProcess
+{
+ /**
+ * An EL expression that evaluates to a StatefulKnowledgeSession.
+ * @return an EL expression
+ */
+ String ksession() default "";
+
+ /**
+ * The process id to be started.
+ */
+ String processId() default "";
+}
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-27 20:37:26 UTC (rev 11439)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools/StatefulKnowledgeSession.java 2009-08-28 02:19:41 UTC (rev 11440)
@@ -4,15 +4,18 @@
import java.io.Serializable;
import java.util.Map;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.drools.KnowledgeBaseFactory;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.process.WorkItemHandler;
import org.drools.spi.GlobalResolver;
import org.drools.event.process.ProcessEventListener;
import org.drools.event.rule.AgendaEventListener;
import org.drools.event.rule.WorkingMemoryEventListener;
+import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Scope;
@@ -35,10 +38,14 @@
public class StatefulKnowledgeSession implements Mutable, Serializable
{
private static final LogProvider log = Logging.getLogProvider(org.jboss.seam.drools.StatefulKnowledgeSession.class);
+ private static final Pattern DIVIDER = Pattern.compile(";");
+ private static final int WORKITEMHANDLER_NAME = 0;
+ private static final int WORKITEMHANDLER_TYPE = 1;
private ValueExpression<org.drools.KnowledgeBase> knowledgeBase;
private ValueExpression<org.jboss.seam.drools.FactProvider> factProvider;
private String[] eventListeners;
+ private String[] workItemHandlers;
private String knowledgeSessionConfig;
private String auditLog;
@@ -89,6 +96,19 @@
}
}
+ if(workItemHandlers != null) {
+ for(String nextWorkItemHandler : workItemHandlers) {
+ String[] handlerParts = DIVIDER.split(nextWorkItemHandler.trim());
+ if(handlerParts.length != 2) {
+ log.error("Unable to use workItemHandler definition: " + nextWorkItemHandler);
+ } else {
+ WorkItemHandler handler = (WorkItemHandler) Component.getInstance(handlerParts[WORKITEMHANDLER_TYPE], true);
+ log.info("Registering new WorkItemHandler: " + handlerParts[WORKITEMHANDLER_NAME]);
+ ksession.getWorkItemManager().registerWorkItemHandler(handlerParts[WORKITEMHANDLER_NAME], handler);
+ }
+ }
+ }
+
if(auditLog != null) {
auditLog+=System.currentTimeMillis();
log.info("Setting auding log: " + auditLog);
@@ -188,5 +208,17 @@
public void setAuditLog(String auditLog)
{
this.auditLog = auditLog;
- }
+ }
+
+ public String[] getWorkItemHandlers()
+ {
+ return workItemHandlers;
+ }
+
+ public void setWorkItemHandlers(String[] workItemHandlers)
+ {
+ this.workItemHandlers = workItemHandlers;
+ }
+
+
}
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-27 20:37:26 UTC (rev 11439)
+++ branches/community/Seam_2_2_Drools5/src/main/org/jboss/seam/drools-2.2.xsd 2009-08-28 02:19:41 UTC (rev 11440)
@@ -93,6 +93,8 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element minOccurs="0" maxOccurs="1"
ref="drools:event-listeners" />
+ <xs:element minOccurs="0" maxOccurs="1"
+ ref="drools:work-item-handlers" />
</xs:choice>
<xs:attributeGroup ref="components:attlist.component" />
<xs:attributeGroup ref="drools:attlist.StatefulKnowledgeSession" />
@@ -101,10 +103,12 @@
<xs:attributeGroup name="attlist.StatefulKnowledgeSession">
<xs:attribute name="knowledge-base" type="components:expressionType" />
<xs:attribute name="event-listeners" type="components:string" />
+ <xs:attribute name="work-item-handlers" type="components:string"/>
<xs:attribute name="knowledge-session-config" type="components:string" />
<xs:attribute name="fact-provider" type="components:expressionType"/>
<xs:attribute name="audit-log" type="components:string"/>
</xs:attributeGroup>
+ <xs:element name="work-item-handlers" type="components:multiValuedProperty" />
<xs:element name="stateless-knowledge-session">
<xs:annotation>
15 years, 4 months
Seam SVN: r11439 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-27 16:37:26 -0400 (Thu, 27 Aug 2009)
New Revision: 11439
Modified:
branches/enterprise/JBPAPP_5_0/build/core.pom.xml
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
Log:
JBPAPP-2658
Modified: branches/enterprise/JBPAPP_5_0/build/core.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2009-08-27 20:27:27 UTC (rev 11438)
+++ branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2009-08-27 20:37:26 UTC (rev 11439)
@@ -93,7 +93,7 @@
</dependency>
<dependency>
- <groupId>javax.jws</groupId>
+ <groupId>sun-jaxws</groupId>
<artifactId>jsr181-api</artifactId>
<scope>provided</scope>
<optional>true</optional>
@@ -135,7 +135,7 @@
</dependency>
<dependency>
- <groupId>javax.annotation</groupId>
+ <groupId>sun-jaxws</groupId>
<artifactId>jsr250-api</artifactId>
<optional>true</optional>
<scope>provided</scope>
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-27 20:27:27 UTC (rev 11438)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2009-08-27 20:37:26 UTC (rev 11439)
@@ -569,15 +569,9 @@
</dependency>
<dependency>
- <groupId>javax.jws</groupId>
- <artifactId>jsr181-api</artifactId>
- <version>1.0-MR1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>sun-jaxws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>2.1.3</version>
</dependency>
<dependency>
@@ -593,9 +587,9 @@
</dependency>
<dependency>
- <groupId>javax.annotation</groupId>
+ <groupId>sun-jaxws</groupId>
<artifactId>jsr250-api</artifactId>
- <version>1.0</version>
+ <version>2.1.3</version>
</dependency>
<dependency>
15 years, 4 months
Seam SVN: r11438 - branches/enterprise/JBPAPP_5_0/examples/ui/view.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-08-27 16:27:27 -0400 (Thu, 27 Aug 2009)
New Revision: 11438
Modified:
branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidator.xhtml
branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidatorWConvert.xhtml
branches/enterprise/JBPAPP_5_0/examples/ui/view/template.xhtml
Log:
JBPAPP-2694
Modified: branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidator.xhtml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidator.xhtml 2009-08-27 12:35:44 UTC (rev 11437)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidator.xhtml 2009-08-27 20:27:27 UTC (rev 11438)
@@ -5,31 +5,31 @@
<ui:define name="body">
<h:form>
<p>Validates that two java.lang.String inputs are equal (may be empty)</p>
- <h:panelGrid columns="3">
+ <h:panelGrid columns="2">
<s:label for="name">Name</s:label>
<h:inputText id="name" value="#{equalityValidatorBean.name}" />
- <h:message for="name" />
+<!-- <h:message for="name" />-->
<s:label for="nameVerification">Name Verification</s:label>
<h:inputText id="nameVerification">
<s:validateEquality for="name" message="Must be the same as name!" required="false" />
</h:inputText>
- <h:message for="nameVerification" />
+<!-- <h:message for="nameVerification" />-->
<h:commandButton action="#{equalityValidatorBean.check}" value="Check name" />
</h:panelGrid>
</h:form>
<h:form>
<p>Validates that one number is greater than another</p>
- <h:panelGrid columns="3">
+ <h:panelGrid columns="2">
<s:label for="min">Minimum age (e.g. 18)</s:label>
<h:inputText id="min" value="#{equalityValidatorBean.age}" />
- <h:message for="min" />
+<!-- <h:message for="min" />-->
<s:label for="minVerification">Maximum age (e.g. 25)</s:label>
<h:inputText id="minVerification">
<f:convertNumber integerOnly="true" />
<s:validateEquality for="min" message="Must be larger than minimum!" operator="greater" />
</h:inputText>
- <h:message for="minVerification" />
+<!-- <h:message for="minVerification" />-->
<h:commandButton action="#{equalityValidatorBean.check}" value="Check ages" />
</h:panelGrid>
</h:form>
Modified: branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidatorWConvert.xhtml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidatorWConvert.xhtml 2009-08-27 12:35:44 UTC (rev 11437)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/view/equalityValidatorWConvert.xhtml 2009-08-27 20:27:27 UTC (rev 11438)
@@ -9,18 +9,18 @@
<ui:define name="body">
<p>Validates that two java.util.Date inputs are equal</p>
<h:form>
- <h:panelGrid columns="3">
+ <h:panelGrid columns="2">
<s:label for="date">Date (yyyy-MM-dd)</s:label>
<h:inputText id="date" value="#{equalityValidatorBean.date}">
<f:convertDateTime pattern="yyyy-MM-dd" />
</h:inputText>
- <h:message for="date" />
+<!-- <h:message for="date" />-->
<s:label for="dateVerification">Date Verification (yyyy-MM-dd)</s:label>
<h:inputText id="dateVerification">
<f:convertDateTime pattern="yyyy-MM-dd" />
<s:validateEquality for="date" />
</h:inputText>
- <h:message for="dateVerification" />
+<!-- <h:message for="dateVerification" />-->
<h:commandButton action="#{equalityValidatorBean.checkDate}"
value="Check date" />
</h:panelGrid>
Modified: branches/enterprise/JBPAPP_5_0/examples/ui/view/template.xhtml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/view/template.xhtml 2009-08-27 12:35:44 UTC (rev 11437)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/view/template.xhtml 2009-08-27 20:27:27 UTC (rev 11438)
@@ -121,7 +121,7 @@
<s:div styleClass="content">
<h1><code><h:outputText value="#{tagName}" /></code></h1>
<ui:insert name="body" />
-<!-- <h:messages /> -->
+ <h:messages />
</s:div>
</body>
15 years, 4 months