[kune-commits] r882 - in trunk: script src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/server/manager/impl src/main/java/org/ourproject/kune/workspace/client/signin src/main/java/org/ourproject/kune/workspace/client/skel src/test/java/org/ourproject/kune/platf/server/manager/impl

vjrj vjrj at ourproject.org
Wed Sep 24 16:53:18 CEST 2008


Author: vjrj
Date: 2008-09-24 16:53:10 +0200 (Wed, 24 Sep 2008)
New Revision: 882

Added:
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerTest.java
Modified:
   trunk/script/generateBasicUIElements.sh
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManager.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
Log:
Incomplete - task 66: Add a FileUploadManagerTest 

Complete - task 24: new suco 0.5.0 and emite 0.4.1 
http://code.google.com/p/kune/issues/detail?id=24

Modified: trunk/script/generateBasicUIElements.sh
===================================================================
--- trunk/script/generateBasicUIElements.sh	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/script/generateBasicUIElements.sh	2008-09-24 14:53:10 UTC (rev 882)
@@ -85,7 +85,7 @@
 import $PACKAGE.${NAME}Panel;
 import $PACKAGE.${NAME};
 
-register(SingletonScope.class, new Factory<${NAME}>(${NAME}.class) {
+register(Singleton.class, new Factory<${NAME}>(${NAME}.class) {
     public ${NAME} create() {
 	final ${NAME}Presenter presenter = new ${NAME}Presenter();
 	final ${NAME}Panel panel = new ${NAME}Panel(presenter, ws);

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -94,7 +94,7 @@
 	});
 	application.onApplicationStop(new Listener0() {
 	    public void onEvent() {
-		chat.logout();
+		chat.stop();
 	    }
 	});
 	session.onUserSignOut(new Listener0() {

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -27,4 +27,6 @@
     void login(String jid, String passwd);
 
     void logout();
+
+    void stop();
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -25,8 +25,8 @@
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
 import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
 import com.calclab.emiteuimodule.client.SubscriptionMode;
-import com.calclab.emiteuimodule.client.EmiteUIDialog;
 import com.calclab.emiteuimodule.client.UserChatOptions;
 import com.calclab.emiteuimodule.client.params.AvatarProvider;
 import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
@@ -134,6 +134,11 @@
 	}
     }
 
+    public void stop() {
+	// emiteDialog.destroy();
+	emiteDialog.getSession().logout();
+    }
+
     private UserChatOptions getUserChatOptions(final String jid, final String passwd) {
 	final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
 	// getGwtMetaProperty(GWT_PROPERTY_RELEASE);

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientActions.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -53,10 +53,10 @@
 	this.contentServiceProvider = contentServiceProvider;
 	this.fileUploaderProvider = fileUploaderProvider;
 	this.contextActionRegistry = contextActionRegistry;
-
+	createActions();
     }
 
-    public void createActions() {
+    private void createActions() {
 	final ActionMenuDescriptor<StateToken> addFolder = createFolderAction(TYPE_FOLDER, "images/nav/folder_add.png",
 		i18n.t("New folder"), i18n.t("Folder"), i18n.t("New"), i18n.t("New folder"));
 	final ActionMenuDescriptor<StateToken> addGallery = createFolderAction(TYPE_GALLERY,

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -109,7 +109,7 @@
 	    }
 	});
 
-	register(Singleton.class, new Factory<DocumentClientActions>(DocumentClientActions.class) {
+	register(ToolGroup.class, new Factory<DocumentClientActions>(DocumentClientActions.class) {
 	    public DocumentClientActions create() {
 		return new DocumentClientActions($(I18nUITranslationService.class), $(ContextNavigator.class),
 			$(Session.class), $(StateManager.class), $$(ContentServiceAsync.class), $$(FileUploader.class),
@@ -160,7 +160,7 @@
 	    }
 	});
 
-	register(Singleton.class, new Factory<DocumentContext>(DocumentContext.class) {
+	register(ToolGroup.class, new Factory<DocumentContext>(DocumentContext.class) {
 	    public DocumentContext create() {
 		final DocumentContextPresenter presenter = new DocumentContextPresenter($(StateManager.class),
 			$$(ContextNavigator.class), $$(AdminContext.class));

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -361,19 +361,19 @@
 	    }
 	});
 
-	register(ApplicationComponentGroup.class, new Factory<SiteLogo>(SiteLogo.class) {
-	    public SiteLogo create() {
-		final SiteLogoPresenter presenter = new SiteLogoPresenter($(Session.class));
-		final SiteLogoPanel panel = new SiteLogoPanel(presenter, ws);
+	register(ApplicationComponentGroup.class, new Factory<SiteSearch>(SiteSearch.class) {
+	    public SiteSearch create() {
+		final SiteSearchPresenter presenter = new SiteSearchPresenter($$(SiteSearcher.class));
+		final SiteSearchPanel panel = new SiteSearchPanel(presenter, ws, i18n);
 		presenter.init(panel);
 		return presenter;
 	    }
 	});
 
-	register(ApplicationComponentGroup.class, new Factory<SiteSearch>(SiteSearch.class) {
-	    public SiteSearch create() {
-		final SiteSearchPresenter presenter = new SiteSearchPresenter($$(SiteSearcher.class));
-		final SiteSearchPanel panel = new SiteSearchPanel(presenter, ws, i18n);
+	register(ApplicationComponentGroup.class, new Factory<SiteLogo>(SiteLogo.class) {
+	    public SiteLogo create() {
+		final SiteLogoPresenter presenter = new SiteLogoPresenter($(Session.class));
+		final SiteLogoPanel panel = new SiteLogoPanel(presenter, ws);
 		presenter.init(panel);
 		return presenter;
 	    }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -81,7 +81,14 @@
     }
 
     public Toolbar createBottomBar(final Panel panel, final String cssStyle) {
+	return createBottomBar(panel, cssStyle, null);
+    }
+
+    public Toolbar createBottomBar(final Panel panel, final String cssStyle, final String id) {
 	final Toolbar bottomToolbar = new Toolbar();
+	if (id != null) {
+	    bottomToolbar.setId(id);
+	}
 	bottomToolbar.setHeight(DEF_TOOLBAR_HEIGHT);
 	if (cssStyle != null) {
 	    bottomToolbar.setCls(cssStyle);
@@ -95,8 +102,15 @@
     }
 
     public Toolbar createTopBar(final Panel panel, final String cssStyle) {
+	return createTopBar(panel, cssStyle);
+    }
+
+    public Toolbar createTopBar(final Panel panel, final String cssStyle, final String id) {
 	final Toolbar topToolbar = new Toolbar();
 	topToolbar.setHeight(DEF_TOOLBAR_HEIGHT);
+	if (id != null) {
+	    topToolbar.setId(id);
+	}
 	if (cssStyle != null) {
 	    topToolbar.setCls(cssStyle);
 	}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManager.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManager.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -109,14 +109,9 @@
 	resp.setStatus(HttpServletResponse.SC_OK);
     }
 
-    private String calculateUploadDirLocation(final StateToken stateToken) {
-	return kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + File.pathSeparator + stateToken.getGroup()
-		+ File.pathSeparator + stateToken.getTool() + File.pathSeparator + stateToken.getFolder();
-    }
-
     @Authenticated
     @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container)
-    private JSONObject createFile(final String userHash, final StateToken stateToken, final String fileName,
+    JSONObject createFile(final String userHash, final StateToken stateToken, final String fileName,
 	    final FileItem fileUploadItem) throws Exception {
 	final String destDir = calculateUploadDirLocation(stateToken);
 	fileManager.mkdir(destDir);
@@ -127,6 +122,11 @@
 	return createJsonResponse(true, "OK");
     }
 
+    private String calculateUploadDirLocation(final StateToken stateToken) {
+	return kuneProperties.get(KuneProperties.UPLOAD_LOCATION) + File.pathSeparator + stateToken.getGroup()
+		+ File.pathSeparator + stateToken.getTool() + File.pathSeparator + stateToken.getFolder();
+    }
+
     private JSONObject createJsonResponse(final boolean success, final String message) {
 	/**
 	 * 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPanel.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -275,13 +275,13 @@
 	confPanel(signInPanel);
 	signInForm = new SignInForm(i18n);
 	signInPanel.add(signInForm.getForm());
-	signInPanel.ensureDebugId(USER_SIGN_IN_PANEL);
+	signInPanel.setCls(USER_SIGN_IN_PANEL);
 	signInPanel.add(createNoAccountRegister());
 	messagesSignInPanel = new MessagePanel();
 	signInPanel.add(messagesSignInPanel);
 
 	final Panel registerPanel = new Panel(i18n.t("Register"));
-	registerPanel.ensureDebugId(USER_REGISTER_PANEL);
+	registerPanel.setCls(USER_REGISTER_PANEL);
 	confPanel(registerPanel);
 
 	centerPanel.add(signInPanel);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntitySummary.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -22,8 +22,8 @@
     public EntitySummary() {
 	mainPanel = new DefaultBorderLayout();
 	entityTools = new Panel();
-	entityTools.ensureDebugId(ENTITY_TOOLS);
 	entityTools.setLayout(new FitLayout());
+	entityTools.setId(ENTITY_TOOLS);
 	entityTools.setAutoHeight(true);
 	vpTools = new VerticalPanel();
 	entityTools.add(vpTools);
@@ -33,9 +33,8 @@
 	entityTools.setAutoScroll(false);
 	entitySummary.setAutoScroll(true);
 	entitySummary.setCls(ENTITY_SUMMARY);
-	entitySummary.ensureDebugId(ENTITY_SUMMARY);
-	trayBar = mainPanel.createBottomBar(entitySummary, SITE_TRAYBAR);
-	trayBar.ensureDebugId(SITE_TRAYBAR);
+	entitySummary.setId(ENTITY_SUMMARY);
+	trayBar = mainPanel.createBottomBar(entitySummary, SITE_TRAYBAR, SITE_TRAYBAR);
 	mainPanel.add(entityTools, DefaultBorderLayout.Position.NORTH);
 	mainPanel.add(entitySummary, DefaultBorderLayout.Position.CENTER);
 	trayBar.addFill();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/EntityWorkspace.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -61,8 +61,8 @@
 	contextWrap.setBorder(true);
 	content = new Panel();
 	context = new Panel();
-	content.ensureDebugId(ENTITY_CONTENT);
-	context.ensureDebugId(ENTITY_CONTEXT);
+	content.setCls(ENTITY_CONTENT);
+	context.setCls(ENTITY_CONTEXT);
 	content.setBorder(false);
 	context.setBorder(false);
 	context.setCollapsible(true);

Added: trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerTest.java	2008-09-24 01:47:16 UTC (rev 881)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerTest.java	2008-09-24 14:53:10 UTC (rev 882)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.platf.server.manager.impl;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.platf.client.errors.SessionExpiredException;
+import org.ourproject.kune.platf.integration.IntegrationTest;
+import org.ourproject.kune.platf.integration.IntegrationTestHelper;
+
+import com.google.inject.Inject;
+
+public class FileUploadManagerTest extends IntegrationTest {
+
+    @Inject
+    FileUploadManager fileUploadManager;
+
+    @Before
+    public void create() {
+	new IntegrationTestHelper(this);
+    }
+
+    @Test(expected = SessionExpiredException.class)
+    public void testNoAuth() throws Exception {
+	fileUploadManager.createFile("otherhash", null, null, null);
+    }
+}




More information about the kune-commits mailing list