Author: erinnp
Date: Fri Jun 28 16:34:32 2013
New Revision: 1497835

URL: http://svn.apache.org/r1497835
Log:
Update java tests for client messages and os widget rendering. Tweak r.js 
optimizer.

Modified:
    
rave/branches/require/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/MessageBundleControllerTest.java
    rave/branches/require/rave-portal-resources/pom.xml
    
rave/branches/require/rave-portal-resources/src/main/resources/requireBuild.js
    rave/branches/require/rave-portal-resources/src/main/resources/wro.xml
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
    
rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/test/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetRendererTest.java

Modified: 
rave/branches/require/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/MessageBundleControllerTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/MessageBundleControllerTest.java?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/MessageBundleControllerTest.java
 (original)
+++ 
rave/branches/require/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/MessageBundleControllerTest.java
 Fri Jun 28 16:34:32 2013
@@ -85,13 +85,13 @@ public class MessageBundleControllerTest
 
     private String buildExpectedJavaScript(String test1, String test2, String 
test3) {
         StringBuilder sb = new StringBuilder();
-        sb.append("rave.addClientMessage(\"test1\",\"");
+        sb.append("define([], function(){ return {\"test1\":\"");
         sb.append(test1);
-        sb.append("\");rave.addClientMessage(\"test2\",\"");
+        sb.append("\",\"test2\":\"");
         sb.append(test2);
-        sb.append("\");rave.addClientMessage(\"test3\",\"");
+        sb.append("\",\"test3\":\"");
         sb.append(test3);
-        sb.append("\");");
+        sb.append("\"}; })");
         return sb.toString();
     }
 }
\ No newline at end of file

Modified: rave/branches/require/rave-portal-resources/pom.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/pom.xml?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/pom.xml (original)
+++ rave/branches/require/rave-portal-resources/pom.xml Fri Jun 28 16:34:32 2013
@@ -133,8 +133,7 @@
                 </configuration>
             </plugin>
             <!--
-               wro4j maven plugin is used for optimization (concatenation, 
minification, etc) of our static resources
-               it is invoked as part of the compile phase of the maven 
lifecycle
+               wro4j maven plugin is used for lesscss compilation
             -->
             <plugin>
                 <groupId>ro.isdc.wro4j</groupId>
@@ -154,11 +153,9 @@
                     <!-- wro.xml defines the resource groups -->
                     <wroFile>${basedir}/src/main/resources/wro.xml</wroFile>
                     <!-- targetGroups is the set of resource groups, defined 
in wro.xml, that you want to process -->
-                    
<targetGroups>rave.core.min,rave.portal.min,rave</targetGroups>
+                    <targetGroups>rave</targetGroups>
                     <!-- minimize instructs the processors to handle their 
minimization work -->
                     <minimize>true</minimize>
-                    <!-- location of the javascript after processing -->
-                    
<jsDestinationFolder>${project.build.directory}/${project.build.finalName}/static/script/</jsDestinationFolder>
                     <!-- location of the CSS after processing -->
                     
<cssDestinationFolder>${project.build.directory}/${project.build.finalName}/static/css/</cssDestinationFolder>
                     <!-- location of webapp directory that wro4j uses for its 
location context -->

Modified: 
rave/branches/require/rave-portal-resources/src/main/resources/requireBuild.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/resources/requireBuild.js?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/resources/requireBuild.js 
(original)
+++ 
rave/branches/require/rave-portal-resources/src/main/resources/requireBuild.js 
Fri Jun 28 16:34:32 2013
@@ -29,6 +29,18 @@
         {
             name: 'ui',
             exclude: ['rave']
+        },
+        {
+            name: 'portal/rave_admin',
+            exclude: ['rave']
+        },
+        {
+            name: 'portal/rave_store',
+            exclude: ['rave']
+        },
+        {
+            name: 'portal/rave_forms',
+            exclude: ['rave']
         }
     ]
 })
\ No newline at end of file

Modified: rave/branches/require/rave-portal-resources/src/main/resources/wro.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/resources/wro.xml?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/resources/wro.xml 
(original)
+++ rave/branches/require/rave-portal-resources/src/main/resources/wro.xml Fri 
Jun 28 16:34:32 2013
@@ -18,26 +18,6 @@ specific language governing permissions 
 under the License.
 -->
 <groups xmlns="http://www.isdc.ro/wro";>
