Search in sources :

Example 1 with Permission

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

the class AccessControlAlgorithmTest method testPermissionMessageTrustLevelDoesntMatchAce.

@Test
public void testPermissionMessageTrustLevelDoesntMatchAce() {
    masterAce.setDefaultConsumerPermission(Permission.YES);
    masterAce.setDefaultRequiredTrustLevel(TrustLevel.MID);
    Permission consumerPermission = accessControlAlgorithm.getConsumerPermission(masterAce, null, null, TrustLevel.LOW);
    Assert.assertEquals(Permission.NO, consumerPermission);
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) Test(org.junit.Test)

Example 2 with Permission

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

the class AccessControlAlgorithmTest method testPermissionWithMasterAndMediatorAce.

// ------ Mediator overrides master with -----------------------------
@Test
public void testPermissionWithMasterAndMediatorAce() {
    masterAce.setDefaultConsumerPermission(Permission.YES);
    masterAce.setDefaultRequiredTrustLevel(TrustLevel.HIGH);
    masterAce.setPossibleConsumerPermissions(allPermissions);
    masterAce.setPossibleRequiredTrustLevels(allTrustLevels);
    mediatorAce.setDefaultConsumerPermission(Permission.ASK);
    mediatorAce.setDefaultRequiredTrustLevel(TrustLevel.LOW);
    Permission providerPermission = accessControlAlgorithm.getConsumerPermission(masterAce, mediatorAce, null, TrustLevel.LOW);
    Assert.assertEquals(Permission.ASK, providerPermission);
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) Test(org.junit.Test)

Example 3 with Permission

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

the class AccessControlAlgorithmTest method testPermissionWithMediatorAndInvalidOwnerAce.

@Test
public void testPermissionWithMediatorAndInvalidOwnerAce() {
    mediatorAce.setPossibleConsumerPermissions(new Permission[] { Permission.NO });
    ownerAce.setConsumerPermission(Permission.ASK);
    Permission consumerPermission = accessControlAlgorithm.getConsumerPermission(null, mediatorAce, ownerAce, TrustLevel.HIGH);
    Assert.assertEquals(Permission.NO, consumerPermission);
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) Test(org.junit.Test)

Example 4 with Permission

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

the class AccessControlAlgorithmTest method testPermissionWithMediatorOnly.

@Test
public void testPermissionWithMediatorOnly() {
    mediatorAce.setDefaultConsumerPermission(Permission.YES);
    mediatorAce.setDefaultRequiredTrustLevel(TrustLevel.MID);
    Permission providerPermission = accessControlAlgorithm.getConsumerPermission(null, mediatorAce, null, TrustLevel.HIGH);
    Assert.assertEquals(Permission.YES, providerPermission);
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) Test(org.junit.Test)

Example 5 with Permission

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

the class AccessControlAlgorithmTest method testPermissionWithMasterAndOwnerAce.

@Test
public void testPermissionWithMasterAndOwnerAce() {
    masterAce.setDefaultConsumerPermission(Permission.ASK);
    masterAce.setDefaultRequiredTrustLevel(TrustLevel.LOW);
    ownerAce.setConsumerPermission(Permission.YES);
    ownerAce.setRequiredTrustLevel(TrustLevel.HIGH);
    Permission consumerPermission = accessControlAlgorithm.getConsumerPermission(masterAce, null, ownerAce, TrustLevel.HIGH);
    Assert.assertEquals(Permission.YES, consumerPermission);
}
Also used : Permission(joynr.infrastructure.DacTypes.Permission) Test(org.junit.Test)

Aggregations

Permission (joynr.infrastructure.DacTypes.Permission)20 Test (org.junit.Test)11 TrustLevel (joynr.infrastructure.DacTypes.TrustLevel)7 MasterAccessControlEntry (joynr.infrastructure.DacTypes.MasterAccessControlEntry)6 Before (org.junit.Before)5 DomainRoleEntry (joynr.infrastructure.DacTypes.DomainRoleEntry)4 OwnerAccessControlEntry (joynr.infrastructure.DacTypes.OwnerAccessControlEntry)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 UserDomainInterfaceOperationKey (io.joynr.accesscontrol.primarykey.UserDomainInterfaceOperationKey)1 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)1 MessagingQos (io.joynr.messaging.MessagingQos)1 ProxyBuilderFactoryImpl (io.joynr.proxy.ProxyBuilderFactoryImpl)1 Set (java.util.Set)1 CheckForNull (javax.annotation.CheckForNull)1 MasterRegistrationControlEntry (joynr.infrastructure.DacTypes.MasterRegistrationControlEntry)1 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)1