-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
627f8f1
commit a927e40
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...l-test/src/main/java/com/intuit/wasabi/tests/service/PastDatedExperimentCreationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/******************************************************************************* | ||
* 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.tests.service; | ||
|
||
import static com.intuit.wasabi.tests.library.util.ModelAssert.assertEqualModelItems; | ||
|
||
import java.util.List; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import com.intuit.wasabi.tests.library.TestBase; | ||
import com.intuit.wasabi.tests.library.util.Constants; | ||
import com.intuit.wasabi.tests.library.util.serialstrategies.DefaultNameExclusionStrategy; | ||
import com.intuit.wasabi.tests.model.Bucket; | ||
import com.intuit.wasabi.tests.model.Experiment; | ||
import com.intuit.wasabi.tests.model.factory.BucketFactory; | ||
import com.intuit.wasabi.tests.model.factory.ExperimentFactory; | ||
|
||
/** | ||
* | ||
* @created on 09/28/2016 as part of below issue | ||
* https://github.com/intuit/wasabi/issues/93 | ||
* | ||
* steps followed | ||
* beforetest: setup require data | ||
* test: do a post on the | ||
* aftertest: clean | ||
*/ | ||
public class PastDatedExperimentCreationTest extends TestBase{ | ||
static final Logger LOGGER = LoggerFactory.getLogger(PastDatedExperimentCreationTest.class); | ||
Experiment experiment; | ||
|
||
@Test | ||
public void testSetUp() | ||
{ | ||
experiment = ExperimentFactory.createPreviousDatedExperiment(); | ||
DefaultNameExclusionStrategy experimentComparisonStrategy = new DefaultNameExclusionStrategy("creationTime", "modificationTime", "ruleJson"); | ||
experiment.setSerializationStrategy(experimentComparisonStrategy); | ||
Experiment exp = postExperiment(experiment); | ||
Assert.assertNotNull(exp.creationTime, "Experiment creation failed (No creationTime)."); | ||
Assert.assertNotNull(exp.modificationTime, "Experiment creation failed (No modificationTime)."); | ||
Assert.assertNotNull(exp.state, "Experiment creation failed (No state)."); | ||
experiment.update(exp); | ||
|
||
//create buckets within the experiment | ||
List<Bucket> buckets = postBuckets(BucketFactory.createCompleteBuckets(experiment, 2)); | ||
Assert.assertEquals(buckets.size(), 2); | ||
|
||
//change the state of experiment to running | ||
experiment.state = Constants.EXPERIMENT_STATE_RUNNING; | ||
exp = putExperiment(experiment); | ||
assertEqualModelItems(exp, experiment); | ||
} | ||
|
||
|
||
} |