-    <!-- defines a wro4j group called rave-all.min which represents all of our 
javascript files -->
-    <group name="rave.core.min">
-        <js>/static/script/core/rave_widget_manager.js</js>
-        <js>/static/script/core/rave_ajax.js</js>
-        <js>/static/script/core/rave_api.js</js>
-        <js>/static/script/core/rave_widget.js</js>
-        <js>/static/script/core/rave_opensocial.js</js>
-        <js>/static/script/core/rave_wookie.js</js>
-    </group>
-    <group name="rave.portal.min">
-        <js>/static/script/portal/rave_portal.js</js>
-        <js>/static/script/portal/rave_backbone.js</js>
-        <js>/static/script/portal/rave_models.js</js>
-        <js>/static/script/portal/rave_layout.js</js>
-        <js>/static/script/portal/rave_ui.js</js>
-        <js>/static/script/portal/rave_forms.js</js>
-        <js>/static/script/portal/rave_person_profile.js</js>
-        <js>/static/script/portal/rave_store.js</js>
-        <js>/static/script/portal/rave_admin.js</js>
-    </group>
     <!-- defines a wro4j group called rave_css which represents the rave less 
file -->
     <group name="rave">
         <css>/static/css/rave.less</css>

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
 Fri Jun 28 16:34:32 2013
