assertNotNull("connector not found", connector);
resource.setConnector(connector);
// specify mappings
SchemaMapping mapping = null;
for (int i = 0; i < 3; i++) {
mapping = new SchemaMapping();
mapping.setExtAttrName("test" + i);
mapping.setIntAttrName("nonexistent" + i);
mapping.setIntMappingType(IntMappingType.UserSchema);
mapping.setMandatoryCondition("false");
mapping.setResource(resource);
resource.addMapping(mapping);
}
SchemaMapping accountId = new SchemaMapping();
accountId.setAccountid(true);
accountId.setExtAttrName("username");
accountId.setIntAttrName("username");
accountId.setIntMappingType(IntMappingType.SyncopeUserId);
accountId.setResource(resource);
resource.addMapping(accountId);
// map a derived attribute
SchemaMapping derived = new SchemaMapping();
derived.setAccountid(false);
derived.setExtAttrName("fullname");
derived.setIntAttrName("cn");
derived.setIntMappingType(IntMappingType.UserDerivedSchema);
derived.setResource(resource);
resource.addMapping(derived);
// save the resource
ExternalResource actual = resourceDAO.save(resource);
assertNotNull(actual);