(1);
+ templateArgs.put("template", template);
+ context.setTemplateArgs(templateArgs);
+
+ notificationService.sendNotification(EMailNotificationProvider.NAME, context);
+
+ return null;
+ }
+ });
+ }
+
public void testTemplateEmailNotification()
diff --git a/repository/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java b/repository/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java
index 3ab38cea19..bde0ab1f04 100644
--- a/repository/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java
+++ b/repository/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java
@@ -51,6 +51,8 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.testing.category.NeverRunsTests;
+import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
/**
@@ -59,6 +61,7 @@ import org.mockito.ArgumentCaptor;
* @deprecated We are introducing the new async RenditionService2.
*/
@Deprecated
+@Category(NeverRunsTests.class)
public class AbstractRenderingEngineTest extends TestCase
{
private final NodeRef source = new NodeRef("http://test/sourceId");
diff --git a/repository/src/test/java/org/alfresco/repo/rendition2/LocalSynchronousTransformClientIntegrationTest.java b/repository/src/test/java/org/alfresco/repo/rendition2/LocalSynchronousTransformClientIntegrationTest.java
index a5cde83a8f..1997641982 100644
--- a/repository/src/test/java/org/alfresco/repo/rendition2/LocalSynchronousTransformClientIntegrationTest.java
+++ b/repository/src/test/java/org/alfresco/repo/rendition2/LocalSynchronousTransformClientIntegrationTest.java
@@ -31,10 +31,12 @@ import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
@@ -50,6 +52,7 @@ import static org.alfresco.model.ContentModel.PROP_CONTENT;
/**
* Integration tests for {@link LocalSynchronousTransformClient}
*/
+@Category(NeverRunsTests.class)
public class LocalSynchronousTransformClientIntegrationTest extends AbstractRenditionIntegrationTest
{
@Autowired
diff --git a/repository/src/test/java/org/alfresco/repo/rendition2/RenditionEventProcessorTest.java b/repository/src/test/java/org/alfresco/repo/rendition2/RenditionEventProcessorTest.java
index 802e8c1dd9..6da871da7d 100644
--- a/repository/src/test/java/org/alfresco/repo/rendition2/RenditionEventProcessorTest.java
+++ b/repository/src/test/java/org/alfresco/repo/rendition2/RenditionEventProcessorTest.java
@@ -32,6 +32,7 @@ import org.alfresco.repo.rawevents.types.OnContentUpdatePolicyEvent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
@@ -39,6 +40,7 @@ import org.apache.camel.support.DefaultExchange;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
@@ -53,6 +55,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*
* @author Cristian Turlica
*/
+@Category(NeverRunsTests.class)
public class RenditionEventProcessorTest
{
private RenditionEventProcessor renditionEventProcessor;
diff --git a/repository/src/test/java/org/alfresco/repo/rule/BaseRuleTest.java b/repository/src/test/java/org/alfresco/repo/rule/BaseRuleTest.java
index d7a1769e86..30229078aa 100644
--- a/repository/src/test/java/org/alfresco/repo/rule/BaseRuleTest.java
+++ b/repository/src/test/java/org/alfresco/repo/rule/BaseRuleTest.java
@@ -62,7 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
* @author Roy Wetherall
*/
@Transactional
-public class BaseRuleTest extends BaseSpringTest
+public abstract class BaseRuleTest extends BaseSpringTest
{
/**
* Data used in the tests
diff --git a/repository/src/test/java/org/alfresco/repo/search/impl/querymodel/impl/db/DBQueryTest.java b/repository/src/test/java/org/alfresco/repo/search/impl/querymodel/impl/db/DBQueryTest.java
index e9c6ae0117..dfb43eadf8 100644
--- a/repository/src/test/java/org/alfresco/repo/search/impl/querymodel/impl/db/DBQueryTest.java
+++ b/repository/src/test/java/org/alfresco/repo/search/impl/querymodel/impl/db/DBQueryTest.java
@@ -77,6 +77,7 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.CachingDateFormat;
import org.alfresco.util.testing.category.LuceneTests;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -90,7 +91,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @author Andy
*
*/
-@Category(LuceneTests.class)
+@Category({LuceneTests.class, NeverRunsTests.class})
public class DBQueryTest implements DictionaryListener
{
protected static ApplicationContext ctx = null;
diff --git a/repository/src/test/java/org/alfresco/repo/security/authority/script/ScriptAuthorityServiceTest.java b/repository/src/test/java/org/alfresco/repo/security/authority/script/ScriptAuthorityServiceTest.java
index ec4178a93e..9f908ee4f0 100644
--- a/repository/src/test/java/org/alfresco/repo/security/authority/script/ScriptAuthorityServiceTest.java
+++ b/repository/src/test/java/org/alfresco/repo/security/authority/script/ScriptAuthorityServiceTest.java
@@ -59,6 +59,7 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.ScriptPagingDetails;
import org.alfresco.util.testing.category.LuceneTests;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
@@ -66,7 +67,7 @@ import org.springframework.context.ApplicationContext;
* Tests for the Script wrapper for the Authority Service,
* ScriptAuthorityService
*/
-@Category(LuceneTests.class)
+@Category({LuceneTests.class, NeverRunsTests.class})
public class ScriptAuthorityServiceTest extends TestCase
{
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
diff --git a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java
index c0819c2b54..955c28b8cf 100644
--- a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java
+++ b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractPermissionTest.java
@@ -64,7 +64,7 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;
-public class AbstractPermissionTest extends TestCase
+public abstract class AbstractPermissionTest extends TestCase
{
protected static final String USER2_LEMUR = "lemur";
diff --git a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractReadPermissionTest.java b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractReadPermissionTest.java
index f363e6499e..4596828e0f 100644
--- a/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractReadPermissionTest.java
+++ b/repository/src/test/java/org/alfresco/repo/security/permissions/impl/AbstractReadPermissionTest.java
@@ -70,7 +70,7 @@ import org.springframework.context.ApplicationContext;
import junit.framework.TestCase;
@Category(LuceneTests.class)
-public class AbstractReadPermissionTest extends TestCase
+public abstract class AbstractReadPermissionTest extends TestCase
{
protected static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext();
diff --git a/repository/src/test/java/org/alfresco/repo/site/CustomRoleTest.java b/repository/src/test/java/org/alfresco/repo/site/CustomRoleTest.java
index 22f49b8017..0d59662c3c 100755
--- a/repository/src/test/java/org/alfresco/repo/site/CustomRoleTest.java
+++ b/repository/src/test/java/org/alfresco/repo/site/CustomRoleTest.java
@@ -40,7 +40,9 @@ import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.BaseAlfrescoSpringTest;
import org.alfresco.util.Pair;
import org.alfresco.util.PropertyMap;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.Before;
+import org.junit.experimental.categories.Category;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Transactional;
@@ -52,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
@ContextConfiguration({"classpath:alfresco/application-context.xml",
"classpath:org/alfresco/repo/site/site-custom-context.xml"})
+@Category(NeverRunsTests.class)
public class CustomRoleTest extends BaseAlfrescoSpringTest
{
private static final String USER_ONE = "UserOne_CustomRoleTest";
diff --git a/repository/src/test/java/org/alfresco/repo/site/SiteServiceTestHuge.java b/repository/src/test/java/org/alfresco/repo/site/SiteServiceTestHuge.java
index 3a33901e5f..6c9fa746ba 100644
--- a/repository/src/test/java/org/alfresco/repo/site/SiteServiceTestHuge.java
+++ b/repository/src/test/java/org/alfresco/repo/site/SiteServiceTestHuge.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco 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 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco 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 Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.site;
import static org.junit.Assert.fail;
@@ -47,11 +47,13 @@ import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.PropertyMap;
+import org.alfresco.util.testing.category.PerformanceTests;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
/**
@@ -59,6 +61,7 @@ import org.springframework.context.ApplicationContext;
*
* @author Alan Davis
*/
+@Category(PerformanceTests.class)
public class SiteServiceTestHuge
{
private enum Allocation
diff --git a/repository/src/test/java/org/alfresco/repo/tenant/AbstractTenantRoutingContentStoreTest.java b/repository/src/test/java/org/alfresco/repo/tenant/AbstractTenantRoutingContentStoreTest.java
index 4ad04c9215..137cb1cc8d 100644
--- a/repository/src/test/java/org/alfresco/repo/tenant/AbstractTenantRoutingContentStoreTest.java
+++ b/repository/src/test/java/org/alfresco/repo/tenant/AbstractTenantRoutingContentStoreTest.java
@@ -55,6 +55,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.test_category.OwnJVMTestsCategory;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.testing.category.LuceneTests;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
@@ -64,7 +65,7 @@ import org.springframework.context.ApplicationContext;
* @author Alfresco
* @since 4.2.1
*/
-@Category({OwnJVMTestsCategory.class, LuceneTests.class})
+@Category({OwnJVMTestsCategory.class, LuceneTests.class, NeverRunsTests.class})
public class AbstractTenantRoutingContentStoreTest extends TestCase
{
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
diff --git a/repository/src/test/java/org/alfresco/repo/version/VersionableAspectTest.java b/repository/src/test/java/org/alfresco/repo/version/VersionableAspectTest.java
index 677735df02..5cd00ab385 100644
--- a/repository/src/test/java/org/alfresco/repo/version/VersionableAspectTest.java
+++ b/repository/src/test/java/org/alfresco/repo/version/VersionableAspectTest.java
@@ -51,13 +51,14 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.test_category.OwnJVMTestsCategory;
import org.alfresco.util.ApplicationContextHelper;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
/**
* @author Dmitry Velichkevich
*/
-@Category(OwnJVMTestsCategory.class)
+@Category({OwnJVMTestsCategory.class, NeverRunsTests.class})
public class VersionableAspectTest extends TestCase
{
public static final String AUTO_VERSION_KEY = "version.store.enableAutoVersioning";
diff --git a/repository/src/test/java/org/alfresco/repo/workflow/activiti/AbstractActivitiComponentTest.java b/repository/src/test/java/org/alfresco/repo/workflow/activiti/AbstractActivitiComponentTest.java
index 2c51ec8076..ba764eea3f 100644
--- a/repository/src/test/java/org/alfresco/repo/workflow/activiti/AbstractActivitiComponentTest.java
+++ b/repository/src/test/java/org/alfresco/repo/workflow/activiti/AbstractActivitiComponentTest.java
@@ -72,8 +72,10 @@ import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowDeployment;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.After;
import org.junit.Before;
+import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
@@ -93,6 +95,7 @@ import org.springframework.transaction.annotation.Transactional;
"classpath:activiti/test-activiti-component-context.xml",
"classpath:alfresco/activiti-context.xml"})
@Transactional
+@Category(NeverRunsTests.class)
public class AbstractActivitiComponentTest
{
protected static final String TEST_GROUP = "GROUP_testGroup";
diff --git a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSmokeTest.java b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSmokeTest.java
index d6fe1e25a1..ddf69aab03 100644
--- a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSmokeTest.java
+++ b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSmokeTest.java
@@ -36,12 +36,15 @@ import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
+import org.alfresco.util.testing.category.NeverRunsTests;
+import org.junit.experimental.categories.Category;
import org.springframework.core.io.ClassPathResource;
/**
* @author Nick Smith
* @since 3.4.e
*/
+@Category(NeverRunsTests.class)
public class ActivitiSmokeTest extends TestCase
{
public void testDeploy() throws Exception
diff --git a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSpringTest.java b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSpringTest.java
index bfc7a5668e..77f03b4729 100644
--- a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSpringTest.java
+++ b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiSpringTest.java
@@ -48,7 +48,9 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.apache.commons.lang3.ArrayUtils;
+import org.junit.experimental.categories.Category;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -56,6 +58,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author Nick Smith
* @since 3.4.e
*/
+@Category(NeverRunsTests.class)
public class ActivitiSpringTest extends TestCase
{
private static final QName PROP_CHECK_VALUE = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "check_value");
diff --git a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTaskComponentTest.java b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTaskComponentTest.java
index 9991861878..9964cf9bff 100644
--- a/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTaskComponentTest.java
+++ b/repository/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTaskComponentTest.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco 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 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco 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 Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.workflow.activiti;
@@ -57,15 +57,18 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
import org.alfresco.service.cmr.workflow.WorkflowTaskQuery;
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.testing.category.NeverRunsTests;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
/**
* @author Nick Smith
* @author Frederik Heremans
* @since 3.4.e
*/
+@Category(NeverRunsTests.class)
public class ActivitiTaskComponentTest extends AbstractActivitiComponentTest
{
private WorkflowDefinition workflowDef;
diff --git a/repository/src/test/java/org/alfresco/util/debug/OutputSpacesStoreSystemTest.java b/repository/src/test/java/org/alfresco/util/debug/OutputSpacesStoreSystemTest.java
index 36b6a00795..b561b104d2 100644
--- a/repository/src/test/java/org/alfresco/util/debug/OutputSpacesStoreSystemTest.java
+++ b/repository/src/test/java/org/alfresco/util/debug/OutputSpacesStoreSystemTest.java
@@ -23,27 +23,28 @@
* along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.util.debug;
-
-import org.alfresco.service.cmr.repository.NodeService;
-import org.alfresco.service.cmr.repository.StoreRef;
-import org.alfresco.test_category.BaseSpringTestsCategory;
-import org.alfresco.util.BaseSpringTest;
-import org.junit.experimental.categories.Category;
-
-/**
- * @author Roy Wetherall
- */
-@Category(BaseSpringTestsCategory.class)
-public class OutputSpacesStoreSystemTest extends BaseSpringTest
-{
- /**
- * Dump the contents of the spaces store to standard out
- */
- public void testDumpSpacesStore()
- {
- NodeService nodeService = (NodeService)this.applicationContext.getBean("nodeService");
- StoreRef spacesStore = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
- System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, spacesStore));
- }
-}
+package org.alfresco.util.debug;
+
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.repository.StoreRef;
+import org.alfresco.test_category.BaseSpringTestsCategory;
+import org.alfresco.util.BaseSpringTest;
+import org.alfresco.util.testing.category.NeverRunsTests;
+import org.junit.experimental.categories.Category;
+
+/**
+ * @author Roy Wetherall
+ */
+@Category({BaseSpringTestsCategory.class, NeverRunsTests.class})
+public class OutputSpacesStoreSystemTest extends BaseSpringTest
+{
+ /**
+ * Dump the contents of the spaces store to standard out
+ */
+ public void testDumpSpacesStore()
+ {
+ NodeService nodeService = (NodeService)this.applicationContext.getBean("nodeService");
+ StoreRef spacesStore = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
+ System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, spacesStore));
+ }
+}
diff --git a/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java b/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java
new file mode 100644
index 0000000000..679c58288a
--- /dev/null
+++ b/repository/src/test/java/org/alfresco/util/test/OmittedTestClassFinderUnitTest.java
@@ -0,0 +1,191 @@
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco 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 Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.util.test;
+
+import static java.util.Collections.emptySet;
+import static java.util.stream.Collectors.toSet;
+
+import static junit.framework.TestCase.assertEquals;
+
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import com.google.common.collect.Sets;
+import com.google.common.collect.Sets.SetView;
+
+import junit.framework.TestCase;
+import org.alfresco.error.AlfrescoRuntimeException;
+import org.alfresco.util.testing.category.NonBuildTests;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runners.Suite.SuiteClasses;
+import org.reflections.Reflections;
+import org.reflections.scanners.MethodAnnotationsScanner;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.scanners.TypeAnnotationsScanner;
+
+public class OmittedTestClassFinderUnitTest
+{
+ /**
+ * Test to look for tests which are unintentionally skipped by our CI.
+ *
+ * In particular we look for classes that contain @Test methods or extend TestCase and which are not referenced by TestSuites. There
+ * are a few subtleties to this:
+ *
+ * - alfresco-core and alfresco-data-model don't use test suites, and some @Test methods are executed via inheritance;
+ * - some tests are explicitly marked as NonBuildTests;
+ * - we assume that all test suite classes have names ending in "TestSuite".
+ *
+ */
+ @Test
+ public void checkTestClassesReferencedInTestSuites()
+ {
+ // We assume that all of our tests are in org.alfresco.
+ Reflections reflections = new Reflections("org.alfresco", new MethodAnnotationsScanner(), new TypeAnnotationsScanner(), new SubTypesScanner());
+
+ // Find the test classes which are not in test suites.
+ Set testClasses = getTestClassesOnPath(reflections);
+ Set classesReferencedByTestSuites = getClassesReferencedByTestSuites(reflections);
+ SetView unreferencedTests = Sets.difference(testClasses, classesReferencedByTestSuites);
+
+ // Filter out tests which are in Maven modules that don't use test suites (alfresco-core and alfresco-data-model).
+ // Also filter any test classes contained in test dependencies (*.jar).
+ Set unreferencedTestClasses = unreferencedTests.stream()
+ .map(this::classFromCanonicalName)
+ .filter(clazz -> {
+ String path = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
+ return !path.endsWith("/data-model/target/test-classes/")
+ && !path.endsWith("/core/target/test-classes/")
+ && !path.endsWith(".jar");
+ })
+ .collect(toSet());
+
+ System.out.println("Unreferenced test class count: " + unreferencedTestClasses.size());
+ unreferencedTestClasses.forEach(System.out::println);
+
+ assertEquals("Found test classes which are not referenced by any test suite.", emptySet(), unreferencedTestClasses);
+ }
+
+ /**
+ * Find all test classes. We define a class to be a test class if it contains a Test, Before or After annotation, is not a test suite,
+ * is not abstract and is not a "non-build" test (e.g. the test class is marked as a performance test).
+ * @param reflections The Reflections object used to provide information about the classes.
+ * @return A set of canonical names for the test classes.
+ */
+ private Set getTestClassesOnPath(Reflections reflections)
+ {
+ Set classesWithTestAnnotations = Stream.of(Test.class, Before.class, After.class)
+ .map(annotation -> findClassesWithMethodAnnotation(reflections, annotation))
+ .flatMap(Set::stream)
+ .collect(toSet());
+
+ Set classesExtendingTestCase = reflections.getSubTypesOf(TestCase.class).stream().map(testClass -> testClass.getCanonicalName()).collect(toSet());
+
+ return Sets.union(classesWithTestAnnotations, classesExtendingTestCase).stream()
+ // Exclude test suite classes.
+ .filter(className -> !className.endsWith("Suite"))
+ // Exclude abstract classes.
+ .filter(className -> !Modifier.isAbstract(classFromCanonicalName(className).getModifiers()))
+ // Exclude test classes which are explicitly marked as "non-build" test classes.
+ .filter(className -> !markedAsNonBuildTest(classFromCanonicalName(className)))
+ .collect(toSet());
+ }
+
+ /**
+ * Several tests are intentionally excluded from the build. These are marked with the {@link Category} annotation referencing an
+ * interface that extends {@link NonBuildTests}. This is useful for e.g. performance testing or to help with debugging.
+ * @param clazz The test class to check.
+ * @return true if the test class has been marked with a NonBuildTests category.
+ */
+ private boolean markedAsNonBuildTest(Class> clazz)
+ {
+ Category category = clazz.getAnnotation(Category.class);
+ if (category == null)
+ {
+ return false;
+ }
+ return Arrays.stream(category.value())
+ .anyMatch(value -> NonBuildTests.class.isAssignableFrom(value));
+ }
+
+ /**
+ * Get all the test classes referenced from test suites.
+ * @param reflections The Reflections object used to provide information about the classes.
+ * @return The set of canonical names of test classes referenced by test suites.
+ */
+ private Set getClassesReferencedByTestSuites(Reflections reflections)
+ {
+ Set classesReferencedByTestSuites = new HashSet<>();
+ for (Class testSuite : reflections.getTypesAnnotatedWith(SuiteClasses.class))
+ {
+ SuiteClasses testSuiteAnnotation = (SuiteClasses) testSuite.getAnnotation(SuiteClasses.class);
+ Arrays.stream(testSuiteAnnotation.value())
+ .map(testClass -> testClass.getCanonicalName())
+ // Exclude nested test suite classes.
+ .filter(className -> !className.endsWith("Suite"))
+ .forEach(classesReferencedByTestSuites::add);
+ }
+ return classesReferencedByTestSuites;
+ }
+
+ /**
+ * Find the names of classes with the given annotation.
+ * @param reflections The Reflections object used to provide information about the classes.
+ * @param annotation The class of the annotation to look for.
+ * @return The set of canonical names of classes containing methods annotated with the annotation.
+ */
+ private Set findClassesWithMethodAnnotation(Reflections reflections, Class annotation)
+ {
+ return reflections.getStore()
+ .get(MethodAnnotationsScanner.class, annotation.getName())
+ .stream()
+ // Get the class name from the method name.
+ .map(methodName -> methodName.split("\\.[^\\.]+\\(")[0])
+ .collect(toSet());
+ }
+
+ /**
+ * Find the Class corresponding to a canonical class name.
+ * @param name The name of the class.
+ * @return The Class object.
+ */
+ private Class> classFromCanonicalName(String name)
+ {
+ try
+ {
+ return Class.forName(name, false, getClass().getClassLoader());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new AlfrescoRuntimeException("Couldn't find test class for name.", e);
+ }
+ }
+}