Search in sources :

Example 21 with Radiator

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

the class RadiatorWebDriverTest method confirmDataRefreshes.

@Test
public void confirmDataRefreshes() throws InterruptedException {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A"), build("1", "running", 0, step("A", 0, "running")));
    app = new TestVersionOfBuildRadiatorApp(rad) {

        @Override
        protected void serveRadiatorPage() {
            // speed up refresh interval - hack radiator.html as it is send to the browser
            super.serveIndexPageButWithReplacement("30000", "300");
        }
    };
    startAppAndOpenWebDriverOnRadiatorPage("xxx");
    FWD.trs().get(1).getText().shouldContain("(running)");
    rad.stepPassed("1", "A");
    FWD.trs().get(1).getText().within(secs(4)).shouldContain("(passed)");
}
Also used : Radiator(com.paulhammant.buildradiator.model.Radiator)

Example 22 with Radiator

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

the class RadiatorIntegrationTest method knownCodeHasListOfBuildsAvailableAsJson.

@Test
public void knownCodeHasListOfBuildsAvailableAsJson() throws InterruptedException {
    Radiator rad = rad("RAD_CODE", "a_secret", stepNames("A", "B", "C"), build("1", "running", 0, step("A", 0, "running"), step("B"), step("C"))).withIpAccessRestrictedToThese("127.0.0.1");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    get("/r/RAD_CODE").then().assertThat().body(ignoringLastUpdatedFieldTheRadiatorIsTheSameAs(rad.withoutSecret())).statusCode(200).contentType("application/json;charset=UTF-8");
}
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)

Example 23 with Radiator

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

the class RadiatorIntegrationTest method radiatorCannotBeUpdatedWithWithBuildStartIfTheSecretIsTooLong.

@Test
public void radiatorCannotBeUpdatedWithWithBuildStartIfTheSecretIsTooLong() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A"));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    postStepStartedAndConfirmTestResponse("aaa", "secret--way--too--long", "1", "A", 200, "secret parameter too long");
    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)

Example 24 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithWithBuildStart.

@Test
public void radiatorCanBeUpdatedWithWithBuildStart() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A"));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    postStepStartedAndConfirmTestResponse("aaa", "sseeccrreett", "1", "A", 200, "OK");
    assertThat(rad.builds.get(0).steps.get(0).status, equalTo("running"));
}
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)

Example 25 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeCreatedWithStepNamesThatAreNotTooLong.

@Test
public void radiatorCanBeCreatedWithStepNamesThatAreNotTooLong() {
    app = new TestVersionOfBuildRadiatorApp(null);
    startApp();
    CreatedRadiator createdRadiator = new CreatedRadiator();
    given().params("stepNames", join(",", "short1", "short 2", "short 333")).when().post("/r/create").then().statusCode(200).body(captureCreatedRadiator(createdRadiator));
    Radiator rad = app.getResultsStore().actualRadiators.values().iterator().next();
    assertThat(rad.code, equalTo(createdRadiator.code));
    assertThat(rad.secret, equalTo(createdRadiator.secret));
    assertThat(rad.stepNames, equalTo(stepNames("short1", "short 2", "short 333")));
}
Also used : HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.hamcrest.HasNewRadiator.captureCreatedRadiator) CreatedRadiator(com.paulhammant.buildradiator.model.CreatedRadiator) 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