Skip to content

Commit

Permalink
Cleaned up changes for table name change (user assignment look up)
Browse files Browse the repository at this point in the history
  • Loading branch information
mans4singh committed Nov 23, 2016
1 parent 079400a commit 744511a
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ protected void configure() {
bind(StateExperimentIndexAccessor.class).toProvider(StateExperimentIndexAccessorProvider.class).in(Singleton.class);
bind(UserAssignmentIndexAccessor.class).toProvider(UserAssignmentIndexAccessorProvider.class).in(Singleton.class);
bind(UserBucketIndexAccessor.class).toProvider(UserBucketIndexAccessorProvider.class).in(Singleton.class);
// bind(UserExperimentIndexAccessor.class).toProvider(UserExperimentIndexAccessorProvider.class).in(Singleton.class);
//Bind those audit
bind(AuditLogAccessor.class).toProvider(AuditLogAccessorProvider.class).in(Singleton.class);
bind(BucketAuditLogAccessor.class).toProvider(BucketAuditLogAccessorProvider.class).in(Singleton.class);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public class CassandraAssignmentsRepository implements AssignmentsRepository {

private ExperimentAccessor experimentAccessor;
private ExperimentUserIndexAccessor experimentUserIndexAccessor;
// private UserExperimentIndexAccessor userExperimentIndexAccessor;

private UserAssignmentAccessor userAssignmentAccessor;
private UserAssignmentIndexAccessor userAssignmentIndexAccessor;
Expand All @@ -106,7 +105,6 @@ public CassandraAssignmentsRepository(
EventLog eventLog,
ExperimentAccessor experimentAccessor,
ExperimentUserIndexAccessor experimentUserIndexAccessor,
// UserExperimentIndexAccessor userExperimentIndexAccessor,

UserAssignmentAccessor userAssignmentAccessor,
UserAssignmentIndexAccessor userAssignmentIndexAccessor,
Expand Down Expand Up @@ -138,7 +136,6 @@ public CassandraAssignmentsRepository(
//Experiment related accessors
this.experimentAccessor = experimentAccessor;
this.experimentUserIndexAccessor = experimentUserIndexAccessor;
// this.userExperimentIndexAccessor = userExperimentIndexAccessor;
//UserAssignment related accessors
this.userAssignmentAccessor = userAssignmentAccessor;
this.userAssignmentIndexAccessor = userAssignmentIndexAccessor;
Expand Down Expand Up @@ -345,7 +342,6 @@ public Assignment assignUser(Assignment assignment, Experiment experiment, Date
assignmentsCountExecutor.execute(new AssignmentCountEnvelope(this, experimentRepository,
dbRepository, experiment, assignment, countUp, eventLog, date, assignUserToExport, assignBucketCount));

// indexUserToExperiment(assignment);
indexUserToBucket(assignment);
indexExperimentsToUser(assignment);

Expand Down Expand Up @@ -399,30 +395,6 @@ void indexUserToBucket(Assignment assignment) {
}
}

// void indexUserToExperiment(Assignment assignment) {
// try {
// if(Objects.isNull(assignment.getBucketLabel())) {
// userExperimentIndexAccessor.insertBy(
// assignment.getUserID().toString(),
// assignment.getContext().getContext(),
// assignment.getApplicationName().toString(),
// assignment.getExperimentID().getRawID(),
// new String(new byte[0], StandardCharsets.UTF_8 ) //Needed because of compact storage, which is essentially just ""
// );
// } else {
// userExperimentIndexAccessor.insertBy(
// assignment.getUserID().toString(),
// assignment.getContext().getContext(),
// assignment.getApplicationName().toString(),
// assignment.getExperimentID().getRawID(),
// assignment.getBucketLabel().toString()
// );
// }
// } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e){
// throw new RepositoryException("Could not index user to experiment \"" + assignment + "\"", e);
// }
// }

/**
* Adds an assignment associated with a new user
*
Expand Down Expand Up @@ -535,7 +507,6 @@ public void deleteAssignment(Experiment experiment, User.ID userID, Context cont
dbRepository, experiment, currentAssignment, countUp, eventLog, null, assignUserToExport,
assignBucketCount));

// removeIndexUserToExperiment(userID, experiment.getID(), context, appName);
removeIndexUserToBucket(userID, experiment.getID(), context, currentAssignment.getBucketLabel());
removeIndexExperimentsToUser(userID, experiment.getID(), context, appName);
}
Expand Down Expand Up @@ -569,29 +540,6 @@ void deleteUserFromLookUp(Experiment.ID experimentID, User.ID userID, Context co
}
}

/**
* Removes the referenced pair from the user_experiment_index.
*
* @param userID user id
* @param experimentID experiment id
* @param context context
* @param appName application name
*/
// public void removeIndexUserToExperiment(User.ID userID, Experiment.ID experimentID, Context context,
// Application.Name appName) {
// try {
// userExperimentIndexAccessor.deleteBy(
// userID.toString(),
// experimentID.getRawID(),
// context.getContext(),
// appName.toString()
// );
// } catch (WriteTimeoutException | UnavailableException | NoHostAvailableException e) {
// throw new RepositoryException(
// "Could not remove from user_experiment_index for user: " + userID + " to experiment: " + experimentID, e);
// }
// }

@Override
public void removeIndexUserToBucket(User.ID userID, Experiment.ID experimentID, Context context, Bucket.Label bucketLabel) {
try {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public void testConfigure() throws Exception {
assertThat(injector.getInstance(StagingAccessor.class), is(not(nullValue())));
assertThat(injector.getInstance(ExperimentUserIndexAccessor.class), is(not(nullValue())));
assertThat(injector.getInstance(UserAssignmentIndexAccessor.class), is(not(nullValue())));
// assertThat(injector.getInstance(UserExperimentIndexAccessor.class), is(not(nullValue())));
assertThat(injector.getInstance(AuditLogAccessor.class), is(not(nullValue())));
assertThat(injector.getInstance(BucketAssignmentCountAccessor.class), is(not(nullValue())));
assertThat(injector.getInstance(UserAssignmentExportAccessor.class), is(not(nullValue())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,35 +876,6 @@ public void testAssignExportWihtoutLabel(){
eq(true));
}

// @Test
// public void testRemoveIndexUserToExperimentWriteException(){
// User.ID userId = User.ID.valueOf("testuser1");
// Experiment.ID experimentId = Experiment.ID.valueOf(this.experimentId);
// Context context = Context.valueOf("test");
// doThrow(WriteTimeoutException.class)
// .when(userExperimentIndexAccessor)
// .deleteBy(eq(userId.toString()),
// eq(experimentId.getRawID()),
// eq(context.getContext()),
// eq(APPLICATION_NAME.toString()));
// thrown.expect(RepositoryException.class);
// thrown.expectMessage("Could not remove from user_experiment_index for user: testuser1 to experiment: 4d4d8f3b-3b81-44f3-968d-d1c1a48b4ac8");
// repository.removeIndexUserToExperiment(userId, experimentId, context, APPLICATION_NAME);
// }

// @Test
// public void testRemoveIndexUserToExperiment(){
// User.ID userId = User.ID.valueOf("testuser1");
// Experiment.ID experimentId = Experiment.ID.valueOf(this.experimentId);
// Context context = Context.valueOf("test");
// repository.removeIndexUserToExperiment(userId, experimentId, context, APPLICATION_NAME);
// verify(userExperimentIndexAccessor, times(1)).deleteBy(
// eq(userId.toString()),
// eq(experimentId.getRawID()),
// eq(context.getContext()),
// eq(APPLICATION_NAME.toString()));
// }

@Test
public void testRemoveIndexUserToBucketWriteException(){
User.ID userId = User.ID.valueOf("testuser1");
Expand Down

0 comments on commit 744511a

Please sign in to comment.