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));
}
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));
}
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));
}
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));
}
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));
}
Aggregations