Search in sources :

Example 6 with Radiator

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

the class RadiatorWebDriverTest method pageCanHaveStepsReplaceOnBrowserSide.

@Test
public void pageCanHaveStepsReplaceOnBrowserSide() 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", "/A/Ant/B/Bat/C/Clever_Cat");
    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\nAnt\n2 secs\n(running) Bat\n0 secs\nClever Cat\n0 secs");
    FWD.trs().get(2).getText().shouldBe("1\n4 secs\nAnt\n4 secs\n(failed) Bat\n0 secs\n(skipped) Clever Cat\n0 secs\n(skipped)");
}
Also used : Radiator(com.paulhammant.buildradiator.model.Radiator)

Example 7 with Radiator

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

the class RadiatorUnitTest method radiatorCanIgnoreABogusStepName.

@Test
public void radiatorCanIgnoreABogusStepName() throws InterruptedException, JsonProcessingException {
    Radiator rad = new RadiatorStore().createRadiator(new TestRandomGenerator("X", "sseeccrreett"), "A");
    try {
        rad.startStep("1", "NoMatch");
        fail();
    } catch (UnknownStep e) {
    }
    assertRadiatorsEqualIgnoringLastUpdatedField(rad, rad("X", "sseeccrreett", stepNames("A"), build("1", "", 0, step("A", 0, ""))));
}
Also used : UnknownStep(com.paulhammant.buildradiator.model.UnknownStep) Radiator(com.paulhammant.buildradiator.model.Radiator) Test(org.junit.Test)

Example 8 with Radiator

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

the class RadiatorStore method createRadiator.

Radiator createRadiator(RandomGenerator codeGenerator, String... steps) {
    String radiatorCode = codeGenerator.generateRadiatorCode();
    String secret = codeGenerator.generateSecret();
    Radiator radiator = new Radiator(radiatorCode, secret, steps);
    this.actualRadiators.put(radiatorCode, radiator);
    return radiator;
}
Also used : ByteString(com.google.protobuf.ByteString) Radiator(com.paulhammant.buildradiator.model.Radiator)

Example 9 with Radiator

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

the class RadiatorStore method processRadiatorsToSave.

private void processRadiatorsToSave() {
    synchronized (radiatorLastSavedTimes) {
        Set<String> ks = actualRadiators.keySet();
        for (String radCode : ks) {
            Radiator rad = actualRadiators.get(radCode);
            Long lastSaved = radiatorLastSavedTimes.get(radCode);
            if (lastSaved == null || rad.lastUpdated > lastSaved) {
                saveInDataService(radCode, rad);
                radiatorLastSavedTimes.put(radCode, rad.lastUpdated);
            }
        }
    }
}
Also used : ByteString(com.google.protobuf.ByteString) Radiator(com.paulhammant.buildradiator.model.Radiator)

Example 10 with Radiator

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

the class RadiatorIntegrationTest method radiatorCannotBeUpdatedWithWithBuildStartIfTheSecretIsWrong.

@Test
public void radiatorCannotBeUpdatedWithWithBuildStartIfTheSecretIsWrong() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A"));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    postStepStartedAndConfirmTestResponse("aaa", "wrong-secret", "1", "A", 200, "secret doesnt match");
    assertThat(rad.builds.size(), equalTo(0));
}
Also used : HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.hamcrest.HasNewRadiator.captureCreatedRadiator) Radiator(com.paulhammant.buildradiator.model.Radiator) CreatedRadiator(com.paulhammant.buildradiator.model.CreatedRadiator) Test(org.junit.Test)

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