Search in sources :

Example 1 with HeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.HeatmapHighlighter in project beakerx by twosigma.

the class TableDisplayTest method shouldSendCommMsgWhenAddHeatmapHighlighterForColumnChange.

@Test
public void shouldSendCommMsgWhenAddHeatmapHighlighterForColumnChange() throws Exception {
    // given;
    // when
    TableDisplayCellHighlighter heatmapHighlighter = TableDisplayCellHighlighter.getHeatmapHighlighter(COL_1, TableDisplayCellHighlighter.FULL_ROW);
    tableDisplay.addCellHighlighter(heatmapHighlighter);
    // then
    assertThat(tableDisplay.getCellHighlighters().get(0)).isEqualTo(heatmapHighlighter);
    LinkedHashMap model = getModelUpdate();
    assertThat(model.size()).isEqualTo(1);
    List actual = getValueAsList(model, CELL_HIGHLIGHTERS);
    Map column = (Map) actual.get(0);
    assertThat(column.get(HeatmapHighlighterSerializer.TYPE)).isEqualTo(HeatmapHighlighter.class.getSimpleName());
    assertThat(column.get(HeatmapHighlighterSerializer.STYLE)).isEqualTo(TableDisplayCellHighlighter.FULL_ROW.toString());
}
Also used : TableDisplayCellHighlighter(com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) ThreeColorHeatmapHighlighter(com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 2 with HeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.HeatmapHighlighter in project beakerx by twosigma.

the class HeatmapHighlighterSerializerTest method serializeHeatmapHighlighter_resultJsonHasHeatmapHighlighterType.

@Test
public void serializeHeatmapHighlighter_resultJsonHasHeatmapHighlighterType() throws IOException {
    // given
    HeatmapHighlighter heatmapHighlighter = (HeatmapHighlighter) TableDisplayCellHighlighter.getHeatmapHighlighter("a");
    // when
    JsonNode actualObj = serializeHeatmapHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("type")).isTrue();
    Assertions.assertThat(actualObj.get("type").asText()).isEqualTo("HeatmapHighlighter");
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 3 with HeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.HeatmapHighlighter in project beakerx by twosigma.

the class HeatmapHighlighterSerializerTest method serializeMaxValue_resultJsonHasMaxValue.

@Test
public void serializeMaxValue_resultJsonHasMaxValue() throws IOException {
    // given
    HeatmapHighlighter heatmapHighlighter = (HeatmapHighlighter) TableDisplayCellHighlighter.getHeatmapHighlighter("a", 1, 10);
    // when
    JsonNode actualObj = serializeHeatmapHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("maxVal")).isTrue();
    Assertions.assertThat(actualObj.get("maxVal").asInt()).isEqualTo(10);
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 4 with HeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.HeatmapHighlighter in project beakerx by twosigma.

the class HeatmapHighlighterSerializerTest method serializeMaxColor_resultJsonHasMaxColor.

@Test
public void serializeMaxColor_resultJsonHasMaxColor() throws IOException {
    // given
    HeatmapHighlighter heatmapHighlighter = (HeatmapHighlighter) TableDisplayCellHighlighter.getHeatmapHighlighter("a", 1, 10, Color.BLACK, Color.BLUE);
    // when
    JsonNode actualObj = serializeHeatmapHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("maxColor")).isTrue();
    Assertions.assertThat(actualObj.get("maxColor").get("rgb").asInt()).isEqualTo(Color.BLUE.getRGB());
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Example 5 with HeatmapHighlighter

use of com.twosigma.beakerx.table.highlight.HeatmapHighlighter in project beakerx by twosigma.

the class HeatmapHighlighterSerializerTest method serializeColumnName_resultJsonHasColumnName.

@Test
public void serializeColumnName_resultJsonHasColumnName() throws IOException {
    // given
    HeatmapHighlighter heatmapHighlighter = (HeatmapHighlighter) TableDisplayCellHighlighter.getHeatmapHighlighter("a");
    // when
    JsonNode actualObj = serializeHeatmapHighlighter(heatmapHighlighter);
    // then
    Assertions.assertThat(actualObj.has("colName")).isTrue();
    Assertions.assertThat(actualObj.get("colName").asText()).isEqualTo("a");
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) HeatmapHighlighter(com.twosigma.beakerx.table.highlight.HeatmapHighlighter) Test(org.junit.Test) KernelTest(com.twosigma.beakerx.KernelTest)

Aggregations

KernelTest (com.twosigma.beakerx.KernelTest)8 HeatmapHighlighter (com.twosigma.beakerx.table.highlight.HeatmapHighlighter)8 Test (org.junit.Test)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)7 TableDisplayCellHighlighter (com.twosigma.beakerx.table.highlight.TableDisplayCellHighlighter)1 ThreeColorHeatmapHighlighter (com.twosigma.beakerx.table.highlight.ThreeColorHeatmapHighlighter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1