Search in sources :

Example 1 with ProfileTableFactory

use of com.palantir.example.profile.schema.generated.ProfileTableFactory in project atlasdb by palantir.

the class ProfileStoreTest method testDeleteImage.

@Test
public void testDeleteImage() {
    final UUID userId = storeUser();
    storeImage(userId);
    runWithRetry(Transaction.TransactionType.AGGRESSIVE_HARD_DELETE, store -> {
        store.deleteImage(userId);
        return userId;
    });
    txnMgr.runTaskWithRetry((TransactionTask<Void, RuntimeException>) txn -> {
        ProfileTableFactory tables = ProfileTableFactory.of();
        UserPhotosStreamValueTable streams = tables.getUserPhotosStreamValueTable(txn);
        Assert.assertTrue(streams.getAllRowsUnordered().isEmpty());
        return null;
    });
}
Also used : Throwables(com.palantir.common.base.Throwables) UserPhotosStreamValueTable(com.palantir.example.profile.schema.generated.UserPhotosStreamValueTable) Function(java.util.function.Function) TransactionManagers(com.palantir.atlasdb.factory.TransactionManagers) Assert.assertThat(org.junit.Assert.assertThat) ByteArrayInputStream(java.io.ByteArrayInputStream) Matchers.nullValue(org.hamcrest.Matchers.nullValue) After(org.junit.After) Closeables(com.google.common.io.Closeables) Sha256Hash(com.palantir.util.crypto.Sha256Hash) ExpectedException(org.junit.rules.ExpectedException) ImmutableSet(com.google.common.collect.ImmutableSet) ProfileSchema(com.palantir.example.profile.schema.ProfileSchema) Set(java.util.Set) IOException(java.io.IOException) Test(org.junit.Test) TransactionManager(com.palantir.atlasdb.transaction.api.TransactionManager) UUID(java.util.UUID) Rule(org.junit.Rule) Transaction(com.palantir.atlasdb.transaction.api.Transaction) TransactionTask(com.palantir.atlasdb.transaction.api.TransactionTask) UserProfile(com.palantir.example.profile.protos.generated.ProfilePersistence.UserProfile) ProfileTableFactory(com.palantir.example.profile.schema.generated.ProfileTableFactory) Assert(org.junit.Assert) InputStream(java.io.InputStream) ProfileTableFactory(com.palantir.example.profile.schema.generated.ProfileTableFactory) UserPhotosStreamValueTable(com.palantir.example.profile.schema.generated.UserPhotosStreamValueTable) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

ImmutableSet (com.google.common.collect.ImmutableSet)1 Closeables (com.google.common.io.Closeables)1 TransactionManagers (com.palantir.atlasdb.factory.TransactionManagers)1 Transaction (com.palantir.atlasdb.transaction.api.Transaction)1 TransactionManager (com.palantir.atlasdb.transaction.api.TransactionManager)1 TransactionTask (com.palantir.atlasdb.transaction.api.TransactionTask)1 Throwables (com.palantir.common.base.Throwables)1 UserProfile (com.palantir.example.profile.protos.generated.ProfilePersistence.UserProfile)1 ProfileSchema (com.palantir.example.profile.schema.ProfileSchema)1 ProfileTableFactory (com.palantir.example.profile.schema.generated.ProfileTableFactory)1 UserPhotosStreamValueTable (com.palantir.example.profile.schema.generated.UserPhotosStreamValueTable)1 Sha256Hash (com.palantir.util.crypto.Sha256Hash)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Set (java.util.Set)1 UUID (java.util.UUID)1 Function (java.util.function.Function)1 Matchers.nullValue (org.hamcrest.Matchers.nullValue)1 After (org.junit.After)1