use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class ProfileServiceUnitTest method getProfile.
@Test
public void getProfile() {
Profile profile = new Profile();
profile.setId(1L);
profile.setUserKey(USER_KEY);
when(profileRepository.findOneByUserKey(USER_KEY)).thenReturn(profile);
service.getProfile(USER_KEY);
verify(profileRepository).findOneByUserKey(USER_KEY);
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class SystemQueueConsumerUnitTest method updateNotExistsProfile.
@Test
public void updateNotExistsProfile() {
when(profileService.getProfile(USER_KEY)).thenReturn(null);
when(profileService.save(anyObject())).thenReturn(new Profile());
consumer.consumeEvent(new ConsumerRecord<>("test", 0, 0, "", UPDATE_PROFILE_EVENT));
verify(profileService).getProfile(USER_KEY);
verify(profileService, times(0)).save(anyObject());
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class SystemQueueConsumerUnitTest method updateProfile.
@Test
public void updateProfile() {
when(profileService.getProfile(USER_KEY)).thenReturn(new Profile());
when(profileService.save(anyObject())).thenReturn(new Profile());
consumer.consumeEvent(new ConsumerRecord<>("test", 0, 0, "", UPDATE_PROFILE_EVENT));
verify(profileService).getProfile(USER_KEY);
verify(profileService).save(anyObject());
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class TenantDatabaseService method buildProfileForDefaultUser.
private Profile buildProfileForDefaultUser(String tenantKey) {
XmEntity entity = new XmEntity();
entity.setTypeKey("ACCOUNT.USER");
entity.setKey("ACCOUNT.USER-1");
entity.setName("Administrator");
entity.setStateKey(EntityState.NEW.name());
entity.setStartDate(Instant.now());
entity.setUpdateDate(Instant.now());
entity.setCreatedBy(Constants.SYSTEM_ACCOUNT);
Profile profile = new Profile();
profile.setXmentity(entity);
profile.setUserKey(tenantKey.toLowerCase());
return profile;
}
use of com.icthh.xm.ms.entity.domain.Profile in project xm-ms-entity by xm-online.
the class ProfileResourceIntTest method getProfileByXmEntityId.
@Test
@Transactional
public void getProfileByXmEntityId() throws Exception {
profileService.save(profile);
Profile profileByEntityId = profileService.getByXmEntityId(profile.getXmentity().getId());
Assert.assertNotNull(profileByEntityId);
Assert.assertEquals(profile.getId(), profileByEntityId.getId());
Assert.assertEquals(profile.getXmentity().getId(), profileByEntityId.getXmentity().getId());
}
Aggregations