You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2011/04/21 22:10:37 UTC

svn commit: r1095803 - in /incubator/rave/trunk/rave-portal/src: main/db/ main/java/org/apache/rave/jdbc/ main/java/org/apache/rave/jdbc/util/ main/java/org/apache/rave/orm/ main/java/org/apache/rave/orm/jpa/ main/java/org/apache/rave/portal/model/ mai...

Author: mfranklin
Date: Thu Apr 21 20:10:36 2011
New Revision: 1095803

URL: http://svn.apache.org/viewvc?rev=1095803&view=rev
Log:
Created data initialization components that load a given set of SQL scripts into the DataSource prior to handing off of any entity managers to downstream components.  Supports both test and web application runtime contexts.

Added:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
    incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql
      - copied, changed from r1095733, incubator/rave/trunk/rave-portal/src/main/db/data/initial_data.sql
Removed:
    incubator/rave/trunk/rave-portal/src/main/db/
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/datasource/
    incubator/rave/trunk/rave-portal/src/test/resources/test-context.xml
Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext.xml
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/dataContext.xml
    incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java

Added: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java?rev=1095803&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java (added)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java Thu Apr 21 20:10:36 2011
@@ -0,0 +1,175 @@
+package org.apache.rave.jdbc.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.Resource;
+
+import javax.annotation.PostConstruct;
+import javax.persistence.EntityManager;
+import javax.sql.DataSource;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+
+/**
+ * {@inheritDoc}
+ * <p/>
+ * <p/>
+ * Executes a given set of SQL scripts against a javax.sql.DataSource
+ * <p/>
+ * <p/>
+ * Usage:
+ * <code>
+ *    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.DataSourcePopulator">
+ *       <property name="executeScriptQuery" value="SELECT * FROM widgets" />
+ *       <property name="scriptLocations" >
+ *          <list>
+ *              <value>file:db/sequences/create_all_seq.sql</value>
+ *              <value>file:db/tables/create_all_tables.sql</value>
+*               <value>classpath:test-data.sql</value>
+ *          </list>
+ *       </property>
+ *    </bean>
+ * </code>
+ * <p/>
+ */
+public class DataSourcePopulator {
+
+    private static Logger logger = LoggerFactory.getLogger(DataSourcePopulator.class);
+
+    protected String executeScriptQuery;
+    protected List<Resource> scriptLocations;
+
+    /**
+     * Creates a new populator initial values for required properties.
+     * <p/>
+     * NOTE: If the populator is initialized using the default constructor, the required properties must be set prior to use
+     */
+    public DataSourcePopulator() {
+    }
+
+    /**
+     * Creates a new populator and sets the properties to the passed in parameters
+     *
+     * @param scriptLocations    {@see setScriptLocations}
+     * @param executeScriptQuery {@see setExecuteScriptQuery}
+     */
+    public DataSourcePopulator(List<Resource> scriptLocations, String executeScriptQuery, DataSource dataSource, EntityManager entityManager) {
+        setScriptLocations(scriptLocations);
+        setExecuteScriptQuery(executeScriptQuery);
+    }
+
+    /**
+     * Optional Property
+     * <p/>
+     * Set the query used to determine whether or not to execute the scripts on initialization
+     *
+     * @param executeScriptQuery the query to execute.  If there are no results of the query, the scripts referenced
+     *                           in setScriptLocations will be executed.  The statement must be a select statement.
+     */
+    public void setExecuteScriptQuery(String executeScriptQuery) {
+        this.executeScriptQuery = executeScriptQuery;
+    }
+
+
+    /**
+     * Required Property
+     * <p/>
+     * Sets the locations of the files containing DDL to be executed against the database
+     * <p/>
+     * NOTE: Files are executed in order
+     *
+     * @param scriptLocations list of {@link org.springframework.core.io.Resource} compatible location strings
+     */
+    public void setScriptLocations(List<Resource> scriptLocations) {
+        this.scriptLocations = scriptLocations;
+    }
+
+    public void initialize(DataSource dataSource) {
+        validateProperties();
+        populateDataSourceIfNecessary(dataSource);
+    }
+
+    /*
+      Helper methods
+    */
+    protected void validateProperties() {
+        if (scriptLocations == null) {
+            throw new IllegalArgumentException("The path to the database schema DDL is required");
+        }
+    }
+
+    protected void populateDataSourceIfNecessary(DataSource dataSource) {
+        Connection conn = null;
+        try {
+            conn = dataSource.getConnection();
+            if (testExecuteScriptQuery(conn, executeScriptQuery)) {
+                logger.debug("Database is empty.  Loading script files");
+                executeScripts(conn, scriptLocations);
+            }
+        } catch (SQLException e) {
+            logger.error("Error querying or populating database", e);
+            throw new RuntimeException(e);
+        } finally {
+            closeConnection(conn);
+        }
+    }
+
+    /*
+      Static Helper methods
+    */
+    protected static void executeScripts(Connection connection, List<Resource> resources) {
+        for (Resource script : resources) {
+            try {
+                String sql = new SqlFileParser(script).getSQL();
+                logger.debug("Executing sql:\n" + sql);
+                executeSql(sql, connection);
+                logger.debug("Successfully executed statement");
+
+            } catch (IOException e) {
+                throw new RuntimeException("File IO Exception while loading " + script.getFilename(), e);
+            } catch (SQLException e) {
+                throw new RuntimeException("SQL exception occurred loading data from " + script.getFilename(), e);
+            }
+        }
+    }
+
+    protected static boolean testExecuteScriptQuery(Connection conn, String executeScriptQuery) {
+        boolean result;
+        try {
+            //If the ResultSet has any rows, the first method will return true
+            result = !executeQuery(conn, executeScriptQuery).first();
+        } catch (SQLException e) {
+            //Only return true if the execption we got is that the table was not found
+            result = e.getMessage().toLowerCase().matches("table \".*\" not found.*\n*.*");
+        }
+        logger.debug("Executed query " + executeScriptQuery + " with result " + result);
+        return result;
+    }
+
+    protected static void closeConnection(Connection conn) {
+        if (conn != null) {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                logger.error("Error closing connection to database", e);
+            }
+        }
+    }
+
+    protected static ResultSet executeQuery(Connection conn, String executeScriptQuery) throws SQLException {
+        Statement statement = conn.createStatement();
+        return statement.executeQuery(executeScriptQuery);
+    }
+
+
+    protected static void executeSql(String sql, Connection connection) throws SQLException {
+        Statement statement = connection.createStatement();
+        statement.execute(sql);
+    }
+
+
+}
\ No newline at end of file

