Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-85176

DocumentTest: convert integration test to unit tests

Details

    Description

      • Base classes in portal-search-test-util
      • Unit tests in portal-search-elasticsearch6 and portal-search-solr7
      • Unit tests use no Indexer, no IndexerPostProcessor. Just index documents directly and search.
      • Only one integration test will be left using Indexer and IndexerPostProcessor.
      • After all methods are converted, DocumentTest can be deleted.

       

      Sort tests

      New base class in com.liferay.portal.search.test.util.sort

      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchSortedBySingleDouble()
      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchSortedBySingleFloat()
      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchSortedBySingleInteger()
      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchSortedBySingleLong()
      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchSortedBySingleDouble()
      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchSortedBySingleFloat()
      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchSortedBySingleInteger()
      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchSortedBySingleLong()

       

      Count tests

      New base class in com.liferay.portal.search.test.util.count

      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchResultsCount1()
      com.liferay.portal.search.document.test.DocumentTest.testFirstNameSearchResultsCount2()
      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchResultsCount()

       

      Relevance tests: First Name field

      New base class in com.liferay.portal.search.test.util.mappings (NOT a copy of "*FieldQueryBuilderTestCase")

      com.liferay.portal.search.document.test.DocumentTest.testFirstNamesSearchResults()

      Must use the Liferay Type Mappings and the same field name as the original User indexer.

       

      Relevance tests: Last Name field

      New base class in com.liferay.portal.search.test.util.mappings (NOT a copy of "*FieldQueryBuilderTestCase")

      com.liferay.portal.search.document.test.DocumentTest.testLastNameSearchResults()

      Must use the Liferay Type Mappings and the same field name as the original User indexer.

       

      IndexerPostProcessor test

      This is the only integration test. (Everything above are unit tests)

      Create a new integration test in portal-search-test / com.liferay.portal.search.indexer.test

      In the test case, do it like this:

      com.liferay.portal.search.document.test.DocumentTest.setUp()

      To register a BaseIndexerPostProcessor into the User indexer.

      No need to index all the same fields. It's enough to index just one additional field.

      Test should search on the additional field like this:

      com.liferay.portal.search.document.test.DocumentTest.checkSearchContext(SearchContext)

      And assert the additional field is present.

      Test case should: assert no match; register processor; assert match; unregister processor; assert no match again.

      Use UserSearchFixture to create any Groups or Users.

       

      Attachments

        Issue Links

          Activity

            People

              brian.chan Brian Chan
              andre.oliveira André Ricardo Barreto de Oliveira
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Packages

                  Version Package
                  7.1.X
                  Master