Search in sources :

Example 6 with DomainRoleEntry

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

the class DomainAccessControlStoreTest method testUpdateDomainRole.

@Test
public void testUpdateDomainRole() throws Exception {
    store.updateDomainRole(expectedUserDomainRoleEntry);
    // update dre role to MASTER
    DomainRoleEntry dre = store.getDomainRoles(UID1).get(0);
    dre.setRole(Role.MASTER);
    store.updateDomainRole(dre);
    assertTrue("UID1 role should be MASTER", store.getDomainRoles(UID1).get(0).getRole().equals(Role.MASTER));
}
Also used : DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) Test(org.junit.Test)

Example 7 with DomainRoleEntry

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

the class DomainAccessControlStoreTest method setup.

@Before
public void setup() {
    // instantiate some template objects
    expectedUserDomainRoleEntry = new DomainRoleEntry(UID1, new String[0], Role.OWNER);
    expectedMasterAccessControlEntry = new MasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, OPERATION1, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    expectedOwnerAccessControlEntry = new OwnerAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, TrustLevel.LOW, OPERATION1, Permission.NO);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) Permission(joynr.infrastructure.DacTypes.Permission) Before(org.junit.Before)

Example 8 with DomainRoleEntry

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

the class ProvisionedDomainAccessControlStoreTest method setup.

@Before
public void setup() throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    // instantiate some template objects
    expectedUserDomainRoleEntry = new DomainRoleEntry(UID1, new String[0], Role.OWNER);
    DomainRoleEntry[] provisionedDomainRoles = { expectedUserDomainRoleEntry };
    domainRoleEntryString = objectMapper.writeValueAsString(provisionedDomainRoles);
    expectedMasterAccessControlEntry = new MasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, OPERATION1, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
    MasterAccessControlEntry[] provisionedMasterAccessControlEntries = { expectedMasterAccessControlEntry };
    masterAccessControlEntryString = objectMapper.writeValueAsString(provisionedMasterAccessControlEntries);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) TrustLevel(joynr.infrastructure.DacTypes.TrustLevel) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) Permission(joynr.infrastructure.DacTypes.Permission) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 9 with DomainRoleEntry

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

the class AccessControllerEnd2EndTest method sendProvisionedEntriesToGDAC.

private void sendProvisionedEntriesToGDAC(List<DomainRoleEntry> domainRoleEntries, List<MasterAccessControlEntry> masterAccessControlEntries, List<MasterAccessControlEntry> mediatorAccessControlEntries, List<OwnerAccessControlEntry> ownerAccessControlEntries) {
    DiscoveryQos discoveryQos = new DiscoveryQos();
    discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
    discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
    discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
    MessagingQos messagingQos = new MessagingQos();
    messagingQos.setTtl_ms(MESSAGING_TTL);
    GlobalDomainAccessControlListEditorProxy gdacListEditorProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainAccessControlListEditorProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    GlobalDomainRoleControllerProxy gdrcProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainRoleControllerProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
    for (DomainRoleEntry entry : domainRoleEntries) {
        assertTrue(gdrcProxy.updateDomainRole(entry));
    }
    for (MasterAccessControlEntry entry : masterAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMasterAccessControlEntry(entry));
    }
    for (MasterAccessControlEntry entry : mediatorAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateMediatorAccessControlEntry(entry));
    }
    for (OwnerAccessControlEntry entry : ownerAccessControlEntries) {
        assertTrue(gdacListEditorProxy.updateOwnerAccessControlEntry(entry));
    }
}
Also used : MessagingQos(io.joynr.messaging.MessagingQos) GlobalDomainAccessControlListEditorProxy(joynr.infrastructure.GlobalDomainAccessControlListEditorProxy) MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry) GlobalDomainRoleControllerProxy(joynr.infrastructure.GlobalDomainRoleControllerProxy) DiscoveryQos(io.joynr.arbitration.DiscoveryQos)

Example 10 with DomainRoleEntry

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

the class AccessControllerEnd2EndTest method createDefaultGDACEntries.

private void createDefaultGDACEntries(String domainName, String interfaceName, String operationName, String userId, Permission permission) {
    MasterAccessControlEntry testEntry = new MasterAccessControlEntry();
    testEntry.setUid(userId);
    testEntry.setDomain(domainName);
    testEntry.setInterfaceName(interfaceName);
    testEntry.setDefaultConsumerPermission(permission);
    testEntry.setOperation(operationName);
    List<MasterAccessControlEntry> provisionedACEs = new ArrayList<MasterAccessControlEntry>();
    provisionedACEs.add(testEntry);
    DomainRoleEntry domainMasterRoleEntry = new DomainRoleEntry();
    domainMasterRoleEntry.setDomains(new String[] { domainName });
    domainMasterRoleEntry.setRole(Role.MASTER);
    domainMasterRoleEntry.setUid(userId);
    DomainRoleEntry domainOwnerRoleEntry = new DomainRoleEntry();
    domainOwnerRoleEntry.setDomains(new String[] { domainName });
    domainOwnerRoleEntry.setRole(Role.OWNER);
    domainOwnerRoleEntry.setUid(userId);
    List<DomainRoleEntry> domainRoleEntries = new ArrayList<DomainRoleEntry>();
    domainRoleEntries.add(domainMasterRoleEntry);
    domainRoleEntries.add(domainOwnerRoleEntry);
    OwnerAccessControlEntry ownerControlEntry = new OwnerAccessControlEntry();
    ownerControlEntry.setDomain(domainName);
    ownerControlEntry.setInterfaceName(interfaceName);
    ownerControlEntry.setUid(userId);
    ownerControlEntry.setConsumerPermission(Permission.YES);
    List<OwnerAccessControlEntry> ownerEntries = new ArrayList<OwnerAccessControlEntry>();
    ownerEntries.add(ownerControlEntry);
    sendProvisionedEntriesToGDAC(domainRoleEntries, provisionedACEs, provisionedACEs, ownerEntries);
}
Also used : MasterAccessControlEntry(joynr.infrastructure.DacTypes.MasterAccessControlEntry) OwnerAccessControlEntry(joynr.infrastructure.DacTypes.OwnerAccessControlEntry) ArrayList(java.util.ArrayList) DomainRoleEntry(joynr.infrastructure.DacTypes.DomainRoleEntry)

Aggregations

DomainRoleEntry (joynr.infrastructure.DacTypes.DomainRoleEntry)21 Test (org.junit.Test)8 MasterAccessControlEntry (joynr.infrastructure.DacTypes.MasterAccessControlEntry)7 OwnerAccessControlEntry (joynr.infrastructure.DacTypes.OwnerAccessControlEntry)6 Permission (joynr.infrastructure.DacTypes.Permission)4 TrustLevel (joynr.infrastructure.DacTypes.TrustLevel)4 Cache (net.sf.ehcache.Cache)4 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)3 Query (net.sf.ehcache.search.Query)3 Results (net.sf.ehcache.search.Results)3 DomainRoleEntryEntity (io.joynr.accesscontrol.global.jee.persistence.DomainRoleEntryEntity)2 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)2 MessagingQos (io.joynr.messaging.MessagingQos)2 Result (net.sf.ehcache.search.Result)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DomainAccessControlStoreEhCache (io.joynr.accesscontrol.DomainAccessControlStoreEhCache)1 UserRoleKey (io.joynr.accesscontrol.primarykey.UserRoleKey)1 Promise (io.joynr.provider.Promise)1 ProxyBuilderFactoryImpl (io.joynr.proxy.ProxyBuilderFactoryImpl)1