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