@@ -237,8 +237,8 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
-        require(["rave", "ui", "portal/rave_person_profile", 
"portal/rave_portal", "portal/rave_forms", "jquery"],
-                function (rave, ui, ravePersonProfile, ravePortal, raveForms, 
$) {
+        require(["rave", "ui", "portal/rave_person_profile", "jquery"],
+                function (rave, ui, ravePersonProfile, $) {
                     rave.setDefaultView('profile');
                     rave.setOwner({
                         username: "<c:out value="${userProfile.username}"/>",
@@ -246,8 +246,7 @@
                     });
 
                     $(function () {
-                        ravePersonProfile.init();
-                        raveForms.validateEditAccountForm();
+                        ui.forms.validateEditAccountForm();
                         rave.renderWidgets('home');
                     });
                 })

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/store.jsp
 Fri Jun 28 16:34:32 2013
@@ -306,8 +306,8 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
-        require(["rave", "ui", "portal/rave_store", "portal/rave_display", 
"jquery"],
-                function(rave, ui, raveStore, raveDisplay, $){
+        require(["rave", "ui", "portal/rave_store", "jquery"],
+                function(rave, ui, raveStore, $){
                     //Helper function for callback below
                     function addWidgetToPageCallback (result){
                         var widgetTitle = 
ui.getClientMessage("widget.add_prefix");
@@ -335,7 +335,7 @@
 
                         $("#storeItems").on("click", "a.displayUsersLink", 
function(event){
                             var element = $(this);
-                            
raveDisplay.displayUsersOfWidget(element.data('widget-id'));
+                            ui.displayUsersOfWidget(element.data('widget-id'));
                         });
                     })
 

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/widget.jsp
 Fri Jun 28 16:34:32 2013
@@ -259,7 +259,7 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
-        require(["rave", "ui", "portal/rave_display", "portal/rave_store", 
"jquery"], function(rave, ui, raveDisplay, raveStore, $){
+        require(["rave", "ui", "portal/rave_store", "jquery"], function(rave, 
ui, raveStore, $){
             //Helper function for callback below
             function addWidgetToPageCallback (result){
                 var widgetTitle = ui.getClientMessage("widget.add_prefix");
@@ -285,7 +285,7 @@
                 })
 
                 $('#displayUsersOfWidgetLink').click(function(){
-                    raveDisplay.displayUsersOfWidget($(this).data('widget-id'))
+                    ui.displayUsersOfWidget($(this).data('widget-id'))
                 })
             })
 

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
 Fri Jun 28 16:34:32 2013
@@ -30,13 +30,13 @@
     <c:when test="${jsDebugMode == '1'}">
         <script src="<spring:url 
value="/static/script/requireConfig.js"/>"></script>
         <script>
-            requirejs.config({baseUrl:"/portal/static/script"});
+            requirejs.config({baseUrl:"<c:url value="/static/script"/>"});
         </script>
     </c:when>
     <c:otherwise>
         <script src="<spring:url 
value="/static/script-built/requireConfig.js"/>"></script>
         <script>
-            requirejs.config({baseUrl:"/portal/static/script-built"});
+            requirejs.config({baseUrl:"<c:url 
value="/static/script-built"/>"});
         </script>
     </c:otherwise>
 </c:choose>

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
 Fri Jun 28 16:34:32 2013
@@ -17,5 +17,20 @@
  * under the License.
  */
 
-             console.log("in main");
-})
+define(['underscore', 'core/rave_widget_manager', 'core/rave_api', 
'core/rave_widget', 'core/rave_log',
+    'core/rave_event_manager', 'core/rave_view_manager', 
'core/rave_state_manager'],
+    function (_, widgetManager, api, RegionWidget, log, eventManager, 
viewManager, stateManager) {
+
+        var rave = {};
+
+        rave.api = api;
+        rave.RegionWidget = RegionWidget;
+        rave.log = log;
+        _.extend(rave, eventManager);
+        _.extend(rave, viewManager);
+        _.extend(rave, widgetManager);
+        _.extend(rave, stateManager);
+
+        return rave;
+    }
+)

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
 Fri Jun 28 16:34:32 2013
@@ -831,6 +831,6 @@ define(['underscore', 'core/rave_ajax', 
 
         return {
             rest: restApi,
-            rpc: rpcApi,
+            rpc: rpcApi
         };
     })
\ No newline at end of file

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
 Fri Jun 28 16:34:32 2013
@@ -17,12 +17,16 @@
  * under the License.
  */
 
-define(['underscore', 'portal/rave_portal', 'portal/rave_models', 
'portal/rave_ui',
-    'portal/rave_layout', 'portal/rave_forms'],
-    function (_, portal, models, ui, layout, forms) {
+define(['underscore', 'portal/rave_portal', 'portal/rave_models', 
'portal/rave_layout', 'portal/rave_ui',
+    'portal/rave_forms', 'portal/rave_display'],
+    function (_, portal, models, layout, ui, forms, display) {
 
         portal.models = models;
         portal.layout = layout;
+        _.extend(portal, ui);
+        portal.forms = forms;
+        _.extend(portal, display);
+
 
         return portal
 

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
 Fri Jun 28 16:34:32 2013
@@ -539,8 +539,9 @@ define(["jquery", "portal/rave_portal", 
         initButtons();
     }
 
+    rave.registerOnInitHandler(init);
+
     return {
-        init : init,
         dealWithUserResults : dealWithUserResults,
         addFriend : addFriend,
         removeFriend : removeFriend,

Modified: 
rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/test/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetRendererTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/test/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetRendererTest.java?rev=1497835&r1=1497834&r2=1497835&view=diff
==============================================================================
--- 
rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/test/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetRendererTest.java
 (original)
+++ 
rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/test/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetRendererTest.java
 Fri Jun 28 16:34:32 2013
@@ -105,28 +105,30 @@ public class OpenSocialWidgetRendererTes
         rw.setRegion(region);
         rw.setHideChrome(VALID_HIDE_CHROME);
         rw.setLocked(VALID_LOCKED);
-        rw.setPreferences(Arrays.asList((RegionWidgetPreference)new 
RegionWidgetPreferenceImpl( "1", "color", "blue"),
-                                        new RegionWidgetPreferenceImpl("1", 
"speed", "fast"),
-                                        new RegionWidgetPreferenceImpl( "1", 
null, null)));
+        rw.setPreferences(Arrays.asList((RegionWidgetPreference) new 
RegionWidgetPreferenceImpl("1", "color", "blue"),
+                new RegionWidgetPreferenceImpl("1", "speed", "fast"),
+                new RegionWidgetPreferenceImpl("1", null, null)));
 
         final String markup =
-            "<script>rave.registerWidget('" + REGION_ID + "', {type: 
'OpenSocial'," +
-            " regionWidgetId: '" + REGION_WIDGET_ID + "'," +
-            " widgetUrl: '" + VALID_GADGET_URL +"', " +
-            " securityToken: '" + VALID_SECURITY_TOKEN + "', " +
-            " metadata: " + VALID_METADATA + "," +
-            " userPrefs: {\"speed\":\"fast\",\"color\":\"blue\"}," +
-            " collapsed: " + VALID_COLLAPSED + ", " +
-            " widgetId: '" + WIDGET_ID + "'," +
-            " locked: " + VALID_LOCKED + "," +
-            " hideChrome: " + VALID_HIDE_CHROME + "," +
-            " subPage: {id: '" + VALID_SUBPAGE_ID + "', name: '" + 
VALID_SUBPAGE_NAME + "', isDefault: " + VALID_IS_DEFAULT_SUBPAGE + "}" +
-            "});</script>";
+                "<script>require(['rave'], function(rave){" +
+                        "rave.registerWidget('" + REGION_ID + "', {type: 
'OpenSocial'," +
+                        " regionWidgetId: '" + REGION_WIDGET_ID + "'," +
+                        " widgetUrl: '" + VALID_GADGET_URL + "', " +
+                        " securityToken: '" + VALID_SECURITY_TOKEN + "', " +
+                        " metadata: " + VALID_METADATA + "," +
+                        " userPrefs: {\"speed\":\"fast\",\"color\":\"blue\"}," 
+
+                        " collapsed: " + VALID_COLLAPSED + ", " +
+                        " widgetId: '" + WIDGET_ID + "'," +
+                        " locked: " + VALID_LOCKED + "," +
+                        " hideChrome: " + VALID_HIDE_CHROME + "," +
+                        " subPage: {id: '" + VALID_SUBPAGE_ID + "', name: '" + 
VALID_SUBPAGE_NAME + "', isDefault: " + VALID_IS_DEFAULT_SUBPAGE + "}" +
+                        "})" +
+                        "});</script>";
 
         expect(securityTokenService.getEncryptedSecurityToken(rw, 
w)).andReturn(VALID_SECURITY_TOKEN);
         replay(securityTokenService);
 
-        String key = 
OpenSocialWidgetWrapperRenderer.REGISTER_WIDGET_KEY+"-"+rw.getId();
+        String key = OpenSocialWidgetWrapperRenderer.REGISTER_WIDGET_KEY + "-" 
+ rw.getId();
         scriptManager.registerScriptBlock(key, markup, 
ScriptLocation.AFTER_RAVE, RenderScope.CURRENT_REQUEST, renderContext);
         expectLastCall();
         replay(scriptManager);
@@ -147,7 +149,7 @@ public class OpenSocialWidgetRendererTes
 
         Page page = new PageImpl();
         page.setPageType(PageType.USER);
-        
+
         WidgetImpl w = new WidgetImpl();
         w.setType(Constants.WIDGET_TYPE);
 
@@ -158,18 +160,20 @@ public class OpenSocialWidgetRendererTes
         rw.setRegion(region);
 
         final String markup =
-            "<script>rave.registerWidget('8675309', {type: 'OpenSocial'," +
-            " regionWidgetId: 'null'," +
-            " widgetUrl: 'null', " +
-            " securityToken: 'null', " +
-            " metadata: null," +
-            " userPrefs: {}," +
-            " collapsed: false, " +
-            " widgetId: 'null'," +
-            " locked: false," +
-            " hideChrome: false," +
-            " subPage: {id: null, name: '', isDefault: false}" +
-            "});</script>";
+                "<script>require(['rave'], function(rave){" +
+                        "rave.registerWidget('8675309', {type: 'OpenSocial'," +
+                        " regionWidgetId: 'null'," +
+                        " widgetUrl: 'null', " +
+                        " securityToken: 'null', " +
+                        " metadata: null," +
+                        " userPrefs: {}," +
+                        " collapsed: false, " +
+                        " widgetId: 'null'," +
+                        " locked: false," +
+                        " hideChrome: false," +
+                        " subPage: {id: null, name: '', isDefault: false}" +
+                        "})" +
+                        "});</script>";
 
         
scriptManager.registerScriptBlock(OpenSocialWidgetWrapperRenderer.REGISTER_WIDGET_KEY,
 markup, ScriptLocation.AFTER_RAVE, RenderScope.CURRENT_REQUEST, null);
         expectLastCall();


Reply via email to