use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class EntityServiceImplIntTest method testGetLinkTargetsSelfKey.
@Test
@Transactional
public void testGetLinkTargetsSelfKey() throws Exception {
XmEntity targetEntity = xmEntityRepository.save(createEntity(2l, TARGET_TYPE_KEY));
Link link = createSelfLink(targetEntity);
linkRepository.save(link);
List<Link> result = xmEntityService.getLinkTargets(IdOrKey.SELF, TARGET_TYPE_KEY);
assertThat(result).isNotNull();
assertThat(result.size()).isEqualTo(BigInteger.ONE.intValue());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class EntityServiceImplIntTest method deleteForeignLinkTarget.
@Test(expected = BusinessException.class)
@Transactional
@WithMockUser(authorities = "SUPER-ADMIN")
public void deleteForeignLinkTarget() {
XmEntity sourceEntity = xmEntityRepository.save(createEntity(25l, "ACCOUNT.USER"));
XmEntity targetEntity = xmEntityRepository.save(createEntity(2l, TARGET_TYPE_KEY));
Link link = createLink(sourceEntity, targetEntity);
linkRepository.save(link);
xmEntityService.deleteLinkTarget(IdOrKey.SELF, link.getId().toString());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class EntityServiceImplIntTest method testGetLinkTargetsByEntityId.
@Test
@Transactional
public void testGetLinkTargetsByEntityId() throws Exception {
XmEntity sourceEntity = xmEntityRepository.save(createEntity(null, "ACCOUNT"));
XmEntity targetEntity = xmEntityRepository.save(createEntity(2l, TARGET_TYPE_KEY));
Link link = createLink(sourceEntity, targetEntity);
linkRepository.save(link);
List<Link> targetsLinks = xmEntityService.getLinkTargets(IdOrKey.of(sourceEntity.getId()), TARGET_TYPE_KEY);
assertThat(targetsLinks).isNotEmpty();
assertThat(targetsLinks.size()).isEqualTo(BigInteger.ONE.intValue());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class AvatarUrlListenerUnitTest method testPostLoadSuccess.
@Ignore
@Test
public void testPostLoadSuccess() {
XmEntity entity = new XmEntity().avatarUrl("hello.jpg");
target.postLoad(entity);
assertEquals("http://hello.rgw.icthh.test/hello.jpg", entity.getAvatarUrl());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class AvatarUrlListenerUnitTest method testPrePersistEmpty.
@Test
public void testPrePersistEmpty() {
XmEntity entity = new XmEntity().avatarUrl(null);
target.prePersist(entity);
assertEquals(null, entity.getAvatarUrl());
}
Aggregations