use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method getAllUsersTest.
@Test
public void getAllUsersTest() {
List<SocialUser> allUsers = new ArrayList<>();
allUsers.add(new SocialUser("system"));
allUsers.add(new SocialUser("admin"));
allUsers.add(new SocialUser("user"));
doReturn(allUsers).when(socialUserRepositoryAPI).findAllUsers();
final List<SocialUser> users = libraryService.getAllUsers();
assertEquals(2, users.size());
assertEquals("admin", users.get(0).getUserName());
assertEquals("user", users.get(1).getUserName());
}
use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.
the class ContributorsManagementListItemPresenterTest method setupSelectedUserWithoutNameTest.
@Test
public void setupSelectedUserWithoutNameTest() {
presenter.setup(new SocialUser("user"), true);
verify(view).init(presenter);
verify(view).setUserName("user");
verify(view).setSelected(true);
}
use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.
the class ContributorsManagementPresenterTest method setup.
@Before
public void setup() {
organizationalUnitServiceCaller = new CallerMock<>(organizationalUnitService);
libraryServiceCaller = new CallerMock<>(libraryService);
sessionInfo = new SessionInfoMock();
List<SocialUser> allUsers = new ArrayList<>();
allUsers.add(userA);
allUsers.add(userB);
allUsers.add(userC);
doReturn(allUsers).when(libraryService).getAllUsers();
doReturn(contributorsManagementListItemPresenter).when(contributorsManagementListItemPresenters).get();
presenter = new ContributorsManagementPresenter(view, organizationalUnitServiceCaller, libraryServiceCaller, contributorsManagementListItemPresenters, sessionInfo);
}
use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.
the class NewRepositoryEventAdapter method toSocial.
@Override
public SocialActivitiesEvent toSocial(Object object) {
NewRepositoryEvent event = (NewRepositoryEvent) object;
SocialUser socialUser = null;
try {
socialUser = socialUserRepositoryAPI.findSocialUser(loggedUser.getIdentifier());
} catch (ContextNotActiveException e) {
// clean repository
socialUser = new SocialUser("system");
}
String additionalInfo = "Created";
return new SocialActivitiesEvent(socialUser, ExtendedTypes.NEW_REPOSITORY_EVENT, new Date()).withAdicionalInfo(additionalInfo).withLink(event.getNewRepository().getAlias(), event.getNewRepository().getUri()).withDescription("");
}
use of org.ext.uberfire.social.activities.model.SocialUser in project kie-wb-common by kiegroup.
the class ResourceUpdatedEventAdapter method toSocial.
@Override
public SocialActivitiesEvent toSocial(Object object) {
ResourceUpdatedEvent event = (ResourceUpdatedEvent) object;
SocialUser socialUser = socialUserRepositoryAPI.findSocialUser(event.getSessionInfo().getIdentity().getIdentifier());
String additionalInfo = "Edited";
String description = getCommitDescription(event);
return new SocialActivitiesEvent(socialUser, HomePageTypes.RESOURCE_UPDATE_EVENT.name(), new Date()).withLink(event.getPath().getFileName(), event.getPath().toURI()).withAdicionalInfo(additionalInfo).withDescription(description);
}
Aggregations