/** * Returns the family name. * * @return family name */ public FamilyName getFamilyName() { return getExtension(FamilyName.class); }
/** * Returns whether it has the name suffix. * * @return whether it has the name suffix */ public boolean hasNameSuffix() { return hasExtension(NameSuffix.class); }
/** * Sets the given name. * * @param givenName given name or <code>null</code> to reset */ public void setGivenName(GivenName givenName) { if (givenName == null) { removeExtension(GivenName.class); } else { setExtension(givenName); } }
Name name = new Name(); while (nameIterator.hasNext()) { OMElement singleNameElement = (OMElement) nameIterator.next(); if (elementValue != null && !elementValue.isEmpty()) { if (Constants.NAME_PREFIX.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setNamePrefix(new NamePrefix(elementValue)); } else if (Constants.FULL_NAME.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setFullName(new FullName(elementValue, null)); } else if (Constants.GIVEN_NAME.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setGivenName(new GivenName(elementValue, null)); } else if (Constants.FAMILY_NAME.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setFamilyName(new FamilyName(elementValue, null)); } else if (Constants.ADDITIONAL_NAME.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setAdditionalName(new AdditionalName(elementValue, null)); } else if (Constants.NAME_SUFFIX.equalsIgnoreCase(singleNameElement.getLocalName())) { name.setNameSuffix(new NameSuffix(elementValue));
extProfile.declare(BasePersonEntry.class, Mileage.class); extProfile.declare(BasePersonEntry.class, Name.class); new Name().declareExtensions(extProfile); extProfile.declare(BasePersonEntry.class, Nickname.class); extProfile.declare(BasePersonEntry.class, Occupation.class);
/** * 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()); }
extProfile.declare(BasePersonEntry.class, Mileage.class); extProfile.declare(BasePersonEntry.class, Name.class); new Name().declareExtensions(extProfile); extProfile.declare(BasePersonEntry.class, Nickname.class); extProfile.declare(BasePersonEntry.class, Occupation.class);
/** * 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()); }
/** * Sets the full name. * * @param fullName full name or <code>null</code> to reset */ public void setFullName(FullName fullName) { if (fullName == null) { removeExtension(FullName.class); } else { setExtension(fullName); } }
/** * Returns whether it has the full name. * * @return whether it has the full name */ public boolean hasFullName() { return hasExtension(FullName.class); }
/** * Returns the name suffix. * * @return name suffix */ public NameSuffix getNameSuffix() { return getExtension(NameSuffix.class); }
extProfile.declare(BasePersonEntry.class, Mileage.class); extProfile.declare(BasePersonEntry.class, Name.class); new Name().declareExtensions(extProfile); extProfile.declare(BasePersonEntry.class, Nickname.class); extProfile.declare(BasePersonEntry.class, Occupation.class);
/** * 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)); }
/** * Sets the name prefix. * * @param namePrefix name prefix or <code>null</code> to reset */ public void setNamePrefix(NamePrefix namePrefix) { if (namePrefix == null) { removeExtension(NamePrefix.class); } else { setExtension(namePrefix); } }
/** * Returns whether it has the name prefix. * * @return whether it has the name prefix */ public boolean hasNamePrefix() { return hasExtension(NamePrefix.class); }
/** * Returns the given name. * * @return given name */ public GivenName getGivenName() { return getExtension(GivenName.class); }
/** * Sets the given name. * * @param givenName given name or <code>null</code> to reset */ public void setGivenName(GivenName givenName) { if (givenName == null) { removeExtension(GivenName.class); } else { setExtension(givenName); } }
/** * Returns whether it has the given name. * * @return whether it has the given name */ public boolean hasGivenName() { return hasExtension(GivenName.class); }
/** * Returns the additional name. * * @return additional name */ public AdditionalName getAdditionalName() { return getExtension(AdditionalName.class); }
/** * Sets the family name. * * @param familyName family name or <code>null</code> to reset */ public void setFamilyName(FamilyName familyName) { if (familyName == null) { removeExtension(FamilyName.class); } else { setExtension(familyName); } }