@Test
public void issueSYNCOPE112() {
// ----------------------------------------
// Create a new connector
// ----------------------------------------
ConnInstanceTO connectorTO = new ConnInstanceTO();
connectorTO.setLocation(connectorService.read(100L).getLocation());
// set connector version
connectorTO.setVersion(connidSoapVersion);
// set connector name
connectorTO.setConnectorName("org.connid.bundles.soap.WebServiceConnector");
// set bundle name
connectorTO.setBundleName("org.connid.bundles.soap");
// set display name
connectorTO.setDisplayName("WSSoap");
// set the connector configuration using PropertyTO
Set<ConnConfProperty> conf = new HashSet<ConnConfProperty>();
ConnConfPropSchema userSchema = new ConnConfPropSchema();
userSchema.setName("endpoint");
userSchema.setType(String.class.getName());
userSchema.setRequired(true);
ConnConfProperty endpoint = new ConnConfProperty();
endpoint.setSchema(userSchema);
endpoint.getValues().add("http://localhost:9080/does_not_work");
endpoint.setOverridable(true);
ConnConfPropSchema keyColumnSchema = new ConnConfPropSchema();
keyColumnSchema.setName("servicename");
keyColumnSchema.setType(String.class.getName());
keyColumnSchema.setRequired(true);
ConnConfProperty servicename = new ConnConfProperty();
servicename.setSchema(keyColumnSchema);
servicename.getValues().add("org.connid.bundles.soap.provisioning.interfaces.Provisioning");
servicename.setOverridable(false);
conf.add(endpoint);
conf.add(servicename);
// set connector configuration
connectorTO.getConfiguration().addAll(conf);
try {
assertFalse(connectorService.check(connectorTO));
Response response = connectorService.create(connectorTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
throw (RuntimeException) clientFactory.getExceptionMapper().fromResponse(response);
}
connectorTO = getObject(response.getLocation(), ConnectorService.class, ConnInstanceTO.class);
assertNotNull(connectorTO);
// ----------------------------------------
// ----------------------------------------
// create a resourceTO
// ----------------------------------------
String resourceName = "checkForPropOverriding";
ResourceTO resourceTO = new ResourceTO();
resourceTO.setName(resourceName);
resourceTO.setConnectorId(connectorTO.getId());
conf = new HashSet<ConnConfProperty>();
endpoint.getValues().clear();
endpoint.getValues().add("http://localhost:9080/wssample/services/provisioning");
conf.add(endpoint);
resourceTO.getConnConfProperties().addAll(conf);
MappingTO mapping = new MappingTO();
resourceTO.setUmapping(mapping);
MappingItemTO mapItem = new MappingItemTO();
mapItem.setExtAttrName("uid");
mapItem.setIntAttrName("userId");
mapItem.setIntMappingType(IntMappingType.UserSchema);
mapItem.setAccountid(true);
mapping.setAccountIdItem(mapItem);
// ----------------------------------------
// ----------------------------------------
// Check connection without saving the resource ....
// ----------------------------------------
assertTrue(resourceService.check(resourceTO));
// ----------------------------------------
} finally {
// Remove connector from db to make test re-runnable
connectorService.delete(connectorTO.getId());
}
}