rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r1204845 - in /incubator/rave/trunk/rave-components/rave-web/src: main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
Date Tue, 22 Nov 2011 07:55:34 GMT
Author: jasha
Date: Tue Nov 22 07:55:33 2011
New Revision: 1204845

URL: http://svn.apache.org/viewvc?rev=1204845&view=rev
Log:
RAVE-362 do redirect after succesful post of a widget to prevent duplicate submission

Modified:
    incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
    incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java

Modified: incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java?rev=1204845&r1=1204844&r2=1204845&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
(original)
+++ incubator/rave/trunk/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/WidgetStoreController.java
Tue Nov 22 07:55:33 2011
@@ -162,12 +162,7 @@ public class WidgetStoreController {
         widget.setOwner(user);
 
         final Widget storedWidget = widgetService.registerNewWidget(widget);
-        model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
-        model.addAttribute(ModelKeys.WIDGET, storedWidget);
-        model.addAttribute(ModelKeys.WIDGET_STATISTICS,
-                widgetService.getWidgetStatistics(storedWidget.getEntityId(), user.getEntityId()));
-        model.addAttribute(ModelKeys.USER_PROFILE, user);
-        return ViewNames.WIDGET;
+        return "redirect:/app/store/widget/" + storedWidget.getEntityId() + "?referringPageId="
+ referringPageId;
     }
 
     public int getPageSize() {

Modified: incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java?rev=1204845&r1=1204844&r2=1204845&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
(original)
+++ incubator/rave/trunk/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/controller/WidgetStoreControllerTest.java
Tue Nov 22 07:55:33 2011
@@ -22,7 +22,6 @@ package org.apache.rave.portal.web.contr
 
 import org.apache.rave.portal.model.User;
 import org.apache.rave.portal.model.Widget;
-import org.apache.rave.portal.model.WidgetStatus;
 import org.apache.rave.portal.model.util.SearchResult;
 import org.apache.rave.portal.model.util.WidgetStatistics;
 import org.apache.rave.portal.service.PortalPreferenceService;
@@ -188,16 +187,12 @@ public class WidgetStoreControllerTest {
 
         expect(widgetService.registerNewWidget(widget)).andReturn(widget);
         expect(widgetService.isRegisteredUrl(widgetUrl)).andReturn(false);
-        expect(widgetService.getWidgetStatistics(WIDGET_ID, validUser.getEntityId())).andReturn(widgetStatistics);
         replay(widgetService);
         String view = controller.viewAddWidgetResult(widget, errors, model,REFERRER_ID);
         verify(widgetService);
 
-        assertEquals(ViewNames.WIDGET, view);
+        assertEquals("redirect:/app/store/widget/" + widget.getEntityId() +     "?referringPageId="
+ REFERRER_ID, view);
         assertFalse("Valid widget data", errors.hasErrors());
-        final Widget fromModel = (Widget) model.asMap().get(ModelKeys.WIDGET);
-        assertEquals(widget, fromModel);
-        assertEquals("New widget has state preview", WidgetStatus.PREVIEW, fromModel.getWidgetStatus());
     }
 
     @Test



Mime
View raw message