use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.
the class SocialEventModuleConstraintTest method nullModulehasNoRestrictionsTest.
@Test
public void nullModulehasNoRestrictionsTest() throws Exception {
eventProject = null;
final SocialActivitiesEvent vfsEvent = new SocialActivitiesEvent(socialUser, "type", new Date());
final SocialActivitiesEvent moduleEvent = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
socialEventModuleConstraint.init();
assertFalse(socialEventModuleConstraint.hasRestrictions(vfsEvent));
assertFalse(socialEventModuleConstraint.hasRestrictions(moduleEvent));
verify(authorizationManager, never()).authorize((Resource) null, user);
verify(authorizationManager, never()).authorize((Permission) null, user);
}
use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.
the class SocialEventOUConstraintTest method hasRestrictionsBecauseThrowsAnExceptionTest.
@Test
public void hasRestrictionsBecauseThrowsAnExceptionTest() throws Exception {
final SocialActivitiesEvent event = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("name", "ouname", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
SocialEventOUConstraint spy = spy(socialEventOUConstraint);
when(spy.isOUSocialEvent(event)).thenThrow(RuntimeException.class);
spy.init();
assertTrue(spy.hasRestrictions(event));
}
use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.
the class SocialEventOUConstraintTest method hasRestrictionsTest.
@Test
public void hasRestrictionsTest() throws Exception {
final SocialActivitiesEvent event = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()).withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
socialEventOUConstraint.init();
assertTrue(socialEventOUConstraint.hasRestrictions(event));
}
use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraintTest method hasNoRestrictionsForOtherSocialEventsTest.
@Test
public void hasNoRestrictionsForOtherSocialEventsTest() throws Exception {
final SocialActivitiesEvent customEventOtherType = new SocialActivitiesEvent(socialUser, "type", new Date()).withLink("link", "link", SocialActivitiesEvent.LINK_TYPE.CUSTOM);
assertFalse(socialEventRepositoryConstraint.hasRestrictions(customEventOtherType));
}
use of org.ext.uberfire.social.activities.model.SocialActivitiesEvent in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraintTest 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.VFS);
socialEventRepositoryConstraint.init();
assertFalse(socialEventRepositoryConstraint.hasRestrictions(restrictedEvent));
}
Aggregations