Пример #1
0
 /** @return the expected value */
 private String setMetadataValueQuery(final String givenQuery) {
   when(dsf.getMetadataValueQuery()).thenReturn(givenQuery);
   DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
   return "{\"nested\":{\"query\":"
       + uut.getSimpleQuery(DataSearchQueryBuilder.METADATA_VALUE, givenQuery).getPayload()
       + ",\"path\":\"metadata\"}}";
 }
Пример #2
0
 @Test
 public void testApplyOROperator_case2() {
   DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
   String searchText = "one ";
   final String applyOROperator = uut.applyOROperator(searchText);
   final String expected = "one";
   assertEquals("Verify OR operator applied", expected, applyOROperator);
 }
Пример #3
0
 /** when string contains '*' */
 @Test
 public void testApplyImplicitAsteriskSearchText_Case2() {
   DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
   String searchText =
       "one*"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "two"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "three";
   final String applyImplicitAsteriskSearchText = uut.applyImplicitAsteriskSearchText(searchText);
   assertEquals(
       "Verify that implicit asterisk NOT applied", searchText, applyImplicitAsteriskSearchText);
 }
Пример #4
0
 /** when asterisks needed */
 @Test
 public void testApplyImplicitAsteriskSearchText_Case1() {
   DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
   String searchText =
       "one"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "two"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "three";
   final String applyImplicitAsteriskSearchText = uut.applyImplicitAsteriskSearchText(searchText);
   final String expected =
       "*one*"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "*two*"
           + DataSearchQueryBuilder.OR_OPERATOR
           + "*three*";
   assertEquals(
       "Verify application of implicit asterisk(*)", expected, applyImplicitAsteriskSearchText);
 }
Пример #5
0
 private String setTaggedWithQuery(final Set<Tag> tags, final DiskResourceQueryTemplate drqt) {
   when(dsf.getTagQuery()).thenReturn(tags);
   DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
   return uut.taggedWith();
 }
Пример #6
0
  /** @return the expected value */
  private String setNegatedFileQuery(final String givenSearchTerms) {
    when(dsf.getNegatedFileQuery()).thenReturn(givenSearchTerms);

    DataSearchQueryBuilder uut = new DataSearchQueryBuilder(dsf, userInfoMock);
    return uut.getSimpleQuery(DataSearchQueryBuilder.LABEL, givenSearchTerms).getPayload();
  }