Search in sources :

Example 16 with SiteMemberData

use of org.alfresco.bm.site.SiteMemberData in project records-management by Alfresco.

the class RMBaseEventProcessorUnitTest method testGetUserWithNoRegisteredAdminRoleUser.

@Test(expected = IllegalStateException.class)
public void testGetUserWithNoRegisteredAdminRoleUser() throws Exception {
    String userName = "user1";
    Logger mockedLog = mock(Logger.class);
    SiteData mockedSiteData = mock(SiteData.class);
    when(mockedSiteDataService.getSite(PATH_SNIPPET_RM_SITE_ID)).thenReturn(mockedSiteData);
    SiteMemberData mockedSiteMemberData = mock(SiteMemberData.class);
    when(mockedSiteMemberData.getUsername()).thenReturn(userName);
    when(mockedSiteDataService.randomSiteMember(PATH_SNIPPET_RM_SITE_ID, DataCreationState.Created, null, RMRole.Administrator.toString())).thenReturn(mockedSiteMemberData);
    when(mockedUserDataService.findUserByUsername(userName)).thenReturn(null);
    testRMBaseEventProcessor.getRandomUser(mockedLog);
}
Also used : SiteData(org.alfresco.bm.site.SiteData) SiteMemberData(org.alfresco.bm.site.SiteMemberData) Logger(org.slf4j.Logger) Test(org.junit.Test)

Example 17 with SiteMemberData

use of org.alfresco.bm.site.SiteMemberData in project records-management by Alfresco.

the class RMBaseEventProcessorUnitTest method testGetUserSuccessfull.

@Test
public void testGetUserSuccessfull() throws Exception {
    String userName = "user1";
    Logger mockedLog = mock(Logger.class);
    SiteData mockedSiteData = mock(SiteData.class);
    when(mockedSiteDataService.getSite(PATH_SNIPPET_RM_SITE_ID)).thenReturn(mockedSiteData);
    SiteMemberData mockedSiteMemberData = mock(SiteMemberData.class);
    when(mockedSiteMemberData.getUsername()).thenReturn(userName);
    when(mockedSiteDataService.randomSiteMember(PATH_SNIPPET_RM_SITE_ID, DataCreationState.Created, null, RMRole.Administrator.toString())).thenReturn(mockedSiteMemberData);
    UserData mockedUserData = mock(UserData.class);
    when(mockedUserDataService.findUserByUsername(userName)).thenReturn(mockedUserData);
    UserData user = testRMBaseEventProcessor.getRandomUser(mockedLog);
    assertEquals(mockedUserData, user);
}
Also used : SiteData(org.alfresco.bm.site.SiteData) SiteMemberData(org.alfresco.bm.site.SiteMemberData) UserData(org.alfresco.bm.user.UserData) Logger(org.slf4j.Logger) Test(org.junit.Test)

Aggregations

SiteMemberData (org.alfresco.bm.site.SiteMemberData)17 Event (org.alfresco.bm.event.Event)13 EventResult (org.alfresco.bm.event.EventResult)12 Test (org.junit.Test)11 DBObject (com.mongodb.DBObject)8 SiteData (org.alfresco.bm.site.SiteData)8 UserData (org.alfresco.bm.user.UserData)6 RMUserAPI (org.alfresco.rest.rm.community.requests.gscore.api.RMUserAPI)3 UserModel (org.alfresco.utility.model.UserModel)3 StopWatch (org.apache.commons.lang3.time.StopWatch)3 RMSite (org.alfresco.rest.rm.community.model.site.RMSite)2 RMSiteAPI (org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI)2 Logger (org.slf4j.Logger)2 BasicDBObject (com.mongodb.BasicDBObject)1 ArrayList (java.util.ArrayList)1 FolderData (org.alfresco.bm.cm.FolderData)1 RMRole (org.alfresco.bm.dataload.rm.role.RMRole)1 EventDataObject (org.alfresco.bm.event.selector.EventDataObject)1 EventProcessorResponse (org.alfresco.bm.event.selector.EventProcessorResponse)1 RMRestWrapper (org.alfresco.rest.core.RMRestWrapper)1