mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	119609 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)
      119576 adavis: Merged 5.0.3 (5.0.3) to 5.0.N (5.0.4)
         119521 amukha: Merged 5.0.3-MNT-15258 (5.0.3) to 5.0.3 (5.0.3)
            118559 amukha: MNT-15258: Huge database after upgrade to 5.1.c
               - Added usage of JobLockService for prop cleanup job.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123601 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
		
	
		
			
				
	
	
		
			63 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package org.alfresco.repo.attributes;
 | |
| 
 | |
| import static org.mockito.Mockito.verify;
 | |
| import static org.mockito.Mockito.when;
 | |
| 
 | |
| import org.alfresco.error.AlfrescoRuntimeException;
 | |
| import org.junit.Before;
 | |
| import org.junit.Test;
 | |
| import org.junit.runner.RunWith;
 | |
| import org.mockito.Mock;
 | |
| import org.mockito.runners.MockitoJUnitRunner;
 | |
| import org.quartz.JobDetail;
 | |
| import org.quartz.JobExecutionContext;
 | |
| import org.quartz.JobExecutionException;
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * Tests for the {@link PropTablesCleanupJob} class.
 | |
|  * 
 | |
|  * @author Matt Ward
 | |
|  */
 | |
| @RunWith(MockitoJUnitRunner.class)
 | |
| public class PropTablesCleanupJobTest
 | |
| {
 | |
|     private PropTablesCleanupJob cleanupJob;
 | |
|     private @Mock JobExecutionContext jobCtx;
 | |
|     private @Mock PropTablesCleaner propTablesCleaner;
 | |
|     private JobDetail jobDetail;
 | |
|     
 | |
|     @Before
 | |
|     public void setUp() throws Exception
 | |
|     {
 | |
|         jobDetail = new JobDetail("propTablesCleanupJob", PropTablesCleanupJob.class);
 | |
|         jobDetail.getJobDataMap().put("propTablesCleaner", propTablesCleaner);
 | |
|         cleanupJob = new PropTablesCleanupJob();
 | |
|         
 | |
|         when(jobCtx.getJobDetail()).thenReturn(jobDetail);
 | |
|     }
 | |
| 
 | |
|     @Test
 | |
|     public void testExecute() throws JobExecutionException
 | |
|     {
 | |
|         cleanupJob.execute(jobCtx);
 | |
|         
 | |
|         verify(propTablesCleaner).execute();
 | |
|     }
 | |
|     
 | |
|     @Test(expected=AlfrescoRuntimeException.class)
 | |
|     public void testMissingPropTablesCleaner() throws JobExecutionException
 | |
|     {
 | |
|         jobDetail.getJobDataMap().put("propTablesCleaner", null);
 | |
|         cleanupJob.execute(jobCtx);
 | |
|     }
 | |
|     
 | |
|     @Test(expected=AlfrescoRuntimeException.class)
 | |
|     public void testWrongTypeForPropTablesCleaner() throws JobExecutionException
 | |
|     {
 | |
|         jobDetail.getJobDataMap().put("propTablesCleaner", "This is not a PropTablesCleaner");
 | |
|         cleanupJob.execute(jobCtx);
 | |
|     }
 | |
| 
 | |
| }
 |