replaced the todos

This commit is contained in:
cagache
2019-11-07 12:36:52 +02:00
parent 659c945506
commit 1c2b4da16a
4 changed files with 27 additions and 15 deletions

View File

@@ -41,6 +41,8 @@ import static org.testng.AssertJUnit.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.alfresco.dataprep.CMISUtil; import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.audit.AuditEntry; import org.alfresco.rest.rm.community.model.audit.AuditEntry;
@@ -174,8 +176,9 @@ public class AuditAddToHoldTests extends BaseRMRestTest
holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD1); holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD1);
STEP("Check the audit log contains the entry for the add to hold event."); STEP("Check the audit log contains the entry for the add to hold event.");
rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_HOLD, rmAdmin, HOLD1, Collections.emptyList()); rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_HOLD, rmAdmin, HOLD1,
//TODO replace changed values asList(ImmutableMap.of("new", nodeName, "previous", "", "name", "Name"),
ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name")));
} }
/** /**
@@ -211,7 +214,7 @@ public class AuditAddToHoldTests extends BaseRMRestTest
{ {
STEP("Create a new record folder with a record inside"); STEP("Create a new record folder with a record inside");
RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder"); RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder");
createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record"); Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record");
rmAuditService.clearAuditLog(); rmAuditService.clearAuditLog();
@@ -221,8 +224,10 @@ public class AuditAddToHoldTests extends BaseRMRestTest
auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD); auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD);
STEP("Check the audit log contains only an entry for add to hold."); STEP("Check the audit log contains only an entry for add to hold.");
assertEquals("The list of events should not contain Add to Hold entry for the record", 1, auditEntries.size()); assertEquals("The list of events should contain only an entry", 1, auditEntries.size());
//TODO check content name assertTrue("The list of events should not contain Add to Hold entry for the record",
auditEntries.stream().noneMatch(entry -> entry.getChangedValues().contains(
Collections.singletonList(ImmutableMap.of("new", record.getName(), "previous", "", "name", "Name")))));
} }
/** /**

View File

@@ -105,7 +105,7 @@ public class AuditCreateHoldTests extends BaseRMRestTest
STEP("Check the audit log contains the entry for the created hold with the hold details."); STEP("Check the audit log contains the entry for the created hold with the hold details.");
rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_HOLD, rmAdmin, HOLD1, rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_HOLD, rmAdmin, HOLD1,
asList(ImmutableMap.of("new", HOLD_REASON, "previous", "", "name", "Hold Reason"), asList(ImmutableMap.of("new", HOLD_REASON, "previous", "", "name", "Hold Reason"),
ImmutableMap.of("new", HOLD1, "previous", "", "name", "Name"))); ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name")));
} }
/** /**

View File

@@ -39,6 +39,8 @@ import static org.testng.AssertJUnit.assertTrue;
import java.util.Collections; import java.util.Collections;
import com.google.common.collect.ImmutableMap;
import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.user.UserRoles; import org.alfresco.rest.rm.community.model.user.UserRoles;
import org.alfresco.rest.v0.HoldsAPI; import org.alfresco.rest.v0.HoldsAPI;
@@ -106,7 +108,8 @@ public class AuditDeleteHoldTests extends BaseRMRestTest
holdsAPI.deleteHold(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2); holdsAPI.deleteHold(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2);
STEP("Check the audit log contains the entry for the deleted hold with the hold details."); STEP("Check the audit log contains the entry for the deleted hold with the hold details.");
rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_HOLD, rmAdmin, HOLD2, Collections.emptyList()); rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_HOLD, rmAdmin, HOLD2,
Collections.singletonList(ImmutableMap.of("new", "", "previous", HOLD2, "name", "Hold Name")));
} }
/** /**

View File

@@ -41,6 +41,8 @@ import static org.testng.AssertJUnit.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.alfresco.dataprep.CMISUtil; import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.audit.AuditEntry; import org.alfresco.rest.rm.community.model.audit.AuditEntry;
@@ -185,8 +187,9 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD3); holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD3);
STEP("Check the audit log contains the entry for the remove from hold event."); STEP("Check the audit log contains the entry for the remove from hold event.");
rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, HOLD3, Collections.emptyList()); rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, HOLD3,
//TODO replace changed values asList(ImmutableMap.of("new", "", "previous", nodeName, "name", "Name"),
ImmutableMap.of("new", "", "previous", HOLD3, "name", "Hold Name")));
} }
/** /**
@@ -208,8 +211,8 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
STEP("Check the audit log contains the entry for the remove from hold."); STEP("Check the audit log contains the entry for the remove from hold.");
rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, DELETED_HOLD, rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, DELETED_HOLD,
Collections.emptyList()); asList(ImmutableMap.of("new", "", "previous", heldContent.getName(), "name", "Name"),
//TODO replace changed values ImmutableMap.of("new", "", "previous", DELETED_HOLD, "name", "Hold Name")));
} }
/** /**
@@ -242,7 +245,7 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
{ {
STEP("Create a new record folder with a record inside"); STEP("Create a new record folder with a record inside");
RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder"); RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder");
createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record"); Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record");
STEP("Add the record folder to a hold."); STEP("Add the record folder to a hold.");
holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1); holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1);
@@ -256,9 +259,10 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD); auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD);
STEP("Check the audit log contains only an entry for remove from hold."); STEP("Check the audit log contains only an entry for remove from hold.");
assertEquals("The list of events should not contain Remove from Hold entry for the record", 1, assertEquals("The list of events should contain only an entry", 1, auditEntries.size());
auditEntries.size()); assertTrue("The list of events should not contain Remove from Hold entry for the record",
//TODO check content name auditEntries.stream().noneMatch(entry -> entry.getChangedValues().contains(
Collections.singletonList(ImmutableMap.of("new", "", "previous", record.getName(), "name", "Name")))));
} }
/** /**