Author: vjrj_ Date: 2011-03-25 23:16:57 +0100 (Fri, 25 Mar 2011) New Revision: 1299 Added: trunk/src/test/java/cc/kune/core/server/integration/ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java trunk/src/test/java/cc/kune/core/server/integration/content/ trunk/src/test/java/cc/kune/core/server/integration/kuneservice/ trunk/src/test/java/cc/kune/core/server/integration/selenium/ trunk/src/test/java/cc/kune/core/server/integration/site/ trunk/src/test/java/cc/kune/core/server/integration/socialnet/ trunk/src/test/java/cc/kune/core/server/rack/ trunk/src/test/java/cc/kune/core/server/rack/filters/ trunk/src/test/java/cc/kune/core/server/rack/filters/rest/ trunk/src/test/java/cc/kune/core/server/testhelper/ trunk/src/test/java/cc/kune/core/server/testhelper/ctx/ Removed: trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java trunk/src/test/java/org/ourproject/kune/platf/integration/content/ trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/ trunk/src/test/java/org/ourproject/kune/platf/integration/site/ trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/ trunk/src/test/java/org/ourproject/kune/rack/filters/rest/ trunk/src/test/java/org/ourproject/kune/testhelper/ctx/ Modified: trunk/src/test/java/cc/kune/core/server/TestHelper.java trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentCommentServiceTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceIntegrationTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java trunk/src/test/java/cc/kune/core/server/integration/site/SiteServiceTest.java trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java trunk/src/test/java/cc/kune/core/server/manager/impl/AbstractSocialNetworkManagerTest.java trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTMethodFinder.java trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTServiceDefinition.java trunk/src/test/java/cc/kune/core/server/testhelper/ctx/DomainContext.java trunk/src/test/java/cc/kune/core/server/testhelper/ctx/SocialNetworkOperator.java trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java trunk/src/test/java/testsuites/IntegrationTestSuite.java trunk/src/test/java/testsuites/OthersTestSuite.java Log: server refactorization Modified: trunk/src/test/java/cc/kune/core/server/TestHelper.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -22,7 +22,6 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.configuration.ConfigurationException; -import org.ourproject.kune.platf.integration.HttpServletRequestMocked; import org.waveprotocol.box.server.CoreSettings; import org.waveprotocol.box.server.ServerModule; import org.waveprotocol.box.server.authentication.AccountStoreHolder; @@ -32,6 +31,7 @@ import org.waveprotocol.wave.federation.noop.NoOpFederationModule; import cc.kune.core.server.init.FinderRegistry; +import cc.kune.core.server.integration.HttpServletRequestMocked; import cc.kune.core.server.properties.PropertiesFileName; import cc.kune.wave.server.CustomSettingsBinder; Modified: trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -24,10 +24,10 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.testhelper.ctx.DomainContext; import cc.kune.core.server.TestDomainHelper; import cc.kune.core.server.access.AccessRightsServiceDefault; +import cc.kune.core.server.testhelper.ctx.DomainContext; import cc.kune.core.shared.domain.utils.AccessRights; import cc.kune.domain.AccessLists; import cc.kune.domain.Group; Modified: trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -25,13 +25,13 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.SessionExpiredException; import cc.kune.core.client.errors.UserMustBeLoggedException; import cc.kune.core.server.auth.Authenticated; import cc.kune.core.server.auth.AuthenticatedMethodInterceptor; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; public class AuthenticatedMethodInterceptorTest extends IntegrationTest { Modified: trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -25,14 +25,14 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.AccessViolationException; import cc.kune.core.client.errors.ContentNotFoundException; import cc.kune.core.server.auth.ActionLevel; import cc.kune.core.server.auth.Authorizated; import cc.kune.core.server.auth.AuthorizatedMethodInterceptor; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.AccessRol; import cc.kune.core.shared.domain.utils.StateToken; Copied: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -0,0 +1,125 @@ +/* + * + * 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.integration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.ourproject.kune.chat.server.ChatServerTool; +import org.ourproject.kune.docs.server.DocumentServerTool; + +import cc.kune.core.server.content.ContainerManager; +import cc.kune.core.server.content.ContentManager; +import cc.kune.core.server.manager.GroupManager; +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.server.manager.LicenseManager; +import cc.kune.domain.Container; +import cc.kune.domain.Content; +import cc.kune.domain.Group; +import cc.kune.domain.ToolConfiguration; + +import com.google.inject.Inject; +import com.google.inject.persist.Transactional; + +public class DatabaseInitializationTest { + @Inject + GroupManager groupManager; + @Inject + LicenseManager licenseManager; + @Inject + I18nTranslationManager transManager; + @Inject + I18nLanguageManager languageManager; + @Inject + I18nCountryManager countryManager; + @Inject + ContentManager contentManager; + @Inject + ContainerManager containerManager; + + private Group defaultGroup; + + /** + * If this test fails, see database configuration in INSTALL (the collation + * part) and http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html + * + * Title must be created as something like `title` varchar(255) collate + * utf8_bin default NULL + * + */ + @Test + public void caseSensitive() { + final Content defaultContent = defaultGroup.getDefaultContent(); + assertTrue(contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo")); + assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "welcome to kune Demo")); + assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo ")); + } + + @Transactional + @Before + public void init() { + new IntegrationTestHelper(this); + defaultGroup = groupManager.getSiteDefaultGroup(); + } + + @Test + public void testDefaultContentAndLicenses() { + assertNotNull(defaultGroup.getDefaultContent()); + assertTrue(licenseManager.getAll().size() > 0); + assertNotNull(defaultGroup.getDefaultLicense()); + } + + @Test + public void testDefaultDocumentContent() { + final Content content = defaultGroup.getDefaultContent(); + assertEquals(DocumentServerTool.TYPE_DOCUMENT, content.getTypeId()); + final Container rootDocFolder = content.getContainer(); + assertEquals(true, rootDocFolder.isRoot()); + } + + @Test + public void testI18n() { + assertNotNull(countryManager.find(Long.valueOf(75))); + assertNotNull(languageManager.findByCode("en")); + assertNotNull(languageManager.find(Long.valueOf(1819))); + } + + @Test + public void testToolConfiguration() { + assertNotNull(defaultGroup); + final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(DocumentServerTool.NAME); + assertNotNull(docToolConfig); + assertTrue(docToolConfig.isEnabled()); + final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatServerTool.NAME); + assertNotNull(chatToolConfig); + assertTrue(chatToolConfig.isEnabled()); + final List<String> enabledTools = groupManager.findEnabledTools(defaultGroup.getId()); + assertNotNull(enabledTools); + assertTrue(enabledTools.size() > 0); + } + +} Copied: trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -0,0 +1,262 @@ +/* + * + * 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.integration; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletInputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +public class HttpServletRequestMocked implements HttpServletRequest { + + public Object getAttribute(final String arg0) { + return null; + } + + @SuppressWarnings("rawtypes") + public Enumeration getAttributeNames() { + return null; + } + + public String getAuthType() { + return null; + } + + public String getCharacterEncoding() { + return null; + } + + public int getContentLength() { + return 0; + } + + public String getContentType() { + return null; + } + + public String getContextPath() { + return null; + } + + // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17 + public Cookie[] getCookies() { + return null; + } + + public long getDateHeader(final String arg0) { + return 0; + } + + public String getHeader(final String arg0) { + return null; + } + + @SuppressWarnings("rawtypes") + public Enumeration getHeaderNames() { + return null; + } + + @SuppressWarnings("rawtypes") + public Enumeration getHeaders(final String arg0) { + return null; + } + + public ServletInputStream getInputStream() throws IOException { + return null; + } + + public int getIntHeader(final String arg0) { + return 0; + } + + public String getLocalAddr() { + return null; + } + + public Locale getLocale() { + return null; + } + + @SuppressWarnings("rawtypes") + public Enumeration getLocales() { + return null; + } + + public String getLocalName() { + return null; + } + + public int getLocalPort() { + return 0; + } + + public String getMethod() { + return null; + } + + public String getParameter(final String arg0) { + return null; + } + + @SuppressWarnings("rawtypes") + public Map getParameterMap() { + return null; + } + + @SuppressWarnings("rawtypes") + public Enumeration getParameterNames() { + return null; + } + + // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17 + public String[] getParameterValues(final String arg0) { + return null; + } + + public String getPathInfo() { + return null; + } + + public String getPathTranslated() { + return null; + } + + public String getProtocol() { + return null; + } + + public String getQueryString() { + return null; + } + + public BufferedReader getReader() throws IOException { + return null; + } + + public String getRealPath(final String arg0) { + return null; + } + + public String getRemoteAddr() { + return null; + } + + public String getRemoteHost() { + return null; + } + + public int getRemotePort() { + return 0; + } + + public String getRemoteUser() { + return null; + } + + public RequestDispatcher getRequestDispatcher(final String arg0) { + return null; + } + + public String getRequestedSessionId() { + return null; + } + + public String getRequestURI() { + return null; + } + + public StringBuffer getRequestURL() { + return null; + } + + public String getScheme() { + return null; + } + + public String getServerName() { + return null; + } + + public int getServerPort() { + return 0; + } + + public String getServletPath() { + return null; + } + + public HttpSession getSession() { + return null; + } + + public HttpSession getSession(final boolean arg0) { + return null; + } + + public Principal getUserPrincipal() { + return null; + } + + public boolean isRequestedSessionIdFromCookie() { + return false; + } + + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + public boolean isRequestedSessionIdFromURL() { + return false; + } + + public boolean isRequestedSessionIdValid() { + return false; + } + + public boolean isSecure() { + return false; + } + + public boolean isUserInRole(final String arg0) { + return false; + } + + public void removeAttribute(final String arg0) { + + } + + public void setAttribute(final String arg0, final Object arg1) { + + } + + public void setCharacterEncoding(final String arg0) throws UnsupportedEncodingException { + + } + +} Copied: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -0,0 +1,86 @@ +/* + * + * 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.integration; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + + +import cc.kune.core.client.errors.DefaultException; +import cc.kune.core.client.rpcservices.UserService; +import cc.kune.core.server.UserSession; +import cc.kune.core.server.properties.DatabaseProperties; + +import com.google.inject.Inject; + +public abstract class IntegrationTest { + + @Inject + DatabaseProperties properties; + @Inject + protected UserSession session; + protected String token; + @Inject + UserService userService; + + protected String doLogin() throws DefaultException, IOException { + waveLogin(); + return userService.login(getSiteAdminShortName(), properties.getAdminPassword(), token).getUserHash(); + } + + protected String doLoginWithDummyUser() throws DefaultException, IOException { + waveLogin(); + return userService.login("dummy", properties.getAdminPassword(), token).getUserHash(); + } + + protected void doLogout() throws DefaultException { + userService.logout(getHash()); + } + + protected String getDefLicense() { + return properties.getDefaultLicense(); + } + + protected String getDefSiteGroupName() { + return properties.getDefaultSiteShortName(); + } + + public String getHash() { + return session.getHash(); + } + + protected String getSiteAdminShortName() { + return properties.getAdminShortName(); + } + + protected void waveLogin() throws IOException { + token = "somesampletoken"; + // final ClientAuthenticator authenticator = new + // ClientAuthenticator("http://localhost:8080" + // + SessionManager.SIGN_IN_URL); + // final HttpCookie cookie = + // authenticator.authenticate("admin@localhost", + // "easyeasy".toCharArray()); + // token = cookie.getValue(); + assertNotNull(token); + } + +} Copied: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -0,0 +1,83 @@ +/* + * + * 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.integration; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.configuration.ConfigurationException; +import org.ourproject.kune.chat.server.ChatServerModule; +import org.ourproject.kune.docs.server.DocumentServerModule; +import org.ourproject.kune.wiki.server.WikiServerModule; +import org.waveprotocol.box.server.CoreSettings; +import org.waveprotocol.box.server.ServerModule; +import org.waveprotocol.box.server.persistence.PersistenceModule; +import org.waveprotocol.wave.federation.noop.NoOpFederationModule; + +import cc.kune.core.server.KunePersistenceService; +import cc.kune.core.server.PlatformServerModule; +import cc.kune.core.server.TestConstants; +import cc.kune.core.server.init.FinderRegistry; +import cc.kune.core.server.properties.PropertiesFileName; +import cc.kune.wave.server.CustomSettingsBinder; + +import com.google.inject.AbstractModule; +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Scopes; +import com.google.inject.persist.jpa.JpaPersistModule; +import com.google.inject.servlet.RequestScoped; +import com.google.inject.servlet.SessionScoped; + +public class IntegrationTestHelper { + + public static Injector createInjector() { + Injector injector; + try { + injector = Guice.createInjector(CustomSettingsBinder.bindSettings(TestConstants.WAVE_TEST_PROPFILE, + CoreSettings.class)); + final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class); + final NoOpFederationModule federationModule = injector.getInstance(NoOpFederationModule.class); + final Injector childInjector = injector.createChildInjector(wavePersistModule, + FinderRegistry.init(new JpaPersistModule(TestConstants.PERSISTENCE_UNIT)), + new PlatformServerModule(), new DocumentServerModule(), new ChatServerModule(), new ServerModule( + false), federationModule, new WikiServerModule(), new AbstractModule() { + @Override + protected void configure() { + bindScope(SessionScoped.class, Scopes.SINGLETON); + bindScope(RequestScoped.class, Scopes.SINGLETON); + bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties"); + bind(HttpServletRequest.class).to(HttpServletRequestMocked.class); + } + }); + return childInjector; + } catch (final ConfigurationException e) { + e.printStackTrace(); + } + return null; + } + + public IntegrationTestHelper(final Object... tests) { + final Injector injector = createInjector(); + injector.getInstance(KunePersistenceService.class).start(); + for (final Object test : tests) { + injector.injectMembers(test); + } + } +} Copied: trunk/src/test/java/cc/kune/core/server/integration/content (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/content) Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentCommentServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentCommentServiceTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentCommentServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,16 +17,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.DefaultException; import cc.kune.core.client.errors.UserMustBeLoggedException; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.dto.CommentDTO; import cc.kune.core.shared.dto.StateContainerDTO; Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -28,11 +28,11 @@ import org.junit.Test; import org.ourproject.kune.docs.client.DocumentClientTool; import org.ourproject.kune.docs.server.DocumentServerTool; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import org.ourproject.kune.wiki.server.WikiServerTool; import cc.kune.core.client.errors.ContentNotFoundException; import cc.kune.core.client.errors.UserMustBeLoggedException; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.utils.AccessRights; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.ContainerDTO; Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceGetTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -25,9 +25,9 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.ContentNotFoundException; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.StateAbstractDTO; import cc.kune.core.shared.dto.StateContainerDTO; Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceIntegrationTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceIntegrationTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,12 +17,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; -import org.ourproject.kune.platf.integration.IntegrationTest; import cc.kune.core.client.rpcservices.ContentService; import cc.kune.core.client.rpcservices.UserService; +import cc.kune.core.server.integration.IntegrationTest; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.StateContentDTO; Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,15 +17,15 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.server.TestDomainHelper; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.dto.StateContentDTO; public class ContentServiceSaveTest extends ContentServiceIntegrationTest { Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.content; +package cc.kune.core.server.integration.content; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -31,9 +31,9 @@ import org.junit.Test; import org.ourproject.kune.docs.client.DocumentClientTool; import org.ourproject.kune.docs.server.DocumentServerTool; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.AccessViolationException; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.TagCloudResult; import cc.kune.core.shared.domain.TagCount; import cc.kune.core.shared.domain.utils.StateToken; Copied: trunk/src/test/java/cc/kune/core/server/integration/kuneservice (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice) Modified: trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/kuneservice/GroupServiceTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,18 +17,18 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.kuneservice; +package cc.kune.core.server.integration.kuneservice; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.UserMustBeLoggedException; import cc.kune.core.client.rpcservices.GroupService; import cc.kune.core.server.UserSession; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.AdmissionType; import cc.kune.core.shared.dto.GroupDTO; import cc.kune.core.shared.dto.GroupType; Copied: trunk/src/test/java/cc/kune/core/server/integration/selenium (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/selenium) Copied: trunk/src/test/java/cc/kune/core/server/integration/site (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/site) Modified: trunk/src/test/java/cc/kune/core/server/integration/site/SiteServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/site/SiteServiceTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/site/SiteServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.site; +package cc.kune.core.server.integration.site; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -27,11 +27,11 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.rpcservices.SiteService; import cc.kune.core.server.UserSession; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.manager.I18nLanguageManager; import cc.kune.core.shared.dto.InitDataDTO; import cc.kune.core.shared.dto.LicenseDTO; Modified: trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.site; +package cc.kune.core.server.integration.site; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -27,13 +27,13 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.EmailAddressInUseException; import cc.kune.core.client.errors.GroupNameInUseException; import cc.kune.core.client.errors.SessionExpiredException; import cc.kune.core.client.rpcservices.UserService; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.manager.I18nLanguageManager; import cc.kune.core.server.mapper.Mapper; import cc.kune.core.server.properties.DatabaseProperties; Copied: trunk/src/test/java/cc/kune/core/server/integration/socialnet (from rev 1295, trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet) Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkMembersTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.socialnet; +package cc.kune.core.server.integration.socialnet; import static org.junit.Assert.assertEquals; @@ -25,10 +25,10 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.server.UserSession; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.manager.GroupManager; import cc.kune.core.server.manager.SocialNetworkManager; import cc.kune.domain.Group; Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/socialnet/SocialNetworkServiceTest.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,19 +17,19 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.platf.integration.socialnet; +package cc.kune.core.server.integration.socialnet; import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTest; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.errors.AlreadyUserMemberException; import cc.kune.core.client.errors.UserMustBeLoggedException; import cc.kune.core.client.rpcservices.SocialNetworkService; import cc.kune.core.server.UserSession; +import cc.kune.core.server.integration.IntegrationTest; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.SocialNetworkDataDTO; Modified: trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -26,11 +26,11 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; -import org.ourproject.kune.platf.integration.content.ContentServiceIntegrationTest; import cc.kune.core.client.errors.SessionExpiredException; import cc.kune.core.client.errors.UserMustBeLoggedException; +import cc.kune.core.server.integration.IntegrationTestHelper; +import cc.kune.core.server.integration.content.ContentServiceIntegrationTest; import cc.kune.core.shared.dto.StateContainerDTO; import com.google.inject.Inject; Modified: trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -30,9 +30,9 @@ import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; import cc.kune.core.client.services.ImageSize; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.manager.file.FileDownloadManager; import cc.kune.core.server.manager.file.FileUtils; import cc.kune.core.server.properties.KuneProperties; Modified: trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -21,11 +21,11 @@ import org.junit.Before; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; -import org.ourproject.kune.platf.integration.content.ContentServiceIntegrationTest; import cc.kune.core.client.errors.SessionExpiredException; import cc.kune.core.client.errors.UserMustBeLoggedException; +import cc.kune.core.server.integration.IntegrationTestHelper; +import cc.kune.core.server.integration.content.ContentServiceIntegrationTest; import cc.kune.core.server.manager.file.FileUploadManager; import com.google.inject.Inject; Modified: trunk/src/test/java/cc/kune/core/server/manager/impl/AbstractSocialNetworkManagerTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/impl/AbstractSocialNetworkManagerTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/cc/kune/core/server/manager/impl/AbstractSocialNetworkManagerTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -23,9 +23,9 @@ import org.junit.After; import org.junit.Before; -import org.ourproject.kune.testhelper.ctx.DomainContext; import cc.kune.core.server.PersistenceTest; +import cc.kune.core.server.testhelper.ctx.DomainContext; import cc.kune.domain.Group; import cc.kune.domain.User; Copied: trunk/src/test/java/cc/kune/core/server/rack/filters/rest (from rev 1295, trunk/src/test/java/org/ourproject/kune/rack/filters/rest) Modified: trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTMethodFinder.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTMethodFinder.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTMethodFinder.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.rack.filters.rest; +package cc.kune.core.server.rack.filters.rest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; Modified: trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTServiceDefinition.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/rack/filters/rest/TestRESTServiceDefinition.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/rack/filters/rest/TestRESTServiceDefinition.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.rack.filters.rest; +package cc.kune.core.server.rack.filters.rest; import static org.junit.Assert.assertEquals; Copied: trunk/src/test/java/cc/kune/core/server/testhelper/ctx (from rev 1295, trunk/src/test/java/org/ourproject/kune/testhelper/ctx) Modified: trunk/src/test/java/cc/kune/core/server/testhelper/ctx/DomainContext.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/testhelper/ctx/DomainContext.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/testhelper/ctx/DomainContext.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.testhelper.ctx; +package cc.kune.core.server.testhelper.ctx; import java.util.HashMap; import java.util.TimeZone; Modified: trunk/src/test/java/cc/kune/core/server/testhelper/ctx/SocialNetworkOperator.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/testhelper/ctx/SocialNetworkOperator.java 2011-03-25 20:22:13 UTC (rev 1295) +++ trunk/src/test/java/cc/kune/core/server/testhelper/ctx/SocialNetworkOperator.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -package org.ourproject.kune.testhelper.ctx; +package cc.kune.core.server.testhelper.ctx; import cc.kune.domain.SocialNetwork; Modified: trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -27,8 +27,8 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.ourproject.kune.platf.integration.IntegrationTestHelper; +import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.xmpp.ChatConnection; import cc.kune.core.server.xmpp.ChatException; import cc.kune.core.server.xmpp.Room; Deleted: trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -1,125 +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 org.ourproject.kune.platf.integration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.ourproject.kune.chat.server.ChatServerTool; -import org.ourproject.kune.docs.server.DocumentServerTool; - -import cc.kune.core.server.content.ContainerManager; -import cc.kune.core.server.content.ContentManager; -import cc.kune.core.server.manager.GroupManager; -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.server.manager.LicenseManager; -import cc.kune.domain.Container; -import cc.kune.domain.Content; -import cc.kune.domain.Group; -import cc.kune.domain.ToolConfiguration; - -import com.google.inject.Inject; -import com.google.inject.persist.Transactional; - -public class DatabaseInitializationTest { - @Inject - GroupManager groupManager; - @Inject - LicenseManager licenseManager; - @Inject - I18nTranslationManager transManager; - @Inject - I18nLanguageManager languageManager; - @Inject - I18nCountryManager countryManager; - @Inject - ContentManager contentManager; - @Inject - ContainerManager containerManager; - - private Group defaultGroup; - - /** - * If this test fails, see database configuration in INSTALL (the collation - * part) and http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html - * - * Title must be created as something like `title` varchar(255) collate - * utf8_bin default NULL - * - */ - @Test - public void caseSensitive() { - final Content defaultContent = defaultGroup.getDefaultContent(); - assertTrue(contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo")); - assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "welcome to kune Demo")); - assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo ")); - } - - @Transactional - @Before - public void init() { - new IntegrationTestHelper(this); - defaultGroup = groupManager.getSiteDefaultGroup(); - } - - @Test - public void testDefaultContentAndLicenses() { - assertNotNull(defaultGroup.getDefaultContent()); - assertTrue(licenseManager.getAll().size() > 0); - assertNotNull(defaultGroup.getDefaultLicense()); - } - - @Test - public void testDefaultDocumentContent() { - final Content content = defaultGroup.getDefaultContent(); - assertEquals(DocumentServerTool.TYPE_DOCUMENT, content.getTypeId()); - final Container rootDocFolder = content.getContainer(); - assertEquals(true, rootDocFolder.isRoot()); - } - - @Test - public void testI18n() { - assertNotNull(countryManager.find(Long.valueOf(75))); - assertNotNull(languageManager.findByCode("en")); - assertNotNull(languageManager.find(Long.valueOf(1819))); - } - - @Test - public void testToolConfiguration() { - assertNotNull(defaultGroup); - final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(DocumentServerTool.NAME); - assertNotNull(docToolConfig); - assertTrue(docToolConfig.isEnabled()); - final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatServerTool.NAME); - assertNotNull(chatToolConfig); - assertTrue(chatToolConfig.isEnabled()); - final List<String> enabledTools = groupManager.findEnabledTools(defaultGroup.getId()); - assertNotNull(enabledTools); - assertTrue(enabledTools.size() > 0); - } - -} Deleted: trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -1,262 +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 org.ourproject.kune.platf.integration; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletInputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -public class HttpServletRequestMocked implements HttpServletRequest { - - public Object getAttribute(final String arg0) { - return null; - } - - @SuppressWarnings("rawtypes") - public Enumeration getAttributeNames() { - return null; - } - - public String getAuthType() { - return null; - } - - public String getCharacterEncoding() { - return null; - } - - public int getContentLength() { - return 0; - } - - public String getContentType() { - return null; - } - - public String getContextPath() { - return null; - } - - // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17 - public Cookie[] getCookies() { - return null; - } - - public long getDateHeader(final String arg0) { - return 0; - } - - public String getHeader(final String arg0) { - return null; - } - - @SuppressWarnings("rawtypes") - public Enumeration getHeaderNames() { - return null; - } - - @SuppressWarnings("rawtypes") - public Enumeration getHeaders(final String arg0) { - return null; - } - - public ServletInputStream getInputStream() throws IOException { - return null; - } - - public int getIntHeader(final String arg0) { - return 0; - } - - public String getLocalAddr() { - return null; - } - - public Locale getLocale() { - return null; - } - - @SuppressWarnings("rawtypes") - public Enumeration getLocales() { - return null; - } - - public String getLocalName() { - return null; - } - - public int getLocalPort() { - return 0; - } - - public String getMethod() { - return null; - } - - public String getParameter(final String arg0) { - return null; - } - - @SuppressWarnings("rawtypes") - public Map getParameterMap() { - return null; - } - - @SuppressWarnings("rawtypes") - public Enumeration getParameterNames() { - return null; - } - - // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17 - public String[] getParameterValues(final String arg0) { - return null; - } - - public String getPathInfo() { - return null; - } - - public String getPathTranslated() { - return null; - } - - public String getProtocol() { - return null; - } - - public String getQueryString() { - return null; - } - - public BufferedReader getReader() throws IOException { - return null; - } - - public String getRealPath(final String arg0) { - return null; - } - - public String getRemoteAddr() { - return null; - } - - public String getRemoteHost() { - return null; - } - - public int getRemotePort() { - return 0; - } - - public String getRemoteUser() { - return null; - } - - public RequestDispatcher getRequestDispatcher(final String arg0) { - return null; - } - - public String getRequestedSessionId() { - return null; - } - - public String getRequestURI() { - return null; - } - - public StringBuffer getRequestURL() { - return null; - } - - public String getScheme() { - return null; - } - - public String getServerName() { - return null; - } - - public int getServerPort() { - return 0; - } - - public String getServletPath() { - return null; - } - - public HttpSession getSession() { - return null; - } - - public HttpSession getSession(final boolean arg0) { - return null; - } - - public Principal getUserPrincipal() { - return null; - } - - public boolean isRequestedSessionIdFromCookie() { - return false; - } - - public boolean isRequestedSessionIdFromUrl() { - return false; - } - - public boolean isRequestedSessionIdFromURL() { - return false; - } - - public boolean isRequestedSessionIdValid() { - return false; - } - - public boolean isSecure() { - return false; - } - - public boolean isUserInRole(final String arg0) { - return false; - } - - public void removeAttribute(final String arg0) { - - } - - public void setAttribute(final String arg0, final Object arg1) { - - } - - public void setCharacterEncoding(final String arg0) throws UnsupportedEncodingException { - - } - -} Deleted: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -1,86 +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 org.ourproject.kune.platf.integration; - -import static org.junit.Assert.assertNotNull; - -import java.io.IOException; - - -import cc.kune.core.client.errors.DefaultException; -import cc.kune.core.client.rpcservices.UserService; -import cc.kune.core.server.UserSession; -import cc.kune.core.server.properties.DatabaseProperties; - -import com.google.inject.Inject; - -public abstract class IntegrationTest { - - @Inject - DatabaseProperties properties; - @Inject - protected UserSession session; - protected String token; - @Inject - UserService userService; - - protected String doLogin() throws DefaultException, IOException { - waveLogin(); - return userService.login(getSiteAdminShortName(), properties.getAdminPassword(), token).getUserHash(); - } - - protected String doLoginWithDummyUser() throws DefaultException, IOException { - waveLogin(); - return userService.login("dummy", properties.getAdminPassword(), token).getUserHash(); - } - - protected void doLogout() throws DefaultException { - userService.logout(getHash()); - } - - protected String getDefLicense() { - return properties.getDefaultLicense(); - } - - protected String getDefSiteGroupName() { - return properties.getDefaultSiteShortName(); - } - - public String getHash() { - return session.getHash(); - } - - protected String getSiteAdminShortName() { - return properties.getAdminShortName(); - } - - protected void waveLogin() throws IOException { - token = "somesampletoken"; - // final ClientAuthenticator authenticator = new - // ClientAuthenticator("http://localhost:8080" - // + SessionManager.SIGN_IN_URL); - // final HttpCookie cookie = - // authenticator.authenticate("admin@localhost", - // "easyeasy".toCharArray()); - // token = cookie.getValue(); - assertNotNull(token); - } - -} Deleted: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -1,83 +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 org.ourproject.kune.platf.integration; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.configuration.ConfigurationException; -import org.ourproject.kune.chat.server.ChatServerModule; -import org.ourproject.kune.docs.server.DocumentServerModule; -import org.ourproject.kune.wiki.server.WikiServerModule; -import org.waveprotocol.box.server.CoreSettings; -import org.waveprotocol.box.server.ServerModule; -import org.waveprotocol.box.server.persistence.PersistenceModule; -import org.waveprotocol.wave.federation.noop.NoOpFederationModule; - -import cc.kune.core.server.KunePersistenceService; -import cc.kune.core.server.PlatformServerModule; -import cc.kune.core.server.TestConstants; -import cc.kune.core.server.init.FinderRegistry; -import cc.kune.core.server.properties.PropertiesFileName; -import cc.kune.wave.server.CustomSettingsBinder; - -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Scopes; -import com.google.inject.persist.jpa.JpaPersistModule; -import com.google.inject.servlet.RequestScoped; -import com.google.inject.servlet.SessionScoped; - -public class IntegrationTestHelper { - - public static Injector createInjector() { - Injector injector; - try { - injector = Guice.createInjector(CustomSettingsBinder.bindSettings(TestConstants.WAVE_TEST_PROPFILE, - CoreSettings.class)); - final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class); - final NoOpFederationModule federationModule = injector.getInstance(NoOpFederationModule.class); - final Injector childInjector = injector.createChildInjector(wavePersistModule, - FinderRegistry.init(new JpaPersistModule(TestConstants.PERSISTENCE_UNIT)), - new PlatformServerModule(), new DocumentServerModule(), new ChatServerModule(), new ServerModule( - false), federationModule, new WikiServerModule(), new AbstractModule() { - @Override - protected void configure() { - bindScope(SessionScoped.class, Scopes.SINGLETON); - bindScope(RequestScoped.class, Scopes.SINGLETON); - bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties"); - bind(HttpServletRequest.class).to(HttpServletRequestMocked.class); - } - }); - return childInjector; - } catch (final ConfigurationException e) { - e.printStackTrace(); - } - return null; - } - - public IntegrationTestHelper(final Object... tests) { - final Injector injector = createInjector(); - injector.getInstance(KunePersistenceService.class).start(); - for (final Object test : tests) { - injector.injectMembers(test); - } - } -} Modified: trunk/src/test/java/testsuites/IntegrationTestSuite.java =================================================================== --- trunk/src/test/java/testsuites/IntegrationTestSuite.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/testsuites/IntegrationTestSuite.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -22,18 +22,19 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.ourproject.kune.platf.integration.DatabaseInitializationTest; -import org.ourproject.kune.platf.integration.content.ContentCommentServiceTest; -import org.ourproject.kune.platf.integration.content.ContentServiceAddTest; -import org.ourproject.kune.platf.integration.content.ContentServiceGetTest; -import org.ourproject.kune.platf.integration.content.ContentServiceSaveTest; -import org.ourproject.kune.platf.integration.content.ContentServiceVariousTest; -import org.ourproject.kune.platf.integration.kuneservice.GroupServiceTest; -import org.ourproject.kune.platf.integration.site.SiteServiceTest; -import org.ourproject.kune.platf.integration.site.UserServiceTest; -import org.ourproject.kune.platf.integration.socialnet.SocialNetworkMembersTest; -import org.ourproject.kune.platf.integration.socialnet.SocialNetworkServiceTest; +import cc.kune.core.server.integration.DatabaseInitializationTest; +import cc.kune.core.server.integration.content.ContentCommentServiceTest; +import cc.kune.core.server.integration.content.ContentServiceAddTest; +import cc.kune.core.server.integration.content.ContentServiceGetTest; +import cc.kune.core.server.integration.content.ContentServiceSaveTest; +import cc.kune.core.server.integration.content.ContentServiceVariousTest; +import cc.kune.core.server.integration.kuneservice.GroupServiceTest; +import cc.kune.core.server.integration.site.SiteServiceTest; +import cc.kune.core.server.integration.site.UserServiceTest; +import cc.kune.core.server.integration.socialnet.SocialNetworkMembersTest; +import cc.kune.core.server.integration.socialnet.SocialNetworkServiceTest; + /** * Rescan with : * Modified: trunk/src/test/java/testsuites/OthersTestSuite.java =================================================================== --- trunk/src/test/java/testsuites/OthersTestSuite.java 2011-03-25 21:43:36 UTC (rev 1298) +++ trunk/src/test/java/testsuites/OthersTestSuite.java 2011-03-25 22:16:57 UTC (rev 1299) @@ -28,14 +28,14 @@ import org.ourproject.kune.docs.DocumentToolTest; import org.ourproject.kune.docs.server.DocumentServerToolTest; import org.ourproject.kune.gallery.server.GalleryServerToolTest; -import org.ourproject.kune.rack.filters.rest.TestRESTMethodFinder; -import org.ourproject.kune.rack.filters.rest.TestRESTServiceDefinition; import org.ourproject.kune.wiki.server.WikiServerToolTest; import org.ourproject.kune.workspace.client.entityheader.EntityLogoPresenterTest; import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardPresenterTest; import org.ourproject.kune.workspace.client.socialnet.SNRolActionTest; import org.ourproject.kune.workspace.client.socialnet.RolComparatorTest; +import cc.kune.core.server.rack.filters.rest.TestRESTMethodFinder; +import cc.kune.core.server.rack.filters.rest.TestRESTServiceDefinition; import cc.kune.gspace.client.tags.TagsSummaryPresenterTest; import cc.kune.gspace.client.tool.ToolSelectorPresenterTest;