use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexServiceImplTest method testCreateSearchIndexFromEntity.
@Test
public void testCreateSearchIndexFromEntity() {
// Create a search index key.
SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME);
// Creates a test search index type entity.
SearchIndexTypeEntity searchIndexTypeEntity = new SearchIndexTypeEntity();
searchIndexTypeEntity.setCode(SEARCH_INDEX_TYPE);
// Creates a test search index status entity.
SearchIndexStatusEntity searchIndexStatusEntity = new SearchIndexStatusEntity();
searchIndexStatusEntity.setCode(SEARCH_INDEX_STATUS);
// Create a test search index entity.
SearchIndexEntity searchIndexEntity = new SearchIndexEntity();
searchIndexEntity.setName(SEARCH_INDEX_NAME);
searchIndexEntity.setType(searchIndexTypeEntity);
searchIndexEntity.setStatus(searchIndexStatusEntity);
searchIndexEntity.setCreatedBy(USER_ID);
searchIndexEntity.setCreatedOn(new Timestamp(CREATED_ON.toGregorianCalendar().getTimeInMillis()));
searchIndexEntity.setUpdatedOn(new Timestamp(UPDATED_ON.toGregorianCalendar().getTimeInMillis()));
searchIndexEntity.setActive(Boolean.FALSE);
// Create a search index object from the search index entity.
SearchIndex searchIndex = searchIndexServiceImpl.createSearchIndexFromEntity(searchIndexEntity);
// Verify the external calls.
verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper);
// Validate the returned object.
assertEquals(new SearchIndex(searchIndexKey, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS, SEARCH_INDEX_DEFAULT_ACTIVE_FLAG, NO_SEARCH_INDEX_STATISTICS, USER_ID, CREATED_ON, UPDATED_ON), searchIndex);
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexServiceImplTest method testCreateSearchIndexHelperInvalidSearchIndexType.
@Test
public void testCreateSearchIndexHelperInvalidSearchIndexType() {
// Try to create a search index using an invalid search index type.
try {
searchIndexServiceImpl.createSearchIndexHelper(new SearchIndexKey(SEARCH_INDEX_NAME), SEARCH_INDEX_TYPE);
fail();
} catch (IllegalArgumentException e) {
assertEquals(String.format("Search index type with code \"%s\" is not supported.", SEARCH_INDEX_TYPE), e.getMessage());
}
// Verify the external calls.
verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper);
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexDaoHelperTest method testUpdateSearchIndexStatus.
@Test
public void testUpdateSearchIndexStatus() {
// Create and persist a search index entity.
SearchIndexEntity searchIndexEntity = searchIndexDaoTestHelper.createSearchIndexEntity(SEARCH_INDEX_NAME, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS);
// Create and persist a search index status entity.
searchIndexStatusDaoTestHelper.createSearchIndexStatusEntity(SEARCH_INDEX_STATUS_2);
// Update the status of the search index entity.
searchIndexDaoHelper.updateSearchIndexStatus(new SearchIndexKey(SEARCH_INDEX_NAME), SEARCH_INDEX_STATUS_2);
// Validate the results.
assertEquals(SEARCH_INDEX_STATUS_2, searchIndexEntity.getStatus().getCode());
}
Aggregations