Skip to content

Commit

Permalink
Cross pod review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mans4singh committed Oct 12, 2016
1 parent 24ab622 commit 0356b3a
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ public class BucketComparisonGeneratorTest {
private Bucket.Label bucket2Label = Bucket.Label.valueOf("two");
private Bucket.Label bucket3Label = Bucket.Label.valueOf("three");

// public BucketComparisonGeneratorTest(AnalysisTools analysisTools) {
// this.analysisTools = analysisTools;
// }

@Before
public void before() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public class ExperimentCalculatorTest {
private Bucket.Label bucket2Label = Bucket.Label.valueOf("two");
private AnalysisTools analysisTools = new AnalysisToolsImpl();

// public ExperimentCalculatorTest(AnalysisTools analysisTools) {
// this.analysisTools = analysisTools;
// }


@Before
public void before() {
buckets = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public class ProgressGeneratorTest {
private Bucket.Label bucket3Label = Bucket.Label.valueOf("three");
private Bucket.Label bucket4Label = Bucket.Label.valueOf("four");

// public ProgressGeneratorTest(AnalysisTools analysisTools) {
// this.analysisTools = analysisTools;
// }

@Before
public void before() {
ActionCounts click1 = new ActionCounts.Builder().withActionName(clickName).withEventCount(7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public class RateGeneratorTest {
private Bucket.Label bucket2Label = Bucket.Label.valueOf("two");
private Bucket.Label bucket3Label = Bucket.Label.valueOf("three");

// public RateGeneratorTest(AnalysisTools analysisTools) {
// this.analysisTools = analysisTools;
// }

@Before
public void before() {
ActionCounts click1 = new ActionCounts.Builder().withActionName(clickName).withEventCount(7)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@
import com.google.common.base.Preconditions;
import com.intuit.wasabi.experimentobjects.exceptions.InvalidIdentifierException;
import com.netflix.astyanax.model.ColumnList;

import io.swagger.annotations.ApiModelProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static java.util.Arrays.asList;

/**
* An experiment bucket
*/
Expand Down Expand Up @@ -186,9 +187,9 @@ public boolean isStateTransitionValid(State desiredState) {
}

public enum State {

OPEN, CLOSED, EMPTY;

//TODO: this is a work in progress
public enum BucketStateTransition {

OPEN(State.OPEN, State.CLOSED, State.EMPTY),
Expand All @@ -206,11 +207,11 @@ public enum BucketStateTransition {
}
}
}
//TODO: remove state from enum
//TODO: remove state from enum - this is a work in progress
private final transient List<State> allowedStateTransitions;

BucketStateTransition(State... allowedTransitions) {
this.allowedStateTransitions = asList(allowedTransitions);
this.allowedStateTransitions = Arrays.asList(allowedTransitions);
}

private List<State> getAllowedStateTransitions() {
Expand Down Expand Up @@ -308,7 +309,6 @@ public static class Label {
private String label;

private Label(String label) {
super();
this.label = Preconditions.checkNotNull(label);

if (label.trim().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class Context {
private String ctx = "PROD"; //default value for context

private Context(String ctx) {
super();
this.ctx=Preconditions.checkNotNull(ctx);

if (ctx.trim().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ public static class Label {
private String label;

private Label(String label) {
super();
this.label = Preconditions.checkNotNull(label);
if (!label.matches("^[_\\-$A-Za-z][_\\-$A-Za-z0-9]*")) {
throw new InvalidIdentifierException("Experiment label \"" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.intuit.wasabi.experimentobjects;

import io.swagger.annotations.ApiModelProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
Expand Down Expand Up @@ -83,12 +84,7 @@ public String toString() {
}

@Override
public ExperimentPage clone() {
try {
public ExperimentPage clone() throws CloneNotSupportedException {
return (ExperimentPage) super.clone();
} catch (CloneNotSupportedException e) {
// Should never happen
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Specification of a new experiment
*/
@ApiModel(description = "Subset of Experiment used to create a new experiment.")
public final class NewExperiment implements ExperimentBase {
public class NewExperiment implements ExperimentBase {

// Note, if adding a member variable, be sure to update the builder's
// copy contructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public static class Name {
private final String inner_name;

private Name(String name) {
super();
this.inner_name = Preconditions.checkNotNull(name);

if (name.trim().isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


import io.swagger.annotations.ApiModelProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

Expand All @@ -39,7 +40,6 @@ public static class Builder{
private PageExperiment instance;

public Builder(Experiment.ID experimentID, Experiment.Label label, boolean allowNewAssignment){
super();
instance = new PageExperiment();
instance.id = experimentID;
instance.label = label;
Expand Down Expand Up @@ -96,13 +96,8 @@ public String toString() {
}

@Override
public PageExperiment clone() {
try {
public PageExperiment clone() throws CloneNotSupportedException {
return (PageExperiment) super.clone();
} catch (CloneNotSupportedException e) {
// Should never happen
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Preconditions;

import io.swagger.annotations.ApiModelProperty;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
Expand Down Expand Up @@ -290,13 +292,8 @@ public String toString() {
}

@Override
public PrioritizedExperiment clone() {
try {
public PrioritizedExperiment clone() throws CloneNotSupportedException {
return (PrioritizedExperiment) super.clone();
} catch (CloneNotSupportedException e) {
// Should never happen
throw new RuntimeException(e);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2016 Intuit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.intuit.wasabi.experimentobjects;

import static org.junit.Assert.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testEquals(){
}

@Test
public void testClone(){
public void testClone() throws Exception{
PageExperiment pClone = pe.clone();
assertEquals(pClone, pe);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testBuilderMethods(){
}

@Test
public void testClone(){
public void testClone() throws Exception{
assertEquals(prioExp,prioExp.clone());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2016 Intuit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.intuit.wasabi.experimentobjects.exceptions;

import org.hamcrest.core.Is;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*******************************************************************************
* Copyright 2016 Intuit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.intuit.wasabi.experimentobjects.exceptions;

import org.hamcrest.core.Is;
Expand Down

0 comments on commit 0356b3a

Please sign in to comment.