@Test void twoConcurrentUpdatesWhenNoACLStoredShouldReturnACLWithTwoEntries(CassandraCluster cassandra) throws Exception { Barrier barrier = new Barrier(2); cassandra.getConf() .registerScenario(awaitOn(barrier) .thenExecuteNormally() .times(2) .whenQueryStartsWith("SELECT acl,version FROM acl WHERE id=:id;")); MailboxACL.EntryKey keyBob = new MailboxACL.EntryKey("bob", MailboxACL.NameType.user, false); MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights(MailboxACL.Right.Read); MailboxACL.EntryKey keyAlice = new MailboxACL.EntryKey("alice", MailboxACL.NameType.user, false); Future<Boolean> future1 = performACLUpdateInExecutor(cassandra, executor, keyBob, rights); Future<Boolean> future2 = performACLUpdateInExecutor(cassandra, executor, keyAlice, rights); barrier.awaitCaller(); barrier.releaseCaller(); awaitAll(future1, future2); assertThat(cassandraACLMapper.getACL(MAILBOX_ID).block()) .isEqualTo(new MailboxACL().union(keyBob, rights).union(keyAlice, rights)); }
public Mono<MailboxACL> getACL(CassandraId cassandraId) { return getStoredACLRow(cassandraId) .map(row -> getAcl(cassandraId, row)); }
CassandraACLMapper { public Mono<MailboxACL> getACL(CassandraId cassandraId) { return getStoredACLRow(cassandraId) .map(row -> getAcl(cassandraId, row)); } }
CassandraACLMapper { public Mono<MailboxACL> getACL(CassandraId cassandraId) { return getStoredACLRow(cassandraId) .map(row -> getAcl(cassandraId, row)); } @Inject  CassandraACLMapper(Session session, CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                              CassandraConfiguration cassandraConfiguration, CassandraConsistenciesConfiguration consistenciesConfiguration); }
CassandraACLMapper { public Mono<MailboxACL> getACL(CassandraId cassandraId) { return getStoredACLRow(cassandraId) .map(row -> getAcl(cassandraId, row)); } @Inject  CassandraACLMapper(Session session, CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                              CassandraConfiguration cassandraConfiguration, CassandraConsistenciesConfiguration consistenciesConfiguration); Mono<MailboxACL> getACL(CassandraId cassandraId); Mono<ACLDiff> updateACL(CassandraId cassandraId, MailboxACL.ACLCommand command); Mono<ACLDiff> setACL(CassandraId cassandraId, MailboxACL mailboxACL); Mono<Void> delete(CassandraId cassandraId); }
CassandraACLMapper { public Mono<MailboxACL> getACL(CassandraId cassandraId) { return getStoredACLRow(cassandraId) .map(row -> getAcl(cassandraId, row)); } @Inject  CassandraACLMapper(Session session, CassandraUserMailboxRightsDAO userMailboxRightsDAO,
                              CassandraConfiguration cassandraConfiguration, CassandraConsistenciesConfiguration consistenciesConfiguration); Mono<MailboxACL> getACL(CassandraId cassandraId); Mono<ACLDiff> updateACL(CassandraId cassandraId, MailboxACL.ACLCommand command); Mono<ACLDiff> setACL(CassandraId cassandraId, MailboxACL mailboxACL); Mono<Void> delete(CassandraId cassandraId); static final int INITIAL_VALUE; }