Search in sources :

Example 1 with CheckAccountExternalIdsInput

use of com.google.gerrit.extensions.api.config.ConsistencyCheckInput.CheckAccountExternalIdsInput in project gerrit by GerritCodeReview.

the class ExternalIdIT method checkConsistency.

@Test
public void checkConsistency() throws Exception {
    allowGlobalCapabilities(REGISTERED_USERS, GlobalCapability.ACCESS_DATABASE);
    resetCurrentApiUser();
    insertValidExternalIds();
    ConsistencyCheckInput input = new ConsistencyCheckInput();
    input.checkAccountExternalIds = new CheckAccountExternalIdsInput();
    ConsistencyCheckInfo checkInfo = gApi.config().server().checkConsistency(input);
    assertThat(checkInfo.checkAccountExternalIdsResult.problems).isEmpty();
    Set<ConsistencyProblemInfo> expectedProblems = new HashSet<>();
    expectedProblems.addAll(insertInvalidButParsableExternalIds());
    expectedProblems.addAll(insertNonParsableExternalIds());
    checkInfo = gApi.config().server().checkConsistency(input);
    assertThat(checkInfo.checkAccountExternalIdsResult.problems).hasSize(expectedProblems.size());
    assertThat(checkInfo.checkAccountExternalIdsResult.problems).containsExactlyElementsIn(expectedProblems);
}
Also used : ConsistencyCheckInput(com.google.gerrit.extensions.api.config.ConsistencyCheckInput) ConsistencyCheckInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo) CheckAccountExternalIdsInput(com.google.gerrit.extensions.api.config.ConsistencyCheckInput.CheckAccountExternalIdsInput) ConsistencyProblemInfo(com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo) HashSet(java.util.HashSet) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 ConsistencyCheckInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo)1 ConsistencyProblemInfo (com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo)1 ConsistencyCheckInput (com.google.gerrit.extensions.api.config.ConsistencyCheckInput)1 CheckAccountExternalIdsInput (com.google.gerrit.extensions.api.config.ConsistencyCheckInput.CheckAccountExternalIdsInput)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1