[kune-commits] r1464 - in trunk/src: main/java/cc/kune/core/client/dnd main/java/cc/kune/core/client/errors main/java/cc/kune/core/client/rpcservices main/java/cc/kune/core/server main/java/cc/kune/core/server/content main/java/cc/kune/core/server/rpc main/java/cc/kune/domain main/java/cc/kune/gspace/client/tool/selector main/java/cc/kune/gspace/client/viewers test/java/cc/kune/core/server test/java/cc/kune/core/server/manager

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Jul 26 05:03:14 CEST 2011


Author: vjrj_
Date: 2011-07-26 05:03:13 +0200 (Tue, 26 Jul 2011)
New Revision: 1464

Added:
   trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java
   trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
   trunk/src/test/java/cc/kune/core/server/manager/I18nManagerDefaultTest.java
   trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerDefaultTest.java
Removed:
   trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
   trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java
   trunk/src/test/java/cc/kune/core/server/manager/I18nManagerTest.java
   trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerTest.java
Modified:
   trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
   trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
   trunk/src/main/java/cc/kune/core/server/KuneContainerListener.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
   trunk/src/main/java/cc/kune/domain/Container.java
   trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
   trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java
Log:
Drag and drop of contents in folders

Modified: trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/client/dnd/FolderViewerDropController.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -2,6 +2,11 @@
 
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.errors.ErrorHandler;
+import cc.kune.core.client.rpcservices.ContentServiceAsync;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.StateContainerDTO;
 import cc.kune.gspace.client.viewers.FolderItemWidget;
 
 import com.allen_sauer.gwt.dnd.client.DragContext;
@@ -9,71 +14,111 @@
 import com.allen_sauer.gwt.dnd.client.drop.SimpleDropController;
 import com.google.gwt.event.logical.shared.AttachEvent;
 import com.google.gwt.event.logical.shared.AttachEvent.Handler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
 
