use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.
the class OwnerAccessControlEntryManagerTest method testUpdate.
@Test
public void testUpdate() {
OwnerAccessControlEntryEntity entity = create("user", "domain", "interfaceName", TrustLevel.HIGH, TrustLevel.LOW, "operation", Permission.ASK);
entityManager.persist(entity);
flushAndClear();
OwnerAccessControlEntry updateData = new OwnerAccessControlEntry("user", "domain", "interfaceName", TrustLevel.MID, TrustLevel.HIGH, "operation", Permission.YES);
CreateOrUpdateResult<OwnerAccessControlEntry> result = subject.createOrUpdate(updateData);
assertNotNull(result);
assertEquals(ChangeType.UPDATE, result.getChangeType());
assertNotNull(result.getEntry());
assertEquals("user", result.getEntry().getUid());
flushAndClear();
entity = entityManager.find(OwnerAccessControlEntryEntity.class, entity.getId());
assertNotNull(entity);
assertEquals(TrustLevel.MID, entity.getRequiredTrustLevel());
assertEquals(TrustLevel.HIGH, entity.getRequiredAceChangeTrustLevel());
assertEquals(Permission.YES, entity.getConsumerPermission());
}
use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry in project joynr by bmwcarit.
the class DomainAccessControlStoreTest method testGetWildcardUser.
@Test
public void testGetWildcardUser() throws Exception {
OwnerAccessControlEntry expectedOwnerAccessControlEntryWildcard = new OwnerAccessControlEntry(WILDCARD, DOMAIN1, INTERFACEX, TrustLevel.HIGH, TrustLevel.HIGH, OPERATIONX, Permission.YES);
store.updateOwnerAccessControlEntry(expectedOwnerAccessControlEntryWildcard);
assertTrue("Exactly one owner ACE for WILDCARD user should be in Owner ACL", store.getOwnerAccessControlEntries(WILDCARD).size() == 1);
assertTrue("In case no USER2_ID ACE found, WILDCARD user ACE should be returned", store.getOwnerAccessControlEntries(UID2).get(0).getUid().equals(WILDCARD));
assertTrue("Uid of returned owner ACEs associated to DOMAIN1 and INTERFACEX should be WILDCARD", store.getOwnerAccessControlEntries(DOMAIN1, INTERFACEX).get(0).getUid().equals(WILDCARD));
}
use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry 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.OwnerAccessControlEntry in project joynr by bmwcarit.
the class GlobalDomainAccessStoreAdminEhCache method getAllOwnerAclEntries.
@Override
public List<OwnerAccessControlEntry> getAllOwnerAclEntries() {
List<OwnerAccessControlEntry> result = new ArrayList<OwnerAccessControlEntry>();
Cache aclCache = getCache(CacheId.OWNER_ACL);
Map<Object, Element> aclMap = aclCache.getAll(aclCache.getKeys());
Iterator<Map.Entry<Object, Element>> iterator = aclMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<Object, Element> thisMapEntry = iterator.next();
Element thisElement = thisMapEntry.getValue();
OwnerAccessControlEntry objectValue = getElementValue(thisElement);
result.add(objectValue);
}
return result;
}
use of joynr.infrastructure.DacTypes.OwnerAccessControlEntry 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));
}
}
Aggregations