Example #1
0
  @Test
  public void should_aggregate_on_preparation() throws IOException {

    // given
    final String preparationId =
        createPreparationFromFile("dataset/dataset.csv", "testPreparationContentGet", "text/csv");

    AggregationParameters params =
        getAggregationParameters("aggregation/aggregation_parameters.json");
    params.setDatasetId(null);
    params.setPreparationId(preparationId);
    params.setStepId(null);

    // when
    final String response =
        given()
            .contentType(ContentType.JSON) //
            .body(builder.build().writer().writeValueAsString(params)) //
            .when() //
            .post("/api/aggregate")
            .asString();

    // then
    assertThat(
        response,
        sameJSONAsFile(
            this.getClass().getResourceAsStream("aggregation/aggregation_expected.json")));
  }
Example #2
0
  @Test
  public void should_not_aggregate_because_dataset_and_preparation_id_are_set() throws IOException {

    // given
    AggregationParameters params =
        getAggregationParameters("aggregation/aggregation_parameters.json");
    params.setDatasetId("ds#753874");

    // when
    final Response response =
        given()
            .contentType(ContentType.JSON) //
            .body(builder.build().writer().writeValueAsString(params)) //
            .when() //
            .post("/api/aggregate");

    // then
    assertEquals(400, response.getStatusCode());
  }