/** * Positive test case for updateContactPhoto method with mandatory parameters. */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactWithOptionalParameters" }, description = "Google Contacts {updateContactPhoto} integration test with mandatory parameters.") public void testUpdateContactPhotoWithMandatoryParameters() throws Exception { Map<String, String> parametersMap = new HashMap<String, String>(); Map<String, String> attachmentMap = new HashMap<String, String>(); attachmentMap.put("photo", "updateContactPhoto_image.png"); parametersMap.put("contactId", contactId); sendSOAPRequest(proxyUrl, "esb_updateContactPhoto_mandatory.xml", parametersMap, attachmentMap); ContactEntry directResponseObject = directInvoker.retrieveSingleContact(contactId); Assert.assertTrue(directResponseObject.getContactPhotoLink() != null); }
/** * Positive test case for deleteContactPhoto method with mandatory parameters. * * @throws Exception the exception */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactWithOptionalParameters" }, description = "Google Contacts {deleteContactPhoto} method {mandatory parameters} Integration Tests") public void testDeleteContactPhotoMandatoryParameters() throws Exception { Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("contactId", contactId); // Delete a contact photo for given contact id through a esb call. sendSOAPRequest(proxyUrl, "esb_deleteContactPhoto_mandatory.xml", parametersMap); Thread.sleep(Long.parseLong(connectorProperties.getProperty("timeDelay"))); // Get the contact entry which contact photo was deleted by direct api call. ContactEntry contactEntry = directInvoker.retrieveSingleContact(contactId); // Assert with retrieved contact photo link's etag attribute is not available. // If a contact does not have a photo, then the photo link element has no gd:etag. Assert.assertNull(contactEntry.getContactPhotoLink().getEtag()); }
String photoLink = entry.getContactPhotoLink().getHref(); System.out.println("Photo Link: " + photoLink);
final ContactEntry entryToUpdate = contactsService.getEntry(new URL(requestUrl.toString()), ContactEntry.class); Link photoLink = entryToUpdate.getContactPhotoLink(); URL photoUrl = new URL(photoLink.getHref());
final Link photoLink = contactEntry.getContactPhotoLink(); final URL photoUrl = new URL(photoLink.getHref());