Examples of TestDefinition


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

    private void doAssertTestDefintion(final String resourceName, final ObjectMapper mapper) throws IOException {
        final InputStream input = getClass().getResourceAsStream(resourceName);
        Assert.assertNotNull("Input stream for " + resourceName + " should not be null", input);
        try {
            final TestDefinition definition = mapper.readValue(input, TestDefinition.class);
            Assert.assertEquals("1", definition.getVersion());
            Assert.assertEquals(TestType.ANONYMOUS_USER, definition.getTestType());
            Assert.assertEquals("exampletst", definition.getSalt());
            Assert.assertEquals("loggedIn", definition.getRule());
            Assert.assertTrue(definition.getDescription().startsWith("An example test"));
            Assert.assertEquals(0, definition.getSpecialConstants().size());
            Assert.assertEquals(1, definition.getConstants().size());
            Assert.assertEquals("en", definition.getConstants().get("ENGLISH"));

            Assert.assertEquals(2, definition.getBuckets().size());
            final TestBucket controlBucket = definition.getBuckets().get(0);
            Assert.assertEquals("control", controlBucket.getName());
            Assert.assertEquals(0, controlBucket.getValue());
            Assert.assertNull(controlBucket.getDescription());

            final TestBucket testBucket = definition.getBuckets().get(1);
            Assert.assertEquals("test", testBucket.getName());
            Assert.assertEquals(1, testBucket.getValue());
            Assert.assertNull(testBucket.getDescription());

            Assert.assertEquals(2, definition.getAllocations().size());
            final Allocation englishAllocation = definition.getAllocations().get(0);
            Assert.assertEquals("${lang == ENGLISH}", englishAllocation.getRule());
            Assert.assertEquals(0.25, englishAllocation.getRanges().get(0).getLength(), 1E-16);
            Assert.assertEquals(0, englishAllocation.getRanges().get(0).getBucketValue());
            Assert.assertEquals(0.75, englishAllocation.getRanges().get(1).getLength(), 1E-16);
            Assert.assertEquals(1, englishAllocation.getRanges().get(1).getBucketValue());

            final Allocation defaultAllocation = definition.getAllocations().get(1);
            Assert.assertNull(defaultAllocation.getRule());
            Assert.assertEquals(0.1, defaultAllocation.getRanges().get(0).getLength(), 1E-16);
            Assert.assertEquals(0, defaultAllocation.getRanges().get(0).getBucketValue());
            Assert.assertEquals(0.90, defaultAllocation.getRanges().get(1).getLength(), 1E-16);
            Assert.assertEquals(1, defaultAllocation.getRanges().get(1).getBucketValue());
View Full Code Here

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

        final String description = "test description";

        for(final String tdRule : emptyRules) {
            for(String allocRule : emptyRules) {
                final Allocation allocation = new Allocation(allocRule, Collections.singletonList(range));
                final TestDefinition testDefinition = new TestDefinition(
                    version,
                    tdRule,
                    testType,
                    salt,
                    buckets,
View Full Code Here

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


        for(final String rule : new String[] { "lang == 'en'", "${lang == 'en'}"})
        {
            final Allocation allocation = new Allocation(rule, Collections.singletonList(range));
            final TestDefinition testDefinition = new TestDefinition(
                version,
                rule,
                testType,
                salt,
                buckets,
View Full Code Here

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

        final Allocation allocation = new Allocation(null, Collections.singletonList(range));

        for(final String tdRule : new String[] { "lang == 'en'", "${lang == 'en'}"})
        {
            final TestDefinition testDefinition = new TestDefinition(
                version,
                tdRule,
                testType,
                salt,
                buckets,
View Full Code Here

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

        final String description = "test description";

        for(final String tdRule : emptyRules) {
            for(String allocRule : emptyRules) {
                final Allocation allocation = new Allocation(allocRule, Collections.singletonList(range));
                final TestDefinition testDefinition = new TestDefinition(
                    version,
                    tdRule,
                    testType,
                    salt,
                    buckets,
View Full Code Here

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


        for(final String rule : new String[] { "lang == 'en'", "${lang == 'en'}"})
        {
            final Allocation allocation = new Allocation(rule, Collections.singletonList(range));
            final TestDefinition testDefinition = new TestDefinition(
                version,
                rule,
                testType,
                salt,
                buckets,
View Full Code Here

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

        final Allocation allocation = new Allocation(null, Collections.singletonList(range));

        for(final String tdRule : new String[] { "lang == 'en'", "${lang == 'en'}"})
        {
            final TestDefinition testDefinition = new TestDefinition(
                version,
                tdRule,
                testType,
                salt,
                buckets,
View Full Code Here

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

        final Map<String, TestDefinition> testDefinitions = testMatrixDefinition.getTests();

        final Map<String, ConsumableTestDefinition> consumableTestDefinitions = Maps.newLinkedHashMap();
        for (final Entry<String, TestDefinition> entry : testDefinitions.entrySet()) {
            final TestDefinition td = entry.getValue();
            final ConsumableTestDefinition ctd = convertToConsumableTestDefinition(td);
            consumableTestDefinitions.put(entry.getKey(), ctd);
        }

        artifact.setTests(consumableTestDefinitions);
View Full Code Here

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

        final Map<String, TestDefinition> testDefinitions = Maps.newLinkedHashMap();
        start = System.currentTimeMillis();
        for (final TestVersionResult.Test testDefFile : result.getTests()) {
            final long startForTest = System.currentTimeMillis();
            final TestDefinition testDefinition = getTestDefinition(testDefFile.getTestName(), testDefFile.getRevision());
            if(LOGGER.isTraceEnabled()) {
                final long elapsed = System.currentTimeMillis() - startForTest;
                LOGGER.debug(String.format("Took %d ms to load %s (r%s) %s", elapsed, testDefFile.getTestName(), testDefFile.getRevision(), testDefinition == null ? "unsuccessfully" : "successfully"));
            }
            if(testDefinition == null) {
View Full Code Here

Examples of org.apache.beehive.netui.tools.testrecorder.shared.config.TestDefinition

        }
    }

    private void doRecordStart( String testName, HttpServletRequest request, HttpServletResponse response,
            boolean overwrite, String testUser, String description ) throws IOException, ServletException {
        TestDefinition test = getTest( testName );
        if ( test == null ) {
            test = new TestDefinition( testName, description, TestRecorderFilter.instance().getWebapp(), null );
        }
        if ( test.getWebapp() != TestRecorderFilter.instance().getWebapp() ) {
            String msg = "ERROR: unable to start recording, the webapp of the test( " +
                    test.getWebapp().getName() + " ) is not the same as this webapp( " +
                    TestRecorderFilter.instance().getWebapp() + " )";
            forward( request, response, msg, Constants.RECORD_PAGE, true );
            return;
        }
        // may throw IOException or SecurityException
        RecordSession session = null;
        try {
            session = getRecordSession( test, overwrite, testUser, description );
            if ( description != null ) {
                test.setDescription( description );
            }
            TestRecorderFilter.instance().getTestDefinitions().add( test );
        }
        catch ( Exception ex ) {
            String msg = "ERROR: unable to start recording, unable to obtain session, exception( " +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.