@Test public void testUpdateBucketBatch() { BucketList bucketList = mock(BucketList.class, RETURNS_DEEP_STUBS); List<Bucket> list = new ArrayList<>(); when(list.size()).thenReturn(1); Bucket bucket = mock(Bucket.class, RETURNS_DEEP_STUBS); list.add(bucket); when(bucket.getState()).thenReturn(Bucket.State.OPEN); when(bucket.getPayload()).thenReturn("payload"); when(bucket.getDescription()).thenReturn("description"); when(bucketList.getBuckets()).thenReturn(list); when(transaction.update(anyString(), Matchers.anyVararg())).thenReturn(1); BucketList result = repository.updateBucketBatch(Experiment.ID.newInstance(), bucketList); assertThat(result, is(bucketList)); verify(transaction, times(1)).update(anyString(), Matchers.anyVararg()); }
@Override public BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList) throws RepositoryException { int bucketListSize = bucketList.getBuckets().size(); StringBuilder SQL = new StringBuilder("UPDATE bucket SET "); List<String> args = new ArrayList<>(bucketListSize); boolean hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getState() != null) { hasval = true; break; } } if (hasval) { SQL.append("state = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getAllocationPercent() != null) { hasval = true; break; } } if (hasval) { SQL.append("allocation_percent = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).isControl() != null) { hasval = true; break; } } if (hasval) { SQL.append("is_control = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; } } if (hasval) { SQL.append("payload = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; } } if (hasval) { SQL.append("description = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } if (",".equals(SQL.substring(SQL.length() - 1, SQL.length()))) { SQL.setLength(SQL.length() - 1); } SQL.append(" WHERE experiment_id = ? and label in ("); for (int i = 0; i < bucketListSize; i++) { SQL.append("?,"); } SQL.setLength(SQL.length() - 1); SQL.append(")"); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { args.add(b.getLabel().toString()); args.add(b.getState().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { args.add(b.getLabel().toString()); args.add(b.getAllocationPercent().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { args.add(b.getLabel().toString()); args.add(b.isControl().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription()); } } args.add(experimentID.toString()); for (int i = 0; i < bucketListSize; i++) { args.add(bucketList.getBuckets().get(i).getLabel().toString()); } newTransaction().update(SQL.toString(), args.toArray(new String[args.size()])); return bucketList; }
DatabaseExperimentRepository implements ExperimentRepository { @Override public BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList) throws RepositoryException { int bucketListSize = bucketList.getBuckets().size(); StringBuilder SQL = new StringBuilder("UPDATE bucket SET "); List<String> args = new ArrayList<>(bucketListSize); boolean hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getState() != null) { hasval = true; break; } } if (hasval) { SQL.append("state = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getAllocationPercent() != null) { hasval = true; break; } } if (hasval) { SQL.append("allocation_percent = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).isControl() != null) { hasval = true; break; } } if (hasval) { SQL.append("is_control = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; } } if (hasval) { SQL.append("payload = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; } } if (hasval) { SQL.append("description = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } if (",".equals(SQL.substring(SQL.length() - 1, SQL.length()))) { SQL.setLength(SQL.length() - 1); } SQL.append(" WHERE experiment_id = ? and label in ("); for (int i = 0; i < bucketListSize; i++) { SQL.append("?,"); } SQL.setLength(SQL.length() - 1); SQL.append(")"); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { args.add(b.getLabel().toString()); args.add(b.getState().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { args.add(b.getLabel().toString()); args.add(b.getAllocationPercent().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { args.add(b.getLabel().toString()); args.add(b.isControl().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription()); } } args.add(experimentID.toString()); for (int i = 0; i < bucketListSize; i++) { args.add(bucketList.getBuckets().get(i).getLabel().toString()); } newTransaction().update(SQL.toString(), args.toArray(new String[args.size()])); return bucketList; } }
DatabaseExperimentRepository implements ExperimentRepository { @Override public BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList) throws RepositoryException { int bucketListSize = bucketList.getBuckets().size(); StringBuilder SQL = new StringBuilder("UPDATE bucket SET "); List<String> args = new ArrayList<>(bucketListSize); boolean hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getState() != null) { hasval = true; break; } } if (hasval) { SQL.append("state = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getAllocationPercent() != null) { hasval = true; break; } } if (hasval) { SQL.append("allocation_percent = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).isControl() != null) { hasval = true; break; } } if (hasval) { SQL.append("is_control = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; } } if (hasval) { SQL.append("payload = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; } } if (hasval) { SQL.append("description = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } if (",".equals(SQL.substring(SQL.length() - 1, SQL.length()))) { SQL.setLength(SQL.length() - 1); } SQL.append(" WHERE experiment_id = ? and label in ("); for (int i = 0; i < bucketListSize; i++) { SQL.append("?,"); } SQL.setLength(SQL.length() - 1); SQL.append(")"); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { args.add(b.getLabel().toString()); args.add(b.getState().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { args.add(b.getLabel().toString()); args.add(b.getAllocationPercent().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { args.add(b.getLabel().toString()); args.add(b.isControl().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription()); } } args.add(experimentID.toString()); for (int i = 0; i < bucketListSize; i++) { args.add(bucketList.getBuckets().get(i).getLabel().toString()); } newTransaction().update(SQL.toString(), args.toArray(new String[args.size()])); return bucketList; } @Inject  DatabaseExperimentRepository(TransactionFactory transactionFactory, ExperimentValidator validator,
                                        Flyway flyway); }
