@Test public void should_retrieve_indexation_result_with_tenant() throws Exception { final FileInputStream fileInputStream = new FileInputStream(PropertiesUtils.getResourceFile(INDEXATION_RESULT_WITH_TENANT_JSON)); final JsonNode indexationResultNode = JsonHandler.getFromInputStream(fileInputStream); final String indexationResultTest = indexationResultNode.toString(); IndexParameters indexParameters = new IndexParameters(); indexParameters.setCollectionName("collection_name"); indexParameters.setTenants(Arrays.asList(1, 2)); IndexationResult koResult = indexationHelper.getFullKOResult(indexParameters, messageCause); final String koResultToAssert = JsonHandler.unprettyPrint(koResult); assertThat(koResultToAssert).isEqualTo(indexationResultTest); }
public IndexationResult getFullKOResult(IndexParameters indexParameters, String message) { IndexationResult result = new IndexationResult(); List<IndexKO> koList = new ArrayList<>(); if (indexParameters.getTenants() != null) { koList = new ArrayList<>(indexParameters.getTenants().size()); for (Integer tenant : indexParameters.getTenants()) { koList.add(new IndexKO(indexParameters.getCollectionName() + "_" + tenant + "_*", tenant, message)); } } else { koList.add(new IndexKO(indexParameters.getCollectionName() + "_*", message)); } result.setIndexKO(koList); result.setCollectionName(indexParameters.getCollectionName()); return result; }
IndexationHelper { public IndexationResult getFullKOResult(IndexParameters indexParameters, String message) { IndexationResult result = new IndexationResult(); List<IndexKO> koList = new ArrayList<>(); if (indexParameters.getTenants() != null) { koList = new ArrayList<>(indexParameters.getTenants().size()); for (Integer tenant : indexParameters.getTenants()) { koList.add(new IndexKO(indexParameters.getCollectionName() + "_" + tenant + "_*", tenant, message)); } } else { koList.add(new IndexKO(indexParameters.getCollectionName() + "_*", message)); } result.setIndexKO(koList); result.setCollectionName(indexParameters.getCollectionName()); return result; } }
IndexationHelper { public IndexationResult getFullKOResult(IndexParameters indexParameters, String message) { IndexationResult result = new IndexationResult(); List<IndexKO> koList = new ArrayList<>(); if (indexParameters.getTenants() != null) { koList = new ArrayList<>(indexParameters.getTenants().size()); for (Integer tenant : indexParameters.getTenants()) { koList.add(new IndexKO(indexParameters.getCollectionName() + "_" + tenant + "_*", tenant, message)); } } else { koList.add(new IndexKO(indexParameters.getCollectionName() + "_*", message)); } result.setIndexKO(koList); result.setCollectionName(indexParameters.getCollectionName()); return result; }  }
IndexationHelper { public IndexationResult getFullKOResult(IndexParameters indexParameters, String message) { IndexationResult result = new IndexationResult(); List<IndexKO> koList = new ArrayList<>(); if (indexParameters.getTenants() != null) { koList = new ArrayList<>(indexParameters.getTenants().size()); for (Integer tenant : indexParameters.getTenants()) { koList.add(new IndexKO(indexParameters.getCollectionName() + "_" + tenant + "_*", tenant, message)); } } else { koList.add(new IndexKO(indexParameters.getCollectionName() + "_*", message)); } result.setIndexKO(koList); result.setCollectionName(indexParameters.getCollectionName()); return result; }  static IndexationHelper getInstance(); IndexationResult reindex(MongoCollection<Document> collection, String collectionName,
        ElasticsearchAccess esClient,
        List<Integer> tenants, InputStream mapping); void switchIndex(String aliasName, String newIndex, ElasticsearchAccess esClient); IndexationResult getFullKOResult(IndexParameters indexParameters, String message); IndexationResult getKOResult(SwitchIndexParameters switchIndexParameters, String message); }
IndexationHelper { public IndexationResult getFullKOResult(IndexParameters indexParameters, String message) { IndexationResult result = new IndexationResult(); List<IndexKO> koList = new ArrayList<>(); if (indexParameters.getTenants() != null) { koList = new ArrayList<>(indexParameters.getTenants().size()); for (Integer tenant : indexParameters.getTenants()) { koList.add(new IndexKO(indexParameters.getCollectionName() + "_" + tenant + "_*", tenant, message)); } } else { koList.add(new IndexKO(indexParameters.getCollectionName() + "_*", message)); } result.setIndexKO(koList); result.setCollectionName(indexParameters.getCollectionName()); return result; }  static IndexationHelper getInstance(); IndexationResult reindex(MongoCollection<Document> collection, String collectionName,
        ElasticsearchAccess esClient,
        List<Integer> tenants, InputStream mapping); void switchIndex(String aliasName, String newIndex, ElasticsearchAccess esClient); IndexationResult getFullKOResult(IndexParameters indexParameters, String message); IndexationResult getKOResult(SwitchIndexParameters switchIndexParameters, String message);  }