Package com.indeed.proctor.common.model

Examples of com.indeed.proctor.common.model.Payload


    }

    private Payload[] getTestPayloads() {
        Payload[] payloads = new Payload[7];
        for (int i = 0; i < payloads.length; i++)
            payloads[i] = new Payload();
        payloads[0].setDoubleValue(47.0D);
        payloads[1].setDoubleArray(new Double[]{98.0D, -137D});
        payloads[2].setLongValue(42L);
        payloads[3].setLongArray(new Long[]{9L, 8L, 7L, 6L, 5L, 4L});
        payloads[4].setStringValue("foobar");
View Full Code Here


    @Test
    public void verifyBucketPayloads() throws IncompatibleTestMatrixException {
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("all payloads of the same type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            // bucket 1 is missing a payload here.
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("not all payloads of the test defined", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inact");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("bar");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("all payloads of the wrong type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally inconsistent matrix: different payload types in test
            assertInvalid("all payloads not of the same type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringArray(new String[]{})// empty arrays are allowed.
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringArray(new String[]{"foo", "bar"});
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringArray(new String[]{"baz", "quux", "xyzzy"});
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringArray", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("vector payloads can be different lengths", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","one","val3",new ArrayList<String>()));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","tw","val3",new ArrayList<String>(){{add("a");add("c");}}));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","th","val3",new ArrayList<String>(){{add("foo");add("bar");}}));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","stringValue","val3","stringArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            assertValid("correct allocation and object, map with double values", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val3",1.0,"val4",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable names", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","yea1","val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","yea2","val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","yea3","val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable types than specified", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",1.0,"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue","val4","doubleArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have less variable types than specified", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",new ArrayList<Double>(){{add(1.0D);}},"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable types than specified -- an array instead of a single value", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",ImmutableMap.<String,Object>of("a",1,"b",2),"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",ImmutableMap.<String,Object>of("c",3,"d",4),"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",ImmutableMap.<String,Object>of("e",5,"f",6),"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","map","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't nested map payloads", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","one","val3",new ArrayList<String>()));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","tw","val3",new ArrayList<String>(){{add("a");add("c");}}));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","th","val3",new ArrayList(){{add(2.1D);add("bar");}}));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","stringValue","val3","stringArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

    @Test
    public void verifyBucketPayloadValueValidators() throws IncompatibleTestMatrixException {
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setDoubleValue(0D);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setDoubleValue(10D);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setDoubleValue(20D);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "doubleValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("doubleValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setDoubleValue(0D);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setDoubleValue(10D);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setDoubleValue(-1D);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "doubleValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("doubleValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(0L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(10L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(20L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("longValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(0L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(10L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(-1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("longValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inactive");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("bar");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringValue", "${value >= \"b\"}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("stringValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inactive");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("abba");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringValue", "${value >= \"b\"}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("stringValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",4.0,"val3",1.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "map", ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), "${val1 + val2 + val3 < 10}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("map: a payload value that should pass validation", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",4.0,"val3",1.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",6.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "map", ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), "${val1 + val2 + val3 < 10}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

        {
            // Proctor should not break if it consumes a test matrix
            // that has a payload even if it's not expecting one.
            // (So long as all the payloads are of the same type.)
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets)); // no payload type specified
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("no payload expected; payloads supplied of the same type", matrix, requiredTests);

            // Should have gotten back a test.
            assertEquals("required tests should not be removed from the matrix", 1, matrix.getTests().size());

            // Make sure we don't have any payloads in the resulting tests.
            for (Entry<String, ConsumableTestDefinition> next : matrix.getTests().entrySet()) {
                final ConsumableTestDefinition testDefinition = next.getValue();

                for (final TestBucket bucket : testDefinition.getBuckets()) {
                    assertNull(bucket.getPayload());
                }
            }
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets)); // no payload type specified
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

    @Test
    public void verifyBucketPayloads() throws IncompatibleTestMatrixException {
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("all payloads of the same type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            // bucket 1 is missing a payload here.
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("not all payloads of the test defined", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inact");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("bar");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("all payloads of the wrong type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally inconsistent matrix: different payload types in test
            assertInvalid("all payloads not of the same type", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringArray(new String[]{})// empty arrays are allowed.
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringArray(new String[]{"foo", "bar"});
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringArray(new String[]{"baz", "quux", "xyzzy"});
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringArray", null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("vector payloads can be different lengths", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","one","val3",new ArrayList<String>()));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","tw","val3",new ArrayList<String>(){{add("a");add("c");}}));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","th","val3",new ArrayList<String>(){{add("foo");add("bar");}}));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","stringValue","val3","stringArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            assertValid("correct allocation and object, map with double values", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val3",1.0,"val4",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable names", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","yea1","val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","yea2","val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","yea3","val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable types than specified", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",1.0,"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue","val4","doubleArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have less variable types than specified", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",new ArrayList<Double>(){{add(1.0D);}},"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't have different variable types than specified -- an array instead of a single value", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",ImmutableMap.<String,Object>of("a",1,"b",2),"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",ImmutableMap.<String,Object>of("c",3,"d",4),"val3",3.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",ImmutableMap.<String,Object>of("e",5,"f",6),"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","map","val3","doubleValue"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("map payloads can't nested map payloads", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2","one","val3",new ArrayList<String>()));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","tw","val3",new ArrayList<String>(){{add("a");add("c");}}));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2","th","val3",new ArrayList(){{add(2.1D);add("bar");}}));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets,"map",
                    ImmutableMap.of("val1","doubleValue","val2","stringValue","val3","stringArray"), null));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

    @Test
    public void verifyBucketPayloadValueValidators() throws IncompatibleTestMatrixException {
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setDoubleValue(0D);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setDoubleValue(10D);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setDoubleValue(20D);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "doubleValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("doubleValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setDoubleValue(0D);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setDoubleValue(10D);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setDoubleValue(-1D);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "doubleValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("doubleValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(0L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(10L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(20L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("longValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(0L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(10L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(-1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "longValue", "${value >= 0}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("longValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inactive");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("bar");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringValue", "${value >= \"b\"}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("stringValue: all payload values pass validation", matrix, requiredTests);
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setStringValue("inactive");
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("abba");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "stringValue", "${value >= \"b\"}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertInvalid("stringValue: a payload value doesn't pass validation", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",4.0,"val3",1.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",2.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "map", ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), "${val1 + val2 + val3 < 10}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("map: a payload value that should pass validation", matrix, requiredTests);
        }
        {
            final List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",1.0,"val2",3.0,"val3",1.0));
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",4.0,"val3",1.0));
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setMap(ImmutableMap.<String,Object>of("val1",2.0,"val2",6.0,"val3",2.0));
            buckets.get(2).setPayload(p);

            final Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets, "map", ImmutableMap.of("val1","doubleValue","val2","doubleValue","val3","doubleValue"), "${val1 + val2 + val3 < 10}"));
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

        {
            // Proctor should not break if it consumes a test matrix
            // that has a payload even if it's not expecting one.
            // (So long as all the payloads are of the same type.)
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setLongValue(1L);
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets)); // no payload type specified
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();

            tests.put(TEST_A, constructDefinition(buckets, fromCompactAllocationFormat("-1:0.2,0:0.4,1:0.4")));

            final TestMatrixArtifact matrix = constructArtifact(tests);

            // internally consistent matrix
            assertValid("no payload expected; payloads supplied of the same type", matrix, requiredTests);

            // Should have gotten back a test.
            assertEquals("required tests should not be removed from the matrix", 1, matrix.getTests().size());

            // Make sure we don't have any payloads in the resulting tests.
            for (Entry<String, ConsumableTestDefinition> next : matrix.getTests().entrySet()) {
                final ConsumableTestDefinition testDefinition = next.getValue();

                for (final TestBucket bucket : testDefinition.getBuckets()) {
                    assertNull(bucket.getPayload());
                }
            }
        }
        {
            List<TestBucket> buckets = fromCompactBucketFormat("inactive:-1,control:0,test:1");
            Payload p = new Payload();
            p.setLongValue(-1L);
            buckets.get(0).setPayload(p);
            p = new Payload();
            p.setLongValue(0L);
            buckets.get(1).setPayload(p);
            p = new Payload();
            p.setStringValue("foo");
            buckets.get(2).setPayload(p);

            Map<String, TestSpecification> requiredTests = ImmutableMap.of(TEST_A, transformTestBuckets(buckets)); // no payload type specified
            final Map<String, ConsumableTestDefinition> tests = Maps.newHashMap();
View Full Code Here

                throw new IncompatibleTestMatrixException("For test " + testName + " from " + matrixSource + " test specification payload type unknown: " + specifiedPayloadTypeName);
            }
            final String payloadValidatorRule = payloadSpec.getValidator();
            final List<TestBucket> buckets = testDefinition.getBuckets();
            for (final TestBucket bucket : buckets) {
                Payload payload = bucket.getPayload();
                if (payload != null) {
                    if (!specifiedPayloadType.payloadHasThisType(payload)) {
                        throw new IncompatibleTestMatrixException("For test " + testName + " from " + matrixSource + " expected payload of type " + specifiedPayloadType.payloadTypeName + " but matrix has a test bucket payload with wrong type: " + bucket);
                    }
                    if (specifiedPayloadType == PayloadType.MAP) {
View Full Code Here

        /*
         * When defined, within a single test, all test bucket payloads
         * should be supplied; they should all have just one type each,
         * and they should all be the same type.
         */
        Payload nonEmptyPayload = null;
        final List<TestBucket> bucketsWithoutPayloads = Lists.newArrayList();
        for (final TestBucket bucket : buckets) {
            final Payload p = bucket.getPayload();
            if (p != null) {
                if (p.numFieldsDefined() != 1) {
                    throw new IncompatibleTestMatrixException("Test " + testName + " from " + matrixSource + " has a test bucket payload with multiple types: " + bucket);
                }
                if (nonEmptyPayload == null) {
                    nonEmptyPayload = p;
                } else if (!nonEmptyPayload.sameType(p)) {
View Full Code Here

        // Get the current bucket.
        final TestBucket testBucket = buckets.get(testName);

        // Lookup Payloads for this test
        if (testBucket != null) {
            final Payload payload = testBucket.getPayload();
            if (null != payload) {
                return payload;
            }
        }
View Full Code Here

TOP

Related Classes of com.indeed.proctor.common.model.Payload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.