Search in sources :

Example 1 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeCreatedWithRestrictedIpAddressesAndStillAllowAccess.

@Test
public void radiatorCanBeCreatedWithRestrictedIpAddressesAndStillAllowAccess() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A")).withIpAccessRestrictedToThese("127.0.0.1");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    postStepStartedAndConfirmTestResponse("aaa", "sseeccrreett", "1", "A", 200, "OK");
}
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 2 with Radiator

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

the class RadiatorIntegrationTest method knownCodeHasListOfBuildsAvailableAsJson.

@Test
public void knownCodeHasListOfBuildsAvailableAsJson() {
    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(CONTRIVED_PATH_FOR_TESTING + "/RAD_CODE").then().assertThat().body(ignoringLastUpdatedFieldTheRadiatorIsTheSameAs(rad.withoutSecret())).statusCode(200).contentType("application/json;charset=UTF-8");
}
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 3 with Radiator

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

use of com.paulhammant.buildradiator.radiator.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(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("short1", "short 2", "short 333")));
}
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)

Example 5 with Radiator

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

the class RadiatorIntegrationTest method radiatorCanBeCreatedWithRestrictedIpAddressesAndBlockAccess.

@Test
public void radiatorCanBeCreatedWithRestrictedIpAddressesAndBlockAccess() {
    Radiator rad = rad("aaa", "sseeccrreett", stepNames("A")).withIpAccessRestrictedToThese("111.111.111.111", "222.222.222.222");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startApp();
    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)

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