Exemplo n.º 1
0
  @Test
  public void creatingKeyFromIdentityWithConvertableIdentifier() {
    ObjectIdentity identity = new ObjectIdentityImpl(TYPE, ID);

    AclRecord underTest = new AclRecord(identity, new StringAclIdentifierConverter());

    assertEquals(identity, underTest.getIdentity());
    assertTrue(ArrayUtils.isEquals(ID.getBytes(), underTest.getKey()));
    assertTrue(ArrayUtils.isEquals(String.class.getName().getBytes(), underTest.getIdTypeBytes()));
  }
Exemplo n.º 2
0
  @Test
  public void creatingKeyFromIdentityWithByteArrayIdentifier() {
    ObjectIdentity identity = new ObjectIdentityImpl(TYPE, ID.getBytes());

    AclRecord underTest = new AclRecord(identity, null);

    assertEquals(identity, underTest.getIdentity());
    assertTrue(ArrayUtils.isEquals(ID.getBytes(), underTest.getKey()));
    assertTrue(ArrayUtils.isEquals(byte[].class.getName().getBytes(), underTest.getIdTypeBytes()));
  }
Exemplo n.º 3
0
  @Test
  public void creatingIdentityWithByteArrayIdentifier() {
    NavigableMap<byte[], byte[]> familyMap = recordMap(byte[].class, false);
    AclRecord underTest = new AclRecord(ID.getBytes(), familyMap, null);

    ObjectIdentity returnedIdentity = underTest.getIdentity();
    assertEquals(TYPE, returnedIdentity.getType());
    assertTrue(ArrayUtils.isEquals(ID.getBytes(), returnedIdentity.getIdentifier()));
    assertTrue(ArrayUtils.isEquals(ID.getBytes(), underTest.getKey()));
    assertTrue(ArrayUtils.isEquals(byte[].class.getName().getBytes(), underTest.getIdTypeBytes()));
    assertEquals(new GrantedAuthoritySid(SOME_PRINCIPAL), underTest.getOwner());
  }
Exemplo n.º 4
0
  @Test
  public void creatingRecordFromBytesWithNonPrincipalOwner() {
    NavigableMap<byte[], byte[]> familyMap = recordMap(String.class, false);
    AclRecord underTest =
        new AclRecord(ID.getBytes(), familyMap, new StringAclIdentifierConverter());

    ObjectIdentity identity = new ObjectIdentityImpl(TYPE, ID);

    assertEquals(identity, underTest.getIdentity());
    assertTrue(ArrayUtils.isEquals(ID.getBytes(), underTest.getKey()));
    assertTrue(ArrayUtils.isEquals(String.class.getName().getBytes(), underTest.getIdTypeBytes()));
    assertEquals(new GrantedAuthoritySid(SOME_PRINCIPAL), underTest.getOwner());
  }