当前位置: 首页>>代码示例>>Java>>正文


Java ConsumableTestDefinition.setAllocations方法代码示例

本文整理汇总了Java中com.indeed.proctor.common.model.ConsumableTestDefinition.setAllocations方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumableTestDefinition.setAllocations方法的具体用法?Java ConsumableTestDefinition.setAllocations怎么用?Java ConsumableTestDefinition.setAllocations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.indeed.proctor.common.model.ConsumableTestDefinition的用法示例。


在下文中一共展示了ConsumableTestDefinition.setAllocations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeRandomTestChooser

import com.indeed.proctor.common.model.ConsumableTestDefinition; //导入方法依赖的package包/类
static RandomTestChooser initializeRandomTestChooser(final List<Range> ranges, final List<TestBucket> buckets) {
    final ExpressionFactory expressionFactory = new ExpressionFactoryImpl();

    final FunctionMapper functionMapper = RuleEvaluator.FUNCTION_MAPPER;

    final ConsumableTestDefinition testDefinition = new ConsumableTestDefinition();
    testDefinition.setConstants(Collections.<String, Object>emptyMap());

    testDefinition.setBuckets(buckets);

    final List<Allocation> allocations = Lists.newArrayList();
    allocations.add(new Allocation("${}", ranges));
    testDefinition.setAllocations(allocations);

    final RandomTestChooser rtc = new RandomTestChooser(expressionFactory, functionMapper, "testName", testDefinition);
    return rtc;
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:18,代码来源:TestRandomTestChooser.java

示例2: constructDefinition

import com.indeed.proctor.common.model.ConsumableTestDefinition; //导入方法依赖的package包/类
public static ConsumableTestDefinition constructDefinition(List<TestBucket> buckets,
                                                     List<Allocation> allocations) {

    final ConsumableTestDefinition test = new ConsumableTestDefinition();
    test.setVersion(""); // don't care about version for this test
    test.setSalt(null); // don't care about salt for this test
    test.setRule(null); // don't care about rule for this test
    test.setTestType(TestType.ANONYMOUS_USER);    // don't really care, but need a valid value
    test.setConstants(Collections.<String, Object>emptyMap()); // don't care about constants for this test

    test.setBuckets(buckets);
    test.setAllocations(allocations);
    return test;
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:15,代码来源:TestProctorUtils.java

示例3: testDefaultAllocationWithNonEmptyRule_fallback

import com.indeed.proctor.common.model.ConsumableTestDefinition; //导入方法依赖的package包/类
@Test
public void testDefaultAllocationWithNonEmptyRule_fallback() {
    final String testName = "test";

    final ConsumableTestDefinition testDefinition = new ConsumableTestDefinition();
    testDefinition.setConstants(Collections.<String, Object>emptyMap());
    testDefinition.setTestType(TestType.ANONYMOUS_USER);
    testDefinition.setSalt(testName);

    testDefinition.setBuckets(INACTIVE_CONTROL_TEST_BUCKETS);

    final List<Allocation> allocations = Lists.newArrayList();
    allocations.add(new Allocation("${country == 'US'}", RANGES_100_0));
    allocations.add(new Allocation("${country == 'GB'}", RANGES_100_0));
    testDefinition.setAllocations(allocations);

    final RuleEvaluator ruleEvaluator = newRuleEvaluator(false);
    final TestRangeSelector selector = new TestRangeSelector(
        ruleEvaluator,
        testName,
        testDefinition
    );

    final TestBucket bucket = new StandardTestChooser(selector)
        .choose("identifier", Collections.<String, Object>emptyMap());

    assertNull("Expected no bucket to be found", bucket);

    EasyMock.verify(ruleEvaluator);
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:31,代码来源:TestStandardTestChooser.java

示例4: testDefaultAllocationWithNonEmptyRule_match

import com.indeed.proctor.common.model.ConsumableTestDefinition; //导入方法依赖的package包/类
@Test
public void testDefaultAllocationWithNonEmptyRule_match() {
    final String testName = "test";

    final ConsumableTestDefinition testDefinition = new ConsumableTestDefinition();
    testDefinition.setConstants(Collections.<String, Object>emptyMap());
    testDefinition.setRule("${lang == 'en'}");

    testDefinition.setTestType(TestType.ANONYMOUS_USER);
    testDefinition.setSalt(testName);

    testDefinition.setBuckets(INACTIVE_CONTROL_TEST_BUCKETS);

    final List<Allocation> allocations = Lists.newArrayList();
    allocations.add(new Allocation("${country == 'GB'}", RANGES_100_0));
    testDefinition.setAllocations(allocations);

    final RuleEvaluator ruleEvaluator = newRuleEvaluator(true);
    final TestRangeSelector selector = new TestRangeSelector(
        ruleEvaluator,
        testName,
        testDefinition
    );

    final TestBucket bucket = new StandardTestChooser(selector)
        .choose("identifier", Collections.<String, Object>emptyMap());

    assertEquals("Test bucket with value 1 expected", 1, bucket.getValue());

    EasyMock.verify(ruleEvaluator);
}
 
开发者ID:indeedeng,项目名称:proctor,代码行数:32,代码来源:TestStandardTestChooser.java


注:本文中的com.indeed.proctor.common.model.ConsumableTestDefinition.setAllocations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。