Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
fix for #308: Also required adaptations to the assertions in tests as…
Browse files Browse the repository at this point in the history
… fixing this issued caused the new ConversationInterestingTerms (#290) to extract additional keywords (as the conversation do now get indexed during the integration tests)
  • Loading branch information
westei committed Apr 4, 2019
1 parent af4cbd1 commit 02fb779
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -833,20 +833,27 @@ public void testCreateConversationAnalysisRequest() throws Exception{
.andExpect(jsonPath("[1].origin").value("System"))
.andExpect(jsonPath("[1].state").value("Suggested"))
.andExpect(jsonPath("[1].type").value("Keyword"))
.andExpect(jsonPath("[2].value").value("München"))
.andExpect(jsonPath("[2].value").value("München nach Berlin"))
.andExpect(jsonPath("[2].messageIdx").value(0))
.andExpect(jsonPath("[2].start").value(31))
.andExpect(jsonPath("[2].end").value(38))
.andExpect(jsonPath("[2].end").value(50))
.andExpect(jsonPath("[2].origin").value("System"))
.andExpect(jsonPath("[2].state").value("Suggested"))
.andExpect(jsonPath("[2].type").value("Place"))
.andExpect(jsonPath("[3].value").value("Berlin"))
.andExpect(jsonPath("[2].type").value("Keyword"))
.andExpect(jsonPath("[3].value").value("München"))
.andExpect(jsonPath("[3].messageIdx").value(0))
.andExpect(jsonPath("[3].start").value(44))
.andExpect(jsonPath("[3].end").value(50))
.andExpect(jsonPath("[3].start").value(31))
.andExpect(jsonPath("[3].end").value(38))
.andExpect(jsonPath("[3].origin").value("System"))
.andExpect(jsonPath("[3].state").value("Suggested"))
.andExpect(jsonPath("[3].type").value("Place"));
.andExpect(jsonPath("[3].type").value("Place"))
.andExpect(jsonPath("[4].value").value("Berlin"))
.andExpect(jsonPath("[4].messageIdx").value(0))
.andExpect(jsonPath("[4].start").value(44))
.andExpect(jsonPath("[4].end").value(50))
.andExpect(jsonPath("[4].origin").value("System"))
.andExpect(jsonPath("[4].state").value("Suggested"))
.andExpect(jsonPath("[4].type").value("Place"));

//Assert that an analysis is stored
Assert.assertEquals(1, analysisRepository.count());
Expand Down Expand Up @@ -1151,8 +1158,8 @@ public void testMessageCrudOperations() throws Exception {
//Assert that tokens are NOT NULL but empty
Assert.assertNotNull(analysis.getTokens());
Assert.assertTrue(analysis.getTokens().size() > 0);
//Assert that Bern is extracted 2 times
Assert.assertEquals(2, analysis.getTokens().stream().filter(t -> Objects.equals("Bern", t.getValue())).count());
//Assert that Bern is extracted 2x2 times (2 mentions, each time as Location and Keyword)
Assert.assertEquals(4, analysis.getTokens().stream().filter(t -> Objects.equals("Bern", t.getValue())).count());
//Templates need also t0 be NOT NULL and NOT empty!
Assert.assertNotNull(analysis.getTemplates());
Assert.assertTrue(analysis.getTemplates().size() > 0);
Expand Down Expand Up @@ -1193,8 +1200,8 @@ public void testMessageCrudOperations() throws Exception {
//Assert that tokens are NOT NULL but empty
Assert.assertNotNull(analysis.getTokens());
Assert.assertTrue(analysis.getTokens().size() > 0);
//Assert that Bern is extracted only once as the 2nd message was deleted
Assert.assertEquals(1, analysis.getTokens().stream().filter(t -> Objects.equals("Bern", t.getValue())).count());
//Assert that Bern is extracted only once as the 2nd message was deleted (2 results -> keyword and entity)
Assert.assertEquals(2, analysis.getTokens().stream().filter(t -> Objects.equals("Bern", t.getValue())).count());
//Templates need also t0 be NOT NULL and NOT empty!
Assert.assertNotNull(analysis.getTemplates());
Assert.assertTrue(analysis.getTemplates().size() > 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ public void testEventPropagation() throws Exception {

conversationService.update(client, conversation);
Thread.sleep(2 * conversationIndexer.indexConfig.getCommitWithin());

assertThat(countDocs(), Matchers.equalTo(docCount));
//NOTE: uncompleted conversations are now indexed
assertThat(countDocs(), Matchers.greaterThan(docCount));
docCount = countDocs();

conversation.getMeta().setStatus(ConversationMeta.Status.Complete);
conversationService.update(client, conversation);
Thread.sleep(2 * conversationIndexer.indexConfig.getCommitWithin());
assertThat(countDocs(), Matchers.greaterThan(docCount));
assertThat(countDocs(), Matchers.equalTo(docCount));
}

@Test
Expand Down Expand Up @@ -197,7 +198,7 @@ public void testSearch() throws InterruptedException, IOException, SolrServerExc

SearchResult<ConversationSearchService.ConversationResult> result = searchService.search(client,query);

assertEquals(2, result.getNumFound());
assertEquals(3, result.getNumFound()); //now includes conversation5 as !complete conversations are now also indexed!
assertEquals(1, result.getDocs().get(0).getResults().size()); //one result
assertEquals(2, result.getDocs().get(0).getResults().get(0).getMessages().size()); //but with matches in 2 messages
assertEquals(1, result.getDocs().get(1).getResults().size());
Expand Down

0 comments on commit 02fb779

Please sign in to comment.