Package com.indeed.proctor.common.model

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


    @Test
    public void testAuditVersionAsInt() throws IOException {
        // Tests the legacy audit.version as integer
        final String AUDIT_JSON = "{ \"version\" : 56783, \"updatedBy\" : \"jenkins-build-123\", \"updated\" : 1400693905572 }";
        final Audit audit = Serializers.lenient().readValue(AUDIT_JSON, Audit.class);
        Assert.assertEquals("56783", audit.getVersion());
        Assert.assertEquals("jenkins-build-123", audit.getUpdatedBy());
        Assert.assertEquals(1400693905572L, audit.getUpdated());
    }
View Full Code Here


    @Test
    public void testAuditVersionAsString() throws IOException {
        // Tests the audit.version as String
        final String AUDIT_JSON = "{ \"version\" : \"56783\", \"updatedBy\" : \"jenkins-build-123\", \"updated\" : 1400693905572 }";
        final Audit audit = Serializers.lenient().readValue(AUDIT_JSON, Audit.class);
        Assert.assertEquals("56783", audit.getVersion());
        Assert.assertEquals("jenkins-build-123", audit.getUpdatedBy());
        Assert.assertEquals(1400693905572L, audit.getUpdated());
    }
View Full Code Here

        matrix.setTests(tests);
        return matrix;
    }

    private Audit constructAudit() {
        final Audit audit = new Audit();
        audit.setVersion("1");
        audit.setUpdatedBy("unit test");
        audit.setUpdated(1337133701337L);
        return audit;
    }
View Full Code Here

        matrix.setTests(tests);
        return matrix;
    }

    private Audit constructAudit() {
        final Audit audit = new Audit();
        audit.setVersion("1");
        audit.setUpdatedBy("unit test");
        audit.setUpdated(1337133701337L);
        return audit;
    }
View Full Code Here

    @Test
    public void testAppendTestMatrix_audit() throws IOException {
        // Check that the audit values are correct.
        final TestMatrixArtifact matrix = new TestMatrixArtifact();

        final Audit audit = new Audit();
        audit.setVersion("10");
        audit.setUpdated(1000);
        audit.setUpdatedBy("nobody");
        matrix.setAudit(audit);

        final Writer writer = new StringWriter();
        final Proctor proctor = Proctor.construct(matrix, null, null);
        proctor.appendTestMatrix(writer);
View Full Code Here

            // This should only happen if the versions of the matrix files are the same.
            return false;
        }
        this.current = newProctor;

        final Audit lastAudit = Preconditions.checkNotNull(this.lastAudit, "Missing last audit");
        setDataVersion(lastAudit.getVersion() + " @ " + lastAudit.getUpdated() + " by " + lastAudit.getUpdatedBy());
        LOGGER.info("Successfully loaded new test matrix definition: " + lastAudit.getVersion() + " @ " + lastAudit.getUpdated() + " by " + lastAudit.getUpdatedBy());
        return true;
    }
View Full Code Here

            loadResult = ProctorUtils.verifyWithoutSpecification(testMatrix, getSource(), functionMapper, providedContext);
        } else {
            loadResult = ProctorUtils.verifyAndConsolidate(testMatrix, getSource(), requiredTests, functionMapper, providedContext);
        }

        final Audit newAudit = testMatrix.getAudit();
        if (lastAudit != null) {
            final Audit audit = Preconditions.checkNotNull(newAudit, "Missing audit");
            if(lastAudit.getVersion().equals(audit.getVersion())) {
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Not reloading " + getSource() + " test matrix definition because audit is unchanged: " + lastAudit.getVersion() + " @ " + lastAudit.getUpdated() + " by " + lastAudit.getUpdatedBy());
                }

                return null;
View Full Code Here

        return new Proctor(matrix, loadResult, testChoosers);
    }

    @Nonnull
    private static Proctor createEmptyProctor() {
        final Audit audit = new Audit();
        audit.setUpdated(0);
        audit.setUpdatedBy("nobody");
        audit.setVersion(Audit.EMPTY_VERSION);

        final TestMatrixArtifact testMatrix = new TestMatrixArtifact();
        testMatrix.setAudit(audit);

        final ProctorLoadResult loadResult = ProctorLoadResult.emptyResult();
View Full Code Here

                testChooser.getTestDefinition();
            }
        }

        // TODO Can we make getAudit nonnull?
        final Audit audit = Preconditions.checkNotNull(matrix.getAudit(), "Missing audit");
        return new ProctorResult(audit.getVersion(), testGroups, testDefinitions);
    }
View Full Code Here

        OBJECT_MAPPER.defaultPrettyPrintingWriter().writeValue(writer, artifact);
    }

    @Nonnull
    public static TestMatrixArtifact convertToConsumableArtifact(@Nonnull final TestMatrixVersion testMatrix) {
        final Audit audit = new Audit();
        final Date published = Preconditions.checkNotNull(testMatrix.getPublished(), "Missing publication date");
        audit.setUpdated(published.getTime());
        audit.setVersion(testMatrix.getVersion());
        audit.setUpdatedBy(testMatrix.getAuthor());

        final TestMatrixArtifact artifact = new TestMatrixArtifact();
        artifact.setAudit(audit);

        final TestMatrixDefinition testMatrixDefinition = Preconditions.checkNotNull(testMatrix.getTestMatrixDefinition(), "Missing test matrix definition");
View Full Code Here

TOP

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

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.