Skip to content

Commit

Permalink
KYLO-1323 Updated Elasticsearch integration tests (disabled for now f…
Browse files Browse the repository at this point in the history
…or CI)
  • Loading branch information
jagrutsharma committed Nov 29, 2018
1 parent 9a5e6b9 commit eaa0492
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,6 @@ private void verifySearchResultOnDescription4(String term) {
Assert.assertEquals("0", searchResult.getTotalHits().toString());
}

private void deleteKyloCategory(String categoryId) {
deleteCategory(categoryId);
}

public List<String> getIndexedFieldsWithJsonPathForEntity() {
List<String> indexedFields = new ArrayList<>();
indexedFields.add("_source.'jcr:created'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class SearchEsIntegrationTestBase extends IntegrationTestBase {
protected static final long FOUR_SECONDS_IN_MILLIS = 4000;
protected static final long FIVE_SECONDS_IN_MILLIS = 5000;
protected static final long TEN_SECONDS_IN_MILLIS = 10000;
protected static final long TWENTY_SECONDS_IN_MILLIS = 20000;


protected static int stepNumber;
Expand Down Expand Up @@ -208,4 +209,12 @@ protected String getStepNumber() {
protected static void resetStepNumbers() {
stepNumber = 0;
}

protected void deleteKyloCategory(String categoryId) {
deleteCategory(categoryId);
}

protected void deleteKyloFeed(String feedId) {
deleteFeed(feedId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public void testSearchingFeedPropertiesEs() {
LOG.info(getStepNumber() + "Importing a sample feed...");
ImportFeed importedFeed = importSampleFeed();
String importedFeedId = importedFeed.getNifiFeed().getFeedMetadata().getFeedId();
String categoryIdForImportedFeed = importedFeed.getNifiFeed().getFeedMetadata().getCategoryId();
LOG.info("Category ID for Imported Feed: " + categoryIdForImportedFeed);

waitForSomeTime(FIVE_SECONDS_IN_MILLIS);

Expand Down Expand Up @@ -208,6 +210,19 @@ public void testSearchingFeedPropertiesEs() {
LOG.info(getStepNumber() + "Executing search 4 (description) and verifying results with term: " + searchTerm + " ...");
verifySearchResultOnDescription4(searchTerm);

waitForSomeTime(FOUR_SECONDS_IN_MILLIS);
LOG.info(getStepNumber() + "Deleting feed with id: " + importedFeedId + " ...");
deleteKyloFeed(importedFeedId);

waitForSomeTime(TWENTY_SECONDS_IN_MILLIS);

LOG.info(getStepNumber() + "Deleting the category for the deleted feed (category has id: " + categoryIdForImportedFeed + ") ...");
deleteKyloCategory(categoryIdForImportedFeed);

waitForSomeTime(TEN_SECONDS_IN_MILLIS);

verifySearchResultAfterDeletion(searchTerm);

LOG.info("=== Finished Integration Test: " + this.getClass().getName());
}

Expand Down Expand Up @@ -575,6 +590,15 @@ private void verifySearchResultOnDescription3(String term) {
searchResult.getSearchResults().get(0).getHighlights().get(0).getValue());
}

private void verifySearchResultAfterDeletion(String term) {
Response searchResponse = given(SearchRestController.BASE)
.when()
.get("/?q=" + term);
searchResponse.then().statusCode(HTTP_OK);
SearchResult searchResult = searchResponse.as(SearchResult.class);
Assert.assertEquals("0", searchResult.getTotalHits().toString());
}

public List<String> getIndexedFieldsWithJsonPathForEntity() {
List<String> indexedFields = new ArrayList<>();
indexedFields.add("_source.'jcr:description'");
Expand Down

0 comments on commit eaa0492

Please sign in to comment.