use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBeanTest method testCreateMediatorAccessControlEntry.
@Test
public void testCreateMediatorAccessControlEntry() {
MasterAccessControlEntry mace = new MasterAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.LOW, new TrustLevel[0], TrustLevel.HIGH, new TrustLevel[0], OPERATION, Permission.ASK, new Permission[0]);
CreateOrUpdateResult<MasterAccessControlEntry> createResult = new CreateOrUpdateResult<>(mace, ChangeType.ADD);
when(masterAccessControlEntryManagerMock.createOrUpdate(mace, ControlEntryType.MEDIATOR)).thenReturn(createResult);
Boolean result = globalDomainAccessControlListEditorSubject.updateMediatorAccessControlEntry(mace);
assertEquals(Boolean.TRUE, result);
verify(masterAccessControlEntryManagerMock).createOrUpdate(eq(mace), eq(ControlEntryType.MEDIATOR));
verify(globalDomainAccessControllerBeanMock).doFireMediatorAccessControlEntryChanged(eq(ChangeType.ADD), eq(mace));
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBeanTest method testUpdateMasterAccessControlEntry.
@Test
public void testUpdateMasterAccessControlEntry() {
MasterAccessControlEntry mace = new MasterAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.LOW, new TrustLevel[0], TrustLevel.HIGH, new TrustLevel[0], OPERATION, Permission.ASK, new Permission[0]);
CreateOrUpdateResult<MasterAccessControlEntry> updateResult = new CreateOrUpdateResult<>(mace, ChangeType.UPDATE);
when(masterAccessControlEntryManagerMock.createOrUpdate(mace, ControlEntryType.MASTER)).thenReturn(updateResult);
Boolean result = globalDomainAccessControlListEditorSubject.updateMasterAccessControlEntry(mace);
assertEquals(Boolean.TRUE, result);
verify(masterAccessControlEntryManagerMock).createOrUpdate(mace, ControlEntryType.MASTER);
verify(globalDomainAccessControllerBeanMock).doFireMasterAccessControlEntryChanged(ChangeType.UPDATE, mace);
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBeanTest method testRemoveMediatorAccessControlEntry.
@Test
public void testRemoveMediatorAccessControlEntry() {
MasterAccessControlEntry mace = new MasterAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.LOW, new TrustLevel[0], TrustLevel.HIGH, new TrustLevel[0], OPERATION, Permission.ASK, new Permission[0]);
when(masterAccessControlEntryManagerMock.removeByUserIdDomainInterfaceNameAndOperation(USER_ID, DOMAIN, INTERFACE_NAME, OPERATION, ControlEntryType.MEDIATOR)).thenReturn(mace);
Boolean result = globalDomainAccessControlListEditorSubject.removeMediatorAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, OPERATION);
assertEquals(Boolean.TRUE, result);
verify(masterAccessControlEntryManagerMock).removeByUserIdDomainInterfaceNameAndOperation(eq(USER_ID), eq(DOMAIN), eq(INTERFACE_NAME), eq(OPERATION), eq(ControlEntryType.MEDIATOR));
verify(globalDomainAccessControllerBeanMock).doFireMediatorAccessControlEntryChanged(eq(ChangeType.REMOVE), eq(mace));
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessControlListEditorBeanTest method testCreateMasterAccessControlEntry.
@Test
public void testCreateMasterAccessControlEntry() {
MasterAccessControlEntry mace = new MasterAccessControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.LOW, new TrustLevel[0], TrustLevel.HIGH, new TrustLevel[0], OPERATION, Permission.ASK, new Permission[0]);
CreateOrUpdateResult<MasterAccessControlEntry> createResult = new CreateOrUpdateResult<>(mace, ChangeType.ADD);
when(masterAccessControlEntryManagerMock.createOrUpdate(mace, ControlEntryType.MASTER)).thenReturn(createResult);
Boolean result = globalDomainAccessControlListEditorSubject.updateMasterAccessControlEntry(mace);
assertEquals(Boolean.TRUE, result);
verify(masterAccessControlEntryManagerMock).createOrUpdate(eq(mace), eq(ControlEntryType.MASTER));
verify(globalDomainAccessControllerBeanMock).doFireMasterAccessControlEntryChanged(eq(ChangeType.ADD), eq(mace));
}
use of joynr.infrastructure.DacTypes.MasterAccessControlEntry in project joynr by bmwcarit.
the class MasterAccessControlEntryManagerTest method testRemove.
@Test
public void testRemove() {
MasterAccessControlEntryEntity entity = create("user", "domain", "interfaceName", TrustLevel.HIGH, new TrustLevel[0], TrustLevel.LOW, new TrustLevel[0], "operation", Permission.YES, new Permission[0]);
flushAndClear();
MasterAccessControlEntry result = subject.removeByUserIdDomainInterfaceNameAndOperation(entity.getUserId(), entity.getDomain(), entity.getInterfaceName(), entity.getOperation(), MASTER);
assertNotNull(result);
assertEquals("user", result.getUid());
flushAndClear();
MasterAccessControlEntryEntity persisted = entityManager.find(MasterAccessControlEntryEntity.class, entity.getId());
assertNull(persisted);
}
Aggregations