You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/09/16 20:35:40 UTC

svn commit: r289628 - in /beehive/trunk/netui/test/webapps/drt: ./ coreWeb/WEB-INF/src/databinding/datagrid/controls/ coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/ coreWeb/databinding/xmlBeans/serialize/

Author: ekoneil
Date: Fri Sep 16 11:35:32 2005
New Revision: 289628

URL: http://svn.apache.org/viewcvs?rev=289628&view=rev
Log:
Remove XMLBeans dependency from data grid tests.

BB: self
Test: NetUI BVT pass


Added:
    beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioBean.java
    beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/StockBean.java
Modified:
    beehive/trunk/netui/test/webapps/drt/build.xml
    beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControl.java
    beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControlImpl.jcs
    beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/portfolioXmlBean.tag
    beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/xmlBeans/serialize/Controller.jpf

Modified: beehive/trunk/netui/test/webapps/drt/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/build.xml?rev=289628&r1=289627&r2=289628&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/build.xml (original)
+++ beehive/trunk/netui/test/webapps/drt/build.xml Fri Sep 16 11:35:32 2005
@@ -76,6 +76,12 @@
             <property name="webapp.file" location="${app.dir}/drt/testRecorder/config/testRecorder-webapp.xml"/>
             <property name="struts.version" value="${struts.version}"/>
         </ant>
+
+        <!-- deploy XMLBeans which isn't included in the default webapp template -->
+        <copy todir="${webapp.dir}/WEB-INF/lib">
+            <fileset refid="xbean.fileset"/>
+            <fileset refid="jsr173.fileset"/>
+        </copy>
     </target>
 
     <target name="clean" description="Clean webapp">

