Simplify IndexData builder

This is a small refactor in the large game of refactoring
DatabeseIndexingManager, and the general indexing pipeline
for Settings search.

This change is centered around hiding the normalization of
data (title, summary, keywords) from the data collector,
and putting that responsibility into the IndexData object.

In a future CL, we may move this again to the controller
that actually indexes the data.

Note, the conversion from PreIndexData to IndexData is
still messy, but until I can write a CL that just
rearranges the code, we must stay patient and vigilant.

Bug: 33577327
Test: make RunSettingsRoboTests
Change-Id: I53543d3d9c74a61380601297c55b6e4fea13031a
This commit is contained in:
Matthew Fritze
2017-08-22 15:51:50 -07:00
parent e4cab00ffa
commit 6bbc459f24
8 changed files with 106 additions and 210 deletions

View File

@@ -27,7 +27,6 @@ import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import android.content.ContentValues;
@@ -287,6 +286,7 @@ public class DatabaseIndexingManagerTest {
@Test
public void testLocaleUpdated_afterFullIndexing_localeAdded() {
mManager.performIndexing();
assertThat(IndexDatabaseHelper.isLocaleAlreadyIndexed(mContext, localeStr)).isTrue();
}
@@ -302,8 +302,6 @@ public class DatabaseIndexingManagerTest {
// Locale
assertThat(cursor.getString(0)).isEqualTo(localeStr);
// Data Rank
assertThat(cursor.getInt(1)).isEqualTo(rank);
// Data Title
assertThat(cursor.getString(2)).isEqualTo(updatedTitle);
// Normalized Title
@@ -312,10 +310,6 @@ public class DatabaseIndexingManagerTest {
assertThat(cursor.getString(4)).isEqualTo(updatedSummaryOn);
// Summary On Normalized
assertThat(cursor.getString(5)).isEqualTo(normalizedSummaryOn);
// Summary Off
assertThat(cursor.getString(6)).isEqualTo(updatedSummaryOff);
// Summary off normalized
assertThat(cursor.getString(7)).isEqualTo(normalizedSummaryOff);
// Entries
assertThat(cursor.getString(8)).isEqualTo(entries);
// Keywords