DatabaseExperimentRepository implements ExperimentRepository { @Override public BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList) throws RepositoryException { int bucketListSize = bucketList.getBuckets().size(); StringBuilder SQL = new StringBuilder("UPDATE bucket SET "); List<String> args = new ArrayList<>(bucketListSize); boolean hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getState() != null) { hasval = true; break; } } if (hasval) { SQL.append("state = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getAllocationPercent() != null) { hasval = true; break; } } if (hasval) { SQL.append("allocation_percent = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).isControl() != null) { hasval = true; break; } } if (hasval) { SQL.append("is_control = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; } } if (hasval) { SQL.append("payload = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; } } if (hasval) { SQL.append("description = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } if (",".equals(SQL.substring(SQL.length() - 1, SQL.length()))) { SQL.setLength(SQL.length() - 1); } SQL.append(" WHERE experiment_id = ? and label in ("); for (int i = 0; i < bucketListSize; i++) { SQL.append("?,"); } SQL.setLength(SQL.length() - 1); SQL.append(")"); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { args.add(b.getLabel().toString()); args.add(b.getState().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { args.add(b.getLabel().toString()); args.add(b.getAllocationPercent().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { args.add(b.getLabel().toString()); args.add(b.isControl().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription()); } } args.add(experimentID.toString()); for (int i = 0; i < bucketListSize; i++) { args.add(bucketList.getBuckets().get(i).getLabel().toString()); } newTransaction().update(SQL.toString(), args.toArray(new String[args.size()])); return bucketList; } @Inject  DatabaseExperimentRepository(TransactionFactory transactionFactory, ExperimentValidator validator,
                                        Flyway flyway); @Override Experiment getExperiment(Experiment.ID experimentID); @Override Map<Application.Name, List<Experiment>> getExperimentsForApps(Collection<Application.Name> appNames); @Override Experiment getExperiment(Application.Name appName,
                                    Experiment.Label experimentLabel); @Override List<Experiment.ID> getExperiments(); @Override ExperimentList getExperiments(Collection<Experiment.ID> experimentIDs); @Override Map<Experiment.ID, Experiment> getExperimentsMap(Collection<Experiment.ID> experimentIDs); @Override Table<Experiment.ID, Experiment.Label, Experiment> getExperimentList(Application.Name appName); @Override List<Application.Name> getApplicationsList(); @Override Experiment.ID createExperiment(NewExperiment newExperiment); @Override Experiment updateExperiment(Experiment experiment); @Override Experiment updateExperimentState(Experiment experiment, State state); @Override Bucket getBucket(Experiment.ID experimentID,
                            Bucket.Label bucketLabel); @Override void createBucket(Bucket newBucket); @Override Bucket updateBucket(Bucket bucket); @Override Bucket updateBucketAllocationPercentage(Bucket bucket, Double desiredAllocationPercentage); @Override Bucket updateBucketState(Bucket bucket, Bucket.State desiredState); @Override BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList); @Override void deleteBucket(Experiment.ID experimentID,
                             Bucket.Label bucketLabel); @Override void logBucketChanges(Experiment.ID experimentID, Bucket.Label bucketLabel,
                                 List<Bucket.BucketAuditInfo> changeList); @Override void logExperimentChanges(Experiment.ID experimentID, List<Experiment.ExperimentAuditInfo> changeList); @Override List<Experiment> getExperiments(Application.Name appName); @Override void deleteExperiment(NewExperiment newExperiment); @Override void createIndicesForNewExperiment(NewExperiment newExperiment); @Override HashMap<Experiment.ID, BucketList> getBucketList(Collection<Experiment.ID> experimentIDCollection); @Override BucketList getBucketList(Experiment.ID experimentID); @Override BucketList getBuckets(Experiment.ID experimentID, boolean checkExperiment); @Override Statement createApplication(Application.Name applicationName); @Override Map<Application.Name, Set<String>> getTagListForApplications(Collection<Application.Name> applicationNames); @Override void updateStateIndex(Experiment experiment); }
