@GET public User getUser() { User user = new User(); user.setId(12345L); user.setName("smallnest"); user.setCreatedOn(new Date()); return user; }
private User createUser() { User user = new User(); user.setId(System.currentTimeMillis()); user.setUsername("fred"); user.setFirstName("Fred"); user.setLastName("Meyer"); user.setEmail("*****@*****.**"); user.setPassword("xxXXxx"); user.setPhone("408-867-5309"); user.setUserStatus(123); return user; }
Base1() throws GoraException, NoSuchAlgorithmException { final ByteBuffer b0 = ByteBuffer.wrap("0".getBytes()); b0.mark(); e0 = new com.kareebo.contacts.thrift.EncryptionKey( b0, com.kareebo.contacts.thrift.EncryptionAlgorithm.RSA2048); final User user0 = userDatastore.get(clientId.getUser()); final Map<CharSequence, Client> clients0 = user0.getClients(); clients0.values().iterator().next().getKeys().setEncryption(TypeConverter.convert(e0)); final ByteBuffer b1 = ByteBuffer.wrap("1".getBytes()); b1.mark(); e1 = new com.kareebo.contacts.thrift.EncryptionKey( b1, com.kareebo.contacts.thrift.EncryptionAlgorithm.RSA2048); final Client client01 = createClient(clientId01, verificationKey); client01.getKeys().setEncryption(TypeConverter.convert(e1)); clients0.put(TypeConverter.convert(clientId01.getClient()), client01); user0.setClients(clients0); final Client client10 = createClient(clientId10, verificationKey); final Client client11 = createClient(clientId11, verificationKey); final User user1 = new User(); user1.setBlind(b0); final Map<CharSequence, Client> clients1 = new HashMap<>(2); clients1.put(TypeConverter.convert(clientId10.getClient()), client10); clients1.put(TypeConverter.convert(clientId11.getClient()), client11); user1.setClients(clients1); user1.setIdentities(new ArrayList<>()); user1.setSentRequests(new ArrayList<>()); user1.setId(clientId10.getUser()); userDatastore.put(clientId.getUser(), user0); userDatastore.put(clientId10.getUser(), user1); final HashIdentity hashIdentity = new HashIdentity(); hashIdentity.setHash(b0); final HashIdentityValue hashIdentityValue = new HashIdentityValue(); hashIdentityValue.setConfirmers(new ArrayList<>()); hashIdentityValue.setId(clientId10.getUser()); hashIdentity.setHashIdentity(hashIdentityValue); u.setAlgorithm(HashAlgorithm.SHA256); u.setBuffer(b0); identityDataStore.put(b0, hashIdentity); }
Base() throws GoraException { userDatastore = DataStoreFactory.getDataStore(Long.class, User.class, new Configuration()); notifier = new Notifier(); pendingNotificationDataStore = DataStoreFactory.getDataStore(Long.class, PendingNotification.class, new Configuration()); clientNotifier = new ClientNotifier(notifier, pendingNotificationDataStore); identityDataStore = DataStoreFactory.getDataStore(ByteBuffer.class, HashIdentity.class, new Configuration()); sendContactCard = new SendContactCard(userDatastore, identityDataStore, clientNotifier); final User user = new User(); final ByteBuffer b = ByteBuffer.wrap("".getBytes()); b.mark(); user.setBlind(b); user.setId(clientId.getUser()); user.setIdentities(new ArrayList<>()); user.setSentRequests(new ArrayList<>()); final Map<CharSequence, Client> clients = new HashMap<>(1); clients.put( TypeConverter.convert(clientId.getClient()), createClient(clientId, verificationKey)); user.setClients(clients); userDatastore.put(user.getId(), user); }
Base3() throws GoraException, TException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, SignatureException { final User user = new User(); user.setId(userId); final ByteBuffer b = ByteBuffer.wrap("".getBytes()); b.mark(); user.setBlind(b); user.setIdentities(new ArrayList<>()); user.setSentRequests(new ArrayList<>()); final Map<CharSequence, Client> clients = new HashMap<>(2); final VerificationKey verificationKey = new VerificationKey(); verificationKey.setAlgorithm(com.kareebo.contacts.server.gora.SignatureAlgorithm.Fake); verificationKey.setBuffer(b); clients.put( TypeConverter.convert(clientId0.getClient()), createClient(clientId0, verificationKey)); clients.put( TypeConverter.convert(clientId1.getClient()), createClient(clientId1, verificationKey)); user.setClients(clients); userDatastore.put(userId, user); final com.kareebo.contacts.thrift.EncryptedBuffer encryptedBuffer0 = new com.kareebo.contacts.thrift.EncryptedBuffer( b, com.kareebo.contacts.thrift.EncryptionAlgorithm.Fake, clientId0); final EncryptedBufferSigned encryptedBufferSigned0 = new EncryptedBufferSigned(encryptedBuffer0, sign(encryptedBuffer0, clientId)); encryptedBufferSignedSet.add(encryptedBufferSigned0); e0 = new EncryptedBufferSignedWithVerificationKey( encryptedBufferSigned0, TypeConverter.convert(this.verificationKey)); final com.kareebo.contacts.thrift.EncryptedBuffer encryptedBuffer1 = new com.kareebo.contacts.thrift.EncryptedBuffer( b, com.kareebo.contacts.thrift.EncryptionAlgorithm.Fake, clientId1); final EncryptedBufferSigned encryptedBufferSigned1 = new EncryptedBufferSigned(encryptedBuffer1, sign(encryptedBuffer1, clientId)); encryptedBufferSignedSet.add(encryptedBufferSigned1); e1 = new EncryptedBufferSignedWithVerificationKey( encryptedBufferSigned1, TypeConverter.convert(this.verificationKey)); }