use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class AttachmentResourceIntTest method createEntity.
/**
* Create an entity for this test.
* <p>
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Attachment createEntity(EntityManager em) {
Attachment attachment = new Attachment().typeKey(DEFAULT_TYPE_KEY).name(DEFAULT_NAME).contentUrl(DEFAULT_CONTENT_URL).description(DEFAULT_DESCRIPTION).startDate(DEFAULT_START_DATE).endDate(DEFAULT_END_DATE).valueContentType(DEFAULT_VALUE_CONTENT_TYPE).valueContentSize(DEFAULT_VALUE_CONTENT_SIZE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
attachment.setXmEntity(xmEntity);
return attachment;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntitySaveIntTest method createEntity.
public static XmEntity createEntity(String typeKey) {
val data = new HashMap<String, Object>();
data.put("runGeneralScript", 0);
data.put("runGeneralScriptDELETE", 0);
data.put("runSaveProceed", 0);
data.put("runSaveRun", 0);
data.put("runDeleteProceed", 0);
data.put("runDeleteRun", 0);
val entity = new XmEntity().key(UUID.randomUUID()).typeKey(typeKey).startDate(Instant.now()).stateKey("STATE1").name("DEFAULT_NAME").description("DEFAULT_DESCRIPTION");
entity.setData(data);
return entity;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntitySaveIntTest method testLep.
@Test
@Transactional
public void testLep() throws Exception {
initLeps();
XmEntity runSaveProceed = createEntity("TEST_SAVE_AND_PROCEED");
XmEntity runSave = createEntity("TEST_SAVE_RUN");
XmEntity runGeneralScript = createEntity("TEST_NOT_RUN_SAVE");
xmEntityServiceImpl.save(runSaveProceed);
xmEntityServiceImpl.save(runSave);
xmEntityServiceImpl.save(runGeneralScript);
assertThat(runSaveProceed.getData().get("runGeneralScript")).isEqualTo(1);
assertThat(runSaveProceed.getData().get("runSaveProceed")).isEqualTo(1);
assertThat(runSaveProceed.getData().get("runSaveRun")).isEqualTo(0);
assertThat(runSave.getData().get("runGeneralScript")).isEqualTo(0);
assertThat(runSave.getData().get("runSaveProceed")).isEqualTo(0);
assertThat(runSave.getData().get("runSaveRun")).isEqualTo(1);
assertThat(runGeneralScript.getData().get("runGeneralScript")).isEqualTo(1);
assertThat(runGeneralScript.getData().get("runSaveProceed")).isEqualTo(0);
assertThat(runGeneralScript.getData().get("runSaveRun")).isEqualTo(0);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class EntityToExcelConverterUnitTest method buildXmEntity.
private XmEntity buildXmEntity() {
XmEntity entity = new XmEntity();
entity.setId(DEFAULT_LONG_VALUE);
return entity.key(DEFAULT_STRING_VALUE).typeKey(DEFAULT_STRING_VALUE).stateKey(DEFAULT_STRING_VALUE).name(DEFAULT_STRING_VALUE).startDate(Instant.now()).updateDate(Instant.now()).endDate(Instant.now()).avatarUrl(DEFAULT_STRING_VALUE).description(DEFAULT_STRING_VALUE).createdBy(DEFAULT_STRING_VALUE).removed(false);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class ProfileServiceUnitTest method getProfileByEntityId.
@Test
public void getProfileByEntityId() {
Profile profile = new Profile();
profile.setId(1L);
profile.setUserKey(USER_KEY);
XmEntity entity = XmEntityResourceIntTest.createEntity(null);
entity.setId(2L);
profile.setXmentity(entity);
when(profileRepository.findOneByXmentityId(entity.getId())).thenReturn(profile);
service.getByXmEntityId(entity.getId());
verify(profileRepository).findOneByXmentityId(entity.getId());
}
Aggregations