use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntityResourceIntTest method createXmEntity.
@Test
@Transactional
public void createXmEntity() throws Exception {
int databaseSizeBeforeCreate = xmEntityRepository.findAll().size();
// Create the XmEntity
restXmEntityMockMvc.perform(post("/api/xm-entities").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(xmEntity))).andExpect(status().isCreated());
// Validate the XmEntity in the database
List<XmEntity> xmEntityList = xmEntityRepository.findAll();
assertThat(xmEntityList).hasSize(databaseSizeBeforeCreate + 1);
XmEntity testXmEntity = xmEntityList.get(xmEntityList.size() - 1);
assertThat(testXmEntity.getKey()).isEqualTo(DEFAULT_KEY);
assertThat(testXmEntity.getTypeKey()).isEqualTo(DEFAULT_TYPE_KEY);
assertThat(testXmEntity.getStateKey()).isEqualTo(DEFAULT_STATE_KEY);
assertThat(testXmEntity.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testXmEntity.getStartDate()).isEqualTo(MOCKED_START_DATE);
assertThat(testXmEntity.getUpdateDate()).isEqualTo(MOCKED_UPDATE_DATE);
assertThat(testXmEntity.getEndDate()).isEqualTo(DEFAULT_END_DATE);
assertThat(testXmEntity.getAvatarUrl()).contains("aaaaa.jpg");
assertThat(testXmEntity.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
assertThat(testXmEntity.getData()).isEqualTo(DEFAULT_DATA);
assertThat(testXmEntity.isRemoved()).isEqualTo(DEFAULT_REMOVED);
// Validate the XmEntity in Elasticsearch
XmEntity xmEntityEs = xmEntitySearchRepository.findOne(testXmEntity.getId());
assertThat(xmEntityEs).isEqualToComparingFieldByField(testXmEntity);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntityResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(XmEntity.class);
XmEntity xmEntity1 = new XmEntity();
xmEntity1.setId(1L);
XmEntity xmEntity2 = new XmEntity();
xmEntity2.setId(xmEntity1.getId());
assertThat(xmEntity1).isEqualTo(xmEntity2);
xmEntity2.setId(2L);
assertThat(xmEntity1).isNotEqualTo(xmEntity2);
xmEntity1.setId(null);
assertThat(xmEntity1).isNotEqualTo(xmEntity2);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntitySaveIntTest method testDeleteLep.
@Test
@Transactional
public void testDeleteLep() throws Exception {
initLeps();
XmEntity runSaveProceed = createEntity("TEST_DELETE_AND_PROCEED");
XmEntity runSave = createEntity("TEST_DELETE_RUN");
XmEntity runGeneralScript = createEntity("TEST_NOT_RUN_DELETE");
xmEntityServiceImpl.save(runSaveProceed);
xmEntityServiceImpl.save(runSave);
xmEntityServiceImpl.save(runGeneralScript);
xmEntityServiceImpl.delete(runSaveProceed.getId());
xmEntityServiceImpl.delete(runSave.getId());
xmEntityServiceImpl.delete(runGeneralScript.getId());
assertThat(runSaveProceed.getData().get("runGeneralScriptDELETE")).isEqualTo(1);
assertThat(runSaveProceed.getData().get("runDeleteProceed")).isEqualTo(1);
assertThat(runSaveProceed.getData().get("runDeleteRun")).isEqualTo(0);
assertThat(runSave.getData().get("runGeneralScriptDELETE")).isEqualTo(0);
assertThat(runSave.getData().get("runDeleteProceed")).isEqualTo(0);
assertThat(runSave.getData().get("runDeleteRun")).isEqualTo(1);
assertThat(runGeneralScript.getData().get("runGeneralScriptDELETE")).isEqualTo(1);
assertThat(runGeneralScript.getData().get("runDeleteProceed")).isEqualTo(0);
assertThat(runGeneralScript.getData().get("runDeleteRun")).isEqualTo(0);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TagResourceIntTest 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 Tag createEntity(EntityManager em) {
Tag tag = new Tag().typeKey(DEFAULT_TYPE_KEY).name(DEFAULT_NAME).startDate(DEFAULT_START_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
tag.setXmEntity(xmEntity);
return tag;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class VoteResourceIntTest method createEntity.
/**
* Create an entity for this test.
*
* 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 Vote createEntity(EntityManager em) {
Vote vote = new Vote().userKey(DEFAULT_USER_KEY).value(DEFAULT_VALUE).message(DEFAULT_MESSAGE).entryDate(DEFAULT_ENTRY_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
vote.setXmEntity(xmEntity);
Rating rating = RatingResourceIntTest.createEntity(em);
em.persist(rating);
em.flush();
vote.setRating(rating);
return vote;
}
Aggregations