Ejemplo n.º 1
0
  @Test
  public void delete_documents_indexes() throws Exception {
    insertNewProjectInIndexes(1);
    insertNewProjectInIndexes(2);

    newRequest().setParam(PARAM_KEY, "project-key-1").execute();

    String remainingProjectUuid = "project-uuid-2";
    assertThat(
            es.getDocumentFieldValues(
                IssueIndexDefinition.INDEX,
                IssueIndexDefinition.TYPE_ISSUE,
                IssueIndexDefinition.FIELD_ISSUE_PROJECT_UUID))
        .containsOnly(remainingProjectUuid);
    assertThat(
            es.getDocumentFieldValues(
                IssueIndexDefinition.INDEX,
                IssueIndexDefinition.TYPE_AUTHORIZATION,
                IssueIndexDefinition.FIELD_AUTHORIZATION_PROJECT_UUID))
        .containsOnly(remainingProjectUuid);
    assertThat(
            es.getDocumentFieldValues(
                TestIndexDefinition.INDEX,
                TestIndexDefinition.TYPE,
                TestIndexDefinition.FIELD_PROJECT_UUID))
        .containsOnly(remainingProjectUuid);
  }
Ejemplo n.º 2
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());
  }