Search in sources :

Example 11 with Radiator

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

the class RadiatorWebDriverTest method pageContainsDataFromServer.

@Test
public void pageContainsDataFromServer() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A", "B", "C"), build("2", "running", 2000, step("A", 2000, "running"), step("B"), step("C")), build("1", "running", 4000, step("A", 4000, "failed"), skip("B"), skip("C"))).withIpAccessRestrictedToThese("0:0:0:0:0:0:0:1", "127.0.0.1", "111.222.33.44");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build");
    FWD.trs().getText().within(secs(2)).shouldContain("Main Project Trunk");
    FWD.td().getText().within(secs(3)).shouldBe("Main Project Trunk Build\nchange URL to customize the title ↑ or step codes ↓ Edit the title and step descriptions");
    FWD.body().getText().within(secs(2)).shouldContain("(running)");
    FWD.trs().get(1).getText().shouldBe("2\n2 secs\nA\n2 secs\n(running) B\n0 secs\nC\n0 secs");
    FWD.trs().get(2).getText().shouldBe("1\n4 secs\nA\n4 secs\n(failed) B\n0 secs\n(skipped) C\n0 secs\n(skipped)");
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 12 with Radiator

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

the class RadiatorWebDriverTest method pageCanHaveStepsReplaceOnBrowserSide.

@Test
public void pageCanHaveStepsReplaceOnBrowserSide() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A", "B", "C"), build("2", "running", 2000, step("A", 2000, "running"), step("B"), step("C")), build("1", "running", 4000, step("A", 4000, "failed"), skip("B"), skip("C"))).withIpAccessRestrictedToThese("0:0:0:0:0:0:0:1", "127.0.0.1", "111.222.33.44");
    app = new TestVersionOfBuildRadiatorApp(rad);
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build/A/Ant/B/Bat/C/Clever_Cat");
    FWD.td().getText().within(secs(2)).shouldBe("Main Project Trunk Build\nchange URL to customize the title ↑ or step codes ↓ Edit the title and step descriptions");
    FWD.trs().getText().within(secs(2)).shouldContain("running");
    FWD.trs().get(1).getText().shouldBe("2\n2 secs\nAnt\n2 secs\n(running) Bat\n0 secs\nClever Cat\n0 secs");
    FWD.trs().get(2).getText().shouldBe("1\n4 secs\nAnt\n4 secs\n(failed) Bat\n0 secs\n(skipped) Clever Cat\n0 secs\n(skipped)");
}
Also used : Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 13 with Radiator

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

the class RadiatorWebDriverTest method confirmDataRefreshes.

@Test
public void confirmDataRefreshes() {
    Radiator rad = rad("xxx", "sseeccrreett", stepNames("A"), build("1", "running", 0, step("A", 0, "running")));
    app = new TestVersionOfBuildRadiatorApp(rad).withFasterRefresh();
    startAppAndOpenWebDriverOnRadiatorPage(CONTRIVED_PATH_FOR_TESTING + "#xxx/Main_Project_Trunk_Build");
    final FluentWebElement rootDiv = FWD.within(secs(2)).div();
    rootDiv.getText().within(secs(2)).shouldContain("(running)");
    rad.stepPassed("1", "A");
    FWD.trs().get(1).getText().within(secs(4)).shouldContain("(passed)");
    rootDiv.getText().shouldNotContain("(running)");
}
Also used : FluentWebElement(org.seleniumhq.selenium.fluent.FluentWebElement) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 14 with Radiator

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

the class RadiatorStore method processRadiatorsToSave.

private void processRadiatorsToSave() {
    synchronized (radiatorLastSavedTimes) {
        Set<String> ks = actualRadiators.keySet();
        for (String radCode : ks) {
            Radiator rad = actualRadiators.get(radCode);
            Long lastSaved = radiatorLastSavedTimes.get(radCode);
            if (lastSaved == null || rad.lastUpdated > lastSaved) {
                saveInDataService(radCode, rad);
                radiatorLastSavedTimes.put(radCode, rad.lastUpdated);
            }
        }
    }
}
Also used : ByteString(com.google.protobuf.ByteString) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

Example 15 with Radiator

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

the class RadiatorStore method get.

Radiator get(final String radCode, String ipAddress) {
    Radiator radiator = this.actualRadiators.get(radCode);
    if (radiator == null) {
        radiator = getFromDataService(radCode);
        if (radiator != null) {
            actualRadiators.put(radCode, radiator);
            radiatorLastSavedTimes.put(radCode, radiator.lastUpdated);
        }
    }
    if (radiator != null) {
        radiator.verifyIP(ipAddress);
    } else {
        throw new RadiatorDoesntExist();
    }
    return radiator;
}
Also used : RadiatorDoesntExist(com.paulhammant.buildradiator.radiator.model.RadiatorDoesntExist) Radiator(com.paulhammant.buildradiator.radiator.model.Radiator)

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