@Test public void testDeleteAssignment() { Experiment experiment = Experiment.withID(Experiment.ID.valueOf(this.experimentId)).build(); User.ID userID = User.ID.valueOf("testuser1"); Context context = Context.valueOf("test"); Assignment currentAssignment = Assignment.newInstance(experiment.getID()) .withBucketLabel(Bucket.Label.valueOf("bucket-1")) .build(); spyRepository.deleteAssignment(experiment, userID, context, APPLICATION_NAME, currentAssignment); verify(spyRepository, times(1)).removeIndexExperimentsToUser( eq(userID), eq(experiment.getID()), eq(context), eq(APPLICATION_NAME) ); }
@Override public void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment) { boolean countUp = false; assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository, dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport, assignBucketCount)); removeIndexExperimentsToUser(userID, experiment.getID(), context, appName); }
CassandraAssignmentsRepository implements AssignmentsRepository { @Override public void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment) { boolean countUp = false; assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository, dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport, assignBucketCount)); removeIndexExperimentsToUser(userID, experiment.getID(), context, appName); } }
CassandraAssignmentsRepository implements AssignmentsRepository { @Override public void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment) { boolean countUp = false; assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository, dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport, assignBucketCount)); removeIndexExperimentsToUser(userID, experiment.getID(), context, appName); } @Inject  CassandraAssignmentsRepository(
            @CassandraRepository ExperimentRepository experimentRepository,
            @DatabaseRepository ExperimentRepository dbRepository,
            EventLog eventLog,
            ExperimentAccessor experimentAccessor,
            ExperimentUserIndexAccessor experimentUserIndexAccessor,

            UserAssignmentExportAccessor userAssignmentExportAccessor,

            BucketAccessor bucketAccessor,
            BucketAssignmentCountAccessor bucketAssignmentCountAccessor,

            StagingAccessor stagingAccessor,
            PrioritiesAccessor prioritiesAccessor,
            ExclusionAccessor exclusionAccessor,
            PageExperimentIndexAccessor pageExperimentIndexAccessor,
            CassandraDriver driver,
            MappingManager mappingManager,
            @Named("AssignmentsCountThreadPoolExecutor") ThreadPoolExecutor assignmentsCountExecutor,
            final @Named("assign.user.to.export") boolean assignUserToExport,
            final @Named("assign.bucket.count") boolean assignBucketCount,
            final @Named("default.time.format") String defaultTimeFormat); }
CassandraAssignmentsRepository implements AssignmentsRepository { @Override public void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment) { boolean countUp = false; assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository, dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport, assignBucketCount)); removeIndexExperimentsToUser(userID, experiment.getID(), context, appName); } @Inject  CassandraAssignmentsRepository(
            @CassandraRepository ExperimentRepository experimentRepository,
            @DatabaseRepository ExperimentRepository dbRepository,
            EventLog eventLog,
            ExperimentAccessor experimentAccessor,
            ExperimentUserIndexAccessor experimentUserIndexAccessor,

            UserAssignmentExportAccessor userAssignmentExportAccessor,

            BucketAccessor bucketAccessor,
            BucketAssignmentCountAccessor bucketAssignmentCountAccessor,

            StagingAccessor stagingAccessor,
            PrioritiesAccessor prioritiesAccessor,
            ExclusionAccessor exclusionAccessor,
            PageExperimentIndexAccessor pageExperimentIndexAccessor,
            CassandraDriver driver,
            MappingManager mappingManager,
            @Named("AssignmentsCountThreadPoolExecutor") ThreadPoolExecutor assignmentsCountExecutor,
            final @Named("assign.user.to.export") boolean assignUserToExport,
            final @Named("assign.bucket.count") boolean assignBucketCount,
            final @Named("default.time.format") String defaultTimeFormat); @Override @Timed void populateAssignmentsMetadata(User.ID userID, Application.Name appName, Context context, ExperimentBatch experimentBatch, Optional<Map<Experiment.ID, Boolean>> allowAssignments,
                                            PrioritizedExperimentList prioritizedExperimentList,
                                            Map<Experiment.ID, com.intuit.wasabi.experimentobjects.Experiment> experimentMap,
                                            Map<Experiment.ID, BucketList> bucketMap,
                                            Map<Experiment.ID, List<Experiment.ID>> exclusionMap
    ); @Override @Timed List<Pair<Experiment, String>> getAssignments(User.ID userID,
                                                         Application.Name appLabel,
                                                         Context context,
                                                         Map<Experiment.ID, Experiment> experimentMap); @Override @Timed Assignment getAssignment(User.ID userID, Application.Name appName, Experiment.ID experimentID, Context context); @Override @Timed void assignUsersInBatch(List<Pair<Experiment, Assignment>> assignments, Date date); @Override void assignUserToExports(Assignment assignment, Date date); @Override void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment); @Override StreamingOutput getAssignmentStream(Experiment.ID experimentID, Context context, Parameters parameters, Boolean ignoreNullBucket); @Override @Timed void pushAssignmentToStaging(String type, String exception, String data); void pushAssignmentsToStaging(String type, String exception, Collection<String> data); Map<UUID, String> getBatchPayloadsFromStaging(int batchSize); void deleteFromStaging(UUID timeUUID); @Override void updateBucketAssignmentCount(Experiment experiment, Assignment assignment, boolean countUp); @Override AssignmentCounts getBucketAssignmentCount(Experiment experiment); @Override Map<Experiment.ID, AssignmentCounts> getBucketAssignmentCountsInParallel(List<Experiment.ID> experimentIds); }