Added: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java?rev=1095803&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java (added)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java Thu Apr 21 20:10:36 2011
@@ -0,0 +1,131 @@
+package org.apache.rave.jdbc.util;
+
+import org.springframework.core.io.Resource;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Stack;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Parses a file looking for create, alter, insert, update, delete or drop commands and appends them to an output
+ * string or follows @@ syntax to read child scripts.
+ */
+public class SqlFileParser {
+    private static final Pattern WORD_PATTERN = Pattern.compile("^([a-zA-Z]*)[ ;]");
+    private static final String CHILD_SCRIPT_INDICATOR = "@@";
+    private static final Set<String> commandSet;
+
+    static {
+        commandSet = new HashSet<String>();
+        commandSet.add("create");
+        commandSet.add("alter");
+        commandSet.add("insert");
+        commandSet.add("update");
+        commandSet.add("drop");
+        commandSet.add("delete");
+        commandSet.add("commit");
+        commandSet.add("set");
+        commandSet.add("truncate");
+        commandSet.add("rollback");
+    }
+
+    private enum State {
+        INIT,
+        READFILE,
+        READSQL
+    }
+
+    private Stack<State> stateStack;
+    private Resource resource;
+
+    /**
+     * Constructor takes a Spring {@link org.springframework.core.io.Resource}
+     *
+     * @param resource the initial file to parse
+     */
+    public SqlFileParser(Resource resource) {
+        stateStack = new Stack<State>();
+        this.resource = resource;
+    }
+
+    /**
+     * Gets the executable SQL statements from the resource passed to the constructor and its children
+     *
+     * @return a valid executable string containing SQL statements
+     * @throws java.io.IOException if the resource or its children are not found
+     */
+    public String getSQL() throws IOException {
+        return processResource(resource);
+    }
+
+    private String processResource(Resource res) throws IOException {
+        StringBuilder sql = new StringBuilder();
+        File resourceFile = res.getFile();
+        stateStack.push(State.INIT);
+        processFile(resourceFile, sql);
+        stateStack.pop();
+        return sql.toString();
+    }
+
+    private void processFile(File file, StringBuilder sql) throws IOException {
+        BufferedReader fileReader = new BufferedReader(new FileReader(file.getAbsoluteFile()));
+        String line = null;
+        while ((line = fileReader.readLine()) != null) {
+            processLine(sql, line);
+        }
+    }
+
+    private void processLine(StringBuilder sql, String line) throws IOException {
+        String lowerLine = line.toLowerCase().trim();
+        switch (stateStack.peek()) {
+            case INIT: {
+                if (lowerLine.startsWith(CHILD_SCRIPT_INDICATOR)) {
+                    //replace the current element in the stack with the new state
+                    stateStack.pop();
+                    stateStack.push(State.READFILE);
+                    processLine(sql, line);
+                } else if (commandSet.contains(getFirstWord(lowerLine))) {
+
+                    //replace the current element in the stack with the new state
+                    stateStack.pop();
+                    stateStack.push(State.READSQL);
+                    processLine(sql, line);
+                }
+                break;
+            }
+            case READFILE: {
+                stateStack.push(State.INIT);
+                Resource child = resource.createRelative(line.replace(CHILD_SCRIPT_INDICATOR, ""));
+                sql.append(processResource(child));
+                //Read File lines do not have a terminal character but are by definition only one line long
+                stateStack.pop();
+                stateStack.push(State.INIT);
+                break;
+            }
+            case READSQL: {
+                sql.append(line);
+                //add a space to accommodate line breaks.  Not a big deal if extraneous spaces are added
+                sql.append(" ");
+                if (lowerLine.endsWith(";")) {
+                    stateStack.pop();
+                    stateStack.push(State.INIT);
+                }
+                break;
+            }
+            default: {
+                throw new RuntimeException("Invalid State");
+            }
+        }
+    }
+
+    private static String getFirstWord(String line) {
+        Matcher match = WORD_PATTERN.matcher(line);
+        return match.find() ? match.group(1) : null;
+    }
+}

