Verifying the test cases execution. [ags]

This commit is contained in:
kshah
2022-10-10 22:00:52 +05:30
parent 2d47d89036
commit 4f6b86fac6
5 changed files with 18 additions and 9 deletions

View File

@@ -78,7 +78,6 @@ public class AuditHoldsTest extends BaseRMRestTest {
private List<AuditEntry> auditEntries;
private String hold1NodeRef;
public static final String RECORD_FOLDER_THREE = "record-folder-three";
private static final String SITES_PATH = "/Sites";
@BeforeClass(alwaysRun = true)
public void preconditionForAuditAddToHoldTests()
{
@@ -93,7 +92,6 @@ public class AuditHoldsTest extends BaseRMRestTest {
publicSite = dataSite.usingAdmin().createPublicRandomSite();
testFile = dataContent.usingAdmin().usingSite(publicSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
STEP("Create a record category with 2 folders and 1 record");
recordCategory = createRootCategory(getRandomName("recordCategory"));
recordFolder1 = createRecordFolder(recordCategory.getId(), PREFIX + "recFolder1");
@@ -101,9 +99,6 @@ public class AuditHoldsTest extends BaseRMRestTest {
Record recordToBeAdded = createElectronicRecord(recordFolder1.getId(), PREFIX + "record");
assertStatusCode(CREATED);
// //This is required to assert line 137
// rmAuditService.clearAuditLog();
STEP("Add some items to the hold, then remove them from the hold");
final List<String> itemsList = asList(testFile.getNodeRefWithoutVersion(), recordToBeAdded.getId(), recordFolder2.getId());
final List<String> holdsList = Collections.singletonList(HOLD1);
@@ -133,12 +128,11 @@ public class AuditHoldsTest extends BaseRMRestTest {
}
@Test (dataProvider = "holdsEvents")
public void checkItemPathLink(AuditEvents event) {
System.out.println("Executing checkItemPathLink test");
auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), event);
assertFalse("Audit results should not be empty",auditEntries.size()==0);
final String auditedEvent = event + " - " + testFile.getName();
assertTrue("Audit results should contain one " + auditedEvent + " event",auditEntries.stream().anyMatch(e -> e.getEvent().startsWith(event.eventDisplayName)));
String expectedLocation = testFile.getCmisLocation().replace(SITES_PATH, "");
System.out.println(auditEntries.size());
STEP("Check the audit log contains only an entry for add to hold.");
assertThat(auditEntries, is(not(empty())));
}

View File

@@ -98,6 +98,7 @@ public class ElectronicRecordAuditLogTest extends BaseRMRestTest {
@Test(description = "Audit log for newly filed electronic record")
@AlfrescoTest(jira="RM-4303")
public void newElectronicRecordAudit() {
System.out.println("Executing newElectronicRecordAudit test");
List<AuditEntry> auditEntries= auditLog.getRMAuditLogAll(getAdminUser().getUsername(),getAdminUser().getPassword(),100);
// newly created record contains 2 events: "file to" and metadata update
@@ -115,6 +116,7 @@ public class ElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void electronicRecordAuditIsEvent()
{
System.out.println("Executing electronicRecordAuditIsEvent test");
List<AuditEntry> auditEntries= auditLog.getRMAuditLogAll(getAdminUser().getUsername(),getAdminUser().getPassword(),100);
assertTrue("Audit View Event is not present.",auditEntries.stream().anyMatch(x -> x.getEvent().startsWith("Audit View")));
}
@@ -126,6 +128,7 @@ public class ElectronicRecordAuditLogTest extends BaseRMRestTest {
)
@AlfrescoTest(jira="RM-4303")
public void renameElectronicRecord() {
System.out.println("Executing renameElectronicRecord test");
auditLog.clearAuditLog(rmAdmin.get().getUsername(),rmAdmin.get().getPassword());
Record renameElectronicRecord = createRecordModel("edited " + electronicRecord.getName(), "", "");
@@ -143,6 +146,7 @@ public class ElectronicRecordAuditLogTest extends BaseRMRestTest {
description = "Complete and reopen electronic record")
@AlfrescoTest(jira="RM-4303")
public void completeAndReopenElectronicRecord() {
System.out.println("Executing completeAndReopenElectronicRecord test");
electronicRecord2 = createElectronicRecord(recordFolder1.getId(),AUDIT_COMPLETE_REOPEN_ELECTRONIC_RECORD);
// complete record
@@ -198,6 +202,7 @@ public class ElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void fileElectronicRecordAuditLogAsRecord()
{
System.out.println("Executing completeAndReopenElectronicRecord test");
// audit log is stored in the same folder, refresh it so that it appears in the list
HttpResponse auditRecordHttpResponse = auditLog.logsAuditLogAsRecord(rmAdmin.get().getUsername(),rmAdmin.get().getPassword(),
getRecordNodeRef(electronicRecord2.getId()),getFolderNodeRef(recordFolder1.getId()));

View File

@@ -97,7 +97,7 @@ public class NonElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void newNonElectronicRecordAudit()
{
System.out.println("Executing newNonElectronicRecordAudit test");
List<AuditEntry> auditEntries= auditLog.getRMAuditLogAll(getAdminUser().getUsername(),getAdminUser().getPassword(),100);
// newly created record contains 3 events: "created object", "file to" and metadata update
@@ -114,6 +114,7 @@ public class NonElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void nonElectronicRecordAuditIsEvent()
{
System.out.println("Executing nonElectronicRecordAuditIsEvent test");
List<AuditEntry> auditEntries= auditLog.getRMAuditLogAll(getAdminUser().getUsername(),getAdminUser().getPassword(),100);
assertTrue("Audit View Event is not present.",auditEntries.stream().anyMatch(x -> x.getEvent().startsWith("Audit View")));
@@ -127,6 +128,7 @@ public class NonElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void renameNonElectronicRecord()
{
System.out.println("Executing renameNonElectronicRecord test");
auditLog.clearAuditLog(rmAdmin.get().getUsername(),rmAdmin.get().getPassword());
Record renameNonElectronicRecord = createRecordModel("edited " + nonElectronicRecord.getName(), "", "");
@@ -144,6 +146,7 @@ public class NonElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void completeAndReopenNonElectronicRecord()
{
System.out.println("Executing completeAndReopenNonElectronicRecord test");
nonElectronicRecord2 = createNonElectronicRecord(recordFolder1.getId(),AUDIT_COMPLETE_REOPEN_NON_ELECTRONIC_RECORD);
// complete record
@@ -199,6 +202,7 @@ public class NonElectronicRecordAuditLogTest extends BaseRMRestTest {
@AlfrescoTest(jira="RM-4303")
public void fileNonElectronicRecordAuditLogAsRecord()
{
System.out.println("Executing fileNonElectronicRecordAuditLogAsRecord test");
// audit log is stored in the same folder, refresh it so that it appears in the list
HttpResponse auditRecordHttpResponse = auditLog.logsAuditLogAsRecord(rmAdmin.get().getUsername(),rmAdmin.get().getPassword(),
getRecordNodeRef(nonElectronicRecord2.getId()),getFolderNodeRef(recordFolder1.getId()));

View File

@@ -70,6 +70,7 @@ public class RecordCategoryAuditLogTest extends BaseRMRestTest {
@Test
@AlfrescoTest(jira = "RM-2768")
public void recordCategoryAudit() throws Exception {
System.out.println("Executing recordCategoryAudit test");
STEP("Create root level category");
recordCategoryAudit = createRootCategory(AUDIT_CATEGORY);
List<AuditEntry> auditEntries = auditLog.getRMAuditLogAll(getAdminUser().getUsername(), getAdminUser().getPassword(), 100);
@@ -92,7 +93,7 @@ public class RecordCategoryAuditLogTest extends BaseRMRestTest {
)
@AlfrescoTest(jira="RM-4303")
public void recordCategoryAuditIsEvent() {
System.out.println("Executing recordCategoryAuditIsEvent test");
List<AuditEntry> auditEntries = auditLog.getRMAuditLogAll(getAdminUser().getUsername(), getAdminUser().getPassword(), 100);
assertTrue("Audit View Event is not present.", auditEntries.stream().anyMatch(x -> x.getEvent().startsWith("Audit View")));
}
@@ -104,6 +105,7 @@ public class RecordCategoryAuditLogTest extends BaseRMRestTest {
)
@AlfrescoTest(jira="RM-4303")
public void renameRecordCategory() {
System.out.println("Executing renameRecordCategory test");
String categoryName = "Category name " + getRandomAlphanumeric();
RecordCategory rootRecordCategory = createRootCategory(categoryName);
String newCategoryName = "Rename " + categoryName;

View File

@@ -81,6 +81,7 @@ public class RecordFolderAuditLogTest extends BaseRMRestTest {
@Test(description = "Audit log for empty record folder")
@AlfrescoTest(jira = "RM-4303")
public void recordFolderAudit() {
System.out.println("Executing recordFolderAudit test");
category1 = createRootCategory(TITLE, DESCRIPTION);
recordFolder1 = createFolder(category1.getId(), TITLE);
List<AuditEntry> auditEntries = auditLog.getRMAuditLogAll(getAdminUser().getUsername(), getAdminUser().getPassword(), 100);
@@ -96,6 +97,7 @@ public class RecordFolderAuditLogTest extends BaseRMRestTest {
)
@AlfrescoTest(jira = "RM-4303")
public void recordFolderAuditIsEvent() {
System.out.println("Executing recordFolderAuditIsEvent test");
List<AuditEntry> auditEntries = auditLog.getRMAuditLogAll(getAdminUser().getUsername(), getAdminUser().getPassword(), 100);
assertTrue("Audit View Event is not present.", auditEntries.stream().anyMatch(x -> x.getEvent().startsWith("Audit View")));
@@ -108,6 +110,7 @@ public class RecordFolderAuditLogTest extends BaseRMRestTest {
)
@AlfrescoTest(jira = "RM-4303")
public void renameRecordFolder() {
System.out.println("Executing renameRecordFolder test");
auditLog.clearAuditLog(rmAdmin.get().getUsername(), rmAdmin.get().getPassword());
RecordFolder renameRecordFolder = createRecordFolderModel(category1.getId(), "edited");
getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(renameRecordFolder, recordFolder1.getId());
@@ -123,6 +126,7 @@ public class RecordFolderAuditLogTest extends BaseRMRestTest {
description = "Close and reopen folder")
@AlfrescoTest(jira = "RM-4303")
public void closeReopenFolder() {
System.out.println("Executing closeReopenFolder test");
//close folder
recordFoldersAPI.closeRecordFolder(rmAdmin.get().getUsername(), rmAdmin.get().getPassword(),
recordFolder1.getName());