mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge branch 'master' into feature/RM-6930_DeleteHold
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2019 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 <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RemoveFromHoldAuditEvent}.
|
||||
*
|
||||
* @author Chris Shields
|
||||
* @since 3.3
|
||||
*/
|
||||
public class RemoveFromHoldAuditEventUnitTest extends BaseUnitTest
|
||||
{
|
||||
@InjectMocks
|
||||
private RemoveFromHoldAuditEvent removeFromHoldAuditEvent;
|
||||
|
||||
@Mock
|
||||
private NodeService mockedNodeService;
|
||||
|
||||
private NodeRef holdNodeRef;
|
||||
private NodeRef contentNodeRef;
|
||||
|
||||
/**
|
||||
* Set up the mocks.
|
||||
*/
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
initMocks(this);
|
||||
|
||||
holdNodeRef = generateNodeRef();
|
||||
String holdName = "Hold " + GUID.generate();
|
||||
|
||||
contentNodeRef = generateNodeRef();
|
||||
String contentName = "Content " + GUID.generate();
|
||||
|
||||
when(mockedNodeService.getProperty(holdNodeRef, PROP_NAME)).thenReturn(holdName);
|
||||
when(mockedNodeService.getProperty(contentNodeRef, PROP_NAME)).thenReturn(contentName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the remove from hold event calls an audit event.
|
||||
*/
|
||||
@Test
|
||||
public void testRemoveFromHoldCausesAuditEvent()
|
||||
{
|
||||
removeFromHoldAuditEvent.onRemoveFromHold(holdNodeRef, contentNodeRef);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(contentNodeRef), any(String.class), any(Map.class), isNull(Map.class), eq(true));
|
||||
}
|
||||
|
||||
}
|
@@ -474,7 +474,6 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
||||
verify(mockedNodeService, never()).removeChild(hold, recordFolder);
|
||||
verify(mockedNodeService, never()).removeAspect(recordFolder, ASPECT_FROZEN);
|
||||
verify(mockedNodeService, never()).removeAspect(record, ASPECT_FROZEN);
|
||||
verify(mockedRecordsManagementAuditService, never()).auditEvent(eq(recordFolder), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -491,7 +490,6 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
||||
verify(mockedNodeService, times(1)).removeChild(hold, recordFolder);
|
||||
verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN);
|
||||
verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN);
|
||||
verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -515,7 +513,6 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
||||
verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder);
|
||||
verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN);
|
||||
verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN);
|
||||
verify(mockedRecordsManagementAuditService, times(2)).auditEvent(any(NodeRef.class), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user