use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class ProfileService method save.
/**
* Save a profile.
*
* @param profile the entity to save
* @return the persisted entity
*/
public Profile save(Profile profile) {
Profile result = profileRepository.save(profile);
profileSearchRepository.save(result);
entitySearchRepository.save(result.getXmentity());
return result;
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class SystemEventMapperUnitTest method testMap.
@Test
public void testMap() {
Profile profile = new Profile();
SystemEventMapper.toProfile(createEvent(), profile);
assertNotNull(profile.getXmentity());
assertEquals(DEFAULT_FIRST_NAME + " " + DEFAULT_LAST_NAME, profile.getXmentity().getName());
assertEquals(Constants.ACCOUNT_TYPE_KEY + "-" + DEFAULT_ID, profile.getXmentity().getKey());
assertEquals(DEFAULT_IMAGE_URL, profile.getXmentity().getAvatarUrl());
assertEquals(EntityState.NEW.name(), profile.getXmentity().getStateKey());
assertEquals(DEFAULT_CREATED_DATE, profile.getXmentity().getStartDate());
assertEquals(DEFAULT_LAST_MODIFIED_DATE, profile.getXmentity().getUpdateDate());
assertEquals(DEFAULT_USER_KEY, profile.getUserKey());
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class SystemEventMapperUnitTest method testMapWithoutDate.
@Test
public void testMapWithoutDate() {
Profile profile = new Profile();
SystemEventMapper.toProfile(createEventWithoutDates(), profile);
assertNotNull(profile.getXmentity());
assertEquals(DEFAULT_FIRST_NAME + " " + DEFAULT_LAST_NAME, profile.getXmentity().getName());
assertEquals(Constants.ACCOUNT_TYPE_KEY + "-" + DEFAULT_ID, profile.getXmentity().getKey());
assertEquals(DEFAULT_IMAGE_URL, profile.getXmentity().getAvatarUrl());
assertEquals(EntityState.NEW.name(), profile.getXmentity().getStateKey());
assertNotNull(profile.getXmentity().getStartDate());
assertNotNull(profile.getXmentity().getUpdateDate());
assertEquals(DEFAULT_USER_KEY, profile.getUserKey());
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class SystemEventMapperUnitTest method testMapProfileAlreadyExists.
@Test
public void testMapProfileAlreadyExists() {
Long id = 1L;
Profile profile = new Profile();
profile.setId(id);
profile.setXmentity(new XmEntity());
profile.getXmentity().setStateKey(EntityState.ACTIVE.name());
profile.getXmentity().setId(id);
SystemEventMapper.toProfile(createEvent(), profile);
assertNotNull(profile.getXmentity());
assertEquals(id, profile.getId());
assertEquals(id, profile.getXmentity().getId());
assertEquals(DEFAULT_FIRST_NAME + " " + DEFAULT_LAST_NAME, profile.getXmentity().getName());
assertEquals(Constants.ACCOUNT_TYPE_KEY + "-" + DEFAULT_ID, profile.getXmentity().getKey());
assertEquals(DEFAULT_IMAGE_URL, profile.getXmentity().getAvatarUrl());
assertEquals(EntityState.ACTIVE.name(), profile.getXmentity().getStateKey());
assertNotNull(profile.getXmentity().getStartDate());
assertNotNull(profile.getXmentity().getUpdateDate());
assertEquals(DEFAULT_USER_KEY, profile.getUserKey());
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class ProfileServiceUnitTest method saveProfile.
@Test
public void saveProfile() {
Profile profile = new Profile();
profile.setId(ID);
XmEntity xmEntity = new XmEntity();
xmEntity.setId(ID);
profile.setXmentity(xmEntity);
when(profileRepository.save(profile)).thenReturn(profile);
when(profileSearchRepository.save(profile)).thenReturn(profile);
when(entitySearchRepository.save(profile.getXmentity())).thenReturn(profile.getXmentity());
service.save(profile);
verify(profileRepository).save(profile);
verify(profileSearchRepository).save(profile);
verify(entitySearchRepository).save(profile.getXmentity());
}
Aggregations