Added: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java?rev=1095803&view=auto
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java (added)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java Thu Apr 21 20:10:36 2011
@@ -0,0 +1,32 @@
+package org.apache.rave.orm.jpa;
+
+import org.apache.rave.jdbc.util.DataSourcePopulator;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.spi.PersistenceUnitInfo;
+
+/**
+ * @author mfranklin
+ *         Date: 4/21/11
+ *         Time: 2:57 PM
+ */
+public class PopulatedLocalContainerEntityManagerFactory extends LocalContainerEntityManagerFactoryBean{
+    private DataSourcePopulator populator;
+
+    public PopulatedLocalContainerEntityManagerFactory() {
+        super();
+    }
+
+    public void setPopulator(DataSourcePopulator populator) {
+        this.populator = populator;
+    }
+
+    @Override
+    protected void postProcessEntityManagerFactory(EntityManagerFactory emf, PersistenceUnitInfo pui) {
+        //Create an entity manager to force initialization of the context and then populate
+        emf.createEntityManager().close();
+        populator.initialize(this.getDataSource());
+        super.postProcessEntityManagerFactory(emf, pui);
+    }
+}

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java (original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java Thu Apr 21 20:10:36 2011
@@ -38,8 +38,7 @@ public class RegionWidget {
     @Basic @Column(name="render_position")
     private String renderPosition;
 
-    @Transient
-    //@Basic @Column(name="collapsed")
+    @Basic @Column(name="collapsed")
     private boolean collapsed;
 
 

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java (original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java Thu Apr 21 20:10:36 2011
@@ -35,11 +35,12 @@ public class Widget {
     private Long id;
 
     /*
-        TODO: Figure out what the OpenJPA strategy is for functionality provided by Eclisplink's @Convert
+        TODO 1: Figure out what the OpenJPA strategy is for functionality provided by Eclisplink's @Convert
      */
 
-    @Transient
-    private InternationalString title;
+    @Basic @Column(name="title")
+    private String title;
+    //private InternationalString title;
 
     @Basic @Column(name="url")
     private String url;
@@ -57,11 +58,22 @@ public class Widget {
         this.id = id;
     }
 
-    public InternationalString getTitle() {
+    //See TODO 1
+//    public InternationalString getTitle() {
+//        return title;
+//    }
+//
+//    public void setTitle(InternationalString title) {
+//        this.title = title;
+//
+// }
+
+
+    public String getTitle() {
         return title;
     }
 
-    public void setTitle(InternationalString title) {
+    public void setTitle(String title) {
         this.title = title;
     }
 

Copied: incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql (from r1095733, incubator/rave/trunk/rave-portal/src/main/db/data/initial_data.sql)
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql?p2=incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql&p1=incubator/rave/trunk/rave-portal/src/main/db/data/initial_data.sql&r1=1095733&r2=1095803&rev=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/db/data/initial_data.sql (original)
+++ incubator/rave/trunk/rave-portal/src/main/resources/initial_data.sql Thu Apr 21 20:10:36 2011
@@ -60,3 +60,21 @@ values (next value for page_layout_id_se
 insert into page_layout (id, code,  number_of_regions)
 values (next value for page_layout_id_seq, 'columns_3nwn_1_bottom', 4);
 --- end page layout data ----
+
+INSERT INTO page (id, name, owner_id, render_sequence, page_layout_id)
+values (set(@page_1_id, next value for page_id_seq), 'main', @user_id_1, 1, @two_col_id);
+
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_1, next value for region_id_seq), @page_1_id);
+INSERT INTO region(id, page_id)
+values (set(@page_1_region_2, next value for region_id_seq), @page_1_id);
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @wikipedia_widget_id, @page_1_region_1, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @translate_widget_id, @page_1_region_1, 2, 'N');
+
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @nyt_widget_id, @page_1_region_2, 1, 'N');
+INSERT INTO region_widget(id, widget_id, region_id, render_position, collapsed)
+values (next value for region_widget_id_seq, @tabnews_widget_id, @page_1_region_2, 2, 'N');

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext.xml?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/applicationContext.xml Thu Apr 21 20:10:36 2011
@@ -33,19 +33,31 @@
         <property name="entityManagerFactory" ref="entityManagerFactory"/>
     </bean>
 
+    <!-- Bean that executes the given set of resources (SQL scripts) in order
+         To remove runtime initialization of initial data, remove this bean and change teh entity manager factory to the default
+         Spring implementation
+    -->
+    <bean id="dataSourcePopulator" class="org.apache.rave.jdbc.util.DataSourcePopulator">
+        <property name="executeScriptQuery" value="SELECT * FROM WIDGETS"/>
+        <property name="scriptLocations">
+            <list>
+                <value>classpath:initial_data.sql</value>
+            </list>
+        </property>
+    </bean>
+
     <bean id="entityManagerFactory"
-          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+          class="org.apache.rave.orm.jpa.PopulatedLocalContainerEntityManagerFactory">
+        <property name="populator" ref="dataSourcePopulator" />
         <property name="persistenceUnitName" value="ravePersistenceUnit"/>
         <property name="dataSource" ref="dataSource"/>
         <property name="jpaVendorAdapter">
-            <!--<bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter" >-->
             <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
                 <property name="showSql" value="true" />
             </bean>
         </property>
         <property name="jpaPropertyMap">
             <map>
-                <!--<entry key="eclipselink.weaving" value="false"/>-->
                 <entry key="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
                 <entry key="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
                 <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/dataContext.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/dataContext.xml?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/dataContext.xml (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/dataContext.xml Thu Apr 21 20:10:36 2011
@@ -19,13 +19,12 @@
   -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
-            <property name="url" value="jdbc:h2:mem:portal;DB_CLOSE_DELAY=-1"/>
-            <property name="driverClassName" value="org.h2.Driver" />
-            <property name="username" value="sa" />
-            <property name="password" value="local" />
-        </bean>
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
 
+    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+        <property name="url" value="jdbc:h2:mem:portal;DB_CLOSE_DELAY=-1"/>
+        <property name="driverClassName" value="org.h2.Driver"/>
+        <property name="username" value="sa"/>
+        <property name="password" value="local"/>
+    </bean>
 </beans>
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/WEB-INF/views/home.jsp Thu Apr 21 20:10:36 2011
@@ -32,7 +32,7 @@
       <td>
         <c:forEach var="regionWidget" items="${region.regionWidgets}">
           <c:set var="widget" value="${regionWidget.widget}"/>
-          ${widget.title.defaultLocalizedString.value}
+          ${widget.title}
           <br>
           <iframe src="/gadgets/ifr?url=${widget.url}&view=home" width="250" height="250" frameborder="0"></iframe>
           <br><br>

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java?rev=1095803&r1=1095802&r2=1095803&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java (original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java Thu Apr 21 20:10:36 2011
@@ -36,7 +36,7 @@ import static org.junit.Assert.assertTha
  *         Time: 9:13 AM
  */
 @RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations={"classpath:test-context.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
+@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
 public class JpaPageRepositoryTest {
 
     private static final String USER_ID = "canonical";