SearchIndexServiceImpl implements SearchIndexService { 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()); if (searchIndexEntity.getActive() != null) { searchIndex.setActive(searchIndexEntity.getActive()); } else { searchIndex.setActive(Boolean.FALSE); } searchIndex.setCreatedByUserId(searchIndexEntity.getCreatedBy()); searchIndex.setCreatedOn(HerdDateUtils.getXMLGregorianCalendarValue(searchIndexEntity.getCreatedOn())); searchIndex.setLastUpdatedOn(HerdDateUtils.getXMLGregorianCalendarValue(searchIndexEntity.getUpdatedOn())); return searchIndex; }  @Override SearchIndex createSearchIndex(SearchIndexCreateRequest request); @Override SearchIndex deleteSearchIndex(SearchIndexKey searchIndexKey); @Override SearchIndex getSearchIndex(SearchIndexKey searchIndexKey); @Override SearchIndexKeys getSearchIndexes();  }
@Test public void testCreateSearchIndexFromEntity() { SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME); SearchIndexTypeEntity searchIndexTypeEntity = new SearchIndexTypeEntity(); searchIndexTypeEntity.setCode(SEARCH_INDEX_TYPE); SearchIndexStatusEntity searchIndexStatusEntity = new SearchIndexStatusEntity(); searchIndexStatusEntity.setCode(SEARCH_INDEX_STATUS); 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); SearchIndex searchIndex = searchIndexServiceImpl.createSearchIndexFromEntity(searchIndexEntity); verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper); 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); }