Search in sources :

Example 6 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithWithBuildStepCompletion.

@Test
public void radiatorCanBeUpdatedWithWithBuildStepCompletion() {
    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", "step", "A", "secret", "sseeccrreett").when().post(CONTRIVED_PATH_FOR_TESTING + "/aaa/stepPassed").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"));
}
Also used : Step(com.paulhammant.buildradiator.radiator.model.Step) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator) CreatedRadiator(com.paulhammant.buildradiator.radiator.model.CreatedRadiator) HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator) Test(org.junit.Test)

Example 7 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithWithBuildStepFailure.

@Test
public void radiatorCanBeUpdatedWithWithBuildStepFailure() {
    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", "step", "A", "secret", "sseeccrreett").when().post(CONTRIVED_PATH_FOR_TESTING + "/aaa/stepFailed").then().statusCode(200).body(equalTo("OK"));
    Build build = rad.builds.get(0);
    assertThat(build.status, equalTo("failed"));
    assertThat(build.steps.get(0).status, equalTo("failed"));
    assertThat(build.steps.get(1).status, equalTo("skipped"));
}
Also used : Build(com.paulhammant.buildradiator.radiator.model.Build) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator) CreatedRadiator(com.paulhammant.buildradiator.radiator.model.CreatedRadiator) HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator) Test(org.junit.Test)

Example 8 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithWithCancelledBuild.

@Test
public void radiatorCanBeUpdatedWithWithCancelledBuild() {
    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", "step", "A", "secret", "sseeccrreett").when().post(CONTRIVED_PATH_FOR_TESTING + "/aaa/buildCancelled").then().statusCode(200).body(equalTo("OK"));
    Build build = rad.builds.get(0);
    assertThat(build.status, equalTo("cancelled"));
    ArrayList<Step> steps = build.steps;
    assertThat(steps.get(0).name, equalTo("A"));
    assertThat(steps.get(0).status, equalTo("cancelled"));
    assertThat(steps.get(1).name, equalTo("B"));
    assertThat(steps.get(1).status, equalTo("cancelled"));
}
Also used : Build(com.paulhammant.buildradiator.radiator.model.Build) Step(com.paulhammant.buildradiator.radiator.model.Step) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator) CreatedRadiator(com.paulhammant.buildradiator.radiator.model.CreatedRadiator) HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator) Test(org.junit.Test)

Example 9 with Radiator

use of com.paulhammant.buildradiator.radiator.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.radiator.model.Radiator) Test(org.junit.Test)

Example 10 with Radiator

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

the class RadiatorStoreUnitTest method saverThreadShouldDoItsBusinessForUnsavedRadiatorTwiceIfNeeded.

@Test
public void saverThreadShouldDoItsBusinessForUnsavedRadiatorTwiceIfNeeded() throws InterruptedException {
    saverThreadShouldDoItsBusinessForUnsavedRadiatorJustOnce();
    Radiator rad = radStore.get("QWERTY", "127.0.0.1");
    rad.lastUpdated = System.currentTimeMillis();
    Thread.sleep(10);
    assertThat(called, equalTo(2));
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator) Test(org.junit.Test)

Aggregations

Radiator (com.paulhammant.buildradiator.radiator.model.Radiator)30 Test (org.junit.Test)21 HasNewRadiator.captureCreatedRadiator (com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator)14 CreatedRadiator (com.paulhammant.buildradiator.radiator.model.CreatedRadiator)14 Step (com.paulhammant.buildradiator.radiator.model.Step)3 ByteString (com.google.protobuf.ByteString)2 Build (com.paulhammant.buildradiator.radiator.model.Build)2 RadiatorDoesntExist (com.paulhammant.buildradiator.radiator.model.RadiatorDoesntExist)2 UnknownStep (com.paulhammant.buildradiator.radiator.model.UnknownStep)1 FluentWebElement (org.seleniumhq.selenium.fluent.FluentWebElement)1