Search in sources :

Example 6 with OwnerRegistrationControlEntry

use of joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry in project joynr by bmwcarit.

the class GlobalDomainAccessControlListEditorBeanTest method testRemoveOwnerRegistrationControlEntry.

@Test
public void testRemoveOwnerRegistrationControlEntry() {
    OwnerRegistrationControlEntry orce = new OwnerRegistrationControlEntry(USER_ID, DOMAIN, INTERFACE_NAME, TrustLevel.HIGH, TrustLevel.LOW, Permission.ASK);
    when(ownerRegistrationControlEntryManagerMock.removeByUserIdDomainAndInterfaceName(USER_ID, DOMAIN, INTERFACE_NAME)).thenReturn(orce);
    assertTrue(globalDomainAccessControlListEditorSubject.removeOwnerRegistrationControlEntry(USER_ID, DOMAIN, INTERFACE_NAME));
    verify(ownerRegistrationControlEntryManagerMock).removeByUserIdDomainAndInterfaceName(eq(USER_ID), eq(DOMAIN), eq(INTERFACE_NAME));
    verify(globalDomainAccessControllerBeanMock).doFireOwnerRegistrationControlEntryChanged(eq(ChangeType.REMOVE), eq(orce));
}
Also used : OwnerRegistrationControlEntry(joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry) Test(org.junit.Test)

Example 7 with OwnerRegistrationControlEntry

use of joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry in project joynr by bmwcarit.

the class OwnerRegistrationControlEntryManagerTest method testCreate.

@Test
public void testCreate() {
    String userId = "user";
    String domain = "domain";
    String interfaceName = "interfaceName";
    OwnerRegistrationControlEntry data = new OwnerRegistrationControlEntry(userId, domain, interfaceName, TrustLevel.MID, TrustLevel.HIGH, Permission.ASK);
    CreateOrUpdateResult<OwnerRegistrationControlEntry> result = subject.createOrUpdate(data);
    assertNotNull(result);
    assertEquals(ChangeType.ADD, result.getChangeType());
    assertNotNull(result.getEntry());
    assertEquals(userId, result.getEntry().getUid());
    flushAndClear();
    OwnerRegistrationControlEntry[] persisted = subject.findByUserId(userId);
    assertNotNull(persisted);
    assertEquals(1, persisted.length);
}
Also used : OwnerRegistrationControlEntry(joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry) Test(org.junit.Test)

Example 8 with OwnerRegistrationControlEntry

use of joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry in project joynr by bmwcarit.

the class OwnerRegistrationControlEntryManagerTest method testFindByUserIdAndThatAreEditable.

@Test
public void testFindByUserIdAndThatAreEditable() {
    String userId = "userId";
    String domain = "domain1";
    create(userId, domain, "interfaceName", TrustLevel.MID, TrustLevel.HIGH, Permission.ASK);
    create(userId, "domain2", "interfaceName", TrustLevel.MID, TrustLevel.HIGH, Permission.ASK);
    DomainRoleEntryEntity domainRoleEntryEntity = new DomainRoleEntryEntity();
    domainRoleEntryEntity.setUserId(userId);
    domainRoleEntryEntity.setRole(Role.OWNER);
    domainRoleEntryEntity.setDomains(Sets.newHashSet(domain));
    entityManager.persist(domainRoleEntryEntity);
    flushAndClear();
    OwnerRegistrationControlEntry[] result = subject.findByUserIdAndThatIsEditable(userId);
    assertNotNull(result);
    assertEquals(1, result.length);
}
Also used : DomainRoleEntryEntity(io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity) OwnerRegistrationControlEntry(joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry) Test(org.junit.Test)

Aggregations

OwnerRegistrationControlEntry (joynr.infrastructure.DacTypes.OwnerRegistrationControlEntry)8 Test (org.junit.Test)7 DomainRoleEntryEntity (io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity)2 OwnerRegistrationControlEntryEntity (io.joynr.accesscontrol.global.jee.persistence.OwnerRegistrationControlEntryEntity)2 ChangeType (joynr.infrastructure.DacTypes.ChangeType)1