CassandraAssignmentsRepository implements AssignmentsRepository { @Override public void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment) { boolean countUp = false; assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository, dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport, assignBucketCount)); removeIndexExperimentsToUser(userID, experiment.getID(), context, appName); } @Inject  CassandraAssignmentsRepository(
            @CassandraRepository ExperimentRepository experimentRepository,
            @DatabaseRepository ExperimentRepository dbRepository,
            EventLog eventLog,
            ExperimentAccessor experimentAccessor,
            ExperimentUserIndexAccessor experimentUserIndexAccessor,

            UserAssignmentExportAccessor userAssignmentExportAccessor,

            BucketAccessor bucketAccessor,
            BucketAssignmentCountAccessor bucketAssignmentCountAccessor,

            StagingAccessor stagingAccessor,
            PrioritiesAccessor prioritiesAccessor,
            ExclusionAccessor exclusionAccessor,
            PageExperimentIndexAccessor pageExperimentIndexAccessor,
            CassandraDriver driver,
            MappingManager mappingManager,
            @Named("AssignmentsCountThreadPoolExecutor") ThreadPoolExecutor assignmentsCountExecutor,
            final @Named("assign.user.to.export") boolean assignUserToExport,
            final @Named("assign.bucket.count") boolean assignBucketCount,
            final @Named("default.time.format") String defaultTimeFormat); @Override @Timed void populateAssignmentsMetadata(User.ID userID, Application.Name appName, Context context, ExperimentBatch experimentBatch, Optional<Map<Experiment.ID, Boolean>> allowAssignments,
                                            PrioritizedExperimentList prioritizedExperimentList,
                                            Map<Experiment.ID, com.intuit.wasabi.experimentobjects.Experiment> experimentMap,
                                            Map<Experiment.ID, BucketList> bucketMap,
                                            Map<Experiment.ID, List<Experiment.ID>> exclusionMap
    ); @Override @Timed List<Pair<Experiment, String>> getAssignments(User.ID userID,
                                                         Application.Name appLabel,
                                                         Context context,
                                                         Map<Experiment.ID, Experiment> experimentMap); @Override @Timed Assignment getAssignment(User.ID userID, Application.Name appName, Experiment.ID experimentID, Context context); @Override @Timed void assignUsersInBatch(List<Pair<Experiment, Assignment>> assignments, Date date); @Override void assignUserToExports(Assignment assignment, Date date); @Override void deleteAssignment(Experiment experiment, User.ID userID, Context context, Application.Name appName, Assignment currentAssignment); @Override StreamingOutput getAssignmentStream(Experiment.ID experimentID, Context context, Parameters parameters, Boolean ignoreNullBucket); @Override @Timed void pushAssignmentToStaging(String type, String exception, String data); void pushAssignmentsToStaging(String type, String exception, Collection<String> data); Map<UUID, String> getBatchPayloadsFromStaging(int batchSize); void deleteFromStaging(UUID timeUUID); @Override void updateBucketAssignmentCount(Experiment experiment, Assignment assignment, boolean countUp); @Override AssignmentCounts getBucketAssignmentCount(Experiment experiment); @Override Map<Experiment.ID, AssignmentCounts> getBucketAssignmentCountsInParallel(List<Experiment.ID> experimentIds); static final Bucket.Label NULL_LABEL; }