/** * Creates and persists a new search index type entity. * * @param typeCode the code of the search index type * * @return the newly created search index type entity */ public SearchIndexTypeEntity createSearchIndexTypeEntity(String typeCode) { SearchIndexTypeEntity searchIndexTypeEntity; searchIndexTypeEntity = searchIndexTypeDao.getSearchIndexTypeByCode(typeCode); if (searchIndexTypeEntity == null) { searchIndexTypeEntity = new SearchIndexTypeEntity(); searchIndexTypeEntity.setCode(typeCode); searchIndexTypeEntity = searchIndexTypeDao.saveAndRefresh(searchIndexTypeEntity); } return searchIndexTypeEntity; } }
/** * Creates a test search index entity along with the relative database entities. * * @return the search index entity */ private SearchIndexEntity createTestSearchIndexEntity() { // Creates a test search index type entity. SearchIndexTypeEntity searchIndexTypeEntity = new SearchIndexTypeEntity(); searchIndexTypeEntity.setCode(SEARCH_INDEX_TYPE_BDEF); // 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); return searchIndexEntity; } }
searchIndexTypeEntity.setCode(searchIndexType);
searchIndexTypeEntity.setCode(searchIndexType);
searchIndexTypeEntity.setCode(searchIndexType);
searchIndexTypeEntity.setCode(SEARCH_INDEX_TYPE);
searchIndexTypeEntity.setCode(SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name());
searchIndexTypeEntity.setCode(SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name());
searchIndexTypeEntity.setCode(SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name());
@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()); }