@Test public void savePrivateKeySalt() { final byte[] salt = "some private salt".getBytes(); jpaDataStore.savePrivateKeySalt(salt); assertThat(jpaDataStore.getPrivateKeySalt(), equalTo(salt)); }
@Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8))); return null; } }; jpaExecutor.execute(saveSalt); }
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8))); return null; } }; jpaExecutor.execute(saveSalt); } }
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8))); return null; } }; jpaExecutor.execute(saveSalt); } JpaDataStore(final String persistenceUnit); }
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8))); return null; } }; jpaExecutor.execute(saveSalt); } JpaDataStore(final String persistenceUnit); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel channel); @Override Channel getChannel(final String channelId); @Override void removeChannels(final Set<String> channelIds); @Override Set<String> getChannelIds(final String uaid); @Override void removeChannels(final String uaid); @Override String updateVersion(final String endpointToken, final long version); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked); }
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8))); return null; } }; jpaExecutor.execute(saveSalt); } JpaDataStore(final String persistenceUnit); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel channel); @Override Channel getChannel(final String channelId); @Override void removeChannels(final Set<String> channelIds); @Override Set<String> getChannelIds(final String uaid); @Override void removeChannels(final String uaid); @Override String updateVersion(final String endpointToken, final long version); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked);  }