use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testEntityTypeKeyValidationIsValid.
@Test
public void testEntityTypeKeyValidationIsValid() {
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE1-1").typeKey("TYPE1.SUBTYPE1").name("Entity name").startDate(Instant.now()).updateDate(Instant.now()).stateKey("STATE1");
Set<ConstraintViolation<XmEntity>> constraintViolations = validator.validate(entity);
assertEquals(0, constraintViolations.size());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class CalendarResourceIntTest 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 Calendar createEntity(EntityManager em) {
// Create required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
return new Calendar().typeKey(DEFAULT_TYPE_KEY).name(DEFAULT_NAME).description(DEFAULT_DESCRIPTION).startDate(DEFAULT_START_DATE).endDate(DEFAULT_END_DATE).xmEntity(xmEntity);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class CommentResourceIntTest 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 Comment createEntity(EntityManager em) {
Comment comment = new Comment().userKey(DEFAULT_USER_KEY).message(DEFAULT_MESSAGE).entryDate(DEFAULT_ENTRY_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
comment.setXmEntity(xmEntity);
return comment;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class RatingResourceIntTest 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 Rating createEntity(EntityManager em) {
Rating rating = new Rating().typeKey(DEFAULT_TYPE_KEY).value(DEFAULT_VALUE).startDate(DEFAULT_START_DATE).endDate(DEFAULT_END_DATE);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
rating.setXmEntity(xmEntity);
return rating;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntityResourceIntTest method updateXmEntity.
@Test
@Transactional
public void updateXmEntity() throws Exception {
// Initialize the database
xmEntityServiceImpl.save(xmEntity);
int databaseSizeBeforeUpdate = xmEntityRepository.findAll().size();
// Update the xmEntity
XmEntity updatedXmEntity = xmEntityRepository.findOne(xmEntity.getId());
em.detach(updatedXmEntity);
updatedXmEntity.key(UPDATED_KEY).typeKey(UPDATED_TYPE_KEY).stateKey(UPDATED_STATE_KEY).name(UPDATED_NAME).startDate(UPDATED_START_DATE).updateDate(UPDATED_UPDATE_DATE).endDate(UPDATED_END_DATE).avatarUrl(UPDATED_AVATAR_URL).description(UPDATED_DESCRIPTION).data(UPDATED_DATA).removed(UPDATED_REMOVED);
restXmEntityMockMvc.perform(put("/api/xm-entities").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedXmEntity))).andExpect(status().isOk());
// Validate the XmEntity in the database
List<XmEntity> xmEntityList = xmEntityRepository.findAll();
assertThat(xmEntityList).hasSize(databaseSizeBeforeUpdate);
XmEntity testXmEntity = xmEntityList.get(xmEntityList.size() - 1);
assertThat(testXmEntity.getKey()).isEqualTo(UPDATED_KEY);
assertThat(testXmEntity.getTypeKey()).isEqualTo(UPDATED_TYPE_KEY);
assertThat(testXmEntity.getStateKey()).isEqualTo(UPDATED_STATE_KEY);
assertThat(testXmEntity.getName()).isEqualTo(UPDATED_NAME);
assertThat(testXmEntity.getStartDate()).isEqualTo(MOCKED_START_DATE);
assertThat(testXmEntity.getUpdateDate()).isEqualTo(MOCKED_UPDATE_DATE);
assertThat(testXmEntity.getEndDate()).isEqualTo(UPDATED_END_DATE);
assertThat(testXmEntity.getAvatarUrl()).contains("bbbbb.jpg");
assertThat(testXmEntity.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testXmEntity.getData()).isEqualTo(UPDATED_DATA);
assertThat(testXmEntity.isRemoved()).isEqualTo(UPDATED_REMOVED);
// Validate the XmEntity in Elasticsearch
XmEntity xmEntityEs = xmEntitySearchRepository.findOne(testXmEntity.getId());
assertThat(xmEntityEs).isEqualToIgnoringGivenFields(testXmEntity, "avatarUrl", "attachments", "calendars", "locations", "ratings", "tags", "comments", "targets", "functionContexts");
}
Aggregations