Ejemplo n.º 1
0
  @Test
  public void delete_views() throws Exception {
    ViewDoc view1 = new ViewDoc().setUuid("UUID1").setProjects(asList("P1"));
    ViewDoc view2 = new ViewDoc().setUuid("UUID2").setProjects(asList("P2", "P3", "P4"));
    ViewDoc view3 = new ViewDoc().setUuid("UUID3").setProjects(asList("P2", "P3", "P4"));
    esTester.putDocuments(INDEX, TYPE_VIEW, view1);
    esTester.putDocuments(INDEX, TYPE_VIEW, view2);
    esTester.putDocuments(INDEX, TYPE_VIEW, view3);

    index.delete(asList(view1.uuid(), view2.uuid()));

    assertThat(esTester.getDocumentFieldValues(INDEX, TYPE_VIEW, ViewIndexDefinition.FIELD_UUID))
        .containsOnly(view3.uuid());
  }
Ejemplo n.º 2
0
  @Test
  public void delete_views() throws Exception {
    esTester.putDocuments(
        ViewIndexDefinition.INDEX,
        ViewIndexDefinition.TYPE_VIEW,
        this.getClass(),
        "view1.json",
        "view2.json");

    index.delete(
        newArrayList(
            "fed0a543-9d9c-4af5-a4ec-450a8fe78ce7", "8d0bc2a5-bfba-464b-92de-bb170e9d978e"));

    assertThat(esTester.countDocuments(ViewIndexDefinition.INDEX, ViewIndexDefinition.TYPE_VIEW))
        .isEqualTo(0L);
  }