diff --git a/celements-common-test-deprecated/pom.xml b/celements-common-test-deprecated/pom.xml deleted file mode 100644 index c97195c..0000000 --- a/celements-common-test-deprecated/pom.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - com.celements - celements-parent - 7.1-SNAPSHOT - - 4.0.0 - celements-shared-tests-deprecated - 7.1-SNAPSHOT - Celements Shared Tests Deprecated Classes - - scm:git:git@github.com:celements/celements-shared-tests.git - scm:git:git@github.com:celements/celements-shared-tests.git - https://github.com/celements/celements-shared-tests/celements-common-test-deprecated - HEAD - - - - - com.celements - celements-shared-tests - - - - - com.celements - celements-commons - - - com.celements - celements-component - - - com.celements - celements-config-source-api - - - com.celements - celements-reference - - - com.celements - celements-observation - - - com.celements - celements-servlet - - - com.celements - celements-xwiki-core - - - com.celements - celements-xwiki-velocity - - - com.celements - celements-xwiki-rendering-api - - - - - org.xwiki.platform - xwiki-core-cache-api - - - org.xwiki.platform - xwiki-core-bridge - - - org.xwiki.platform - xwiki-core-query-manager - - - - - org.springframework - spring-context - - - org.springframework - spring-web - - - org.springframework - spring-webmvc - - - - - org.hibernate - hibernate - provided - - - commons-collections - commons-collections - - - dom4j - dom4j - - - - - - - securityfilter - securityfilter - provided - - - - - ecs - ecs - provided - - - - org.dom4j - dom4j - provided - - - - - org.seleniumhq.selenium - selenium-java - - - org.mutabilitydetector - MutabilityDetector - 0.9.5 - - - - org.slf4j - slf4j-api - provided - - - - javax.servlet - javax.servlet-api - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - **/*Test.class - - - - - - - diff --git a/celements-common-test-deprecated/src/main/java/com/celements/common/test/AbstractBridgedComponentTestCase.java b/celements-common-test-deprecated/src/main/java/com/celements/common/test/AbstractBridgedComponentTestCase.java deleted file mode 100644 index cdde1b2..0000000 --- a/celements-common-test-deprecated/src/main/java/com/celements/common/test/AbstractBridgedComponentTestCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package com.celements.common.test; - -import com.xpn.xwiki.XWiki; -import com.xpn.xwiki.XWikiContext; - -/** - * Extension of {@link org.xwiki.test.AbstractComponentTestCase} that sets up a bridge - * between the new Execution Context and the old XWikiContext. This allows code that uses - * XWikiContext to be tested using this Test Case class. - * - * @version: AbstractBridgedComponentTestCase.java fpichler copied from - * AbstractBridgedComponentTestCase.java - * @deprecated instead use {@link AbstractComponentTest} together with static import - * {@link CelementsTestUtils} - */ -@Deprecated -public abstract class AbstractBridgedComponentTestCase extends AbstractComponentTest { - - public XWiki getWikiMock() { - return CelementsTestUtils.getWikiMock(); - } - - public XWikiContext getContext() { - return CelementsTestUtils.getContext(); - } - - public TestMessageTool getMessageToolStub() { - return CelementsTestUtils.getMessageToolStub(); - } - - public T createMockAndAddToDefault(final Class toMock) { - return CelementsTestUtils.createMockAndAddToDefault(toMock); - } - -} diff --git a/celements-common-test-deprecated/src/main/java/org/xwiki/test/AbstractComponentTestCase.java b/celements-common-test-deprecated/src/main/java/org/xwiki/test/AbstractComponentTestCase.java deleted file mode 100644 index cc4d4e4..0000000 --- a/celements-common-test-deprecated/src/main/java/org/xwiki/test/AbstractComponentTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.xwiki.test; - -import static com.celements.common.test.CelementsTestUtils.*; - -import org.xwiki.component.manager.ComponentRepositoryException; - -import com.celements.common.test.AbstractComponentTest; -import com.celements.common.test.CelementsTestUtils; - -/** - * Tests which needs to have XWiki Components set up should extend this class which makes the - * Component Manager - * available. Use this class for JUnit 4.x tests. For JUnit 3.x tests use - * {@link AbstractXWikiComponentTestCase} - * instead. - * Since XWiki 2.2M1 you should prefer using {@link org.xwiki.test.AbstractMockingComponentTestCase} - * instead. - * - * @deprecated since 6.0 - */ -@Deprecated -public class AbstractComponentTestCase extends AbstractComponentTest { - - /** - * @deprecated instead use {@link CelementsTestUtils#registerComponentMock(Class, String)} - */ - @Deprecated - public T registerMockComponent(Class role, String hint) - throws ComponentRepositoryException { - return registerComponentMock(role, hint); - } - - /** - * @deprecated instead use {@link CelementsTestUtils#registerComponentMock(Class)} - */ - @Deprecated - public T registerMockComponent(Class role) throws ComponentRepositoryException { - return registerComponentMock(role); - } - -} diff --git a/celements-common-test-deprecated/src/test/java/com/celements/common/test/AbstractBridgedComponentTestCaseTest.java b/celements-common-test-deprecated/src/test/java/com/celements/common/test/AbstractBridgedComponentTestCaseTest.java deleted file mode 100644 index 9a595c5..0000000 --- a/celements-common-test-deprecated/src/test/java/com/celements/common/test/AbstractBridgedComponentTestCaseTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.celements.common.test; - -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -import static org.easymock.EasyMock.*; -import static org.junit.Assert.*; - -import org.junit.Test; -import org.xwiki.cache.CacheManager; -import org.xwiki.cache.config.CacheConfiguration; -import org.xwiki.cache.eviction.EntryEvictionConfiguration; -import org.xwiki.cache.eviction.LRUEvictionConfiguration; -import org.xwiki.model.reference.EntityReferenceSerializer; - -import com.celements.common.test.service.ITestServiceRole; -import com.celements.common.test.service.InjectedTestService; -import com.xpn.xwiki.render.XWikiRenderingEngine; -import com.xpn.xwiki.web.Utils; - -public class AbstractBridgedComponentTestCaseTest extends AbstractBridgedComponentTestCase { - - @Test - public void testDefaultMocks() { - assertNotNull(getContext()); - assertNotNull(getWikiMock()); - assertSame(getContext().getWiki(), getWikiMock()); - } - - @Test - public void testOnceLoadComponentManager() throws Exception { - replayDefault(); - assertNotNull(getComponentManager()); - assertNotNull(Utils.getComponent(EntityReferenceSerializer.class, "default")); - verifyDefault(); - } - - @Test - public void testInitCache() throws Exception { - CacheConfiguration configuration = new CacheConfiguration(); - configuration.setConfigurationId("xwiki.renderingcache"); - LRUEvictionConfiguration lru = new LRUEvictionConfiguration(); - lru.setMaxEntries(100); - configuration.put(EntryEvictionConfiguration.CONFIGURATIONID, lru); - replayDefault(); - assertNotNull(Utils.getComponent(CacheManager.class).createNewCache(configuration)); - verifyDefault(); - } - - @Test - public void test() { - XWikiRenderingEngine renderingEngine = createMockAndAddToDefault( - XWikiRenderingEngine.class); - expect(getWikiMock().getRenderingEngine()).andReturn(renderingEngine).anyTimes(); - expect(renderingEngine.interpretText(eq("link"), same(getContext().getDoc()), - same(getContext()))).andReturn("rendered link"); - replayDefault(); - assertNotNull(getWikiMock().getRenderingEngine()); - assertEquals("renderingEngine schould get set to replay by replayDefault because it" - + " is created with createMockAndAddToDefault.", "rendered link", - getWikiMock().getRenderingEngine().interpretText("link", - getContext().getDoc(), getContext())); - verifyDefault(); - } - - @Test - public void test_registerComponentMock() throws Exception { - ITestServiceRole injTestServiceMock = registerComponentMock(ITestServiceRole.class, - "injected"); - ITestServiceRole testService = Utils.getComponent(ITestServiceRole.class); - Object obj = new Object(); - expect(injTestServiceMock.getObj()).andReturn(obj).once(); - replayDefault(); - Object ret = testService.getInjectedComponent().getObj(); - verifyDefault(); - assertSame(obj, ret); - } - - @Test - public void test_registerComponentMock_wrongOrder() throws Exception { - ITestServiceRole testService = Utils.getComponent(ITestServiceRole.class); - registerComponentMock(ITestServiceRole.class, "injected"); - replayDefault(); - Object ret = testService.getInjectedComponent().getObj(); - verifyDefault(); - assertSame(InjectedTestService.OBJ, ret); - } - - @Test - public void test_registerComponentMock_noMock() throws Exception { - ITestServiceRole testService = Utils.getComponent(ITestServiceRole.class); - replayDefault(); - Object ret = testService.getInjectedComponent().getObj(); - verifyDefault(); - assertSame(InjectedTestService.OBJ, ret); - } - - @Test - public void test_registerComponentMock_setBack() throws Exception { - ITestServiceRole testServiceMock = registerComponentMock(ITestServiceRole.class, - "injected"); - assertSame(testServiceMock, Utils.getComponent(ITestServiceRole.class, "injected")); - this.tearDownXWiki(); - this.tearDownSpring(); - this.setUpSpring(); - this.setUpXWiki(); - assertNotNull(Utils.getComponent(ITestServiceRole.class, "injected")); - assertNotSame(testServiceMock, Utils.getComponent(ITestServiceRole.class, "injected")); - } - -}