public static KrbIdentity[] createManyIdentities() throws KrbException { List<KrbIdentity> results = createManyIdentities(20); return results.toArray(new KrbIdentity[results.size()]); }
public static KrbIdentity createOneIdentity() throws KrbException { return createOneIdentity(TEST_PRINCIPAL); }
private void prepareIdentities() throws KrbException { BackendTestUtil.createManyIdentities(backend, 100); BackendTestUtil.createTheTestIdentity(backend); }
public static KrbIdentity createOneIdentity(String principal) throws KrbException { KrbIdentity kid = new KrbIdentity(principal); kid.setCreatedTime(KerberosTime.now()); kid.setExpireTime(KerberosTime.now()); kid.setDisabled(false); kid.setKeyVersion(1); kid.setLocked(false); kid.addKeys(generateKeys()); return kid; }
public static List<EncryptionKey> generateKeys() throws KrbException { return EncryptionUtil.generateKeys(getEncryptionTypes()); }
@Benchmark @Fork(1) public void queryTest() throws Exception { BackendTestUtil.getTheTestIdentity(backend); }
public static KrbIdentity createOneIdentity(String principal) throws KrbException { KrbIdentity kid = new KrbIdentity(principal); kid.setCreatedTime(KerberosTime.now()); kid.setExpireTime(KerberosTime.now()); kid.setDisabled(false); kid.setKeyVersion(1); kid.setLocked(false); kid.addKeys(generateKeys()); return kid; }
public static List<EncryptionKey> generateKeys() throws KrbException { return EncryptionUtil.generateKeys(getEncryptionTypes()); }
public static KrbIdentity[] createManyIdentities() throws KrbException { List<KrbIdentity> results = createManyIdentities(20); return results.toArray(new KrbIdentity[results.size()]); }
public static KrbIdentity createOneIdentity() throws KrbException { return createOneIdentity(TEST_PRINCIPAL); }
public static void createManyIdentities(IdentityBackend backend, int count) throws KrbException { int howMany = count > 0 ? count : 20; List<KrbIdentity> identities = createManyIdentities(howMany); for (KrbIdentity identity : identities) { backend.addIdentity(identity); } }
public static List<KrbIdentity> createManyIdentities( int count) throws KrbException { List<KrbIdentity> results = new ArrayList<>(count); for (int i = 0; i < count; ++i) { String tmp = TEST_PRINCIPAL_PREFIX + i + "@" + TEST_REALM; results.add(createOneIdentity(tmp)); } return results; }
public static void createManyIdentities(IdentityBackend backend, int count) throws KrbException { int howMany = count > 0 ? count : 20; List<KrbIdentity> identities = createManyIdentities(howMany); for (KrbIdentity identity : identities) { backend.addIdentity(identity); } }
public static List<KrbIdentity> createManyIdentities( int count) throws KrbException { List<KrbIdentity> results = new ArrayList<>(count); for (int i = 0; i < count; ++i) { String tmp = TEST_PRINCIPAL_PREFIX + i + "@" + TEST_REALM; results.add(createOneIdentity(tmp)); } return results; }
protected void testGetIdentities(IdentityBackend backend) throws KrbException { KrbIdentity[] identities = BackendTestUtil.createManyIdentities(); for (KrbIdentity identity : identities) { backend.addIdentity(identity); } // clear the identity cache. backend.release(); Iterable<String> principals = backend.getIdentities(); Iterator<String> iterator = principals.iterator(); List<String> principalList = new LinkedList<>(); while (iterator.hasNext()) { principalList.add(iterator.next()); } assertThat(principalList).hasSize(identities.length) .contains(identities[0].getPrincipalName()) .contains(identities[1].getPrincipalName()) .contains(identities[2].getPrincipalName()) .contains(identities[3].getPrincipalName()) .contains(identities[4].getPrincipalName()); //tearDown for (KrbIdentity identity : identities) { backend.deleteIdentity(identity.getPrincipalName()); } }
public static void createTheTestIdentity( IdentityBackend backend) throws KrbException { backend.addIdentity(createOneIdentity(TEST_PRINCIPAL)); }
protected void testGetIdentities(IdentityBackend backend) throws KrbException { KrbIdentity[] identities = BackendTestUtil.createManyIdentities(); for (KrbIdentity identity : identities) { backend.addIdentity(identity); } // clear the identity cache. backend.release(); Iterable<String> principals = backend.getIdentities(); Iterator<String> iterator = principals.iterator(); List<String> principalList = new LinkedList<>(); while (iterator.hasNext()) { principalList.add(iterator.next()); } assertThat(principalList).hasSize(identities.length) .contains(identities[0].getPrincipalName()) .contains(identities[1].getPrincipalName()) .contains(identities[2].getPrincipalName()) .contains(identities[3].getPrincipalName()) .contains(identities[4].getPrincipalName()); //tearDown for (KrbIdentity identity : identities) { backend.deleteIdentity(identity.getPrincipalName()); } }
public static void createTheTestIdentity( IdentityBackend backend) throws KrbException { backend.addIdentity(createOneIdentity(TEST_PRINCIPAL)); }
protected void testStore(IdentityBackend backend) throws KrbException { KrbIdentity kid = BackendTestUtil.createOneIdentity(TEST_PRINCIPAL); backend.addIdentity(kid); // clear the identity cache. backend.release(); KrbIdentity kid2 = backend.getIdentity(TEST_PRINCIPAL); assertThat(kid).isEqualTo(kid2); //tearDown backend.deleteIdentity(TEST_PRINCIPAL); }
protected void testStore(IdentityBackend backend) throws KrbException { KrbIdentity kid = BackendTestUtil.createOneIdentity(TEST_PRINCIPAL); backend.addIdentity(kid); // clear the identity cache. backend.release(); KrbIdentity kid2 = backend.getIdentity(TEST_PRINCIPAL); assertThat(kid).isEqualTo(kid2); //tearDown backend.deleteIdentity(TEST_PRINCIPAL); }