use of joynr.infrastructure.DacTypes.Permission 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.Permission in project joynr by bmwcarit.
the class MasterRegistrationControlEntryManager method mapEntityToJoynrType.
private MasterRegistrationControlEntry mapEntityToJoynrType(MasterRegistrationControlEntryEntity entity) {
Set<TrustLevel> possibleRequiredTrustLevels = Sets.newHashSet(entity.getPossibleRequiredTrustLevels());
Set<TrustLevel> possibleRequiredControlEntryChangeTrustLevels = Sets.newHashSet(entity.getPossibleRequiredControlEntryChangeTrustLevels());
Set<Permission> possibleProviderPermissions = Sets.newHashSet(entity.getDefaultProviderPermission());
MasterRegistrationControlEntry entry = new MasterRegistrationControlEntry(entity.getUserId(), entity.getDomain(), entity.getInterfaceName(), entity.getDefaultRequiredTrustLevel(), possibleRequiredTrustLevels.toArray(new TrustLevel[possibleRequiredTrustLevels.size()]), entity.getDefaultRequiredControlEntryChangeTrustLevel(), possibleRequiredControlEntryChangeTrustLevels.toArray(new TrustLevel[possibleRequiredControlEntryChangeTrustLevels.size()]), entity.getDefaultProviderPermission(), possibleProviderPermissions.toArray(new Permission[possibleProviderPermissions.size()]));
return entry;
}
use of joynr.infrastructure.DacTypes.Permission in project joynr by bmwcarit.
the class AceValidatorTest method setup.
@Before
public void setup() {
masterAce = new MasterAccessControlEntry(null, null, null, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.HIGH }, null, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
mediatorAce = new MasterAccessControlEntry(null, null, null, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.HIGH }, null, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
ownerAce = new OwnerAccessControlEntry(null, null, null, TrustLevel.MID, TrustLevel.HIGH, null, Permission.ASK);
}
use of joynr.infrastructure.DacTypes.Permission in project joynr by bmwcarit.
the class LocalDomainAccessControllerTest method setup.
@SuppressWarnings("unchecked")
@Before
public void setup() {
cacheManager = CacheManager.create();
domainAccessControlStore = new DomainAccessControlStoreEhCache(cacheManager, new DefaultDomainAccessControlProvisioning());
when(proxyInvocationHandlerFactoryMock.create(any(Set.class), any(String.class), any(String.class), any(DiscoveryQos.class), any(MessagingQos.class))).thenReturn(proxyInvocationHandlerMock);
GlobalDiscoveryEntry accessControlDomain = mock(GlobalDiscoveryEntry.class);
when(accessControlDomain.getDomain()).thenReturn("accessControlDomain");
localDomainAccessController = new LocalDomainAccessControllerImpl(accessControlDomain, domainAccessControlStore, new ProxyBuilderFactoryImpl(localDiscoveryAggregator, proxyInvocationHandlerFactoryMock, MAX_TTL, DISCOVERY_TIMEOUT_MS, RETRY_INTERVAL_MS), "systemServiceDomain");
// instantiate some template objects
userDre = new DomainRoleEntry(UID1, new String[] { DOMAIN1 }, Role.OWNER);
masterAce = new MasterAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, TrustLevel.LOW, new TrustLevel[] { TrustLevel.MID, TrustLevel.LOW }, OPEARATION1, Permission.NO, new Permission[] { Permission.ASK, Permission.NO });
ownerAce = new OwnerAccessControlEntry(UID1, DOMAIN1, INTERFACE1, TrustLevel.LOW, TrustLevel.LOW, OPEARATION1, Permission.YES);
}
use of joynr.infrastructure.DacTypes.Permission in project joynr by bmwcarit.
the class AccessControlAlgorithmTest method testPermissionWithMasterAndInvalidMediatorAce.
@Test
public void testPermissionWithMasterAndInvalidMediatorAce() {
masterAce.setPossibleConsumerPermissions(new Permission[] { Permission.NO });
mediatorAce.setPossibleConsumerPermissions(new Permission[] { Permission.ASK, Permission.YES });
mediatorAce.setDefaultConsumerPermission(Permission.YES);
mediatorAce.setDefaultRequiredTrustLevel(TrustLevel.MID);
Permission consumerPermission = accessControlAlgorithm.getConsumerPermission(masterAce, mediatorAce, null, TrustLevel.HIGH);
Assert.assertEquals(Permission.NO, consumerPermission);
}
Aggregations