for (Email email : entry.getEmailAddresses()) { System.out.print(" " + email.getAddress()); if (email.getRel() != null) {
/** * Positive test case for createContact method with optional parameters. */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactWithOptionalParameters" }, description = "Google Contacts {createContact} integration test with optional parameters.") public void testUpdateContactWithOptionalParameters() throws Exception { Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("contactId", contactId); SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_updateContact_optional.xml", parametersMap); String xPathExp = "string(//atom:id/text())"; String idUrl = (String) xPathEvaluate(esbSoapResponse, xPathExp, nameSpaceMap); String updatedContactId = idUrl.substring(idUrl.lastIndexOf("/") + 1, idUrl.length()); // Adding a sleep timer to buffer time taken to apply changes on backend. Thread.sleep(Long.parseLong(connectorProperties.getProperty("timeDelay"))); ContactEntry directResponseObject = directInvoker.retrieveSingleContact(updatedContactId); Assert.assertEquals(idUrl, directResponseObject.getId()); Assert.assertEquals((String) xPathEvaluate(esbSoapResponse, "string(//gd:phoneNumber/text())", nameSpaceMap), directResponseObject .getPhoneNumbers().get(0).getPhoneNumber()); Assert.assertEquals((String) xPathEvaluate(esbSoapResponse, "string(//gd:email/@address)", nameSpaceMap), directResponseObject .getEmailAddresses().get(0).getAddress()); }
/** * Positive test case for retrieveSingleContact method with mandatory parameters. * * @throws Exception the exception */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactWithOptionalParameters" }, description = "Google Contacts {retrieveSingleContact} integration test with mandatory parameters.") public void testRetrieveSingleContactWithMandatoryParameters() throws Exception { final Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("contactId", contactId); final SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_retrieveSingleContact_mandatory.xml", parametersMap); final ContactEntry directResponse = directInvoker.retrieveSingleContact(contactId); // Assert contact email. Assert.assertEquals( (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//gd:email/@address)", nameSpaceMap), directResponse.getEmailAddresses().get(0).getAddress()); // Assert the contact's title. Assert.assertEquals((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:title/text())", nameSpaceMap), directResponse.getTitle().getPlainText()); }
entryToUpdate.getEmailAddresses().clear(); if (!tempElementString.isEmpty()) { OMElement emailElement = AXIOMUtil.stringToOM(tempElementString);
directResponseRead.getEmailAddresses().get(0).getAddress());