Search in sources :

Example 16 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeUpdatedWithRestrictedIpAddresses.

@Test
public void radiatorCanBeUpdatedWithRestrictedIpAddresses() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A"));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    given().params("ips", "111.111.111.111", "secret", "sseeccrreett").when().post(CONTRIVED_PATH_FOR_TESTING + "/aaa/updateIps").then().statusCode(200).body(equalTo("OK"));
    postStepStartedAndConfirmTestResponse("aaa", "sseeccrreett", "1", "A", 200, "ip address 127.0.0.1 not authorized");
}
Also used : 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 17 with Radiator

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

the class RadiatorIntegrationTest method buildCannotBeStartedTwice.

@Test
public void buildCannotBeStartedTwice() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A"), build("222", "running", 0, step("A", 0, "running")));
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    postStepStartedAndConfirmTestResponse("aaa", "sseeccrreett", "222", "A", 200, "wrong build state");
}
Also used : 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 18 with Radiator

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

the class RadiatorIntegrationTest method radiatorCannotBeUpdatedWithWithBuildStartForBogusStep.

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

use of com.paulhammant.buildradiator.radiator.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 : 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 20 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeCreatedAndTransformUnderscoresInStepNames.

@Test
public void radiatorCanBeCreatedAndTransformUnderscoresInStepNames() {
    app = new TestVersionOfBuildRadiatorApp(null);
    startApp();
    CreatedRadiator createdRadiator = new CreatedRadiator();
    given().params("stepNames", join(",", "P_P", "Q q", "R-R")).when().post(CONTRIVED_PATH_FOR_TESTING + "/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("P P", "Q q", "R-R")));
}
Also used : CreatedRadiator(com.paulhammant.buildradiator.radiator.model.CreatedRadiator) HasNewRadiator.captureCreatedRadiator(com.paulhammant.buildradiator.radiator.hamcrest.HasNewRadiator.captureCreatedRadiator) 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)

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