예제 #1
0
  @Test
  public void checkForEnumType() {
    PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
    schema.setType(AttrSchemaType.Enum);
    schema.setKey("color");

    try {
      plainSchemaDAO.save(schema);
      fail();
    } catch (Exception e) {
      assertNotNull(e);
    }

    schema.setEnumerationValues("red" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "yellow");
    schema.setEnumerationKeys("1" + SyncopeConstants.ENUM_VALUES_SEPARATOR + "2");

    plainSchemaDAO.save(schema);

    PlainSchema actual = plainSchemaDAO.find(schema.getKey());
    assertNotNull(actual);
    assertNotNull(actual.getEnumerationKeys());
    assertFalse(actual.getEnumerationKeys().isEmpty());
  }