Package com.indeed.proctor.common

Examples of com.indeed.proctor.common.ProctorResult


            forcedGroups = parseForcedGroups(request);
            setForcedGroupsCookie(request, response, forcedGroups);
        } else {
            forcedGroups = Collections.emptyMap();
        }
        final ProctorResult result = proctor.determineTestGroups(identifiers, context, forcedGroups);
        return result;
    }
View Full Code Here


                                                            .put(TestType.ANONYMOUS_USER, SPECIFICATION_MATRIX)
                                                            .put(TestType.AUTHENTICATED_USER, SPECIFICATION_MATRIX)
                                                            .put(TestType.PAGE, SPECIFICATION_MATRIX)
                                                            .build());

            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */ new Account(10));
            assertEquals("kluj:kloo2,map_payload:inactive-1,oop_poop:test1,payloaded:inactive-1,payloaded_verified:inactive-1,pimple:control0", calcBuckets(result));
        }
        {
            final ImmutableMap<TestType, String> idMap = ImmutableMap.<TestType, String>builder()
                                                                .put(TestType.EMAIL_ADDRESS, SPECIFICATION_MATRIX)
                                                                .put(TestType.AUTHENTICATED_USER, SPECIFICATION_MATRIX)
                                                                .put(TestType.PAGE, SPECIFICATION_MATRIX)
                                                                .build();
            final Identifiers identifiers = new Identifiers(idMap, true);

            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
            assertEquals(result.getBuckets().get("pimple").getValue(), 0);
            assertNotNull(result.getBuckets().get("bubble").getValue());
            assertEquals(result.getBuckets().get("dubblez").getValue(), 2);
        }
    }
