Search in sources :

Example 6 with SocialUser

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());
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with SocialUser

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);
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) Test(org.junit.Test)

Example 8 with SocialUser

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);
}
Also used : SessionInfoMock(org.uberfire.mocks.SessionInfoMock) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 9 with SocialUser

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("");
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ContextNotActiveException(javax.enterprise.context.ContextNotActiveException) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) NewRepositoryEvent(org.guvnor.structure.repositories.NewRepositoryEvent) Date(java.util.Date)

Example 10 with SocialUser

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);
}
Also used : SocialUser(org.ext.uberfire.social.activities.model.SocialUser) SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) ResourceUpdatedEvent(org.uberfire.workbench.events.ResourceUpdatedEvent) Date(java.util.Date)

Aggregations

SocialUser (org.ext.uberfire.social.activities.model.SocialUser)14 Date (java.util.Date)4 SocialActivitiesEvent (org.ext.uberfire.social.activities.model.SocialActivitiesEvent)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 SocialPaged (org.ext.uberfire.social.activities.model.SocialPaged)2 Before (org.junit.Before)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 Next (org.ext.uberfire.social.activities.client.widgets.pagination.Next)1 SimpleSocialTimelineWidgetModel (org.ext.uberfire.social.activities.client.widgets.timeline.simple.model.SimpleSocialTimelineWidgetModel)1 SocialUserRepositoryAPI (org.ext.uberfire.social.activities.service.SocialUserRepositoryAPI)1 SocialUserServiceAPI (org.ext.uberfire.social.activities.service.SocialUserServiceAPI)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 NewRepositoryEvent (org.guvnor.structure.repositories.NewRepositoryEvent)1 UserImpl (org.jboss.errai.security.shared.api.identity.UserImpl)1 UserEditedEvent (org.kie.workbench.common.screens.social.hp.client.homepage.events.UserEditedEvent)1 UserHomepageSelectedEvent (org.kie.workbench.common.screens.social.hp.client.homepage.events.UserHomepageSelectedEvent)1