use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class LinkResourceIntTest 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 Link createEntity(EntityManager em) {
Link link = new Link().typeKey(DEFAULT_TYPE_KEY).name(DEFAULT_NAME).description(DEFAULT_DESCRIPTION).startDate(DEFAULT_START_DATE).endDate(DEFAULT_END_DATE);
// Add required entity
XmEntity target = XmEntityResourceIntTest.createEntity(em);
em.persist(target);
em.flush();
link.setTarget(target);
// Add required entity
XmEntity source = XmEntityResourceIntTest.createEntity(em);
em.persist(source);
em.flush();
link.setSource(source);
return link;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class LocationResourceIntTest 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 Location createEntity(EntityManager em) {
Location location = new Location().typeKey(DEFAULT_TYPE_KEY).countryKey(DEFAULT_COUNTRY_KEY).longitude(DEFAULT_LONGITUDE).latitude(DEFAULT_LATITUDE).name(DEFAULT_NAME).addressLine1(DEFAULT_ADDRESS_LINE_1).addressLine2(DEFAULT_ADDRESS_LINE_2).city(DEFAULT_CITY).region(DEFAULT_REGION).zip(DEFAULT_ZIP);
// Add required entity
XmEntity xmEntity = XmEntityResourceIntTest.createEntity(em);
em.persist(xmEntity);
em.flush();
location.setXmEntity(xmEntity);
return location;
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testEntityTypeKeyValidationIsNotValid.
@Test
public void testEntityTypeKeyValidationIsNotValid() {
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE2-1").typeKey("TYPE1.SUBTYPE2").name("Entity name").startDate(Instant.now()).updateDate(Instant.now());
Set<ConstraintViolation<XmEntity>> constraintViolations = validator.validate(entity);
assertEquals(1, constraintViolations.size());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testTagTypeKeyValidationIsValid.
@Test
public void testTagTypeKeyValidationIsValid() {
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE1-1").typeKey("TYPE1.SUBTYPE1").name("Entity name").startDate(Instant.now()).updateDate(Instant.now()).stateKey("STATE1").addTags(new Tag().typeKey("TAG1").name("Tag").startDate(Instant.now()));
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 TypeKeyValidatorIntTest method testStateKeyValidationIsValid.
@Test
public void testStateKeyValidationIsValid() {
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());
}
Aggregations