View Full Code Here

    public void testRandom() {
        final Identifiers identifiers = new Identifiers(Collections.<TestType, String>emptyMap(), true);

        final int[] valuesFound = new int[4];
        for (int i = 0; i < 2000; i++) {
            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
            valuesFound[result.getBuckets().get("bubble").getValue()]++;
        }
        for (int i = 0; i < valuesFound.length; i++) {
            assertTrue(valuesFound[i] >= 425);
            assertTrue(valuesFound[i] <= 575);
        }
View Full Code Here

    @Test
    public void testUserBuckets() {
        {
            final Identifiers identifiers = new Identifiers(TestType.ANONYMOUS_USER, "16s2o7s01001d9vj");
            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
            assertEquals("kluj:test1,map_payload:inactive-1,oop_poop:control0,payloaded:inactive-1,payloaded_verified:inactive-1", calcBuckets(result));
            // Check and make sure UnitTestGroups respects these groups and works as expected.
            final UnitTestGroups grps = new UnitTestGroups(result);

            assertNotNull(grps.getPimple());
View Full Code Here

    public void testPageBuckets() {
        final String uidString = "16s2o7s01001d9vj";
        {
            // LoggedIn + MX maps to [0, 0.5, 0.5] ranges
            final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
            assertEquals("pimple:test1", calcBuckets(result));
            // Check and make sure UnitTestGroups respects these groups and works as expected.
            final UnitTestGroups grps = new UnitTestGroups(result);
            assertEquals(UnitTestGroups.Pimple.TEST, grps.getPimple());
            assertEquals(1, grps.getPimpleValue(-99));
            assertNotNull(grps.getKluj());
            assertEquals(-99, grps.getKlujValue(-99));
            assertNotNull(grps.getOop_poop());
            assertEquals(-99, grps.getOop_poopValue(-99));

            // Check the boolean conditions for one of the tests
            assertFalse(grps.isPimpleInactive());
            assertFalse(grps.isPimpleControl());
            assertTrue(grps.isPimpleTest());
            assertEquals("pimple1", grps.toString());
        }
        {
            // LoggedIn + US maps to [1, 0, 0] range
            final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "US", /* account */  new Account(10));
            assertEquals("pimple:inactive-1", calcBuckets(result));
            // Check and make sure UnitTestGroups respects these groups and works as expected.
            final UnitTestGroups grps = new UnitTestGroups(result);
            assertEquals(UnitTestGroups.Pimple.INACTIVE, grps.getPimple());
            assertEquals(-1, grps.getPimpleValue(-99));
            assertNotNull(grps.getKluj());
            assertEquals(-99, grps.getKlujValue(-99));
            assertNotNull(grps.getOop_poop());
            assertEquals(-99, grps.getOop_poopValue(-99));

            // Check the boolean conditions for one of the tests
            assertTrue(grps.isPimpleInactive());
            assertFalse(grps.isPimpleControl());
            assertFalse(grps.isPimpleTest());
            assertEquals("", grps.toString());
        }
        {
            // LoggedIn=false + MX maps to [1, 0, 0] range
            final Identifiers identifiers = new Identifiers(TestType.PAGE, uidString);
            final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ false , /* country */ "FR", /* account */  new Account(10));
            assertEquals("", calcBuckets(result));
            // Check and make sure UnitTestGroups respects these groups and works as expected.
            final UnitTestGroups grps = new UnitTestGroups(result);
            assertNotNull(grps.getPimple());
            assertEquals(-99, grps.getPimpleValue(-99));
View Full Code Here

    }

    @Test
    public void testCompanyBuckets() {
        final Identifiers identifiers = new Identifiers(TestType.COMPANY, "16s2o7s01001d9vj");
        final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "US", /* account */  new Account(10));
        assertEquals("", calcBuckets(result));
        // Check and make sure UnitTestGroups respects these groups and works as expected.
        final UnitTestGroups grps = new UnitTestGroups(result);
        assertNotNull(grps.getPimple());
        assertEquals(-99, grps.getPimpleValue(-99));
View Full Code Here

    @Test
    public void testPayloads() {
        final Identifiers identifiers = new Identifiers(ImmutableMap.<TestType, String>builder()
                .put(TestType.ANONYMOUS_USER, SPECIFICATION_MATRIX)
                .build());
        final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "US", /* account */  new Account(10));
        assertEquals("kluj:kloo2,map_payload:inactive-1,oop_poop:test1,payloaded:inactive-1,payloaded_verified:inactive-1", calcBuckets(result));
        // Check and make sure UnitTestGroups respects these groups and works as expected.
        final UnitTestGroups grps = new UnitTestGroups(result);
        assertNotNull(grps.getPayloaded_verified());
        assertEquals(-1, grps.getPayloaded_verifiedValue(-99));
View Full Code Here

    }

    @Test
    public void testTestDescriptions(){
        final Identifiers identifiers = new Identifiers(TestType.USER, "16s2o7s01001d9vj");
        final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
        assertEquals("kluj:test1,map_payload:inactive-1,oop_poop:control0,payloaded:inactive-1,payloaded_verified:inactive-1", calcBuckets(result));
        // Check and make sure UnitTestGroups respects these groups and works as expected.
        final UnitTestGroups grps = new UnitTestGroups(result);
        //make sure getDescription method exists and returns the correct description
        assertEquals(grps.getKlujDescription(),"2nd test");
View Full Code Here

    }

    @Test
    public void testTestDescriptions_checkEscaping(){
        final Identifiers identifiers = new Identifiers(TestType.USER, "16s2o7s01001d9vj");
        final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));
        assertEquals("kluj:test1,map_payload:inactive-1,oop_poop:control0,payloaded:inactive-1,payloaded_verified:inactive-1", calcBuckets(result));
        // Check and make sure UnitTestGroups respects these groups and works as expected.
        final UnitTestGroups grps = new UnitTestGroups(result);
        //make sure getDescription method exists and returns the correct description with escaping
        assertEquals(grps.getBubbleDescription(),"3rd \n\t\"test");
View Full Code Here

    }

    @Test
    public void testMapPayloadReturns(){
        final Identifiers identifiers = new Identifiers(TestType.USER, "16s2o7s01001d9vj");
        final ProctorResult result = manager.determineBuckets(identifiers, /* loggedin */ true , /* country */ "FR", /* account */  new Account(10));

        final UnitTestGroups grps = new UnitTestGroups(result);
        assertEquals(grps.getMap_payloadPayload().getAstring(),"lol");
        assertEquals(grps.getMap_payloadPayload().getAdouble(), (Double) 2.1);
        assertArrayEquals(grps.getMap_payloadPayload().getAnarray(), new Long[]{1L, 2L, 3L});
View Full Code Here

TOP

Related Classes of com.indeed.proctor.common.ProctorResult

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.