/** * Testing only. For lne-key roles, return the keyrecord. * @deprecated the only usable check allowance method is isAllowedForKeys * @return found {@link KeyRecord} */ @Deprecated public KeyRecord getKeyRecord() { Set<KeyRecord> kr = getKeyRecords(); if (kr.size() > 1) throw new IllegalStateException("can't get key record as there are many of them"); return kr.iterator().next(); }
/** * Get set of all key records in linked role. * * @return set of key records (see {@link KeyRecord}) */ @Override @Deprecated public Set<KeyRecord> getKeyRecords() { return resolve().getKeyRecords(); }
@Deprecated public KeyRecord testGetOwner() { return getRole("owner").getKeyRecords().iterator().next(); }
Role role = Role.fromDslBinder("role",binder); assertTrue(role instanceof SimpleRole); assertTrue(role.getKeyRecords().size() == 1); Role role = Role.fromDslBinder("role",binder); assertTrue(role instanceof SimpleRole); assertTrue(role.getKeyRecords().size() == 2); Role role = Role.fromDslBinder("role",binder); assertTrue(role instanceof SimpleRole); assertTrue(role.getKeyRecords().size() == 1);
protected void assertSameContracts(Contract originContract, Contract checkingContract) { KeyRecord originIssuer = originContract.getIssuer().getKeyRecords().iterator().next(); KeyRecord checkingIssuer = checkingContract.getIssuer().getKeyRecords().iterator().next(); assertNotNull(checkingIssuer); assertThat(checkingIssuer.getPublicKey(), is(instanceOf(PublicKey.class))); KeyRecord originCreator = originContract.getCreator().getKeyRecords().iterator().next(); KeyRecord checkingCreator = checkingContract.getCreator().getKeyRecords().iterator().next(); assertNotNull(checkingCreator); assertThat(checkingCreator.getPublicKey(), is(instanceOf(PublicKey.class))); KeyRecord originOwner = originContract.getOwner().getKeyRecords().iterator().next(); KeyRecord checkingOwner = checkingContract.getOwner().getKeyRecords().iterator().next(); assertNotNull(checkingOwner); assertThat(checkingOwner.getPublicKey(), is(instanceOf(PublicKey.class)));
KeyRecord issuer = c.getIssuer().getKeyRecords().iterator().next(); assertNotNull(issuer); assertThat(issuer.getPublicKey(), is(instanceOf(PublicKey.class)));