-public class FolderViewerDropController extends SimpleDropController {
+public class FolderViewerDropController {
 
-  public FolderViewerDropController(final Widget dropTarget, final KuneDragController dragController) {
-    super(dropTarget);
-    dropTarget.addStyleName("k-drop-allowed");
-    dropTarget.addAttachHandler(new Handler() {
+  private final ContentServiceAsync contentService;
+  private final KuneDragController dragController;
+
+  private SimpleDropController dropController;
+
+  private final ErrorHandler erroHandler;
+  private final Session session;
+  private final StateManager stateManager;
+
+  @Inject
+  public FolderViewerDropController(final KuneDragController dragController,
+      final ContentServiceAsync contentService, final Session session, final StateManager stateManager,
+      final ErrorHandler erroHandler) {
+    this.dragController = dragController;
+    this.contentService = contentService;
+    this.session = session;
+    this.stateManager = stateManager;
+    this.erroHandler = erroHandler;
+
+  }
+
+  public void init(final Widget dropTarget) {
+    dropController = new SimpleDropController(dropTarget) {
+
       @Override
-      public void onAttachOrDetach(final AttachEvent event) {
-        if (!event.isAttached()) {
-          dragController.unregisterDropController(FolderViewerDropController.this);
-        } else {
-          dragController.registerDropController(FolderViewerDropController.this);
+      public void onDrop(final DragContext context) {
+        super.onDrop(context);
+        for (final Widget widget : context.selectedWidgets) {
+          if (widget instanceof FolderItemWidget) {
+            getDropTarget().removeStyleName("k-drop-allowed-hover");
+            if (getDropTarget() instanceof FolderItemWidget) {
+              // NotifyUser.info("" + ((FolderItemWidget)
+              // getDropTarget()).getToken().toString() + " receive: "
+              // + ((FolderItemWidget) widget).getToken().toString());
+              contentService.moveContent(session.getUserHash(), ((FolderItemWidget) widget).getToken(),
+                  ((FolderItemWidget) getDropTarget()).getToken(),
+                  new AsyncCallback<StateContainerDTO>() {
+                    @Override
+                    public void onFailure(final Throwable caught) {
+                      erroHandler.process(caught);
+                      stateManager.reload();
+                    }
+
+                    @Override
+                    public void onSuccess(final StateContainerDTO result) {
+                      stateManager.reload();
+                    }
+                  });
+            } else {
+              NotifyUser.info(TextUtils.IN_DEVELOPMENT);
+            }
+          }
         }
       }
-    });
-  }
 
-  @Override
-  public void onDrop(final DragContext context) {
-    for (final Widget widget : context.selectedWidgets) {
-      if (widget instanceof FolderItemWidget) {
-        getDropTarget().removeStyleName("k-drop-allowed-hover");
-        if (getDropTarget() instanceof FolderItemWidget) {
-          // NotifyUser.info("" + ((FolderItemWidget)
-          // getDropTarget()).getToken().toString() + " receive: "
-          // + ((FolderItemWidget) widget).getToken().toString());
+      @Override
+      public void onEnter(final DragContext context) {
+        super.onEnter(context);
+        for (final Widget widget : context.selectedWidgets) {
+          if (widget instanceof FolderItemWidget) {
+            getDropTarget().addStyleName("k-drop-allowed-hover");
+          }
         }
-        NotifyUser.info(TextUtils.IN_DEVELOPMENT);
       }
-    }
-    super.onDrop(context);
-  }
 
-  @Override
-  public void onEnter(final DragContext context) {
-    super.onEnter(context);
-    for (final Widget widget : context.selectedWidgets) {
-      if (widget instanceof FolderItemWidget) {
-        getDropTarget().addStyleName("k-drop-allowed-hover");
+      @Override
+      public void onLeave(final DragContext context) {
+        super.onLeave(context);
+        for (final Widget widget : context.selectedWidgets) {
+          if (widget instanceof FolderItemWidget) {
+            getDropTarget().removeStyleName("k-drop-allowed-hover");
+          }
+        }
       }
-    }
-  }
 
-  @Override
-  public void onLeave(final DragContext context) {
-    super.onLeave(context);
-    for (final Widget widget : context.selectedWidgets) {
-      if (widget instanceof FolderItemWidget) {
-        getDropTarget().removeStyleName("k-drop-allowed-hover");
+      @Override
+      public void onPreviewDrop(final DragContext context) throws VetoDragException {
+        for (final Widget widget : context.selectedWidgets) {
+          if (widget instanceof FolderItemWidget) {
+            getDropTarget().removeStyleName("k-drop-allowed-hover");
+          } else {
+            throw new VetoDragException();
+          }
+        }
+        super.onPreviewDrop(context);
       }
-    }
-  }
+    };
 
-  @Override
-  public void onPreviewDrop(final DragContext context) throws VetoDragException {
-    for (final Widget widget : context.selectedWidgets) {
-      if (widget instanceof FolderItemWidget) {
-        getDropTarget().removeStyleName("k-drop-allowed-hover");
-      } else {
-        throw new VetoDragException();
+    dropTarget.addStyleName("k-drop-allowed");
+    dropTarget.addAttachHandler(new Handler() {
+      @Override
+      public void onAttachOrDetach(final AttachEvent event) {
+        if (!event.isAttached()) {
+          dragController.unregisterDropController(dropController);
+        } else {
+          dragController.registerDropController(dropController);
+        }
       }
-    }
-    super.onPreviewDrop(context);
+    });
   }
 
 }

Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -114,6 +114,10 @@
       eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
           i18n.t("Action not permitted in this location")));
       goHome();
+    } else if (caught instanceof NameInUseException) {
+      logException(caught);
+      eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+          i18n.t("A content with the same name already exist. Please rename it")));
     } else if (caught instanceof LastAdminInGroupException) {
       logException(caught);
       NotifyUser.showAlertMessage(i18n.t("Warning"),

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -59,6 +59,9 @@
 
   TagCloudResult getSummaryTags(String userHash, StateToken groupToken) throws DefaultException;
 
+  StateContainerDTO moveContent(String userHash, StateToken contentToken, StateToken newContainerToken)
+      throws DefaultException;
+
   RateResult rateContent(String userHash, StateToken token, Double value) throws DefaultException;
 
   void removeAuthor(String userHash, StateToken token, String authorShortName) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -60,6 +60,9 @@
 
   void getSummaryTags(String userHash, StateToken groupToken, AsyncCallback<TagCloudResult> asyncCallback);
 
+  void moveContent(String userHash, StateToken contentToken, StateToken newContainerToken,
+      AsyncCallback<StateContainerDTO> asyncCallback);
+
   void rateContent(String userHash, StateToken token, Double value,
       AsyncCallback<RateResult> asyncCallback);
 

Modified: trunk/src/main/java/cc/kune/core/server/KuneContainerListener.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneContainerListener.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/server/KuneContainerListener.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -36,42 +36,43 @@
 import com.google.inject.Inject;
 
 public class KuneContainerListener implements ContainerListener {
-    private final Logger logger; // NOPMD by vjrj on 16/07/09 22:38
-    private final KunePersistenceService persistenceService;
+  private final Logger logger; // NOPMD by vjrj on 16/07/09 22:38
+  private final KunePersistenceService persistenceService;
 
-    @Inject
-    public KuneContainerListener(final KunePersistenceService persistenceService, final Logger logger) {
-        this.persistenceService = persistenceService;
-        this.logger = logger;
-    }
+  @Inject
+  public KuneContainerListener(final KunePersistenceService persistenceService, final Logger logger) {
+    this.persistenceService = persistenceService;
+    this.logger = logger;
+  }
 
-    private void configureLog4j() {
-        try {
-            final Properties properties = new Properties();
-            final InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(
-                    "log4j.dev.properties");
-            properties.load(input);
-            PropertyConfigurator.configure(properties);
-        } catch (final IOException e) {
-            e.printStackTrace();
-        }
+  private void configureLog4j() {
+    try {
+      final Properties properties = new Properties();
+      final InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(
+          "log4j.dev.properties");
+      properties.load(input);
+      PropertyConfigurator.configure(properties);
+    } catch (final IOException e) {
+      e.printStackTrace();
     }
+  }
 
-    public Logger getLogger() {
-        return logger;
-    }
+  public Logger getLogger() {
+    return logger;
+  }
 
-    @Override
-    public void start() {
-        configureLog4j();
-        logger.log(Level.INFO, "Starting Kune...");
-        persistenceService.start();
-        logger.log(Level.INFO, "Kune server started");
-    }
+  @Override
+  public void start() {
+    configureLog4j();
+    logger.log(Level.INFO, "Kune persistence starting");
+    persistenceService.start();
+    logger.log(Level.INFO, "Kune persistence started");
+    logger.log(Level.INFO, "Kune server started");
+  }
 
-    @Override
-    public void stop() {
-        logger.log(Level.INFO, "Stopping Kune...");
-        logger.log(Level.INFO, "Kune server stopped");
-    }
+  @Override
+  public void stop() {
+    logger.log(Level.INFO, "Stopping Kune...");
+    logger.log(Level.INFO, "Kune server stopped");
+  }
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -62,6 +62,8 @@
 
   Double getRateContent(User user, Content content);
 
+  Content moveContent(Content content, Container newContainer);
+
   RateResult rateContent(User rater, Long contentId, Double value) throws DefaultException;
 
   void removeAuthor(User user, Long contentId, String authorShortName) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -190,6 +190,18 @@
     }
   }
 
+  public Content moveContent(final Content content, final Container newContainer) {
+    final String title = content.getTitle();
+    if (findIfExistsTitle(newContainer, title)) {
+      throw new NameInUseException();
+    }
+    final Container oldContainer = content.getContainer();
+    oldContainer.removeContent(content);
+    newContainer.addContent(content);
+    content.setContainer(newContainer);
+    return persist(content);
+  }
+
   @Override
   public RateResult rateContent(final User rater, final Long contentId, final Double value)
       throws DefaultException {

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -316,6 +316,26 @@
 
   @Override
   @Authenticated
+  @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
+  @Transactional
+  public StateContainerDTO moveContent(final String userHash, final StateToken contentToken,
+      final StateToken newContainerToken) throws DefaultException {
+    final User user = getCurrentUser();
+    try {
+      final Content content = accessService.accessToContent(
+          ContentUtils.parseId(contentToken.getDocument()), user, AccessRol.Editor);
+      final Container newContainer = accessService.accessToContainer(
+          ContentUtils.parseId(newContainerToken.getFolder()), user, AccessRol.Editor);
+      final Container oldContainer = content.getContainer();
+      contentManager.moveContent(content, newContainer);
+      return getState(user, oldContainer);
+    } catch (final NoResultException e) {
+      throw new AccessViolationException();
+    }
+  }
+
+  @Override
+  @Authenticated
   @Authorizated(accessRolRequired = AccessRol.Viewer)
   @Transactional
   public RateResult rateContent(final String userHash, final StateToken token, final Double value)

Modified: trunk/src/main/java/cc/kune/domain/Container.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Container.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/domain/Container.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -238,6 +238,11 @@
     return parent == null;
   }
 
+  public void removeContent(final Content content) {
+    contents.size();
+    contents.remove(content);
+  }
+
   public void setAbsolutePath(final List<Container> absolutePath) {
     this.absolutePath = absolutePath;
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/gspace/client/tool/selector/ToolSelectorPanel.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -20,7 +20,6 @@
 package cc.kune.gspace.client.tool.selector;
 
 import cc.kune.core.client.dnd.FolderViewerDropController;
-import cc.kune.core.client.dnd.KuneDragController;
 import cc.kune.gspace.client.GSpaceArmor;
 import cc.kune.gspace.client.tool.selector.ToolSelectorItemPresenter.ToolSelectorItemView;
 import cc.kune.gspace.client.tool.selector.ToolSelectorPresenter.ToolSelectorView;
@@ -31,6 +30,7 @@
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
+import com.google.inject.Provider;
 import com.gwtplatform.mvp.client.ViewImpl;
 
 public class ToolSelectorPanel extends ViewImpl implements ToolSelectorView {
@@ -40,14 +40,16 @@
 
   private static ToolSelectorPanelUiBinder uiBinder = GWT.create(ToolSelectorPanelUiBinder.class);
 
-  private final KuneDragController dragController;
+  private final Provider<FolderViewerDropController> dropControllerProv;
 
   @UiField
   FlowPanel flow;
 
   @Inject
-  public ToolSelectorPanel(final GSpaceArmor wsArmor, final KuneDragController dragController) {
-    this.dragController = dragController;
+  public ToolSelectorPanel(final GSpaceArmor wsArmor,
+      final Provider<FolderViewerDropController> dropControllerProv) {
+    this.dropControllerProv = dropControllerProv;
+
     wsArmor.getEntityToolsCenter().add(uiBinder.createAndBindUi(this));
   }
 
@@ -55,7 +57,7 @@
   public void addItem(final ToolSelectorItemView item) {
     final Widget widget = item.asWidget();
     flow.add(widget);
-    new FolderViewerDropController(((ToolSelectorItemPanel) widget).getFlow(), dragController);
+    dropControllerProv.get().init(((ToolSelectorItemPanel) widget).getFlow());
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerPanel.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -23,6 +23,7 @@
 import cc.kune.common.client.ui.HasEditHandler;
 import cc.kune.common.client.ui.UiUtils;
 import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.dnd.FolderViewerDropController;
 import cc.kune.core.client.dnd.KuneDragController;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.shared.dto.StateContainerDTO;
@@ -35,12 +36,14 @@
 import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.InsertPanel.ForIsWidget;
 import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Provider;
 import com.gwtplatform.mvp.client.ViewImpl;
 
 public abstract class AbstractFolderViewerPanel extends ViewImpl implements FolderViewerView {
   protected final ContentCapabilitiesRegistry capabilitiesRegistry;
   private final ContentTitleWidget contentTitle;
   protected final KuneDragController dragController;
+  protected final Provider<FolderViewerDropController> dropControllerProv;
   private final InlineLabel emptyLabel;
   private final FlowPanel emptyPanel;
   protected final GSpaceArmor gsArmor;
@@ -48,11 +51,13 @@
   protected Widget widget;
 
   public AbstractFolderViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
-      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController) {
+      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
+      final Provider<FolderViewerDropController> dropControllerProv) {
     this.gsArmor = gsArmor;
     this.i18n = i18n;
     this.capabilitiesRegistry = capabilitiesRegistry;
     this.dragController = dragController;
+    this.dropControllerProv = dropControllerProv;
     emptyPanel = new FlowPanel();
     emptyLabel = new InlineLabel(i18n.t("This is empty."));
     emptyLabel.setStyleName("k-empty-msg");

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsFlowPanel.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -24,6 +24,7 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.ui.BasicThumb;
+import cc.kune.core.client.dnd.FolderViewerDropController;
 import cc.kune.core.client.dnd.KuneDragController;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.shared.dto.StateContainerDTO;
@@ -40,6 +41,7 @@
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
+import com.google.inject.Provider;
 
 public class FolderViewerAsFlowPanel extends AbstractFolderViewerPanel {
   interface FolderViewerAsFlowPanelUiBinder extends UiBinder<Widget, FolderViewerAsFlowPanel> {
@@ -52,8 +54,9 @@
 
   @Inject
   public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
-      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController) {
-    super(gsArmor, i18n, capabilitiesRegistry, dragController);
+      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
+      final Provider<FolderViewerDropController> dropControllerProv) {
+    super(gsArmor, i18n, capabilitiesRegistry, dragController, dropControllerProv);
     widget = uiBinder.createAndBindUi(this);
   }
 

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerAsTablePanel.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -49,6 +49,7 @@
 import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
+import com.google.inject.Provider;
 
 public class FolderViewerAsTablePanel extends AbstractFolderViewerPanel {
 
@@ -67,8 +68,9 @@
   @Inject
   public FolderViewerAsTablePanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
       final GuiProvider guiProvider, final CoreResources res,
-      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController) {
-    super(gsArmor, i18n, capabilitiesRegistry, dragController);
+      final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
+      final Provider<FolderViewerDropController> dropControllerProv) {
+    super(gsArmor, i18n, capabilitiesRegistry, dragController, dropControllerProv);
     this.guiProvider = guiProvider;
     this.res = res;
     widget = uiBinder.createAndBindUi(this);
@@ -144,7 +146,7 @@
       dragController.makeDraggable(itemWidget, itemWidget.getTitleWidget());
     }
     if (item.isDroppable()) {
-      new FolderViewerDropController(itemWidget, dragController);
+      dropControllerProv.get().init(itemWidget);
     }
   }
 

Modified: trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/test/java/cc/kune/core/server/PersistencePreLoadedDataTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -47,76 +47,80 @@
 import com.google.inject.Inject;
 
 public abstract class PersistencePreLoadedDataTest extends PersistenceTest {
-    protected static final String USER_EMAIL = "useremail at example.com";
-    protected static final String USER_LONG_NAME = "the user long name";
-    protected static final String USER_PASSWORD = "userPassword";
-    protected static final String USER_SHORT_NAME = "usershortname";
+  protected static final String USER_EMAIL = "useremail at example.com";
+  protected static final String USER_LONG_NAME = "the user long name";
+  protected static final String USER_PASSWORD = "userPassword";
+  protected static final String USER_SHORT_NAME = "usershortname";
 
-    protected Container container;
-    @Inject
-    protected ContainerManager containerManager;
-    protected Content content;
-    @Inject
-    protected ContentManager contentManager;
-    @Inject
-    protected I18nCountryManager countryManager;
-    protected License defLicense;
-    protected I18nLanguage english;
-    protected I18nCountry gb;
-    @Inject
-    protected GroupFinder groupFinder;
-    @Inject
-    protected GroupManager groupManager;
-    @Inject
-    protected I18nLanguageManager languageManager;
+  protected Container container;
+  @Inject
+  protected ContainerManager containerManager;
+  protected Content content;
+  @Inject
+  protected ContentManager contentManager;
+  @Inject
+  protected I18nCountryManager countryManager;
+  protected License defLicense;
+  protected I18nLanguage english;
+  protected I18nCountry gb;
+  @Inject
+  protected GroupFinder groupFinder;
+  @Inject
+  protected GroupManager groupManager;
+  @Inject
+  protected I18nLanguageManager languageManager;
+  @Inject
+  protected LicenseFinder licenseFinder;
+  @Inject
+  protected LicenseManager licenseManager;
+  protected Container otherContainer;
+  // @Inject
+  // protected PropertyGroupManager propGroupManager;
+  protected User user;
+  @Inject
+  protected UserFinder userFinder;
+  @Inject
+  protected UserManager userManager;
 
-    @Inject
-    protected LicenseFinder licenseFinder;
-    @Inject
-    protected LicenseManager licenseManager;
-    // @Inject
-    // protected PropertyGroupManager propGroupManager;
-    protected User user;
-    @Inject
-    protected UserFinder userFinder;
-    @Inject
-    protected UserManager userManager;
+  public PersistencePreLoadedDataTest() {
+  }
 
-    public PersistencePreLoadedDataTest() {
+  @After
+  public void close() {
+    if (getTransaction().isActive()) {
+      getTransaction().rollback();
     }
+  }
 
-    @After
-    public void close() {
-        if (getTransaction().isActive()) {
-            getTransaction().rollback();
-        }
-    }
-
-    @Before
-    public void preLoadData() throws Exception {
-        openTransaction();
-        assertEquals(0, userFinder.getAll().size());
-        assertEquals(0, groupFinder.getAll().size());
-        assertEquals(0, licenseFinder.getAll().size());
-        // final PropertyGroup groupProps = new PropertyGroup(Group.PROPS_ID);
-        // final PropertyGroup userProps = new PropertyGroup(User.PROPS_ID);
-        // propGroupManager.persist(userProps);
-        // propGroupManager.persist(groupProps);
-        english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
-        languageManager.persist(english);
-        gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
-        countryManager.persist(gb);
-        user = userManager.createUser(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, "en", "GB",
-                TimeZone.getDefault().getID());
-        defLicense = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "",
-                "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
-        licenseManager.persist(defLicense);
-        groupManager.createUserGroup(user, true);
-        content = new Content();
-        content.setLanguage(english);
-        contentManager.persist(content);
-        container = new Container();
-        container.setTypeId(TYPE_FOLDER);
-        containerManager.persist(container);
-    }
+  @Before
+  public void preLoadData() throws Exception {
+    openTransaction();
+    assertEquals(0, userFinder.getAll().size());
+    assertEquals(0, groupFinder.getAll().size());
+    assertEquals(0, licenseFinder.getAll().size());
+    // final PropertyGroup groupProps = new PropertyGroup(Group.PROPS_ID);
+    // final PropertyGroup userProps = new PropertyGroup(User.PROPS_ID);
+    // propGroupManager.persist(userProps);
+    // propGroupManager.persist(groupProps);
+    english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
+    languageManager.persist(english);
+    gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+        "western", ",");
+    countryManager.persist(gb);
+    user = userManager.createUser(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, "en",
+        "GB", TimeZone.getDefault().getID());
+    defLicense = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "",
+        "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
+    licenseManager.persist(defLicense);
+    groupManager.createUserGroup(user, true);
+    content = new Content();
+    content.setLanguage(english);
+    contentManager.persist(content);
+    container = new Container();
+    container.setTypeId(TYPE_FOLDER);
+    containerManager.persist(container);
+    otherContainer = new Container();
+    otherContainer.setTypeId(TYPE_FOLDER);
+    containerManager.persist(otherContainer);
+  }
 }

Added: trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContentManagerDefaultTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -0,0 +1,140 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.server.manager;
+
+import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
+import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import cc.kune.core.client.errors.NameInUseException;
+import cc.kune.core.server.PersistencePreLoadedDataTest;
+import cc.kune.core.server.manager.impl.SearchResult;
+import cc.kune.domain.BasicMimeType;
+import cc.kune.domain.Content;
+
+public class ContentManagerDefaultTest extends PersistencePreLoadedDataTest {
+
+  private static final String BODY = "body";
+  private static final String MIMETYPE = "image";
+  private static final String TITLE = "title";
+
+  private Content createContent() {
+    assertNotNull(container);
+    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
+    persist(cnt);
+    containerManager.persist(container);
+    return cnt;
+  }
+
+  private void createContentWithMimeAndCheck(final String mimetype) {
+    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
+    cnt.setMimeType(new BasicMimeType(mimetype));
+    persist(cnt);
+    final Content newCnt = contentManager.find(cnt.getId());
+    assertEquals(mimetype, newCnt.getMimeType().toString());
+  }
+
+  @Ignore
+  @Test
+  public void testBasicBodySearch() {
+    createContent();
+    final SearchResult<Content> search = contentManager.search(BODY);
+    contentManager.reIndex();
+    assertEquals(1, search.getSize());
+  }
+
+  @Test
+  public void testBasicMimePersist() {
+    final String mimetype = "application/pdf";
+    createContentWithMimeAndCheck(mimetype);
+  }
+
+  @Test
+  public void testBasicMimePersistWithoutSubtype() {
+    final String mimetype = "application";
+    createContentWithMimeAndCheck(mimetype);
+  }
+
+  @Test
+  public void testBasicMimeSearchWithQueriesAndFields() {
+    createContentWithMimeAndCheck(MIMETYPE + "/png");
+    contentManager.reIndex();
+    final SearchResult<Content> search = contentManager.search(new String[] { MIMETYPE },
+        new String[] { "mimeType.mimetype" }, 0, 10);
+    assertEquals(1, search.getSize());
+  }
+
+  @Test
+  public void testBasicMove() {
+    final Content content = createContent();
+    final Content newContent = contentManager.moveContent(content, otherContainer);
+    assertEquals(newContent.getContainer(), otherContainer);
+  }
+
+  @Test(expected = NameInUseException.class)
+  public void testBasicMoveWithExistingNameShouldFail() {
+    final Content content = createContent();
+    final Content sameNameCnt = contentManager.createContent(TITLE, BODY, user, otherContainer,
+        TYPE_UPLOADEDFILE);
+    persist(sameNameCnt);
+    contentManager.moveContent(content, otherContainer);
+  }
+
+  @Test
+  public void testBasicSearchWithQueriesAndFields() {
+    createContentWithMimeAndCheck(MIMETYPE);
+    final SearchResult<Content> search = contentManager.search(new String[] { BODY },
+        new String[] { "lastRevision.body" }, 0, 10);
+    contentManager.reIndex();
+    assertEquals(1, search.getSize());
+  }
+
+  @Test
+  public void testBasicTitleSearch() {
+    createContent();
+    final SearchResult<Content> search = contentManager.search(TITLE);
+    contentManager.reIndex();
+    assertEquals(1, search.getSize());
+  }
+
+  @Ignore
+  @Test
+  public void testtMimeSearch() {
+    createContentWithMimeAndCheck(MIMETYPE + "/png");
+    contentManager.reIndex();
+    final SearchResult<Content> search = contentManager.searchMime(BODY, 0, 10, "asb", MIMETYPE);
+    assertEquals(1, search.getSize());
+  }
+
+  /**
+   * This normally fails with mysql (not configured for utf-8), see the INSTALL
+   * mysql section
+   */
+  @Test
+  public void testUTF8Persist() {
+    final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container, TYPE_DOCUMENT);
+    final Content newCnt = contentManager.find(cnt.getId());
+    assertEquals("汉语/漢語", newCnt.getTitle());
+  }
+}

Deleted: trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/test/java/cc/kune/core/server/manager/ContentManagerTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -1,119 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.server.manager;
-
-import static cc.kune.docs.shared.DocsConstants.TYPE_DOCUMENT;
-import static cc.kune.docs.shared.DocsConstants.TYPE_UPLOADEDFILE;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import cc.kune.core.server.PersistencePreLoadedDataTest;
-import cc.kune.core.server.manager.impl.SearchResult;
-import cc.kune.domain.BasicMimeType;
-import cc.kune.domain.Content;
-
-public class ContentManagerTest extends PersistencePreLoadedDataTest {
-
-  private static final String BODY = "body";
-  private static final String MIMETYPE = "image";
-  private static final String TITLE = "title";
-
-  private void createContent() {
-    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
-    persist(cnt);
-  }
-
-  private void createContentWithMimeAndCheck(final String mimetype) {
-    final Content cnt = contentManager.createContent(TITLE, BODY, user, container, TYPE_UPLOADEDFILE);
-    cnt.setMimeType(new BasicMimeType(mimetype));
-    persist(cnt);
-    final Content newCnt = contentManager.find(cnt.getId());
-    assertEquals(mimetype, newCnt.getMimeType().toString());
-  }
-
-  @Ignore
-  @Test
-  public void testBasicBodySearch() {
-    createContent();
-    final SearchResult<Content> search = contentManager.search(BODY);
-    contentManager.reIndex();
-    assertEquals(1, search.getSize());
-  }
-
-  @Test
-  public void testBasicMimePersist() {
-    final String mimetype = "application/pdf";
-    createContentWithMimeAndCheck(mimetype);
-  }
-
-  @Test
-  public void testBasicMimePersistWithoutSubtype() {
-    final String mimetype = "application";
-    createContentWithMimeAndCheck(mimetype);
-  }
-
-  @Test
-  public void testBasicMimeSearchWithQueriesAndFields() {
-    createContentWithMimeAndCheck(MIMETYPE + "/png");
-    contentManager.reIndex();
-    final SearchResult<Content> search = contentManager.search(new String[] { MIMETYPE },
-        new String[] { "mimeType.mimetype" }, 0, 10);
-    assertEquals(1, search.getSize());
-  }
-
-  @Test
-  public void testBasicSearchWithQueriesAndFields() {
-    createContentWithMimeAndCheck(MIMETYPE);
-    final SearchResult<Content> search = contentManager.search(new String[] { BODY },
-        new String[] { "lastRevision.body" }, 0, 10);
-    contentManager.reIndex();
-    assertEquals(1, search.getSize());
-  }
-
-  @Test
-  public void testBasicTitleSearch() {
-    createContent();
-    final SearchResult<Content> search = contentManager.search(TITLE);
-    contentManager.reIndex();
-    assertEquals(1, search.getSize());
-  }
-
-  @Ignore
-  @Test
-  public void testtMimeSearch() {
-    createContentWithMimeAndCheck(MIMETYPE + "/png");
-    contentManager.reIndex();
-    final SearchResult<Content> search = contentManager.searchMime(BODY, 0, 10, "asb", MIMETYPE);
-    assertEquals(1, search.getSize());
-  }
-
-  /**
-   * This normally fails with mysql (not configured for utf-8), see the INSTALL
-   * mysql section
-   */
-  @Test
-  public void testUTF8Persist() {
-    final Content cnt = contentManager.createContent("汉语/漢語", "汉语/漢語", user, container, TYPE_DOCUMENT);
-    final Content newCnt = contentManager.find(cnt.getId());
-    assertEquals("汉语/漢語", newCnt.getTitle());
-  }
-}

Added: trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -0,0 +1,203 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.server.manager;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.TimeZone;
+
+import org.apache.lucene.queryParser.ParseException;
+import org.hibernate.validator.InvalidStateException;
+import org.junit.Test;
+
+import cc.kune.core.client.errors.EmailAddressInUseException;
+import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.I18nNotFoundException;
+import cc.kune.core.client.errors.UserRegistrationException;
+import cc.kune.core.server.PersistencePreLoadedDataTest;
+import cc.kune.core.server.manager.impl.SearchResult;
+import cc.kune.core.shared.dto.GroupType;
+import cc.kune.domain.AccessLists;
+import cc.kune.domain.Group;
+import cc.kune.domain.SocialNetwork;
+import cc.kune.domain.User;
+
+public class GroupManagerDefaultTest extends PersistencePreLoadedDataTest {
+
+    private static final String PUBLIC_DESCRIP = "Some public descrip";
+
+    @Test
+    public void createdGroupShoudHaveValidSocialNetwork() throws Exception {
+        final Group group = new Group("short", "longName", defLicense, GroupType.PROJECT);
+        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+        final SocialNetwork socialNetwork = group.getSocialNetwork();
+        final AccessLists lists = socialNetwork.getAccessLists();
+        assertTrue(lists.getAdmins().includes(user.getUserGroup()));
+        assertTrue(lists.getEditors().isEmpty());
+        assertTrue(lists.getViewers().isEmpty());
+        closeTransaction();
+    }
+
+    @Test
+    public void createGroup() throws Exception {
+        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+        final Group otherGroup = groupManager.findByShortName("ysei");
+
+        assertEquals(group.getLongName(), otherGroup.getLongName());
+        assertEquals(group.getShortName(), otherGroup.getShortName());
+        closeTransaction();
+    }
+
+    @Test
+    public void createGroupAndSearch() throws Exception, ParseException {
+        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+        groupManager.reIndex();
+        final SearchResult<Group> result = groupManager.search("ysei");
+        assertEquals(1, result.getSize());
+        assertEquals("ysei", result.getList().get(0).getShortName());
+        rollbackTransaction();
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createGroupWithExistingLongName() throws Exception {
+        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+
+        final Group group2 = new Group("ysei2", "Yellow Submarine Environmental Initiative", defLicense,
+                GroupType.PROJECT);
+        group2.setDefaultLicense(defLicense);
+        groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
+
+        rollbackTransaction();
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createGroupWithExistingShortName() throws Exception {
+        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
+
+        final Group group2 = new Group("ysei", "Yellow Submarine Environmental Initiative 2", defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
+
+        rollbackTransaction();
+    }
+
+    private void createTestGroup(final int number) throws Exception {
+        final Group g = new Group("ysei" + number, "Yellow Submarine Environmental Initiative " + number, defLicense,
+                GroupType.PROJECT);
+        groupManager.createGroup(g, user, PUBLIC_DESCRIP);
+    }
+
+    @Test(expected = EmailAddressInUseException.class)
+    public void createUserExistingEmail() throws I18nNotFoundException, GroupNameInUseException,
+            EmailAddressInUseException {
+        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user1);
+        final User user2 = userManager.createUser("test2", "test 2 name", "test1 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user2);
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createUserExistingLongName() throws I18nNotFoundException, GroupNameInUseException,
+            EmailAddressInUseException {
+        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user1);
+        final User user2 = userManager.createUser("test2", "test 1 name", "test2 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user2);
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createUserExistingShortName() throws I18nNotFoundException, GroupNameInUseException,
+            EmailAddressInUseException {
+        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user1);
+        final User user2 = userManager.createUser("test", "test 2 name", "test2 at example.com", "some password", "en",
+                "GB", "GMT");
+        groupManager.createUserGroup(user2);
+    }
+
+    @Test(expected = EmailAddressInUseException.class)
+    public void createUserWithExistingEmail() throws Exception {
+        final User user2 = userManager.createUser("username2", "the user name 2", USER_EMAIL, "userPassword", "en",
+                "GB", TimeZone.getDefault().getID());
+        groupManager.createUserGroup(user2);
+        rollbackTransaction();
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createUserWithExistingLongName() throws Exception {
+        final User user2 = userManager.createUser("username2", USER_LONG_NAME, "email2 at example.com", "userPassword",
+                "en", "GB", TimeZone.getDefault().getID());
+        groupManager.createUserGroup(user2);
+        rollbackTransaction();
+    }
+
+    @Test(expected = GroupNameInUseException.class)
+    public void createUserWithExistingShortName() throws Exception {
+        final User user2 = userManager.createUser(USER_SHORT_NAME, "the user name 2", "email2 at example.com",
+                "userPassword", "en", "GB", TimeZone.getDefault().getID());
+        groupManager.createUserGroup(user2);
+        rollbackTransaction();
+    }
+
+    @Test(expected = UserRegistrationException.class)
+    public void createUserWithIncorrectShortName() throws Exception {
+        final User user2 = userManager.createUser("u s", "the user name 2", "email2 at example.com", "userPassword", "en",
+                "GB", TimeZone.getDefault().getID());
+        groupManager.createUserGroup(user2);
+        rollbackTransaction();
+    }
+
+    @Test(expected = InvalidStateException.class)
+    public void createUserWithVeryShortName() throws Exception {
+        final User user2 = userManager.createUser("us", "the user name 2", "email2 at example.com", "userPassword", "en",
+                "GB", TimeZone.getDefault().getID());
+        groupManager.createUserGroup(user2);
+        rollbackTransaction();
+    }
+
+    @Test
+    public void groupSearchPagination() throws Exception, ParseException {
+        for (int i = 1; i < 10; i++) {
+            createTestGroup(i);
+        }
+        groupManager.reIndex();
+        final SearchResult<Group> result = groupManager.search("Yellow", 0, 5);
+        assertEquals(9, result.getSize());
+        assertEquals(5, result.getList().size());
+        final SearchResult<Group> result2 = groupManager.search("Yellow", 5, 5);
+        assertEquals(9, result2.getSize());
+        assertEquals(4, result2.getList().size());
+        rollbackTransaction();
+    }
+}

Deleted: trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/test/java/cc/kune/core/server/manager/GroupManagerTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -1,203 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.server.manager;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.TimeZone;
-
-import org.apache.lucene.queryParser.ParseException;
-import org.hibernate.validator.InvalidStateException;
-import org.junit.Test;
-
-import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
-import cc.kune.core.client.errors.I18nNotFoundException;
-import cc.kune.core.client.errors.UserRegistrationException;
-import cc.kune.core.server.PersistencePreLoadedDataTest;
-import cc.kune.core.server.manager.impl.SearchResult;
-import cc.kune.core.shared.dto.GroupType;
-import cc.kune.domain.AccessLists;
-import cc.kune.domain.Group;
-import cc.kune.domain.SocialNetwork;
-import cc.kune.domain.User;
-
-public class GroupManagerTest extends PersistencePreLoadedDataTest {
-
-    private static final String PUBLIC_DESCRIP = "Some public descrip";
-
-    @Test
-    public void createdGroupShoudHaveValidSocialNetwork() throws Exception {
-        final Group group = new Group("short", "longName", defLicense, GroupType.PROJECT);
-        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
-        final SocialNetwork socialNetwork = group.getSocialNetwork();
-        final AccessLists lists = socialNetwork.getAccessLists();
-        assertTrue(lists.getAdmins().includes(user.getUserGroup()));
-        assertTrue(lists.getEditors().isEmpty());
-        assertTrue(lists.getViewers().isEmpty());
-        closeTransaction();
-    }
-
-    @Test
-    public void createGroup() throws Exception {
-        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
-        final Group otherGroup = groupManager.findByShortName("ysei");
-
-        assertEquals(group.getLongName(), otherGroup.getLongName());
-        assertEquals(group.getShortName(), otherGroup.getShortName());
-        closeTransaction();
-    }
-
-    @Test
-    public void createGroupAndSearch() throws Exception, ParseException {
-        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
-        groupManager.reIndex();
-        final SearchResult<Group> result = groupManager.search("ysei");
-        assertEquals(1, result.getSize());
-        assertEquals("ysei", result.getList().get(0).getShortName());
-        rollbackTransaction();
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createGroupWithExistingLongName() throws Exception {
-        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
-
-        final Group group2 = new Group("ysei2", "Yellow Submarine Environmental Initiative", defLicense,
-                GroupType.PROJECT);
-        group2.setDefaultLicense(defLicense);
-        groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
-
-        rollbackTransaction();
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createGroupWithExistingShortName() throws Exception {
-        final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(group, user, PUBLIC_DESCRIP);
-
-        final Group group2 = new Group("ysei", "Yellow Submarine Environmental Initiative 2", defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(group2, user, PUBLIC_DESCRIP);
-
-        rollbackTransaction();
-    }
-
-    private void createTestGroup(final int number) throws Exception {
-        final Group g = new Group("ysei" + number, "Yellow Submarine Environmental Initiative " + number, defLicense,
-                GroupType.PROJECT);
-        groupManager.createGroup(g, user, PUBLIC_DESCRIP);
-    }
-
-    @Test(expected = EmailAddressInUseException.class)
-    public void createUserExistingEmail() throws I18nNotFoundException, GroupNameInUseException,
-            EmailAddressInUseException {
-        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user1);
-        final User user2 = userManager.createUser("test2", "test 2 name", "test1 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user2);
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createUserExistingLongName() throws I18nNotFoundException, GroupNameInUseException,
-            EmailAddressInUseException {
-        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user1);
-        final User user2 = userManager.createUser("test2", "test 1 name", "test2 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user2);
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createUserExistingShortName() throws I18nNotFoundException, GroupNameInUseException,
-            EmailAddressInUseException {
-        final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user1);
-        final User user2 = userManager.createUser("test", "test 2 name", "test2 at example.com", "some password", "en",
-                "GB", "GMT");
-        groupManager.createUserGroup(user2);
-    }
-
-    @Test(expected = EmailAddressInUseException.class)
-    public void createUserWithExistingEmail() throws Exception {
-        final User user2 = userManager.createUser("username2", "the user name 2", USER_EMAIL, "userPassword", "en",
-                "GB", TimeZone.getDefault().getID());
-        groupManager.createUserGroup(user2);
-        rollbackTransaction();
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createUserWithExistingLongName() throws Exception {
-        final User user2 = userManager.createUser("username2", USER_LONG_NAME, "email2 at example.com", "userPassword",
-                "en", "GB", TimeZone.getDefault().getID());
-        groupManager.createUserGroup(user2);
-        rollbackTransaction();
-    }
-
-    @Test(expected = GroupNameInUseException.class)
-    public void createUserWithExistingShortName() throws Exception {
-        final User user2 = userManager.createUser(USER_SHORT_NAME, "the user name 2", "email2 at example.com",
-                "userPassword", "en", "GB", TimeZone.getDefault().getID());
-        groupManager.createUserGroup(user2);
-        rollbackTransaction();
-    }
-
-    @Test(expected = UserRegistrationException.class)
-    public void createUserWithIncorrectShortName() throws Exception {
-        final User user2 = userManager.createUser("u s", "the user name 2", "email2 at example.com", "userPassword", "en",
-                "GB", TimeZone.getDefault().getID());
-        groupManager.createUserGroup(user2);
-        rollbackTransaction();
-    }
-
-    @Test(expected = InvalidStateException.class)
-    public void createUserWithVeryShortName() throws Exception {
-        final User user2 = userManager.createUser("us", "the user name 2", "email2 at example.com", "userPassword", "en",
-                "GB", TimeZone.getDefault().getID());
-        groupManager.createUserGroup(user2);
-        rollbackTransaction();
-    }
-
-    @Test
-    public void groupSearchPagination() throws Exception, ParseException {
-        for (int i = 1; i < 10; i++) {
-            createTestGroup(i);
-        }
-        groupManager.reIndex();
-        final SearchResult<Group> result = groupManager.search("Yellow", 0, 5);
-        assertEquals(9, result.getSize());
-        assertEquals(5, result.getList().size());
-        final SearchResult<Group> result2 = groupManager.search("Yellow", 5, 5);
-        assertEquals(9, result2.getSize());
-        assertEquals(4, result2.getList().size());
-        rollbackTransaction();
-    }
-}

Added: trunk/src/test/java/cc/kune/core/server/manager/I18nManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/I18nManagerDefaultTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/server/manager/I18nManagerDefaultTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -0,0 +1,179 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.server.manager;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import cc.kune.core.server.PersistenceTest;
+import cc.kune.core.server.manager.I18nCountryManager;
+import cc.kune.core.server.manager.I18nLanguageManager;
+import cc.kune.core.server.manager.I18nTranslationManager;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.domain.I18nCountry;
+import cc.kune.domain.I18nLanguage;
+import cc.kune.domain.I18nTranslation;
+
+import com.google.inject.Inject;
+
+public class I18nManagerDefaultTest extends PersistenceTest {
+    @Inject
+    I18nTranslationManager translationManager;
+    @Inject
+    I18nCountryManager countryManager;
+    @Inject
+    I18nLanguageManager languageManager;
+    @Inject
+    I18nTranslationService translationService;
+
+    @Test
+    public void byDefaultUseEnglish() {
+        HashMap<String, String> map = translationManager.getLexicon("en");
+        HashMap<String, String> map2 = translationManager.getLexicon("af");
+        assertEquals(map.size(), map2.size());
+    }
+
+    @After
+    public void close() {
+        if (getTransaction().isActive()) {
+            getTransaction().rollback();
+        }
+    }
+
+    @Test
+    public void getNonExistentTranslationInAnyLangReturnsKey() {
+        HashMap<String, String> map = translationManager.getLexicon("en");
+        HashMap<String, String> map2 = translationManager.getLexicon("aa");
+        int initialSize = map.size();
+        int initialSize2 = map2.size();
+
+        String translation = translationManager.getTranslation("es", "Foo foo foo");
+        String translation2 = translationManager.getTranslation("aa", "Foo foo foo");
+
+        assertEquals(I18nTranslation.UNTRANSLATED_VALUE, translation);
+        assertEquals(I18nTranslation.UNTRANSLATED_VALUE, translation2);
+
+        map = translationManager.getLexicon("en");
+        map2 = translationManager.getLexicon("aa");
+        int newSize = map.size();
+        int newSize2 = map2.size();
+
+        assertEquals(initialSize + 1, newSize);
+        assertEquals(initialSize2 + 1, newSize2);
+    }
+
+    @Test
+    public void getNonExistentTranslationReturnsDefaultLanguage() {
+        String translation = translationManager.getTranslation("af", "January [month]");
+        assertEquals("January", translation);
+    }
+
+    @Test
+    public void getTranslation() {
+        String translation = translationManager.getTranslation("af", "Sunday [weekday]");
+        assertEquals("Sondag", translation);
+    }
+
+    @Test
+    public void getTranslationUTF8() {
+        String translation = translationManager.getTranslation("el", "January [month]");
+        assertEquals("Ιανουάριος", translation);
+    }
+
+    @Test
+    public void getTranslationWithIntArg() {
+        String translation = translationManager.getTranslation("en", "[%d] users", 20);
+        assertEquals("20 users", translation);
+    }
+
+    @Test
+    public void getTranslationWithIntArgFromService() {
+        String translation = translationService.t("[%d] users", 20);
+        assertEquals("20 users", translation);
+    }
+
+    @Test
+    public void getTranslationWithIntArgFromWithNtService() {
+        String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
+        assertEquals("20 users", translation);
+    }
+
+    @Test
+    public void getTranslationWithStringArg() {
+        String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
+        assertEquals("Twenty users", translation);
+    }
+
+    @Test
+    public void getTranslationWithStringArgFromService() {
+        String translation = translationService.t("[%s] users", "Twenty");
+        assertEquals("Twenty users", translation);
+    }
+
+    @Test
+    public void getTranslationWithStringArgWithNtFromService() {
+        String translation = translationService.tWithNT("[%s] users", "foo foo", "Twenty");
+        assertEquals("Twenty users", translation);
+    }
+
+    @Before
+    public void insertData() {
+        openTransaction();
+        I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
+        I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "Spanish", "Español", "es");
+        I18nLanguage afrikaans = new I18nLanguage(Long.valueOf(114), "Afrikaans", "Afrikaans", "af");
+        I18nLanguage greek = new I18nLanguage(Long.valueOf(1793), "Greek", "Ελληνικά", "el");
+        languageManager.persist(english);
+        languageManager.persist(spanish);
+        languageManager.persist(afrikaans);
+        languageManager.persist(greek);
+        translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
+        translationManager.persist(new I18nTranslation("January [month]", english, "January"));
+        translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
+        translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
+        translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
+                StringEscapeUtils.escapeHtml("[%s] users")));
+        translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
+                StringEscapeUtils.escapeHtml("[%d] users")));
+        I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+                "western", ",");
+        countryManager.persist(gb);
+    }
+
+    @Test
+    public void setTranslation() {
+        translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
+        String translation = translationManager.getTranslation("en", "Foo foo foo");
+        assertEquals("Foo foo foo translation", translation);
+    }
+
+    @Test
+    public void testGetLexicon() {
+        HashMap<String, String> map = translationManager.getLexicon("af");
+        assertTrue(map.size() > 0);
+    }
+}

Deleted: trunk/src/test/java/cc/kune/core/server/manager/I18nManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/I18nManagerTest.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/test/java/cc/kune/core/server/manager/I18nManagerTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -1,179 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.server.manager;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashMap;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import cc.kune.core.server.PersistenceTest;
-import cc.kune.core.server.manager.I18nCountryManager;
-import cc.kune.core.server.manager.I18nLanguageManager;
-import cc.kune.core.server.manager.I18nTranslationManager;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.domain.I18nCountry;
-import cc.kune.domain.I18nLanguage;
-import cc.kune.domain.I18nTranslation;
-
-import com.google.inject.Inject;
-
-public class I18nManagerTest extends PersistenceTest {
-    @Inject
-    I18nTranslationManager translationManager;
-    @Inject
-    I18nCountryManager countryManager;
-    @Inject
-    I18nLanguageManager languageManager;
-    @Inject
-    I18nTranslationService translationService;
-
-    @Test
-    public void byDefaultUseEnglish() {
-        HashMap<String, String> map = translationManager.getLexicon("en");
-        HashMap<String, String> map2 = translationManager.getLexicon("af");
-        assertEquals(map.size(), map2.size());
-    }
-
-    @After
-    public void close() {
-        if (getTransaction().isActive()) {
-            getTransaction().rollback();
-        }
-    }
-
-    @Test
-    public void getNonExistentTranslationInAnyLangReturnsKey() {
-        HashMap<String, String> map = translationManager.getLexicon("en");
-        HashMap<String, String> map2 = translationManager.getLexicon("aa");
-        int initialSize = map.size();
-        int initialSize2 = map2.size();
-
-        String translation = translationManager.getTranslation("es", "Foo foo foo");
-        String translation2 = translationManager.getTranslation("aa", "Foo foo foo");
-
-        assertEquals(I18nTranslation.UNTRANSLATED_VALUE, translation);
-        assertEquals(I18nTranslation.UNTRANSLATED_VALUE, translation2);
-
-        map = translationManager.getLexicon("en");
-        map2 = translationManager.getLexicon("aa");
-        int newSize = map.size();
-        int newSize2 = map2.size();
-
-        assertEquals(initialSize + 1, newSize);
-        assertEquals(initialSize2 + 1, newSize2);
-    }
-
-    @Test
-    public void getNonExistentTranslationReturnsDefaultLanguage() {
-        String translation = translationManager.getTranslation("af", "January [month]");
-        assertEquals("January", translation);
-    }
-
-    @Test
-    public void getTranslation() {
-        String translation = translationManager.getTranslation("af", "Sunday [weekday]");
-        assertEquals("Sondag", translation);
-    }
-
-    @Test
-    public void getTranslationUTF8() {
-        String translation = translationManager.getTranslation("el", "January [month]");
-        assertEquals("Ιανουάριος", translation);
-    }
-
-    @Test
-    public void getTranslationWithIntArg() {
-        String translation = translationManager.getTranslation("en", "[%d] users", 20);
-        assertEquals("20 users", translation);
-    }
-
-    @Test
-    public void getTranslationWithIntArgFromService() {
-        String translation = translationService.t("[%d] users", 20);
-        assertEquals("20 users", translation);
-    }
-
-    @Test
-    public void getTranslationWithIntArgFromWithNtService() {
-        String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
-        assertEquals("20 users", translation);
-    }
-
-    @Test
-    public void getTranslationWithStringArg() {
-        String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
-        assertEquals("Twenty users", translation);
-    }
-
-    @Test
-    public void getTranslationWithStringArgFromService() {
-        String translation = translationService.t("[%s] users", "Twenty");
-        assertEquals("Twenty users", translation);
-    }
-
-    @Test
-    public void getTranslationWithStringArgWithNtFromService() {
-        String translation = translationService.tWithNT("[%s] users", "foo foo", "Twenty");
-        assertEquals("Twenty users", translation);
-    }
-
-    @Before
-    public void insertData() {
-        openTransaction();
-        I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
-        I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "Spanish", "Español", "es");
-        I18nLanguage afrikaans = new I18nLanguage(Long.valueOf(114), "Afrikaans", "Afrikaans", "af");
-        I18nLanguage greek = new I18nLanguage(Long.valueOf(1793), "Greek", "Ελληνικά", "el");
-        languageManager.persist(english);
-        languageManager.persist(spanish);
-        languageManager.persist(afrikaans);
-        languageManager.persist(greek);
-        translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
-        translationManager.persist(new I18nTranslation("January [month]", english, "January"));
-        translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
-        translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
-        translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
-                StringEscapeUtils.escapeHtml("[%s] users")));
-        translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
-                StringEscapeUtils.escapeHtml("[%d] users")));
-        I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
-                "western", ",");
-        countryManager.persist(gb);
-    }
-
-    @Test
-    public void setTranslation() {
-        translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
-        String translation = translationManager.getTranslation("en", "Foo foo foo");
-        assertEquals("Foo foo foo translation", translation);
-    }
-
-    @Test
-    public void testGetLexicon() {
-        HashMap<String, String> map = translationManager.getLexicon("af");
-        assertTrue(map.size() > 0);
-    }
-}

Added: trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerDefaultTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerDefaultTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -0,0 +1,64 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.server.manager;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import cc.kune.core.server.PersistenceTest;
+import cc.kune.core.server.manager.LicenseManager;
+import cc.kune.domain.License;
+import cc.kune.domain.finders.LicenseFinder;
+
+import com.google.inject.Inject;
+
+public class LicenseManagerDefaultTest extends PersistenceTest {
+    private License license;
+    @Inject
+    LicenseFinder licenseFinder;
+    @Inject
+    LicenseManager licenseManager;
+
+    @After
+    public void close() {
+        if (getTransaction().isActive()) {
+            getTransaction().rollback();
+        }
+    }
+
+    @Before
+    public void insertData() {
+        openTransaction();
+        assertEquals(0, licenseFinder.getAll().size());
+        license = new License("by", "Creative Commons Attribution", "", "http://creativecommons.org/licenses/by/3.0/",
+                true, false, false, "", "");
+        licenseManager.persist(license);
+    }
+
+    @Test
+    public void testLicenseCreation() {
+        assertNotNull(license.getId());
+        assertEquals(1, licenseFinder.getAll().size());
+    }
+}

Deleted: trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerTest.java	2011-07-25 22:00:29 UTC (rev 1463)
+++ trunk/src/test/java/cc/kune/core/server/manager/LicenseManagerTest.java	2011-07-26 03:03:13 UTC (rev 1464)
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.server.manager;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import cc.kune.core.server.PersistenceTest;
-import cc.kune.core.server.manager.LicenseManager;
-import cc.kune.domain.License;
-import cc.kune.domain.finders.LicenseFinder;
-
-import com.google.inject.Inject;
-
-public class LicenseManagerTest extends PersistenceTest {
-    private License license;
-    @Inject
-    LicenseFinder licenseFinder;
-    @Inject
-    LicenseManager licenseManager;
-
-    @After
-    public void close() {
-        if (getTransaction().isActive()) {
-            getTransaction().rollback();
-        }
-    }
-
-    @Before
-    public void insertData() {
-        openTransaction();
-        assertEquals(0, licenseFinder.getAll().size());
-        license = new License("by", "Creative Commons Attribution", "", "http://creativecommons.org/licenses/by/3.0/",
-                true, false, false, "", "");
-        licenseManager.persist(license);
-    }
-
-    @Test
-    public void testLicenseCreation() {
-        assertNotNull(license.getId());
-        assertEquals(1, licenseFinder.getAll().size());
-    }
-}




More information about the kune-commits mailing list