@Test public void testCreateLocalAuthor() { context.checking(new Expectations() {{ oneOf(crypto).generateSignatureKeyPair(); will(returnValue(keyPair)); oneOf(publicKey).getEncoded(); will(returnValue(publicKeyBytes)); oneOf(privateKey).getEncoded(); will(returnValue(privateKeyBytes)); oneOf(authorFactory).createLocalAuthor(authorName, publicKeyBytes, privateKeyBytes); will(returnValue(localAuthor)); }}); assertEquals(localAuthor, identityManager.createLocalAuthor(authorName)); }
@Override public LocalAuthor createLocalAuthor(String name) { long start = now(); KeyPair keyPair = crypto.generateSignatureKeyPair(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); LocalAuthor localAuthor = authorFactory.createLocalAuthor(name, publicKey, privateKey); logDuration(LOG, "Creating local author", start); return localAuthor; }
IdentityManagerImpl implements IdentityManager { @Override public LocalAuthor createLocalAuthor(String name) { long start = now(); KeyPair keyPair = crypto.generateSignatureKeyPair(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); LocalAuthor localAuthor = authorFactory.createLocalAuthor(name, publicKey, privateKey); logDuration(LOG, "Creating local author", start); return localAuthor; } }
IdentityManagerImpl implements IdentityManager { @Override public LocalAuthor createLocalAuthor(String name) { long start = now(); KeyPair keyPair = crypto.generateSignatureKeyPair(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); LocalAuthor localAuthor = authorFactory.createLocalAuthor(name, publicKey, privateKey); logDuration(LOG, "Creating local author", start); return localAuthor; } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); }
IdentityManagerImpl implements IdentityManager { @Override public LocalAuthor createLocalAuthor(String name) { long start = now(); KeyPair keyPair = crypto.generateSignatureKeyPair(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); LocalAuthor localAuthor = authorFactory.createLocalAuthor(name, publicKey, privateKey); logDuration(LOG, "Creating local author", start); return localAuthor; } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); @Override LocalAuthor createLocalAuthor(String name); @Override void registerLocalAuthor(LocalAuthor a); @Override void storeLocalAuthor(); @Override LocalAuthor getLocalAuthor(); @Override LocalAuthor getLocalAuthor(Transaction txn); @Override Status getAuthorStatus(AuthorId authorId); @Override Status getAuthorStatus(Transaction txn, AuthorId authorId); }
IdentityManagerImpl implements IdentityManager { @Override public LocalAuthor createLocalAuthor(String name) { long start = now(); KeyPair keyPair = crypto.generateSignatureKeyPair(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); LocalAuthor localAuthor = authorFactory.createLocalAuthor(name, publicKey, privateKey); logDuration(LOG, "Creating local author", start); return localAuthor; } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); @Override LocalAuthor createLocalAuthor(String name); @Override void registerLocalAuthor(LocalAuthor a); @Override void storeLocalAuthor(); @Override LocalAuthor getLocalAuthor(); @Override LocalAuthor getLocalAuthor(Transaction txn); @Override Status getAuthorStatus(AuthorId authorId); @Override Status getAuthorStatus(Transaction txn, AuthorId authorId);  }