Пример #1
0
  @Test(expected = InvalidEntityException.class)
  public void saveNonValid() {
    PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
    schema.setKey("secondaryEmail");
    schema.setType(AttrSchemaType.String);
    schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
    schema.setMandatoryCondition("false");
    schema.setMultivalue(true);
    schema.setUniqueConstraint(true);

    plainSchemaDAO.save(schema);
  }
Пример #2
0
  @Test
  public void save() {
    PlainSchema schema = entityFactory.newEntity(PlainSchema.class);
    schema.setKey("secondaryEmail");
    schema.setType(AttrSchemaType.String);
    schema.setValidatorClass("org.apache.syncope.core.validation.EmailAddressValidator");
    schema.setMandatoryCondition("false");
    schema.setMultivalue(true);

    plainSchemaDAO.save(schema);

    PlainSchema actual = plainSchemaDAO.find("secondaryEmail");
    assertNotNull("expected save to work", actual);
    assertEquals(schema, actual);
  }