Search in sources :

Example 16 with Radiator

use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithWithBuildStepCompletionAndStartOfNewStepInOneGo.

@Test
public void radiatorCanBeUpdatedWithWithBuildStepCompletionAndStartOfNewStepInOneGo() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A", "B"), build("1", "running", 0, step("A", 0, "running"), step("B")));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    given().params("build", "1", "pStep", "A", "step", "B", "secret", "sseeccrreett").when().post("/r/aaa/stepPassedAndStartStep").then().statusCode(200).body(equalTo("OK"));
    ArrayList<Step> steps = rad.builds.get(0).steps;
    assertThat(steps.get(0).name, equalTo("A"));
    assertThat(steps.get(0).status, equalTo("passed"));
    assertThat(steps.get(1).name, equalTo("B"));
    assertThat(steps.get(1).status, equalTo("running"));
}
Also used : Step(com.paulhammant.buildradiator.model.Step) HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.hamcrest.HasNewRadiator.captureCreatedRadiator) Radiator(com.paulhammant.buildradiator.model.Radiator) CreatedRadiator(com.paulhammant.buildradiator.model.CreatedRadiator) Test(org.junit.Test)

Example 17 with Radiator

use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorStore method get.

Radiator get(final String radCode, String ipAddress) {
    Radiator radiator = this.actualRadiators.get(radCode);
    if (radiator == null) {
        radiator = getFromDataService(radCode);
        if (radiator != null) {
            actualRadiators.put(radCode, radiator);
            radiatorLastSavedTimes.put(radCode, radiator.lastUpdated);
        }
    }
    if (radiator != null) {
        radiator.verifyIP(ipAddress);
    } else {
        throw new RadiatorDoesntExist();
    }
    return radiator;
}
Also used : RadiatorDoesntExist(com.paulhammant.buildradiator.model.RadiatorDoesntExist) Radiator(com.paulhammant.buildradiator.model.Radiator)

Example 18 with Radiator

use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorUnitTest method radiatorCanOnlyHoldTenBuildsAndInReverseOrder.

@Test
public void radiatorCanOnlyHoldTenBuildsAndInReverseOrder() throws InterruptedException, JsonProcessingException {
    Radiator rad = new RadiatorStore().createRadiator(new TestRandomGenerator("X", "sseeccrreett"), "A");
    for (int i = 1; i <= 11; i++) {
        rad.startStep("" + i, "A");
    }
    assertThat(rad.builds.size(), is(10));
}
Also used : Radiator(com.paulhammant.buildradiator.model.Radiator) Test(org.junit.Test)

Example 19 with Radiator

use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorUnitTest method buildCanHaveThreeStepsAndFailOnSecond.

@Test
public void buildCanHaveThreeStepsAndFailOnSecond() throws InterruptedException, JsonProcessingException {
    Radiator r = new RadiatorStore().createRadiator(new TestRandomGenerator("abc123", "123"), "compile", "unit tests", "func tests");
    r.startStep("123", "compile");
    // test on timing too
    Thread.sleep(50);
    r.stepPassed("123", "compile");
    r.startStep("123", "unit tests");
    r.stepFailed("123", "unit tests");
    assertRadiatorsEqualIgnoringLastUpdatedField(r, rad("abc123", "123", stepNames("compile", "unit tests", "func tests"), build("123", "failed", 0, step("compile", 50, "passed"), step("unit tests", 0, "failed"), step("func tests", 0, "skipped"))));
}
Also used : Radiator(com.paulhammant.buildradiator.model.Radiator) Test(org.junit.Test)

Example 20 with Radiator

use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.

the class RadiatorWebDriverTest method pageContainsDataFromServer.

@Test
public void pageContainsDataFromServer() throws InterruptedException {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A", "B", "C"), build("2", "running", 2000, step("A", 2000, "running"), step("B"), step("C")), build("1", "running", 4000, step("A", 4000, "failed"), skip("B"), skip("C"))).withIpAccessRestrictedToThese("127.0.0.1", "111.222.33.44");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage("xxx");
    FWD.td().getText().shouldBe("Main Project Trunk Build\nchange URL to customize the title ↑ or step codes ↓");
    FWD.trs().get(1).getText().shouldBe("2\n2 secs\nA\n2 secs\n(running) B\n0 secs\nC\n0 secs");
    FWD.trs().get(2).getText().shouldBe("1\n4 secs\nA\n4 secs\n(failed) B\n0 secs\n(skipped) C\n0 secs\n(skipped)");
}
Also used : Radiator(com.paulhammant.buildradiator.model.Radiator)

Aggregations

Radiator (com.paulhammant.buildradiator.model.Radiator)27 Test (org.junit.Test)21 HasNewRadiator.captureCreatedRadiator (com.paulhammant.buildradiator.hamcrest.HasNewRadiator.captureCreatedRadiator)14 CreatedRadiator (com.paulhammant.buildradiator.model.CreatedRadiator)14 Step (com.paulhammant.buildradiator.model.Step)4 ByteString (com.google.protobuf.ByteString)2 Build (com.paulhammant.buildradiator.model.Build)2 RadiatorDoesntExist (com.paulhammant.buildradiator.model.RadiatorDoesntExist)2 UnknownStep (com.paulhammant.buildradiator.model.UnknownStep)1