Search in sources :

Example 6 with SocialActivitiesEvent

use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.

the class SocialEventModuleConstraintTest method hasRestrictionsThrowsAnExceptionTest.

@Test
public void hasRestrictionsThrowsAnExceptionTest() throws Exception {
    final SocialActivitiesEvent vfsEvent = spy(new SocialActivitiesEvent(socialUser, "type", new Date()));
    when(vfsEvent.isVFSLink()).thenThrow(RuntimeException.class);
    socialEventModuleConstraint.init();
    assertTrue(socialEventModuleConstraint.hasRestrictions(vfsEvent));
}
Also used : SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date) Test(org.junit.Test)

Example 7 with SocialActivitiesEvent

use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.

the class SocialEventOUConstraintTest method hasNoRestrictionsTest.

@Test
public void hasNoRestrictionsTest() throws Exception {
    final SocialActivitiesEvent event = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("name", "ouname", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
    socialEventOUConstraint.init();
    assertFalse(socialEventOUConstraint.hasRestrictions(event));
}
Also used : SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date) Test(org.junit.Test)

Example 8 with SocialActivitiesEvent

use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.

the class SocialEventOUConstraintTest method hasNoRestrictionsForOtherSocialEventsTest.

@Test
public void hasNoRestrictionsForOtherSocialEventsTest() throws Exception {
    final SocialActivitiesEvent vfsOtherType = new SocialActivitiesEvent(socialUser, "type", new Date()).withLink("link", "link", SocialActivitiesEvent.LINK_TYPE.VFS);
    final SocialActivitiesEvent customEventOtherType = new SocialActivitiesEvent(socialUser, "type", new Date()).withLink("link", "link", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
    socialEventOUConstraint.init();
    assertFalse(socialEventOUConstraint.hasRestrictions(vfsOtherType));
    assertFalse(socialEventOUConstraint.hasRestrictions(customEventOtherType));
}
Also used : SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date) Test(org.junit.Test)

Example 9 with SocialActivitiesEvent

use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.

the class SocialEventOUConstraintTest method ifThereIsNoLoggedUserInScopeShouldNotHaveRestrictions.

@Test
public void ifThereIsNoLoggedUserInScopeShouldNotHaveRestrictions() throws Exception {
    when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(false);
    final SocialActivitiesEvent restrictedEvent = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
    socialEventOUConstraint.init();
    assertFalse(socialEventOUConstraint.hasRestrictions(restrictedEvent));
}
Also used : SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date) Test(org.junit.Test)

Example 10 with SocialActivitiesEvent

use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.

the class SocialEventRepositoryConstraintTest method hasNoRestrictionsTest.

@Test
public void hasNoRestrictionsTest() throws Exception {
    returnRepo = repository;
    final SocialActivitiesEvent vfsEvent = new SocialActivitiesEvent(socialUser, "type", new Date());
    final SocialActivitiesEvent projectEvent = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
    this.socialEventRepositoryConstraint.init();
    assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(vfsEvent));
    assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(projectEvent));
}
Also used : SocialActivitiesEvent(org.ext.uberfire.social.activities.model.SocialActivitiesEvent) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SocialActivitiesEvent (org.ext.uberfire.social.activities.model.SocialActivitiesEvent)24 Date (java.util.Date)20 Test (org.junit.Test)16 ArrayList (java.util.ArrayList)4 SocialUser (org.ext.uberfire.social.activities.model.SocialUser)4 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)3 HashMap (java.util.HashMap)2 Repository (org.guvnor.structure.repositories.Repository)2 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)2 KieServices (org.kie.api.KieServices)2 KieContainer (org.kie.api.runtime.KieContainer)2 KieSession (org.kie.api.runtime.KieSession)2 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 PagedSocialQuery (org.ext.uberfire.social.activities.model.PagedSocialQuery)1 SocialPaged (org.ext.uberfire.social.activities.model.SocialPaged)1 SocialAdapter (org.ext.uberfire.social.activities.service.SocialAdapter)1 NewRepositoryEvent (org.guvnor.structure.repositories.NewRepositoryEvent)1 AgendaFilter (org.kie.api.runtime.rule.AgendaFilter)1 Match (org.kie.api.runtime.rule.Match)1 CommentAddedEvent (org.kie.workbench.common.services.shared.discussion.CommentAddedEvent)1