use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexServiceImplTest method testCreateSearchIndexEntity.
@Test
public void testCreateSearchIndexEntity() {
// Create a search index key.
SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME);
// Create a search index create request.
SearchIndexCreateRequest searchIndexCreateRequest = new SearchIndexCreateRequest(SEARCH_INDEX_TYPE);
// 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 search index entity from the search index create request.
SearchIndexEntity searchIndexEntity = searchIndexServiceImpl.createSearchIndexEntity(searchIndexCreateRequest, searchIndexTypeEntity, searchIndexStatusEntity);
// Verify the external calls.
verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper);
// Validate the returned object.
assertNotNull(searchIndexEntity);
assertNotNull(searchIndexEntity.getType());
assertEquals(SEARCH_INDEX_TYPE, searchIndexEntity.getType().getCode());
assertNotNull(searchIndexEntity.getStatus());
assertEquals(SEARCH_INDEX_STATUS, searchIndexEntity.getStatus().getCode());
assertNull(searchIndexEntity.getCreatedBy());
assertNull(searchIndexEntity.getCreatedOn());
assertNull(searchIndexEntity.getUpdatedBy());
assertNull(searchIndexEntity.getUpdatedOn());
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexActivationServiceImpl method createSearchIndexFromEntity.
/**
* Creates a search index object from the persisted entity.
*
* @param searchIndexEntity the search index entity
*
* @return the search index
*/
protected SearchIndex createSearchIndexFromEntity(SearchIndexEntity searchIndexEntity) {
SearchIndex searchIndex = new SearchIndex();
searchIndex.setSearchIndexKey(new SearchIndexKey(searchIndexEntity.getName()));
searchIndex.setSearchIndexType(searchIndexEntity.getType().getCode());
searchIndex.setSearchIndexStatus(searchIndexEntity.getStatus().getCode());
searchIndex.setActive(searchIndexEntity.getActive());
searchIndex.setCreatedByUserId(searchIndexEntity.getCreatedBy());
searchIndex.setCreatedOn(HerdDateUtils.getXMLGregorianCalendarValue(searchIndexEntity.getCreatedOn()));
searchIndex.setLastUpdatedOn(HerdDateUtils.getXMLGregorianCalendarValue(searchIndexEntity.getUpdatedOn()));
return searchIndex;
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexRestControllerTest method testCreateSearchIndex.
@Test
public void testCreateSearchIndex() {
// Create a search index create request.
SearchIndexCreateRequest searchIndexCreateRequest = new SearchIndexCreateRequest(SEARCH_INDEX_TYPE);
// Create a search index create response.
SearchIndex searchIndex = new SearchIndex(new SearchIndexKey(SEARCH_INDEX_NAME), SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS, SEARCH_INDEX_DEFAULT_ACTIVE_FLAG, NO_SEARCH_INDEX_STATISTICS, USER_ID, CREATED_ON, UPDATED_ON);
// Mock the call to the search index service.
when(searchIndexService.createSearchIndex(searchIndexCreateRequest)).thenReturn(searchIndex);
// Create a search index.
SearchIndex response = searchIndexRestController.createSearchIndex(searchIndexCreateRequest);
// Verify the calls.
verify(searchIndexService, times(1)).createSearchIndex(searchIndexCreateRequest);
// Validate the returned object.
assertEquals(searchIndex, response);
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexRestControllerTest method testGetSearchIndexes.
@Test
public void testGetSearchIndexes() {
// Create a get search indexes response.
SearchIndexKeys searchIndexKeys = new SearchIndexKeys(Arrays.asList(new SearchIndexKey(SEARCH_INDEX_NAME), new SearchIndexKey(SEARCH_INDEX_NAME_2)));
// Mock the call to the search index service.
when(searchIndexService.getSearchIndexes()).thenReturn(searchIndexKeys);
// Get search indexes.
SearchIndexKeys response = searchIndexRestController.getSearchIndexes();
// Verify the calls.
verify(searchIndexService, times(1)).getSearchIndexes();
// Validate the returned object.
assertEquals(searchIndexKeys, response);
}
use of org.finra.herd.model.api.xml.SearchIndexKey in project herd by FINRAOS.
the class SearchIndexRestControllerTest method testDeleteSearchIndex.
@Test
public void testDeleteSearchIndex() {
// Create a search index key.
SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME);
// Create a search index delete response.
SearchIndex searchIndex = new SearchIndex(searchIndexKey, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS, SEARCH_INDEX_DEFAULT_ACTIVE_FLAG, NO_SEARCH_INDEX_STATISTICS, USER_ID, CREATED_ON, UPDATED_ON);
// Mock the call to the search index service.
when(searchIndexService.deleteSearchIndex(searchIndexKey)).thenReturn(searchIndex);
// Delete a search index.
SearchIndex response = searchIndexRestController.deleteSearchIndex(SEARCH_INDEX_NAME);
// Verify the calls.
verify(searchIndexService, times(1)).deleteSearchIndex(new SearchIndexKey(SEARCH_INDEX_NAME));
// Validate the returned object.
assertEquals(searchIndex, response);
}
Aggregations