Seam SVN: r9961 - trunk/examples.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-20 14:47:43 -0500 (Tue, 20 Jan 2009)
New Revision: 9961
Modified:
trunk/examples/build.xml
Log:
JBSEAM-3702
Modified: trunk/examples/build.xml
===================================================================
--- trunk/examples/build.xml 2009-01-20 19:35:15 UTC (rev 9960)
+++ trunk/examples/build.xml 2009-01-20 19:47:43 UTC (rev 9961)
@@ -459,6 +459,7 @@
<fileset id="ear.resources" dir="${resources.dir}">
<include name="META-INF/application.xml" />
<include name="META-INF/jboss-app.xml" />
+ <include name="META-INF/jboss-structure.xml" />
<include name="META-INF/*-service.xml" />
<include name="META-INF/*-xmbean.xml" />
<include name="treecache.xml" />
15 years, 10 months
Seam SVN: r9960 - trunk/src/main/org/jboss/seam/util.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-20 14:35:15 -0500 (Tue, 20 Jan 2009)
New Revision: 9960
Modified:
trunk/src/main/org/jboss/seam/util/Base64.java
Log:
JBSEAM-3813
Modified: trunk/src/main/org/jboss/seam/util/Base64.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/Base64.java 2009-01-20 19:14:02 UTC (rev 9959)
+++ trunk/src/main/org/jboss/seam/util/Base64.java 2009-01-20 19:35:15 UTC (rev 9960)
@@ -856,10 +856,10 @@
return 3;
}catch( Exception e){
- System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
- System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
- System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
- System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
+// System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
+// System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
+// System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
+// System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
return -1;
} // end catch
}
15 years, 10 months
Seam SVN: r9959 - trunk/src/main/org/jboss/seam/exception.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-20 14:14:02 -0500 (Tue, 20 Jan 2009)
New Revision: 9959
Modified:
trunk/src/main/org/jboss/seam/exception/Exceptions.java
Log:
JBSEAM-3845
Modified: trunk/src/main/org/jboss/seam/exception/Exceptions.java
===================================================================
--- trunk/src/main/org/jboss/seam/exception/Exceptions.java 2009-01-20 17:46:51 UTC (rev 9958)
+++ trunk/src/main/org/jboss/seam/exception/Exceptions.java 2009-01-20 19:14:02 UTC (rev 9959)
@@ -198,8 +198,11 @@
try {
handler = createHandler(exception,
Reflections.classForName(className));
- handler.setLogEnabled(logEnabled);
- handler.setLogLevel(logLevel);
+
+ if (handler != null) {
+ handler.setLogEnabled(logEnabled);
+ handler.setLogLevel(logLevel);
+ }
} catch (ClassNotFoundException e) {
log.error("Can't find exception class for exception handler", e);
}
15 years, 10 months
Seam SVN: r9958 - trunk/src/pdf/org/jboss/seam/pdf/ui.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-20 12:46:51 -0500 (Tue, 20 Jan 2009)
New Revision: 9958
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java
Log:
JBSEAM-3673
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java 2009-01-20 11:07:32 UTC (rev 9957)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java 2009-01-20 17:46:51 UTC (rev 9958)
@@ -146,6 +146,7 @@
@Override
public void createITextObject(FacesContext context) {
+ hasContent = false;
PdfPCell defaultCell = getDefaultCellFromTable();
if (defaultCell != null) {
cell = new PdfPCell(defaultCell);
@@ -157,9 +158,9 @@
"horizontalAlignment", horizontalAlignment);
if (horizontalAlignment != null) {
cell.setHorizontalAlignment(ITextUtils
- .alignmentValue(horizontalAlignment));
+ .alignmentValue(horizontalAlignment));
}
-
+
verticalAlignment = (String) valueBinding(context, "verticalAlignment",
verticalAlignment);
if (verticalAlignment != null) {
15 years, 10 months
Seam SVN: r9957 - in trunk: src/test/ftest and 10 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-01-20 06:07:32 -0500 (Tue, 20 Jan 2009)
New Revision: 9957
Added:
trunk/src/test/ftest/examples/seambay/
trunk/src/test/ftest/examples/seambay/build.xml
trunk/src/test/ftest/examples/seambay/jboss-embedded.xml
trunk/src/test/ftest/examples/seambay/jboss.xml
trunk/src/test/ftest/examples/seambay/src/
trunk/src/test/ftest/examples/seambay/src/org/
trunk/src/test/ftest/examples/seambay/src/org/jboss/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/RegistrationTest.java
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SearchTest.java
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java
trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
Modified:
trunk/examples/seambay/view/auction.xhtml
trunk/examples/seambay/view/bid.xhtml
trunk/examples/seambay/view/bidhistory.xhtml
trunk/examples/seambay/view/header.xhtml
trunk/examples/seambay/view/home.xhtml
trunk/examples/seambay/view/login.xhtml
trunk/examples/seambay/view/preview.xhtml
trunk/examples/seambay/view/register.xhtml
trunk/examples/seambay/view/sell.xhtml
trunk/examples/seambay/view/sell2.js
trunk/examples/seambay/view/sell2.xhtml
trunk/examples/seambay/view/sell3.xhtml
trunk/examples/seambay/view/sell4.xhtml
trunk/examples/seambay/view/sell5.xhtml
trunk/src/test/ftest/build.xml
Log:
JBSEAM-3690 Added tests for seambay example
Modified: trunk/examples/seambay/view/auction.xhtml
===================================================================
--- trunk/examples/seambay/view/auction.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/auction.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -88,7 +88,7 @@
<div class="itemDetails">
<div class="itemDetailRow">
- <h:form>
+ <h:form id="bid">
<label>
<s:fragment rendered="#{auction.highBid ne null}">
Current bid:
@@ -133,7 +133,7 @@
<label>History:</label>
<div>
- <h:outputLink value="#{facesContext.externalContext.requestContextPath}/bidhistory/#{auction.auctionId}">
+ <h:outputLink id="bidHistory" value="#{facesContext.externalContext.requestContextPath}/bidhistory/#{auction.auctionId}">
#{auction.bids} bids
</h:outputLink>
@@ -143,7 +143,7 @@
<div class="itemDetailRow">
<label>High bidder:</label>
<div>
- <span>#{auction.highBid.account.name}</span>
+ <span id="highBidder">#{auction.highBid.account.name}</span>
<h:outputText value="No bids" rendered="#{auction.highBid eq null}"/>
</div>
</div>
@@ -225,7 +225,7 @@
<b>Place a bid</b>
<hr class="blueLine"/>
- <h:form>
+ <h:form id="newBid">
<div class="bidRow">
<s:fragment rendered="#{auction.highBid ne null}">
Modified: trunk/examples/seambay/view/bid.xhtml
===================================================================
--- trunk/examples/seambay/view/bid.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/bid.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -56,7 +56,7 @@
</div>
</s:div>
- <s:div rendered="#{bidAction.outcome == 'outbid'}" styleClass="subSection">
+ <s:div id="outbid" rendered="#{bidAction.outcome == 'outbid'}" styleClass="subSection">
<div class="outbidImage"/>
<div class="alertContent">
<b>Your bid has been submitted</b>
@@ -132,7 +132,7 @@
</div>
</s:div>
- <h:form rendered="#{bidAction.outcome == 'invalid' or bidAction.outcome == 'required'}">
+ <h:form id="newBid" rendered="#{bidAction.outcome == 'invalid' or bidAction.outcome == 'required'}">
<div class="maximumBidRow">
<label>Your maximum bid:</label>
<div>
@@ -144,13 +144,13 @@
</div>
<div class="placeBid">
- <h:commandButton action="#{bidAction.updateBid}" value="Continue >"/>
+ <h:commandButton id="placeBidWithAmount" action="#{bidAction.updateBid}" value="Continue >"/>
</div>
</h:form>
</div>
- <h:form rendered="#{bidAction.outcome == 'outbid'}">
+ <h:form id="increaseBid" rendered="#{bidAction.outcome == 'outbid'}">
<div class="increaseBid" >
<label>Increase your maximum bid:</label>
<div>
@@ -160,14 +160,14 @@
</h:outputText> <b>or more</b>)</span>
</div>
</div>
- <h:commandButton styleClass="bidAgain" action="#{bidAction.updateBid}" value="Bid Again >"/>
+ <h:commandButton id="bidAgain" styleClass="bidAgain" action="#{bidAction.updateBid}" value="Bid Again >"/>
</h:form>
- <h:form rendered="#{bidAction.outcome == 'confirm'}">
+ <h:form id="confirm" rendered="#{bidAction.outcome == 'confirm'}">
<div class="confirmBid">
<b>By clicking on the button below, you agree to buy this item if you're the
winning bidder.</b><br/>
- <h:commandButton styleClass="placeBid" action="#{bidAction.confirmBid}" value="Confirm Bid"/>
+ <h:commandButton id="confirmBid" styleClass="placeBid" action="#{bidAction.confirmBid}" value="Confirm Bid"/>
</div>
</h:form>
Modified: trunk/examples/seambay/view/bidhistory.xhtml
===================================================================
--- trunk/examples/seambay/view/bidhistory.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/bidhistory.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -22,7 +22,7 @@
<h:outputLink value="#{facesContext.externalContext.requestContextPath}/itemdetail/#{auction.auctionId}">
<img src="#{facesContext.externalContext.requestContextPath}/img/arrow_left.png" border="0"/>
</h:outputLink>
- <h:outputLink value="#{facesContext.externalContext.requestContextPath}/itemdetail/#{auction.auctionId}">
+ <h:outputLink id="back" value="#{facesContext.externalContext.requestContextPath}/itemdetail/#{auction.auctionId}">
Back to auction details
</h:outputLink>
</div>
Modified: trunk/examples/seambay/view/header.xhtml
===================================================================
--- trunk/examples/seambay/view/header.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/header.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -15,18 +15,18 @@
</div>
<div class="header_search">
- <h:form>
+ <h:form id="search">
<h:inputText id="searchTerm" value="#{auctionSearch.searchTerm}"/>
- <h:commandButton action="#{auctionSearch.queryAllAuctions}" value="Search"/>
+ <h:commandButton id="submit" action="#{auctionSearch.queryAllAuctions}" value="Search"/>
</h:form>
</div>
</div>
<div class="header_tools_bottom">
<div>
- <s:link view="/buy.xhtml" value="Buy" styleClass="header_action" propagation="none"
- /><s:link view="/sell.xhtml" value="Sell" styleClass="header_action" propagation="none"
- /><s:link view="/help.xhtml" value="Help" styleClass="header_action" propagation="none"/>
+ <s:link id="buy" view="/buy.xhtml" value="Buy" styleClass="header_action" propagation="none"
+ /><s:link id="sell" view="/sell.xhtml" value="Sell" styleClass="header_action" propagation="none"
+ /><s:link id="help" view="/help.xhtml" value="Help" styleClass="header_action" propagation="none"/>
</div>
</div>
@@ -34,14 +34,14 @@
<s:fragment rendered="#{not identity.loggedIn}">
<span>Hello! </span>
- <s:link view="/login.seam" value="Sign in" propagation="none"/>
+ <s:link id="login" view="/login.seam" value="Sign in" propagation="none"/>
<span> or </span>
- <s:link view="/register.seam" value="register" propagation="none"/>.
+ <s:link id="register" view="/register.seam" value="register" propagation="none"/>.
</s:fragment>
<s:fragment rendered="#{identity.loggedIn}">
Hello, #{authenticatedAccount.name}.
- <span>(</span><s:link action="#{identity.logout}" propagation="none" value="Sign out"/><span>)</span>
+ <span>(</span><s:link id="logout" action="#{identity.logout}" propagation="none" value="Sign out"/><span>)</span>
</s:fragment>
</ui:composition>
Modified: trunk/examples/seambay/view/home.xhtml
===================================================================
--- trunk/examples/seambay/view/home.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/home.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -23,8 +23,8 @@
Categories
</div>
- <ui:repeat value="#{categories}" var="cat">
- <s:link view="/search.xhtml" action="#{auctionSearch.queryAuctions}" value="#{cat.name}" propagation="none">
+ <ui:repeat id="categories" value="#{categories}" var="cat">
+ <s:link id="link" view="/search.xhtml" action="#{auctionSearch.queryAuctions}" value="#{cat.name}" propagation="none">
<f:param name="categoryId" value="#{cat.categoryId}"/>
</s:link>
</ui:repeat>
Modified: trunk/examples/seambay/view/login.xhtml
===================================================================
--- trunk/examples/seambay/view/login.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/login.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -67,7 +67,7 @@
<b>*tip*</b> you can log in using <i>demo/demo</i>.
</p>
- <h:form>
+ <h:form id="login">
<p>
<b>seamBay User ID</b><br/>
<h:inputText id="username" value="#{identity.username}"/>
@@ -78,7 +78,7 @@
<h:inputSecret id="password" value="#{identity.password}"/>
</p>
- <h:commandButton action="#{identity.login}" value="Sign In > "/>
+ <h:commandButton id="submit" action="#{identity.login}" value="Sign In > "/>
<p>
<h:selectBooleanCheckbox id="rememberMe" value="#{identity.rememberMe}"/>
Modified: trunk/examples/seambay/view/preview.xhtml
===================================================================
--- trunk/examples/seambay/view/preview.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/preview.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -75,7 +75,7 @@
Starting price:
</label>
<div>
- $<b><h:outputText value="#{auctionAction.auction.currentPrice}">
+ $<b><h:outputText id="price" value="#{auctionAction.auction.currentPrice}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2"/>
</h:outputText></b>
</div>
@@ -87,7 +87,7 @@
<label>End time:</label>
<div>
<b>
- <h:outputText value="#{auctionAction.auction.endDate}">
+ <h:outputText id="endDate" value="#{auctionAction.auction.endDate}">
<f:convertDateTime pattern="dd-MMM-yyyy H:mm:ss"/>
</h:outputText>
</b>
@@ -168,7 +168,7 @@
Description
</div>
- <div class="descriptionContent">
+ <div id="description" class="descriptionContent">
<s:formattedText value="#{auctionAction.auction.description}" />
<hr/>
@@ -182,7 +182,7 @@
</div>
</div>
- <h:form>
+ <h:form id="sellForm">
<div class="navBar">
<div class="navBarLeft">
@@ -190,7 +190,7 @@
</div>
<div class="navBarRight">
- <h:commandButton action="#{auctionAction.confirm}" value="Confirm Listing"/>
+ <h:commandButton id="confirm" action="#{auctionAction.confirm}" value="Confirm Listing"/>
</div>
<br class="clear"/>
Modified: trunk/examples/seambay/view/register.xhtml
===================================================================
--- trunk/examples/seambay/view/register.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/register.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -42,32 +42,32 @@
Fill in the following details to register.
</div>
- <h:form>
+ <h:form id="registration">
<p>
<b>seamBay User ID</b><br/>
<h:inputText id="username" value="#{newuser.username}"/>
- <div class="validationError"><h:message for="username"/></div>
+ <div class="validationError"><h:message id="usernameMessage" for="username"/></div>
</p>
<p>
<b>Password</b><br/>
<h:inputSecret id="password" value="#{newuser.password}"/>
- <div class="validationError"><h:message for="password"/></div>
+ <div class="validationError"><h:message id="passwordMessage" for="password"/></div>
</p>
<p>
<b>Confirm Password</b><br/>
<h:inputSecret id="confirm" value="#{registerAction.confirm}"/>
- <div class="validationError"><h:message for="confirm"/></div>
+ <div class="validationError"><h:message id="confirmMessage" for="confirm"/></div>
</p>
<p>
<b>Location</b><br/>
<h:inputText id="location" class="location" value="#{newuser.account.location}"/>
- <div class="validationError"><h:message for="location"/></div>
+ <div class="validationError"><h:message id="locationMessage" for="location"/></div>
</p>
- <h:commandButton value="Register >" action="#{registerAction.register}"/>
+ <h:commandButton id="submit" value="Register >" action="#{registerAction.register}"/>
</h:form>
Modified: trunk/examples/seambay/view/sell.xhtml
===================================================================
--- trunk/examples/seambay/view/sell.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -28,7 +28,7 @@
Enter the details below then click next
</div>
- <h:form>
+ <h:form id="sellForm">
<s:validateAll>
<div class="formRow">
@@ -40,7 +40,7 @@
<div class="navBar">
<div class="navBarRight">
- <h:commandButton action="next" value="Next >"/>
+ <h:commandButton id="next" action="next" value="Next >"/>
</div>
<br class="clear"/>
</div>
Modified: trunk/examples/seambay/view/sell2.js
===================================================================
--- trunk/examples/seambay/view/sell2.js 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell2.js 2009-01-20 11:07:32 UTC (rev 9957)
@@ -26,7 +26,7 @@
}
}
- var catId = document.getElementById("catSelection:categoryId").value;
+ var catId = document.getElementById("sellForm:categoryId").value;
// If the category ID is valid, select it
if ((typeof(catId) == "number" || !isNaN(parseInt(catId))))
@@ -139,7 +139,7 @@
{
var opt = getSelectedOption(ctl);
- var ctl = document.getElementById("catSelection:categoryId");
+ var ctl = document.getElementById("sellForm:categoryId");
var previous = findCategory(ctl.value);
ctl.value = opt.value;
Modified: trunk/examples/seambay/view/sell2.xhtml
===================================================================
--- trunk/examples/seambay/view/sell2.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell2.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -28,7 +28,7 @@
Select the category that most closely matches the item you're selling
</div>
- <h:form id="catSelection">
+ <h:form id="sellForm">
<div id="container" class="category">
<div>
@@ -46,7 +46,7 @@
</div>
<div class="navBarRight">
- <h:commandButton value="Next >" action="next"/>
+ <h:commandButton id="next" value="Next >" action="next"/>
</div>
<br class="clear"/>
Modified: trunk/examples/seambay/view/sell3.xhtml
===================================================================
--- trunk/examples/seambay/view/sell3.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell3.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -28,7 +28,7 @@
Set the running time for your auction, and the starting price
</div>
- <h:form>
+ <h:form id="sellForm">
<s:validateAll>
<div class="formRow">
@@ -53,7 +53,7 @@
</div>
<div class="navBarRight">
- <h:commandButton value="Next >" action="next"/>
+ <h:commandButton id="next" value="Next >" action="next"/>
</div>
<br class="clear"/>
Modified: trunk/examples/seambay/view/sell4.xhtml
===================================================================
--- trunk/examples/seambay/view/sell4.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell4.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -59,7 +59,7 @@
<hr class="thinLine"/>
</ui:repeat>
- <h:form>
+ <h:form id="sellForm">
<div class="navBar">
<div class="navBarLeft">
@@ -67,7 +67,7 @@
</div>
<div class="navBarRight">
- <h:commandButton value="Next >" action="next"/>
+ <h:commandButton id="next" value="Next >" action="next"/>
</div>
<br class="clear"/>
Modified: trunk/examples/seambay/view/sell5.xhtml
===================================================================
--- trunk/examples/seambay/view/sell5.xhtml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/examples/seambay/view/sell5.xhtml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -28,7 +28,7 @@
Enter a detailed description of the item you wish to sell
</div>
- <h:form>
+ <h:form id="sellForm">
<div class="formRow">
<h:inputTextarea id="description" value="#{auctionAction.auction.description}" styleClass="description"/>
@@ -41,7 +41,7 @@
</div>
<div class="navBarRight">
- <h:commandButton value="Next >" action="next"/>
+ <h:commandButton id="next" value="Next >" action="next"/>
</div>
<br class="clear"/>
Modified: trunk/src/test/ftest/build.xml
===================================================================
--- trunk/src/test/ftest/build.xml 2009-01-20 09:53:13 UTC (rev 9956)
+++ trunk/src/test/ftest/build.xml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -64,6 +64,7 @@
<testexample name="numberguess" />
<testexample name="quartz" />
<testexample name="registration" />
+ <testexample name="seambay" />
<testexample name="seampay" />
<testexample name="spring" />
<testexample name="wicket" />
@@ -79,6 +80,7 @@
<testexample name="messages" />
<testexample name="numberguess" />
<testexample name="registration" />
+ <testexample name="seambay" />
<testexample name="seampay" />
<testexample name="booking" />
<testexample name="jpa" />
@@ -140,6 +142,7 @@
<cleanexample name="numberguess" />
<cleanexample name="quartz" />
<cleanexample name="registration" />
+ <cleanexample name="seambay" />
<cleanexample name="seampay" />
<cleanexample name="spring" />
<cleanexample name="wicket" />
@@ -160,6 +163,7 @@
<undeployexample name="numberguess" />
<undeployexample name="quartz" />
<undeployexample name="registration" />
+ <undeployexample name="seambay" />
<undeployexample name="seampay" />
<undeployexample name="spring" />
<undeployexample name="wicket" />
Added: trunk/src/test/ftest/examples/seambay/build.xml
===================================================================
--- trunk/src/test/ftest/examples/seambay/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/seambay/build.xml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="seambay.ftest.build" basedir="." default="build">
+ <property name="example.name" value="seambay"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url" value="seam-bay/home.seam"/>
+ <property name="jboss-embedded.deploy.target" value="tomcat.deploy"/>
+ <property name="jboss-embedded.undeploy.target" value="tomcat.undeploy"/>
+ <property name="jboss-embedded.example.ready.check.url" value="jboss-seam-bay/home.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/seambay/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/jboss-embedded.xml
===================================================================
--- trunk/src/test/ftest/examples/seambay/jboss-embedded.xml (rev 0)
+++ trunk/src/test/ftest/examples/seambay/jboss-embedded.xml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,34 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Seambay example" verbose="2" parallel="false">
+ <test name="seambay_jboss-embedded">
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/seambay/test/selenium/seambay.properties" />
+ <parameter name="CONTEXT_PATH" value="/jboss-seam-bay" />
+ <classes>
+ <class name="org.jboss.seam.example.seambay.test.selenium.RegistrationTest" />
+ <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" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/seambay/jboss-embedded.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/seambay/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/seambay/jboss.xml 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,34 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Seambay example" verbose="2" parallel="false">
+ <test name="seambay_jboss">
+ <parameter name="PROPERTY_FILE" value="/org/jboss/seam/example/seambay/test/selenium/seambay.properties" />
+ <parameter name="CONTEXT_PATH" value="/seam-bay" />
+ <classes>
+ <class name="org.jboss.seam.example.seambay.test.selenium.RegistrationTest" />
+ <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" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/seambay/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,123 @@
+/*
+ * 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 static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.fail;
+
+import org.jboss.seam.example.common.test.selenium.SeamSelenium;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class BidTest extends SeleniumSeamBayTest
+{
+ @Test(dependsOnGroups = { "searchTest"})
+ public void simpleBidTest()
+ {
+ String title = "Lost Tales Volume 1 by J.R.R. Tolkien";
+ String price = "10";
+ int bidCount;
+
+ login();
+ search(title);
+ browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
+ browser.clickAndWait(getProperty("ITEM_BID_HISTORY"));
+ bidCount = browser.getXpathCount(getProperty("BID_HISTORY_COUNT")).intValue();
+ browser.goBackAndWait();
+ placeBid(price);
+ assertTrue("Auction page expected.", browser.getLocation().contains(getProperty("AUCTION_URL")));
+ browser.clickAndWait(getProperty("ITEM_BID_HISTORY"));
+ assertEquals("Unexpected count of bids.", ++bidCount, browser.getXpathCount(getProperty("BID_HISTORY_COUNT")));
+ }
+
+ @Test(dependsOnGroups = { "searchTest", "registrationTest" }, dependsOnMethods = { "simpleBidTest" })
+ public void complexBidTest()
+ {
+ String firstBidderName = "honestjoe";
+ String secondBidderName = "bidTester";
+ String title = "Nikon D80 Digital Camera";
+
+ SeamSelenium firstBrowser = browser;
+ SeamSelenium secondBrowser = startBrowser();
+ try
+ {
+ // register new user in first browser
+ browser.clickAndWait(getProperty("REGISTRATION"));
+ submitRegistrationForm(secondBidderName, "password", "password", "Slovakia");
+ assertTrue("Creating new user failed.", isLoggedIn());
+ // place a bid for a camera
+ search(title);
+ browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
+ placeBid("2000");
+ // switch to second browser and place several bids
+ browser = secondBrowser;
+ browser.open(CONTEXT_PATH + getProperty("HOME_PAGE"));
+ login();
+ search(title);
+ browser.clickAndWait(getProperty("SEARCH_RESULTS_FIRST_ROW_LINK"));
+ for (int i = 1100; i < 2000; i += 200)
+ {
+ placeBid(String.valueOf(i));
+ assertTrue("'You have been outbid' page expected.", browser.isElementPresent(getProperty("BID_OUTBID")));
+ }
+ placeBid("2200");
+ assertFalse("Outbid unexpectedly", browser.isElementPresent(getProperty("BID_OUTBID")));
+ assertEquals("High bidder not recognized.", firstBidderName, browser.getText(getProperty("BID_HIGH_BIDDER")));
+ // switch to first browser again and place the highest bid again
+ browser = firstBrowser;
+ placeBid("2100");
+ assertTrue("'You have been outbid' page expected.", browser.isElementPresent(getProperty("BID_OUTBID")));
+ placeBid("2500");
+ assertEquals("High bidder not recognized.", secondBidderName, browser.getText(getProperty("BID_HIGH_BIDDER")));
+ }
+ finally
+ {
+ browser = firstBrowser;
+ secondBrowser.stop();
+ }
+ }
+
+ public void placeBid(String price)
+ {
+ if (browser.isElementPresent(getProperty("ITEM_NEW_BID_FIELD")))
+ {
+ browser.type(getProperty("ITEM_NEW_BID_FIELD"), price);
+ browser.clickAndWait(getProperty("ITEM_NEW_BID_SUBMIT"));
+ }
+ else if (browser.isElementPresent(getProperty("BID_INCREASE_FIELD")))
+ {
+ browser.type(getProperty("BID_INCREASE_FIELD"), price);
+ browser.clickAndWait(getProperty("BID_INCREASE_SUBMIT"));
+ }
+ else
+ {
+ fail("Unable to place a bid.");
+ }
+ browser.clickAndWait(getProperty("BID_CONFIRM"));
+ }
+}
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/BidTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/RegistrationTest.java
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/RegistrationTest.java (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/RegistrationTest.java 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,68 @@
+/*
+ * 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 static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class RegistrationTest extends SeleniumSeamBayTest
+{
+
+ @Override
+ @BeforeMethod
+ public void setUp() {
+ super.setUp();
+ browser.clickAndWait(getProperty("REGISTRATION"));
+ }
+
+ @Test(groups="registrationTest")
+ public void testRegistration() {
+ submitRegistrationForm("tester", "password", "password", "location");
+ assertTrue("Registration failed.", isLoggedIn());
+ }
+
+ /**
+ * This test verifies that application will not crash after submitting empty registration form
+ */
+ @Test
+ public void testEmptyRegistration() {
+ submitRegistrationForm("", "", "", "");
+ assertFalse("Registration resulted in debug page.", browser.getLocation().contains(getProperty("DEBUG_PAGE")));
+ }
+
+ @Test
+ public void testPasswordConfirmation() {
+ submitRegistrationForm("tester1", "password", "differentPassword", "location");
+ assertTrue("Registration page expected.",
+ browser.getLocation().contains(getProperty("REGISTRATION_PAGE")));
+ assertTrue("Error message not displayed.", browser.isElementPresent(getProperty("REGISTRATION_CONFIRM_MESSAGE")));
+ }
+
+}
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/RegistrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SearchTest.java
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SearchTest.java (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SearchTest.java 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,39 @@
+/*
+ * 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.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertEquals;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class SearchTest extends SeleniumSeamBayTest
+{
+ @Test(groups={"searchTest"})
+ public void searchTest() {
+ String title = "Pontiac Firebird Trans Am T-top";
+ assertEquals("Unexpected number of search results.", 1, search(title));
+ }
+}
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SearchTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,95 @@
+/*
+ * 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 static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.fail;
+
+/**
+ * Main class for SeamBay example tests
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class SeleniumSeamBayTest extends SeamSeleniumTest
+{
+
+ protected String defaultLogin = "demo";
+ protected String defaultPassword = "demo";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + getProperty("HOME_PAGE"));
+ browser.waitForPageToLoad(TIMEOUT);
+ }
+
+ public void login(String username, String password)
+ {
+ if (isLoggedIn())
+ {
+ fail("User already logged in.");
+ }
+ browser.clickAndWait(getProperty("LOGIN"));
+ submitLoginForm(username, password);
+ }
+
+ public void login()
+ {
+ login(defaultLogin, defaultPassword);
+ }
+
+ public boolean isLoggedIn()
+ {
+ return browser.isElementPresent(getProperty("LOGOUT"));
+ }
+
+ public void submitRegistrationForm(String username, String password, String verify, String location)
+ {
+ assertTrue("Registration page expected.", browser.getLocation().contains(getProperty("REGISTRATION_URL")));
+ browser.type(getProperty("REGISTRATION_USERNAME"), username);
+ browser.type(getProperty("REGISTRATION_PASSWORD"), password);
+ browser.type(getProperty("REGISTRATION_VERIFY"), verify);
+ browser.type(getProperty("REGISTRATION_LOCATION"), location);
+ browser.clickAndWait(getProperty("REGISTRATION_SUBMIT"));
+ }
+
+ public void submitLoginForm(String username, String password)
+ {
+ browser.type(getProperty("LOGIN_USERNAME"), username);
+ browser.type(getProperty("LOGIN_PASSWORD"), password);
+ browser.clickAndWait(getProperty("LOGIN_SUBMIT"));
+ }
+
+ public int search(String keyword)
+ {
+ browser.type(getProperty("SEARCH_FIELD"), keyword);
+ browser.clickAndWait(getProperty("SEARCH_SUBMIT"));
+ return browser.getXpathCount(getProperty("SEARCH_RESULTS_COUNT")).intValue();
+ }
+
+}
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SeleniumSeamBayTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java 2009-01-20 11:07:32 UTC (rev 9957)
@@ -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.seambay.test.selenium;
+
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class SellTest extends SeleniumSeamBayTest
+{
+ @Test(dependsOnGroups={"searchTest"})
+ public void joystickSellingTest()
+ {
+ String title = "Saitek X52 Pro Flight System";
+ int category = 7;
+ int subcategory = 3;
+ String duration = "7";
+ String price = "100";
+ String description = "The most fully integrated Stick and throttle flight controller: built to meet the demands of the best virtual pilots in the world!";
+
+ sellItem(title, category, subcategory, duration, price, description);
+ }
+
+ protected void sellItem(String title, int category, int subcategory, String duration, String price, String description)
+ {
+ login();
+ browser.clickAndWait(getProperty("SELL"));
+ submitSell1Page(title);
+ submitSell2Page(category, subcategory);
+ submitSell3Page(duration, price);
+ submitSell4Page();
+ submitSell5Page(description);
+ validatePreview(price, description);
+ browser.clickAndWait(getProperty("SELL_CONFIRM"));
+ assertTrue("Navigation failure, home page expected", browser.getLocation().contains(getProperty("HOME_PAGE")));
+ assertEquals("Unexpected number of search results.", 1, search(title));
+ }
+
+ protected void submitSell1Page(String title) {
+ assertTrue("Navigation failure, sell1 page expected", browser.getLocation().contains(getProperty("SELL_1_URL")));
+ browser.type(getProperty("SELL_TITLE"), title);
+ browser.clickAndWait(getProperty("SELL_NEXT"));
+ }
+
+ protected void submitSell2Page(int category, int subcategory) {
+ assertTrue("Navigation failure, sell2 page expected", browser.getLocation().contains(getProperty("SELL_2_URL")));
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isElementPresent(getProperty("SELL_CATEGORY_SELECT"));
+ }
+ };
+ browser.select(getProperty("SELL_CATEGORY_SELECT"), "index=" + category);
+ if (subcategory != 0)
+ {
+ new Wait()
+ {
+ @Override
+ public boolean until()
+ {
+ return browser.isElementPresent(getProperty("SELL_SUBCATEGORY_SELECT"));
+ }
+ };
+ browser.select(getProperty("SELL_SUBCATEGORY_SELECT"), "index=" + subcategory);
+ }
+ browser.clickAndWait(getProperty("SELL_NEXT"));
+ }
+
+ protected void submitSell3Page(String duration, String price) {
+ assertTrue("Navigation failure, sell3 page expected", browser.getLocation().contains(getProperty("SELL_3_URL")));
+ browser.type(getProperty("SELL_DURATION"), duration);
+ browser.type(getProperty("SELL_PRICE"), price);
+ browser.clickAndWait(getProperty("SELL_NEXT"));
+ }
+
+ protected void submitSell4Page() {
+ assertTrue("Navigation failure, sell4 page expected", browser.getLocation().contains(getProperty("SELL_4_URL")));
+ browser.clickAndWait(getProperty("SELL_NEXT"));
+ }
+
+ protected void submitSell5Page(String description) {
+ assertTrue("Navigation failure, sell5 page expected", browser.getLocation().contains(getProperty("SELL_5_URL")));
+ browser.type(getProperty("SELL_DESCRIPTION"), description);
+ browser.clickAndWait(getProperty("SELL_NEXT"));
+ }
+
+ protected void validatePreview(String price, String description)
+ {
+ assertTrue("Must be on preview page to validate preview.", browser.getLocation().contains(getProperty("SELL_PREVIEW_URL")));
+ assertEquals("Unexpected price on preview page.", Double.valueOf(price), Double.valueOf(browser.getText(getProperty("SELL_PREVIEW_PRICE"))));
+ assertEquals("Unexpected description on description page.", description, browser.getText(getProperty("SELL_PREVIEW_DESCRIPTION")));
+ }
+}
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/SellTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
===================================================================
--- trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties (rev 0)
+++ trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties 2009-01-20 11:07:32 UTC (rev 9957)
@@ -0,0 +1,55 @@
+HOME_PAGE /home.seam
+DEBUG_PAGE debug.seam
+REGISTRATION_PAGE register.seam
+LOGIN id=login
+LOGOUT id=logout
+REGISTRATION id=register
+SELL id=sell
+LOGIN_URL login.seam
+LOGIN_USERNAME id=login:username
+LOGIN_PASSWORD id=login:password
+LOGIN_SUBMIT id=login:submit
+REGISTRATION_USERNAME id=registration:username
+REGISTRATION_PASSWORD id=registration:password
+REGISTRATION_VERIFY id=registration:confirm
+REGISTRATION_LOCATION id=registration:location
+REGISTRATION_SUBMIT id=registration:submit
+REGISTRATION_CONFIRM_MESSAGE id=registration:confirmMessage
+SELL_LINK id=sell
+REGISTRATION_URL register.seam
+ITEMDETAIL_URL itemdetail
+AUCTION_URL auction.seam
+SELL_1_URL sell.seam
+SELL_2_URL sell2.seam
+SELL_3_URL sell3.seam
+SELL_4_URL sell4.seam
+SELL_5_URL sell5.seam
+SELL_PREVIEW_URL preview.seam
+SELL_PREVIEW_PRICE id=price
+SELL_PREVIEW_DESCRIPTION id=description
+SELL_TITLE id=sellForm:title
+SELL_DURATION id=sellForm:duration
+SELL_PRICE id=sellForm:price
+SELL_DESCRIPTION id=sellForm:description
+SELL_NEXT id=sellForm:next
+SELL_CONFIRM id=sellForm:confirm
+SELL_CATEGORY_SELECT id=rootCategory
+SELL_SUBCATEGORY_SELECT id\=tier2
+
+SEARCH_FIELD id=search:searchTerm
+SEARCH_SUBMIT id=search:submit
+SEARCH_RESULTS_COUNT //table[@id='auctions']/tbody/tr
+SEARCH_RESULTS_FIRST_ROW_LINK //table[@id='auctions']/tbody/tr[1]/td[2]/a
+
+ITEM_NEW_BID_FIELD id=newBid:bidAmount
+ITEM_NEW_BID_SUBMIT id=newBid:placeBidWithAmount
+ITEM_NEW_BID_LINK id=bid:placeBid
+ITEM_BID_HISTORY id=bidHistory
+BID_INCREASE_FIELD id=increaseBid:bidAmount
+BID_INCREASE_SUBMIT id=increaseBid:bidAgain
+
+BID_CONFIRM id=confirm:confirmBid
+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
Property changes on: trunk/src/test/ftest/examples/seambay/src/org/jboss/seam/example/seambay/test/selenium/seambay.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 10 months
Seam SVN: r9956 - in trunk: src/test/ftest and 10 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-01-20 04:53:13 -0500 (Tue, 20 Jan 2009)
New Revision: 9956
Added:
trunk/src/test/ftest/examples/messages/
trunk/src/test/ftest/examples/messages/build.xml
trunk/src/test/ftest/examples/messages/jboss-embedded.xml
trunk/src/test/ftest/examples/messages/jboss.xml
trunk/src/test/ftest/examples/messages/src/
trunk/src/test/ftest/examples/messages/src/org/
trunk/src/test/ftest/examples/messages/src/org/jboss/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
Modified:
trunk/examples/messages/view/messages.jsp
trunk/src/test/ftest/build.xml
Log:
JBSEAM-3690 Added tests for messages example
Modified: trunk/examples/messages/view/messages.jsp
===================================================================
--- trunk/examples/messages/view/messages.jsp 2009-01-20 09:14:30 UTC (rev 9955)
+++ trunk/examples/messages/view/messages.jsp 2009-01-20 09:53:13 UTC (rev 9956)
@@ -8,34 +8,34 @@
<body>
<f:view>
<h2>Message List</h2>
- <h:outputText value="No messages to display" rendered="#{messageList.rowCount==0}"/>
- <h:dataTable var="msg" value="#{messageList}" rendered="#{messageList.rowCount>0}">
+ <h:outputText id="noMessages" value="No messages to display" rendered="#{messageList.rowCount==0}"/>
+ <h:dataTable id="messages" var="msg" value="#{messageList}" rendered="#{messageList.rowCount>0}">
<h:column>
<f:facet name="header">
<h:outputText value="Read"/>
</f:facet>
- <h:selectBooleanCheckbox value="#{msg.read}" disabled="true"/>
+ <h:selectBooleanCheckbox id="read" value="#{msg.read}" disabled="true"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Title"/>
</f:facet>
- <s:link value="#{msg.title}" action="#{messageManager.select}"/>
+ <s:link id="link" value="#{msg.title}" action="#{messageManager.select}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Date/Time"/>
</f:facet>
- <h:outputText value="#{msg.datetime}">
+ <h:outputText id="date" value="#{msg.datetime}">
<s:convertDateTime type="both" dateStyle="medium" timeStyle="short"/>
</h:outputText>
</h:column>
<h:column>
- <s:button value="Delete" action="#{messageManager.delete}"/>
+ <s:button id="delete" value="Delete" action="#{messageManager.delete}"/>
</h:column>
</h:dataTable>
- <h3><h:outputText value="#{message.title}"/></h3>
- <div><h:outputText value="#{message.text}"/></div>
+ <h3><h:outputText id="title" value="#{message.title}"/></h3>
+ <div><h:outputText id="text" value="#{message.text}"/></div>
</f:view>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/test/ftest/build.xml
===================================================================
--- trunk/src/test/ftest/build.xml 2009-01-20 09:14:30 UTC (rev 9955)
+++ trunk/src/test/ftest/build.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -59,6 +59,7 @@
<testexample name="hibernate" />
<testexample name="icefaces" />
<testexample name="jpa" />
+ <testexample name="messages" />
<testexample name="nestedbooking" />
<testexample name="numberguess" />
<testexample name="quartz" />
@@ -75,6 +76,7 @@
<!-- Execute tests for all examples on jboss-embedded -->
<testexample name="blog" />
<testexample name="dvdstore" />
+ <testexample name="messages" />
<testexample name="numberguess" />
<testexample name="registration" />
<testexample name="seampay" />
@@ -133,6 +135,7 @@
<cleanexample name="hibernate" />
<cleanexample name="icefaces" />
<cleanexample name="jpa" />
+ <cleanexample name="messages" />
<cleanexample name="nestedbooking" />
<cleanexample name="numberguess" />
<cleanexample name="quartz" />
@@ -152,6 +155,7 @@
<undeployexample name="hibernate" />
<undeployexample name="icefaces" />
<undeployexample name="jpa" />
+ <undeployexample name="messages" />
<undeployexample name="nestedbooking" />
<undeployexample name="numberguess" />
<undeployexample name="quartz" />
Added: trunk/src/test/ftest/examples/messages/build.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/messages/build.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="messages.ftest.build" basedir="." default="build">
+ <property name="example.name" value="messages"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url" value="seam-messages/messages.seam"/>
+ <property name="jboss-embedded.deploy.target" value="tomcat.deploy"/>
+ <property name="jboss-embedded.undeploy.target" value="tomcat.undeploy"/>
+ <property name="jboss-embedded.example.ready.check.url" value="jboss-seam-messages/messages.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/messages/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/messages/jboss-embedded.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/jboss-embedded.xml (rev 0)
+++ trunk/src/test/ftest/examples/messages/jboss-embedded.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,31 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Messages example" verbose="2" parallel="false">
+ <test name="messages_jboss-embedded">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/jboss-seam-messages" />
+ <classes>
+ <class name="org.jboss.seam.example.messages.test.selenium.MessageTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/messages/jboss-embedded.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/messages/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/messages/jboss.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,31 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Messages example" verbose="2" parallel="false">
+ <test name="messages_jboss">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/seam-messages" />
+ <classes>
+ <class name="org.jboss.seam.example.messages.test.selenium.MessageTest" />
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/messages/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
===================================================================
--- trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java (rev 0)
+++ trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,83 @@
+/*
+ * 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.messages.test.selenium;
+
+import java.text.MessageFormat;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+
+/**
+ * Test for messages example
+ * @author Jozef Hartinger
+ *
+ */
+public class MessageTest extends SeamSeleniumTest
+{
+
+ public static final String MESSAGES_URL = "/messages.seam";
+ public static final String MESSAGES_LINK = "messages:{0}:link";
+ public static final String MESSAGES_DELETE = "messages:{0}:delete";
+ public static final String MESSAGES_CHECKBOX = "messages:{0}:read";
+ public static final String MESSAGES_COUNT = "//table[@id='messages']/tbody/tr";
+ public static final String MESSAGE_TITLE = "title";
+ public static final String MESSAGE_TEXT = "text";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + MESSAGES_URL);
+ }
+
+ @Test(dataProvider = "messages")
+ public void readMessageTest(int i, String title, String text)
+ {
+ browser.clickAndWait(MessageFormat.format(MESSAGES_LINK, i));
+ assertEquals("Unexpected message title displayed.", title, browser.getText(MESSAGE_TITLE));
+ assertEquals("Unexpected message text displayed.", text, browser.getText(MESSAGE_TEXT));
+ assertTrue("Checkbox should be checked after message is read.", browser.isChecked(MessageFormat.format(MESSAGES_CHECKBOX, i)));
+ }
+
+ @Test(dependsOnMethods = {"readMessageTest"}, dataProvider = "messages")
+ public void deleteMessageTest(int i, String title, String name)
+ {
+ int messageCount = browser.getXpathCount(MESSAGES_COUNT).intValue();
+ // delete first message in a table
+ browser.clickAndWait(MessageFormat.format(MESSAGES_DELETE, 0));
+ assertEquals("Unexpected count of messages.", --messageCount, browser.getXpathCount(MESSAGES_COUNT));
+ assertFalse("Message title still present.", browser.isTextPresent(title));
+ }
+
+ @DataProvider(name = "messages")
+ public Object[][] getMessages()
+ {
+ Object[][] messages = { { 0, "Greetings Earthling", "This is another example of a message." }, { 1, "Hello World", "This is an example of a message." } };
+ return messages;
+ }
+}
Property changes on: trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 10 months
Seam SVN: r9955 - trunk/examples/remoting/gwt.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2009-01-20 04:14:30 -0500 (Tue, 20 Jan 2009)
New Revision: 9955
Modified:
trunk/examples/remoting/gwt/readme.txt
Log:
updated gwt example readme to contain correct URL
Modified: trunk/examples/remoting/gwt/readme.txt
===================================================================
--- trunk/examples/remoting/gwt/readme.txt 2009-01-19 23:16:16 UTC (rev 9954)
+++ trunk/examples/remoting/gwt/readme.txt 2009-01-20 09:14:30 UTC (rev 9955)
@@ -5,7 +5,7 @@
You can view the example at:
-http://localhost:8080/seam-helloworld/org.jboss.seam.example.remoting.gwt.HelloWorld/HelloWorld.html
+http://localhost:8080/seam-gwt/
GWT:
If you want to rebuild the GWT front end, you will need to download GWT, and configure build.properties to point to it.
15 years, 10 months
Seam SVN: r9954 - trunk/src/pdf/org/jboss/seam/pdf/ui.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-19 18:16:16 -0500 (Mon, 19 Jan 2009)
New Revision: 9954
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UIImage.java
Log:
JBSEAM-3143
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIImage.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIImage.java 2009-01-19 23:15:47 UTC (rev 9953)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIImage.java 2009-01-19 23:16:16 UTC (rev 9954)
@@ -12,261 +12,243 @@
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
-public class UIImage extends UIRectangle
-{
- public static final String COMPONENT_TYPE = "org.jboss.seam.pdf.ui.UIImage";
+public class UIImage extends UIRectangle {
+ public static final String COMPONENT_TYPE = "org.jboss.seam.pdf.ui.UIImage";
- Image image;
+ Image image;
- Object value;
- float rotation;
- float height;
- float width;
- String alignment;
- String alt;
+ Object value;
+ float rotation;
+ float height;
+ float width;
+ String alignment;
+ String alt;
- Float indentationLeft;
- Float indentationRight;
- Float spacingBefore;
- Float spacingAfter;
- Float widthPercentage;
- Float initialRotation;
- String dpi;
- String scalePercent;
+ Float indentationLeft;
+ Float indentationRight;
+ Float spacingBefore;
+ Float spacingAfter;
+ Float widthPercentage;
+ Float initialRotation;
+ String dpi;
+ String scalePercent;
+ String scaleToFit;
+
+ Boolean wrap;
+ Boolean underlying;
- Boolean wrap;
- Boolean underlying;
+ java.awt.Image imageData;
- java.awt.Image imageData;
+
- public void setValue(Object value)
- {
- this.value = value;
- }
+ public void setValue(Object value) {
+ this.value = value;
+ }
- public void setRotation(float rotation)
- {
- this.rotation = rotation;
- }
+ public void setRotation(float rotation) {
+ this.rotation = rotation;
+ }
- public void setHeight(float height)
- {
- this.height = height;
- }
+ public void setHeight(float height) {
+ this.height = height;
+ }
- public void setWidth(float width)
- {
- this.width = width;
- }
+ public void setWidth(float width) {
+ this.width = width;
+ }
- public void setAlignment(String alignment)
- {
- this.alignment = alignment;
- }
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
- public void setAlt(String alt)
- {
- this.alt = alt;
- }
+ public void setAlt(String alt) {
+ this.alt = alt;
+ }
- public void setWrap(Boolean wrap)
- {
- this.wrap = wrap;
- }
+ public void setWrap(Boolean wrap) {
+ this.wrap = wrap;
+ }
- public void setUnderlying(Boolean underlying)
- {
- this.underlying = underlying;
- }
+ public void setUnderlying(Boolean underlying) {
+ this.underlying = underlying;
+ }
- public void setDpi(String dpi)
- {
- this.dpi = dpi;
- }
+ public void setDpi(String dpi) {
+ this.dpi = dpi;
+ }
- public void setIndentationLeft(Float indentationLeft)
- {
- this.indentationLeft = indentationLeft;
- }
+ public void setIndentationLeft(Float indentationLeft) {
+ this.indentationLeft = indentationLeft;
+ }
- public void setIndentationRight(Float indentationRight)
- {
- this.indentationRight = indentationRight;
- }
+ public void setIndentationRight(Float indentationRight) {
+ this.indentationRight = indentationRight;
+ }
- public void setInitialRotation(Float initialRotation)
- {
- this.initialRotation = initialRotation;
- }
+ public void setInitialRotation(Float initialRotation) {
+ this.initialRotation = initialRotation;
+ }
- public void setSpacingAfter(Float spacingAfter)
- {
- this.spacingAfter = spacingAfter;
- }
+ public void setSpacingAfter(Float spacingAfter) {
+ this.spacingAfter = spacingAfter;
+ }
- public void setSpacingBefore(Float spacingBefore)
- {
- this.spacingBefore = spacingBefore;
- }
+ public void setSpacingBefore(Float spacingBefore) {
+ this.spacingBefore = spacingBefore;
+ }
- public void setWidthPercentage(Float widthPercentage)
- {
- this.widthPercentage = widthPercentage;
- }
+ public void setWidthPercentage(Float widthPercentage) {
+ this.widthPercentage = widthPercentage;
+ }
- public void setScalePercent(String scalePercent)
- {
- this.scalePercent = scalePercent;
- }
+ public void setScalePercent(String scalePercent) {
+ this.scalePercent = scalePercent;
+ }
+
+ public void setScaleToFit(String scaleToFit) {
+ this.scaleToFit = scaleToFit;
+ }
+
- @Override
- public Object getITextObject()
- {
- return image;
- }
+ @Override
+ public Object getITextObject() {
+ return image;
+ }
- @Override
- public void removeITextObject()
- {
- image = null;
- }
+ @Override
+ public void removeITextObject() {
+ image = null;
+ }
- @SuppressWarnings("unchecked")
- @Override
- public void createITextObject(FacesContext context) throws IOException, DocumentException
- {
- value = valueBinding(context, "value", value);
+ @SuppressWarnings("unchecked")
+ @Override
+ public void createITextObject(FacesContext context) throws IOException,
+ DocumentException {
+ value = valueBinding(context, "value", value);
- // instance() doesn't work here - we need a new instance
- org.jboss.seam.ui.graphicImage.Image seamImage = new org.jboss.seam.ui.graphicImage.Image();
- if (value instanceof BufferedImage)
- {
- seamImage.setBufferedImage((BufferedImage) value);
- }
- else
- {
- seamImage.setInput(value);
- }
+ // instance() doesn't work here - we need a new instance
+ org.jboss.seam.ui.graphicImage.Image seamImage = new org.jboss.seam.ui.graphicImage.Image();
+ if (value instanceof BufferedImage) {
+ seamImage.setBufferedImage((BufferedImage) value);
+ } else {
+ seamImage.setInput(value);
+ }
- for (UIComponent cmp : this.getChildren())
- {
- if (cmp instanceof ImageTransform)
- {
- ImageTransform imageTransform = (ImageTransform) cmp;
- imageTransform.applyTransform(seamImage);
- }
- }
+ for (UIComponent cmp : this.getChildren()) {
+ if (cmp instanceof ImageTransform) {
+ ImageTransform imageTransform = (ImageTransform) cmp;
+ imageTransform.applyTransform(seamImage);
+ }
+ }
- byte[] data = seamImage.getImage();
- image = Image.getInstance(data);
+ byte[] data = seamImage.getImage();
+ image = Image.getInstance(data);
- rotation = (Float) valueBinding(context, "rotation", rotation);
- if (rotation != 0)
- {
- image.setRotationDegrees(rotation);
- }
+ rotation = (Float) valueBinding(context, "rotation", rotation);
+ if (rotation != 0) {
+ image.setRotationDegrees(rotation);
+ }
- height = (Float) valueBinding(context, "height", height);
- width = (Float) valueBinding(context, "width", width);
- if (height > 0 || width > 0)
- {
- image.scaleAbsolute(width, height);
- }
+ height = (Float) valueBinding(context, "height", height);
+ width = (Float) valueBinding(context, "width", width);
+ if (height > 0 || width > 0) {
+ image.scaleAbsolute(width, height);
+ }
+
+ int alignmentValue = 0;
+ alignment = (String) valueBinding(context, "alignment", alignment);
+ if (alignment != null) {
+ alignmentValue = (ITextUtils.alignmentValue(alignment));
+ }
- int alignmentValue = 0;
+ wrap = (Boolean) valueBinding(context, "wrap", wrap);
+ if (wrap != null && wrap.booleanValue()) {
+ alignmentValue |= Image.TEXTWRAP;
+ }
- alignment = (String) valueBinding(context, "alignment", alignment);
- if (alignment != null)
- {
- alignmentValue = (ITextUtils.alignmentValue(alignment));
- }
+ underlying = (Boolean) valueBinding(context, "underlying", underlying);
+ if (underlying != null && underlying.booleanValue()) {
+ alignmentValue |= Image.UNDERLYING;
+ }
- wrap = (Boolean) valueBinding(context, "wrap", wrap);
- if (wrap != null && wrap.booleanValue())
- {
- alignmentValue |= Image.TEXTWRAP;
- }
+ image.setAlignment(alignmentValue);
- underlying = (Boolean) valueBinding(context, "underlying", underlying);
- if (underlying != null && underlying.booleanValue())
- {
- alignmentValue |= Image.UNDERLYING;
- }
+ alt = (String) valueBinding(context, "alt", alt);
+ if (alt != null) {
+ image.setAlt(alt);
+ }
- image.setAlignment(alignmentValue);
+ indentationLeft = (Float) valueBinding(context, "indentationLeft",
+ indentationLeft);
+ if (indentationLeft != null) {
+ image.setIndentationLeft(indentationLeft);
+ }
- alt = (String) valueBinding(context, "alt", alt);
- if (alt != null)
- {
- image.setAlt(alt);
- }
+ indentationRight = (Float) valueBinding(context, "indentationRight",
+ indentationRight);
+ if (indentationRight != null) {
+ image.setIndentationRight(indentationRight);
+ }
- indentationLeft = (Float) valueBinding(context, "indentationLeft", indentationLeft);
- if (indentationLeft != null)
- {
- image.setIndentationLeft(indentationLeft);
- }
+ spacingBefore = (Float) valueBinding(context, "spacingBefore",
+ spacingBefore);
+ if (spacingBefore != null) {
+ image.setSpacingBefore(spacingBefore);
+ }
- indentationRight = (Float) valueBinding(context, "indentationRight", indentationRight);
- if (indentationRight != null)
- {
- image.setIndentationRight(indentationRight);
- }
+ spacingAfter = (Float) valueBinding(context, "spacingAfter",
+ spacingAfter);
+ if (spacingAfter != null) {
+ image.setSpacingAfter(spacingAfter);
+ }
+ widthPercentage = (Float) valueBinding(context, "widthPercentage",
+ widthPercentage);
+ if (widthPercentage != null) {
+ image.setWidthPercentage(widthPercentage);
+ }
- spacingBefore = (Float) valueBinding(context, "spacingBefore", spacingBefore);
- if (spacingBefore != null)
- {
- image.setSpacingBefore(spacingBefore);
- }
+ initialRotation = (Float) valueBinding(context, "initialRotation",
+ initialRotation);
+ if (initialRotation != null) {
+ image.setInitialRotation(initialRotation);
+ }
- spacingAfter = (Float) valueBinding(context, "spacingAfter", spacingAfter);
- if (spacingAfter != null)
- {
- image.setSpacingAfter(spacingAfter);
- }
- widthPercentage = (Float) valueBinding(context, "widthPercentage", widthPercentage);
- if (widthPercentage != null)
- {
- image.setWidthPercentage(widthPercentage);
- }
+ dpi = (String) valueBinding(context, "dpi", dpi);
+ if (dpi != null) {
+ int[] dpiValues = ITextUtils.stringToIntArray(dpi);
+ image.setDpi(dpiValues[0], dpiValues[1]);
+ }
- initialRotation = (Float) valueBinding(context, "initialRotation", initialRotation);
- if (initialRotation != null)
- {
- image.setInitialRotation(initialRotation);
- }
+ applyRectangleProperties(context, image);
- dpi = (String) valueBinding(context, "dpi", dpi);
- if (dpi != null)
- {
- int[] dpiValues = ITextUtils.stringToIntArray(dpi);
- image.setDpi(dpiValues[0], dpiValues[1]);
- }
+ scaleToFit = (String) valueBinding(context, "scaleToFit", scaleToFit);
+ if (scaleToFit != null) {
+ float[] scale = ITextUtils.stringToFloatArray(scaleToFit);
+ if (scale.length == 2) {
+ image.scaleToFit(scale[0],scale[1]);
+ } else {
+ throw new RuntimeException("scaleToFit must contain two dimensions");
+ }
+ }
+
+ scalePercent = (String) valueBinding(context, "scalePercent", scalePercent);
+ if (scalePercent != null) {
+ float[] scale = ITextUtils.stringToFloatArray(scalePercent);
+ if (scale.length == 1) {
+ image.scalePercent(scale[0]);
+ } else if (scale.length == 2) {
+ image.scalePercent(scale[0], scale[1]);
+ } else {
+ throw new RuntimeException(
+ "scalePercent must contain one or two scale percentages");
+ }
+ }
+ }
- applyRectangleProperties(context, image);
+ @Override
+ public void handleAdd(Object o) {
+ throw new RuntimeException("can't add " + o.getClass().getName()
+ + " to image");
+ }
- scalePercent = (String) valueBinding(context, "scalePercent", scalePercent);
- if (scalePercent != null)
- {
- float[] scale = ITextUtils.stringToFloatArray(scalePercent);
- if (scale.length == 1)
- {
- image.scalePercent(scale[0]);
- }
- else if (scale.length == 2)
- {
- image.scalePercent(scale[0], scale[1]);
- }
- else
- {
- throw new RuntimeException("scalePercent must contain one or two scale percentages");
- }
- }
- }
-
- @Override
- public void handleAdd(Object o)
- {
- throw new RuntimeException("can't add " + o.getClass().getName() + " to image");
- }
}
15 years, 10 months
Seam SVN: r9953 - trunk/ui/src/main/java/org/jboss/seam/ui/graphicImage.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-01-19 18:15:47 -0500 (Mon, 19 Jan 2009)
New Revision: 9953
Modified:
trunk/ui/src/main/java/org/jboss/seam/ui/graphicImage/Image.java
Log:
JBSEAM-3143
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/graphicImage/Image.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/graphicImage/Image.java 2009-01-19 13:18:24 UTC (rev 9952)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/graphicImage/Image.java 2009-01-19 23:15:47 UTC (rev 9953)
@@ -322,6 +322,19 @@
return this;
}
+ public Image scaleToFit(int height, int width)
+ throws IOException
+ {
+ float hratio = height/getHeight();
+ float wratio = width/getWidth();
+
+ if (hratio < wratio) {
+ return scaleToHeight(height);
+ } else {
+ return scaleToWidth(width);
+ }
+ }
+
/**
* Scale the image to the given height
*/
15 years, 10 months
Seam SVN: r9952 - trunk/src/main/org/jboss/seam/util.
by seam-commits@lists.jboss.org
Author: cpopetz
Date: 2009-01-19 08:18:24 -0500 (Mon, 19 Jan 2009)
New Revision: 9952
Modified:
trunk/src/main/org/jboss/seam/util/Work.java
Log:
JBSEAM-3898 Transaction not rolled back by Work if exception is thrown during begin
Modified: trunk/src/main/org/jboss/seam/util/Work.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/Work.java 2009-01-18 16:22:31 UTC (rev 9951)
+++ trunk/src/main/org/jboss/seam/util/Work.java 2009-01-19 13:18:24 UTC (rev 9952)
@@ -36,14 +36,14 @@
boolean newTransactionRequired = isNewTransactionRequired(transactionActive);
UserTransaction userTransaction = newTransactionRequired ? transaction : null;
- if (newTransactionRequired)
- {
- log.debug("beginning transaction");
- userTransaction.begin();
- }
-
try
{
+ if (newTransactionRequired)
+ {
+ log.debug("beginning transaction");
+ userTransaction.begin();
+ }
+
T result = work();
if (newTransactionRequired)
{
15 years, 10 months