Added: beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioBean.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioBean.java?rev=289628&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioBean.java (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioBean.java Fri Sep 16 11:35:32 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package databinding.datagrid.controls;
+
+import java.util.List;
+import java.util.LinkedList;
+
+public class PortfolioBean {
+
+    private LinkedList _stocks = null;
+    
+    public List getStocks() {
+	return _stocks;
+    }
+
+    public void addStock(StockBean stock) {
+	if(_stocks == null)
+	    _stocks = new LinkedList();
+
+	_stocks.add(stock);
+    }
+}

Modified: beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControl.java?rev=289628&r1=289627&r2=289628&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControl.java (original)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControl.java Fri Sep 16 11:35:32 2005
@@ -18,10 +18,9 @@
 package databinding.datagrid.controls;
 
 import org.apache.beehive.controls.api.bean.ControlInterface;
-import org.openuri.customerPortfolio.PortfolioDocument.Portfolio;
 
 @ControlInterface
 public interface PortfolioControl
 {
-    public Portfolio getPortfolio();
+    public PortfolioBean getPortfolio();
 }

Modified: beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControlImpl.jcs
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControlImpl.jcs?rev=289628&r1=289627&r2=289628&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControlImpl.jcs (original)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/PortfolioControlImpl.jcs Fri Sep 16 11:35:32 2005
@@ -1,32 +1,35 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
 package databinding.datagrid.controls;
 
 import org.apache.beehive.controls.api.bean.ControlImplementation;
-import org.apache.xmlbeans.XmlException;
-import org.openuri.customerPortfolio.PortfolioDocument.Portfolio;
-import org.openuri.customerPortfolio.PortfolioDocument;
-
-import java.io.InputStream;
-import java.io.IOException;
 
 @ControlImplementation(isTransient=true)
 public class PortfolioControlImpl
     implements PortfolioControl
 {
-    public Portfolio getPortfolio()
-    {
-        try
-        {
-            InputStream is = getClass().getClassLoader().getResourceAsStream("xml/portfolio.xml");
-            PortfolioDocument pd = PortfolioDocument.Factory.parse(is);
-            return pd.getPortfolio();
-        }
-        catch(Exception e)
-        {
-            assert e instanceof XmlException || e instanceof IOException;
-
-            System.err.println("Caught exception trying to load XMLBean.  Cause: " + e);
-            e.printStackTrace();
-            return null;
-        }
+    public PortfolioBean getPortfolio() {
+	PortfolioBean portfolio = new PortfolioBean();
+	portfolio.addStock(new StockBean("BEAS", "BEA Systems", 14.35, "http://www.bea.com", 500, "nasdaq"));
+	portfolio.addStock(new StockBean("CSCO", "Cisco Systems", 19.42, "http://www.cisco.com", 400, "nasdaq"));
+	portfolio.addStock(new StockBean("GE", "General Electric", 59.42, "http://www.ge.com", 300, "nyse"));
+	portfolio.addStock(new StockBean("RHAT", "RedHat Systems", 18.20, "http://www.redhat.com", 200, "nasdaq"));
+	portfolio.addStock(new StockBean("YHOO", "Yahoo Inc", 48.16, "http://www.yahoo.com", 100, "nyse"));
+	return portfolio;
     }
 }

Added: beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/StockBean.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/StockBean.java?rev=289628&view=auto
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/StockBean.java (added)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/src/databinding/datagrid/controls/StockBean.java Fri Sep 16 11:35:32 2005
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package databinding.datagrid.controls;
+
+public class StockBean {
+
+    private String _symbol;
+    private String _name;
+    private double _price;
+    private String _web;
+    private int _shares;
+    private String _exchange;
+
+    public StockBean() {}
+
+    public StockBean(String symbol, String name, double price, String web, int shares, String exchange) {
+	this();
+
+	_symbol = symbol;
+	_name = name;
+	_price = price;
+	_web = web;
+	_shares = shares;
+	_exchange = exchange;
+    }
+
+    public String getSymbol() {
+	return _symbol;
+    }
+
+    public void setSymbol(String symbol) {
+	_symbol = symbol;
+    }
+
+    public String getName() {
+	return _name;
+    }
+
+    public void setName(String name) {
+	_name = name;
+    }
+
+    public double getPrice() {
+	return _price;
+    }
+
+    public void setPrice(double price) {
+	_price = price;
+    }
+
+    public String getWeb() {
+	return _web;
+    }
+
+    public void setWeb(String web) {
+	_web = web;
+    }
+
+    public int getShares() {
+	return _shares;
+    }
+
+    public void setShares(int shares) {
+	_shares = shares;
+    }
+
+    public String getExchange() {
+	return _exchange;
+    }
+
+    public void setExchange(String exchange) {
+	_exchange = exchange;
+    }
+}
+

Modified: beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/portfolioXmlBean.tag
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/portfolioXmlBean.tag?rev=289628&r1=289627&r2=289628&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/portfolioXmlBean.tag (original)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/tags/org/apache/beehive/netui/test/databinding/tagfiles/portfolioXmlBean.tag Fri Sep 16 11:35:32 2005
@@ -1,6 +1,6 @@
 <%@ tag body-content="empty" %>
 <%@ tag import="databinding.datagrid.controls.PortfolioControlBean"%>
-<%@ variable name-given="stocks" variable-class="org.openuri.customerPortfolio.Stock[]" scope="AT_END" %>
+<%@ variable name-given="stocks" variable-class="java.util.LinkedList" scope="AT_END" %>
 <%--
     Create a portfolio XMLBean bindable with ${pageScope.stocks}
 --%>
@@ -8,5 +8,5 @@
 <%
   // for back-compat with the old way of getting the Portfolio
   PortfolioControlBean pcb = (PortfolioControlBean)getJspContext().getAttribute("portfolioBean");
-  getJspContext().setAttribute("stocks", pcb.getPortfolio().getStocks().getStockArray());
+  getJspContext().setAttribute("stocks", pcb.getPortfolio().getStocks());
 %>

Modified: beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/xmlBeans/serialize/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/xmlBeans/serialize/Controller.jpf?rev=289628&r1=289627&r2=289628&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/xmlBeans/serialize/Controller.jpf (original)
+++ beehive/trunk/netui/test/webapps/drt/coreWeb/databinding/xmlBeans/serialize/Controller.jpf Fri Sep 16 11:35:32 2005
@@ -25,7 +25,7 @@
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
 import org.apache.xmlbeans.XmlObject;
 
-import databinding.datagrid.controls.PortfolioControl;
+import org.openuri.customerPortfolio.PortfolioDocument;
 
 /**
  *
@@ -34,9 +34,6 @@
 public class Controller 
     extends PageFlowController {
 
-    @Control()
-    private PortfolioControl _portfolioControl;
-
     @Jpf.Action(
         forwards = {
             @Jpf.Forward(
@@ -46,6 +43,9 @@
     protected Forward begin()
         throws Exception {
 
-        return new Forward("index", "xmlbean", _portfolioControl.getPortfolio());
+        InputStream is = getClass().getClassLoader().getResourceAsStream("xml/portfolio.xml");
+        PortfolioDocument pd = PortfolioDocument.Factory.parse(is);
+
+        return new Forward("index", "xmlbean", pd.getPortfolio());
     }
 }