Search in sources :

Example 1 with SearchIndexKey

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());
}
Also used : SearchIndexStatusEntity(org.finra.herd.model.jpa.SearchIndexStatusEntity) SearchIndexKey(org.finra.herd.model.api.xml.SearchIndexKey) SearchIndexTypeEntity(org.finra.herd.model.jpa.SearchIndexTypeEntity) SearchIndexCreateRequest(org.finra.herd.model.api.xml.SearchIndexCreateRequest) SearchIndexEntity(org.finra.herd.model.jpa.SearchIndexEntity) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest) Test(org.junit.Test)

Example 2 with SearchIndexKey

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;
}
Also used : SearchIndex(org.finra.herd.model.api.xml.SearchIndex) SearchIndexKey(org.finra.herd.model.api.xml.SearchIndexKey)

Example 3 with SearchIndexKey

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);
}
Also used : SearchIndex(org.finra.herd.model.api.xml.SearchIndex) SearchIndexKey(org.finra.herd.model.api.xml.SearchIndexKey) SearchIndexCreateRequest(org.finra.herd.model.api.xml.SearchIndexCreateRequest) Test(org.junit.Test)

Example 4 with SearchIndexKey

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);
}
Also used : SearchIndexKeys(org.finra.herd.model.api.xml.SearchIndexKeys) SearchIndexKey(org.finra.herd.model.api.xml.SearchIndexKey) Test(org.junit.Test)

Example 5 with SearchIndexKey

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);
}
Also used : SearchIndexKey(org.finra.herd.model.api.xml.SearchIndexKey) SearchIndex(org.finra.herd.model.api.xml.SearchIndex) Test(org.junit.Test)

Aggregations

SearchIndexKey (org.finra.herd.model.api.xml.SearchIndexKey)33 Test (org.junit.Test)28 SearchIndexEntity (org.finra.herd.model.jpa.SearchIndexEntity)11 SearchIndex (org.finra.herd.model.api.xml.SearchIndex)10 SearchIndexTypeEntity (org.finra.herd.model.jpa.SearchIndexTypeEntity)8 ArrayList (java.util.ArrayList)6 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)6 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)5 IndexSearchResult (org.finra.herd.model.api.xml.IndexSearchResult)5 IndexSearchResultKey (org.finra.herd.model.api.xml.IndexSearchResultKey)5 SearchIndexValidationCreateRequest (org.finra.herd.model.api.xml.SearchIndexValidationCreateRequest)5 TagKey (org.finra.herd.model.api.xml.TagKey)5 SearchIndexStatusEntity (org.finra.herd.model.jpa.SearchIndexStatusEntity)5 IndexSearchRequest (org.finra.herd.model.api.xml.IndexSearchRequest)4 IndexSearchResponse (org.finra.herd.model.api.xml.IndexSearchResponse)4 Timestamp (java.sql.Timestamp)3 IndexSearchFilter (org.finra.herd.model.api.xml.IndexSearchFilter)3 IndexSearchKey (org.finra.herd.model.api.xml.IndexSearchKey)3 IndexSearchResultTypeKey (org.finra.herd.model.api.xml.IndexSearchResultTypeKey)3 SearchIndexCreateRequest (org.finra.herd.model.api.xml.SearchIndexCreateRequest)3