DatabaseExperimentRepository implements ExperimentRepository { @Override public BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList) throws RepositoryException { int bucketListSize = bucketList.getBuckets().size(); StringBuilder SQL = new StringBuilder("UPDATE bucket SET "); List<String> args = new ArrayList<>(bucketListSize); boolean hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getState() != null) { hasval = true; break; } } if (hasval) { SQL.append("state = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getAllocationPercent() != null) { hasval = true; break; } } if (hasval) { SQL.append("allocation_percent = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).isControl() != null) { hasval = true; break; } } if (hasval) { SQL.append("is_control = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getPayload() != null) { hasval = true; break; } } if (hasval) { SQL.append("payload = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } hasval = false; for (int i = 0; i < bucketListSize; i++) { if (bucketList.getBuckets().get(i).getDescription() != null) { hasval = true; break; } } if (hasval) { SQL.append("description = CASE label "); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { SQL.append("WHEN ? then ? "); } } SQL.append("END,"); } if (",".equals(SQL.substring(SQL.length() - 1, SQL.length()))) { SQL.setLength(SQL.length() - 1); } SQL.append(" WHERE experiment_id = ? and label in ("); for (int i = 0; i < bucketListSize; i++) { SQL.append("?,"); } SQL.setLength(SQL.length() - 1); SQL.append(")"); for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getState() != null) { args.add(b.getLabel().toString()); args.add(b.getState().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getAllocationPercent() != null) { args.add(b.getLabel().toString()); args.add(b.getAllocationPercent().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.isControl() != null) { args.add(b.getLabel().toString()); args.add(b.isControl().toString()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getPayload() != null) { args.add(b.getLabel().toString()); args.add(b.getPayload()); } } for (int i = 0; i < bucketListSize; i++) { Bucket b = bucketList.getBuckets().get(i); if (b.getDescription() != null) { args.add(b.getLabel().toString()); args.add(b.getDescription()); } } args.add(experimentID.toString()); for (int i = 0; i < bucketListSize; i++) { args.add(bucketList.getBuckets().get(i).getLabel().toString()); } newTransaction().update(SQL.toString(), args.toArray(new String[args.size()])); return bucketList; } @Inject  DatabaseExperimentRepository(TransactionFactory transactionFactory, ExperimentValidator validator,
                                        Flyway flyway); @Override Experiment getExperiment(Experiment.ID experimentID); @Override Map<Application.Name, List<Experiment>> getExperimentsForApps(Collection<Application.Name> appNames); @Override Experiment getExperiment(Application.Name appName,
                                    Experiment.Label experimentLabel); @Override List<Experiment.ID> getExperiments(); @Override ExperimentList getExperiments(Collection<Experiment.ID> experimentIDs); @Override Map<Experiment.ID, Experiment> getExperimentsMap(Collection<Experiment.ID> experimentIDs); @Override Table<Experiment.ID, Experiment.Label, Experiment> getExperimentList(Application.Name appName); @Override List<Application.Name> getApplicationsList(); @Override Experiment.ID createExperiment(NewExperiment newExperiment); @Override Experiment updateExperiment(Experiment experiment); @Override Experiment updateExperimentState(Experiment experiment, State state); @Override Bucket getBucket(Experiment.ID experimentID,
                            Bucket.Label bucketLabel); @Override void createBucket(Bucket newBucket); @Override Bucket updateBucket(Bucket bucket); @Override Bucket updateBucketAllocationPercentage(Bucket bucket, Double desiredAllocationPercentage); @Override Bucket updateBucketState(Bucket bucket, Bucket.State desiredState); @Override BucketList updateBucketBatch(Experiment.ID experimentID, BucketList bucketList); @Override void deleteBucket(Experiment.ID experimentID,
                             Bucket.Label bucketLabel); @Override void logBucketChanges(Experiment.ID experimentID, Bucket.Label bucketLabel,
                                 List<Bucket.BucketAuditInfo> changeList); @Override void logExperimentChanges(Experiment.ID experimentID, List<Experiment.ExperimentAuditInfo> changeList); @Override List<Experiment> getExperiments(Application.Name appName); @Override void deleteExperiment(NewExperiment newExperiment); @Override void createIndicesForNewExperiment(NewExperiment newExperiment); @Override HashMap<Experiment.ID, BucketList> getBucketList(Collection<Experiment.ID> experimentIDCollection); @Override BucketList getBucketList(Experiment.ID experimentID); @Override BucketList getBuckets(Experiment.ID experimentID, boolean checkExperiment); @Override Statement createApplication(Application.Name applicationName); @Override Map<Application.Name, Set<String>> getTagListForApplications(Collection<Application.Name> applicationNames); @Override void updateStateIndex(Experiment experiment);  }