+ "resource/list.json?connInstanceId=103", ResourceTO[].class));
assertEquals(4, resources.size());
// Retrieve a resource TO template.
ResourceTO resourceTO = resources.get(0);
// Make it new.
resourceTO.setName("newAbout103");
// Make it new.
connInstanceTO.setId(0);
connInstanceTO.setDisplayName("newDisplayName");
// ----------------------------------
// ----------------------------------
// Create a new connector instance.
// ----------------------------------
connInstanceTO =
restTemplate.postForObject(BASE_URL + "connector/create.json", connInstanceTO, ConnInstanceTO.class);
assertNotNull(connInstanceTO);
assertTrue(connInstanceTO.getCapabilities().isEmpty());
long connId = connInstanceTO.getId();
// Link resourceTO to the new connector instance.
resourceTO.setConnectorId(connId);
// ----------------------------------
// ----------------------------------
// Check for connector instance update after resource creation.
// ----------------------------------
resourceTO = restTemplate.postForObject(BASE_URL + "resource/create.json", resourceTO, ResourceTO.class);
assertNotNull(resourceTO);
resources = Arrays.asList(restTemplate.getForObject(BASE_URL + "resource/list.json?connInstanceId=" + connId,
ResourceTO[].class));
assertEquals(1, resources.size());
// ----------------------------------
// ----------------------------------
// Check for spring bean.
// ----------------------------------
ConnInstanceTO connInstanceBean = restTemplate.getForObject(
BASE_URL + "connector/{resourceName}/connectorBean", ConnInstanceTO.class, resourceTO.getName());
assertNotNull(connInstanceBean);
assertTrue(connInstanceBean.getCapabilities().isEmpty());
// ----------------------------------
// ----------------------------------
// Check for spring bean update after connector instance update.
// ----------------------------------
connInstanceTO.addCapability(ConnectorCapability.SEARCH);
ConnInstanceTO actual = (ConnInstanceTO) restTemplate.postForObject(BASE_URL + "connector/update.json",
connInstanceTO, ConnInstanceTO.class);
assertNotNull(actual);
assertFalse(connInstanceTO.getCapabilities().isEmpty());
// check for spring bean update
connInstanceBean = restTemplate.getForObject(BASE_URL + "connector/{resourceName}/connectorBean",
ConnInstanceTO.class, resourceTO.getName());
assertFalse(connInstanceBean.getCapabilities().isEmpty());
// ----------------------------------
}