use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class XmEntityResourceIntTest method createXmEntityTenantWithWhitespace.
@Test
@Transactional
public void createXmEntityTenantWithWhitespace() throws Exception {
int databaseSizeBeforeCreate = xmEntityRepository.findAll().size();
XmEntity tenant = createEntity(em);
tenant.setTypeKey(Constants.TENANT_TYPE_KEY);
tenant.setName("test name");
// An entity with an existing ID cannot be created, so this API call must fail
restXmEntityMockMvc.perform(post("/api/xm-entities").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(tenant))).andExpect(status().isBadRequest()).andExpect(jsonPath("$.error").value("error.validation")).andExpect(jsonPath("$.error_description").value(notNullValue()));
// Validate the Alice in the database
List<XmEntity> xmEntityList = xmEntityRepository.findAll();
assertThat(xmEntityList).hasSize(databaseSizeBeforeCreate);
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testStateKeyValidationIsNotValid.
@Test
public void testStateKeyValidationIsNotValid() {
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE1-1").typeKey("TYPE1.SUBTYPE1").name("Entity name").startDate(Instant.now()).updateDate(Instant.now()).stateKey("UNVALIDSTATE");
Set<ConstraintViolation<XmEntity>> constraintViolations = validator.validate(entity);
assertEquals(1, constraintViolations.size());
assertEquals("{xm.ms.entity.state.constraint}", constraintViolations.iterator().next().getMessageTemplate());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testDataValidation.
private void testDataValidation(Map data) {
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE1-1").typeKey("TYPE1.SUBTYPE1").name("Entity name").startDate(Instant.now()).updateDate(Instant.now()).stateKey("STATE1").data(data);
Set<ConstraintViolation<XmEntity>> constraintViolations = validator.validate(entity);
assertEquals(1, constraintViolations.size());
assertEquals("{xm.ms.entity.data.constraint}", constraintViolations.iterator().next().getMessageTemplate());
}
use of com.icthh.xm.ms.entity.domain.XmEntity in project xm-ms-entity by xm-online.
the class TypeKeyValidatorIntTest method testXmEntityDataValidationIsValid.
@Test
public void testXmEntityDataValidationIsValid() {
Map data = of("booleanProperties", false, "numberProperties", 5, "stringProperties", "str");
XmEntity entity = new XmEntity().key("TYPE1.SUBTYPE1-1").typeKey("TYPE1.SUBTYPE1").name("Entity name").startDate(Instant.now()).updateDate(Instant.now()).stateKey("STATE1").data(data);
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 testTagTypeKeyValidationIsNotValid.
@Test
public void testTagTypeKeyValidationIsNotValid() {
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("TAG2").name("Tag").startDate(Instant.now()));
Set<ConstraintViolation<XmEntity>> constraintViolations = validator.validate(entity);
assertEquals(1, constraintViolations.size());
}
Aggregations