use of com.paulhammant.buildradiator.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("/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("P P", "Q q", "R-R")));
}
use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.
the class RadiatorStoreUnitTest method radiatorCanBeRetrieved.
@Test
public void radiatorCanBeRetrieved() {
RadiatorStore rs = new RadiatorStore();
Radiator rad = null;
try {
rad = rs.get("AAA", "127.0.0.1");
fail();
} catch (RadiatorDoesntExist e) {
// expected
}
rs.createRadiator(new TestRandomGenerator("AAA", "sseeccrreett"), "A");
rad = rs.get("AAA", "127.0.0.1");
assertThat(rad.code, equalTo("AAA"));
}
use of com.paulhammant.buildradiator.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(4);
assertThat(called, equalTo(2));
}
use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.
the class RadiatorStoreUnitTest method unknownRadiatorShouldBeSoughtFromDataServiceJustOnce.
@Test
public void unknownRadiatorShouldBeSoughtFromDataServiceJustOnce() throws InterruptedException {
radStore = getTestAwareRadiatorStore();
Radiator r = radStore.createRadiator(new TestRandomGenerator("QWERTY", "sseeccrreett"), "A");
assertQwertyRadiatorHasBeenCalledOnce();
}
use of com.paulhammant.buildradiator.model.Radiator in project BuildRadiator by BuildRadiator.
the class RadiatorStoreUnitTest method radiatorCanBeCreatedWithGoodIpAddresses.
@Test
public void radiatorCanBeCreatedWithGoodIpAddresses() {
Radiator rad = new RadiatorStore().createRadiator(new TestRandomGenerator("QWERTY", "sseeccrreett"), "A").withIpAccessRestrictedToThese("123.123.123.122", "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
assertThat(rad.code, equalTo("QWERTY"));
assertThat(rad.codeAndSecretOnly().code, equalTo("QWERTY"));
assertThat(rad.codeAndSecretOnly().secret, equalTo("sseeccrreett"));
}
Aggregations