private void removeUsersFromGroup_VerifyLogEntries() { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(1, logEntries.size()); BESAuditLogEntry logEntry1 = (BESAuditLogEntry) AuditLogData.get().get(0); Map<AuditLogParameter, String> logParams1 = logEntry1.getLogParameters(); assertEquals(GROUPNAME_1, logParams1.get(AuditLogParameter.GROUP)); assertEquals(USERID_1 + "," + USERID_2, logParams1.get(AuditLogParameter.USER)); }
private void verifyLogEntriesForAssignCategories() { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(1, logEntries.size()); BESAuditLogEntry logEntry = (BESAuditLogEntry) AuditLogData.get().get(0); Map<AuditLogParameter, String> logParams = logEntry.getLogParameters(); assertEquals(String.valueOf(SERVICE_NAME), logParams.get(AuditLogParameter.SERVICE_ID)); assertEquals(LOCALIZED_RESOURCE, logParams.get(AuditLogParameter.SERVICE_NAME)); assertEquals(CATEGORIES_ID, logParams.get(AuditLogParameter.CATEGORIES_ID)); }
private void verifyLogEntriesForSetPublicService() { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(1, logEntries.size()); BESAuditLogEntry logEntry = (BESAuditLogEntry) AuditLogData.get().get(0); Map<AuditLogParameter, String> logParams = logEntry.getLogParameters(); assertEquals(String.valueOf(SERVICE_NAME), logParams.get(AuditLogParameter.SERVICE_ID)); assertEquals(LOCALIZED_RESOURCE, logParams.get(AuditLogParameter.SERVICE_NAME)); assertEquals( Boolean.valueOf(SERVICE_PUBLIC).toString(), logParams.get(AuditLogParameter.SERVICE_PUBLIC)); }
private void accessToServices_VerifyLogEntries(UserGroupAuditLogOperation operation) { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(2, logEntries.size()); BESAuditLogEntry logEntry1 = (BESAuditLogEntry) AuditLogData.get().get(0); assertEquals(operation.name().toString(), logEntry1.getOperationName()); Map<AuditLogParameter, String> logParams1 = logEntry1.getLogParameters(); assertEquals(GROUPNAME_1, logParams1.get(AuditLogParameter.GROUP)); assertEquals(MARKETPLACEID, logParams1.get(AuditLogParameter.MARKETPLACE_ID)); assertEquals(PARAMETERNAME, logParams1.get(AuditLogParameter.MARKETPLACE_NAME)); assertEquals(PRODUCTID_1, logParams1.get(AuditLogParameter.SERVICE_ID)); assertEquals(PARAMETERNAME, logParams1.get(AuditLogParameter.SERVICE_NAME)); assertEquals(VENDORID_1, logParams1.get(AuditLogParameter.SELLER_ID)); }
private void assignUserToGroups_VerifyLogEntries() { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(2, logEntries.size()); BESAuditLogEntry logEntry1 = (BESAuditLogEntry) AuditLogData.get().get(0); Map<AuditLogParameter, String> logParams1 = logEntry1.getLogParameters(); assertEquals(GROUPNAME_1, logParams1.get(AuditLogParameter.GROUP)); assertEquals(USERID_1, logParams1.get(AuditLogParameter.USER)); BESAuditLogEntry logEntry = (BESAuditLogEntry) AuditLogData.get().get(1); Map<AuditLogParameter, String> logParams2 = logEntry.getLogParameters(); assertEquals(GROUPNAME_2, logParams2.get(AuditLogParameter.GROUP)); assertEquals(USERID_1, logParams2.get(AuditLogParameter.USER)); }
@Test public void setServiceAsPublic() { AuditLogData.clear(); logCollector.setServiceAsPublic(dsMock, createService(), SERVICE_PUBLIC); // then verifyLogEntriesForSetPublicService(); }
@Test public void assignCategories() { AuditLogData.clear(); logCollector.assignCategories(dsMock, createService(), createCatagory()); // then verifyLogEntriesForAssignCategories(); }
@Test public void assignToMarketPlace() { AuditLogData.clear(); logCollector.assignToMarketPlace(dsMock, createService(), MARKETPLACE_ID, MARKETPLACE_NAME); // then verifyLogEntriesForAssignToMarketplace(); }
private UserGroupAuditLogCollector accessToServices( UserGroupAuditLogOperation operation, UserGroup group, List<Product> products) throws ObjectNotFoundException { AuditLogData.clear(); logCollector.accessToServices(dsMock, operation, group, products, MARKETPLACEID); return logCollector; }
private void verifyLogEntries() { List<AuditLogEntry> logEntries = AuditLogData.get(); assertEquals(2, logEntries.size()); BESAuditLogEntry logEntry1 = (BESAuditLogEntry) AuditLogData.get().get(0); BESAuditLogEntry logEntry2 = (BESAuditLogEntry) AuditLogData.get().get(1); Map<AuditLogParameter, String> logParams1 = logEntry1.getLogParameters(); Map<AuditLogParameter, String> logParams2 = logEntry2.getLogParameters(); assertEquals(PRODUCT_ID, logParams1.get(AuditLogParameter.SERVICE_ID)); assertEquals(LOCALIZED_RESOURCE, logParams1.get(AuditLogParameter.SERVICE_NAME)); assertEquals(LOCALE_EN, logParams1.get(AuditLogParameter.LOCALE)); assertEquals("YES", logParams1.get(AuditLogParameter.DESCRIPTION)); assertEquals("YES", logParams1.get(AuditLogParameter.SHORT_DESCRIPTION)); assertEquals(LOCALE_JA, logParams2.get(AuditLogParameter.LOCALE)); assertEquals("YES", logParams2.get(AuditLogParameter.DESCRIPTION)); assertEquals("YES", logParams2.get(AuditLogParameter.SHORT_DESCRIPTION)); }
@Test public void localizeService_NullorEmpty() { // given Product prod = givenService(); // when localizeService(prod, new VOServiceLocalization(), new VOServiceLocalization()); // then List<AuditLogEntry> logEntries = AuditLogData.get(); assertNull(logEntries); }
@Test public void localizeService_SaveWithNoOperation() { // given Product prod = givenService(); originalLocalization = givenServiceLocalization(null); newLocalization = givenServiceLocalization(""); // when localizeService(prod, originalLocalization, newLocalization); // then List<AuditLogEntry> logEntries = AuditLogData.get(); assertNull(logEntries); }
private ServiceAuditLogCollector localizeService( Product product, VOServiceLocalization oldLocalization, VOServiceLocalization localization) { AuditLogData.clear(); logCollector.localizeService(dsMock, product, oldLocalization, localization); return logCollector; }
private UserGroupAuditLogCollector removeUsersFromGroup( UserGroup group, List<PlatformUser> users) { AuditLogData.clear(); logCollector.removeUsersFromGroup(dsMock, group, users); return logCollector; }
private UserGroupAuditLogCollector removeUserFromGroups( List<UserGroup> groups, PlatformUser user) { AuditLogData.clear(); logCollector.removeUserFromGroups(dsMock, groups, user); return logCollector; }
private UserGroupAuditLogCollector assignUsersToGroup(UserGroup group, List<PlatformUser> users) { AuditLogData.clear(); logCollector.assignUsersToGroup(dsMock, group, users); return logCollector; }
private UserGroupAuditLogCollector assignUserToGroups(List<UserGroup> groups, PlatformUser user) { AuditLogData.clear(); logCollector.assignUserToGroups(dsMock, groups, user); return logCollector; }