/** * Returns whether it has the value. * * @return whether it has the value */ public boolean hasValue() { return getValue() != null; }
/** * Returns whether it has the value. * * @return whether it has the value */ public boolean hasValue() { return getValue() != null; }
/** * Returns whether it has the value. * * @return whether it has the value */ public boolean hasValue() { return getValue() != null; }
/** * Positive test case for createContact method with mandatory parameters. */ @Test(priority = 1, groups = { "wso2.esb" }, description = "Google Contacts {createContact} integration test with mandatory parameters.") public void testCreateContactWithMandatoryParameters() throws Exception { SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_createContact_mandatory.xml"); Assert.assertTrue(esbSoapResponse.getBody().toString().contains("atom:id")); String xPathExp = "string(//atom:id/text())"; String idUrl = (String) xPathEvaluate(esbSoapResponse, xPathExp, nameSpaceMap); batchDeleteContactId = idUrl.substring(idUrl.lastIndexOf("/") + 1, idUrl.length()); ContactEntry directResponseObject = directInvoker.retrieveSingleContact(batchDeleteContactId); Assert.assertEquals(idUrl, directResponseObject.getId()); Assert.assertEquals((String) xPathEvaluate(esbSoapResponse, "string(//gd:fullName/text())", nameSpaceMap), directResponseObject .getName().getFullName().getValue()); }
/** * Positive test case for createContact method with mandatory parameters. */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactWithOptionalParameters" }, description = "Google Contacts {updateContact} integration test with mandatory parameters.") public void testUpdateContactWithMandatoryParameters() throws Exception { Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("contactId", contactId); SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_updateContact_mandatory.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:fullName/text())", nameSpaceMap), directResponseObject .getName().getFullName().getValue()); }
/** * Positive test case for retrieveAllContacts method with mandatory parameters. * * @throws Exception the exception */ @Test(priority = 1, groups = { "wso2.esb" }, description = "Google Contacts {retrieveAllContacts} integration test with mandatory parameters.") public void testRetrieveAllContactsWithMandatoryParameters() throws Exception { final SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_retrieveAllContacts_mandatory.xml"); final ContactFeed directResponse = directInvoker.retrieveAllContacts(); // Assert id Assert.assertEquals(directResponse.getEntries().get(0).getName().getFullName().getValue(), (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//gd:fullName/text())", nameSpaceMap)); // Assert title Assert.assertEquals(directResponse.getTitle().getPlainText(), (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:title/text())", nameSpaceMap)); // Assert totalResults Assert.assertEquals(String.valueOf(directResponse.getTotalResults()), (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//openSearch:totalResults/text())", nameSpaceMap)); }