/** * Returns the batch interruption information. * * @return batch interruption information */ public BatchInterrupted getBatchInterrupted() { return getExtension(BatchInterrupted.class); }
/** * Returns the contact extended properties. * * @return contact extended properties */ public List<ExtendedProperty> getExtendedProperties() { return getRepeatingExtension(ExtendedProperty.class); }
/** * Returns whether it has the system group. * * @return whether it has the system group */ public boolean hasSystemGroup() { return hasExtension(SystemGroup.class); }
/** * Sets the batch identifier. * * @param batchId batch identifier or <code>null</code> to reset */ public void setBatchId(BatchId batchId) { if (batchId == null) { removeExtension(BatchId.class); } else { setExtension(batchId); } }
group.setTitle(new PlainTextConstruct(title)); group.setContent(new PlainTextConstruct(content)); group.getExtendedProperties().clear(); final String extendedProps = (String) getParameter(messageContext, Constants.EXTENDED_PROPERTIES); final List<ExtendedProperty> extendedPropList = getExtendedPropertyList(extendedPropElems); for (ExtendedProperty extendedPropertyItem : extendedPropList) { group.addExtendedProperty(extendedPropertyItem); group.setEtag(Constants.ETAG); final URL editUrl = new URL(group.getEditLink().getHref()); final ContactGroupEntry updatedGroup = contactService.update(editUrl, group);
updateGroup.setTitle(new PlainTextConstruct(titleElem.getText())); updateGroup.setContent(new PlainTextConstruct(contentElem.getText())); updateGroup.getExtendedProperties().clear(); final OMElement extendedProps = entryElement.getFirstChildWithName(new QName(Constants.EXTENDED_PROPERTIES)); final List<ExtendedProperty> extendedPropList = getExtendedPropertyList(extendedProps); for (ExtendedProperty extendedPropertyItem : extendedPropList) { updateGroup.addExtendedProperty(extendedPropertyItem);
/** * Adds a new extended property. * * @param extendedProperty extended property */ public void addExtendedProperty(ExtendedProperty extendedProperty) { getExtendedProperties().add(extendedProperty); }
final ContactGroupEntry contactGroupEntry = new ContactGroupEntry(); .append(groupIdElem.getText()).toString(); contactGroupEntry.setId(requestUrl); contactGroupEntry.setEtag(Constants.ETAG);
/** * Positive test case for updateContactGroup method with optional parameters. * * @throws Exception the exception */ @Test(priority = 2, groups = { "wso2.esb" }, dependsOnMethods = { "testCreateContactGroupWithMandatoryParameters" }, description = "Google Contacts {updateContactGroup} integration test with optional parameters.") public void testUpdateContactGroupWithOptionalParameters() throws Exception { Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("groupId", groupId); SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_updateContactGroup_optional.xml", parametersMap); // Adding a sleep timer to buffer time taken to apply changes on backend. Thread.sleep(Long.parseLong(connectorProperties.getProperty("timeDelay"))); final ContactGroupEntry directResponse = directInvoker.retrieveSingleContactGroupByUrl((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:link/@href)", nameSpaceMap)); // Assert the group title. Assert.assertEquals((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:content/text())", nameSpaceMap), directResponse.getPlainTextContent()); // Assert the value of the extended property. Assert.assertEquals( (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//gd:extendedProperty/@value)", nameSpaceMap), directResponse.getExtendedProperties().get(0).getValue()); }
/** * Positive test case for createContactGroup method with optional parameters. * * @throws Exception the exception */ @Test(priority = 1, groups = { "wso2.esb" }, description = "Google Contacts {createContactGroup} integration test with optional parameters.") public void testCreateContactGroupWithOptionalParameters() throws Exception { SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_createContactGroup_optional.xml"); // Adding a sleep timer to buffer time taken to apply changes on backend. Thread.sleep(Long.parseLong(connectorProperties.getProperty("timeDelay"))); String xPathExp = "string(//atom:id/text())"; String idUrl = (String) xPathEvaluate(esbSoapResponse, xPathExp, nameSpaceMap); batchDeleteGroupId = idUrl.substring(idUrl.lastIndexOf("/") + 1, idUrl.length()); final ContactGroupEntry directResponse = directInvoker.retrieveSingleContactGroupByUrl((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:link/@href)", nameSpaceMap)); // Assert the group title. Assert.assertEquals((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:title/text())", nameSpaceMap), directResponse.getTitle().getPlainText()); // Assert the value of the extended property. Assert.assertEquals( (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//gd:extendedProperty/@value)", nameSpaceMap), directResponse.getExtendedProperties().get(0).getValue()); }
Constants.REQUEST_URL_GENERIC_END).toString(); final ContactGroupEntry newGroup = new ContactGroupEntry(); newGroup.setTitle(new PlainTextConstruct(title)); newGroup.setContent(new PlainTextConstruct(content)); final List<ExtendedProperty> extendedPropList = getExtendedPropertyList(extendedPropElems); for (ExtendedProperty extendedPropertyItem : extendedPropList) { newGroup.addExtendedProperty(extendedPropertyItem);
/** * Returns whether it has the extended properties. * * @return whether it has the extended properties */ public boolean hasExtendedProperties() { return hasRepeatingExtension(ExtendedProperty.class); }
/** * Default mutable constructor. */ public ContactGroupEntry() { super(); getCategories().add(CATEGORY); }
final ContactGroupEntry createGroup = new ContactGroupEntry(); createGroup.setTitle(new PlainTextConstruct(titleElem.getText())); final List<ExtendedProperty> extendedPropList = getExtendedPropertyList(extendedProps); for (ExtendedProperty extendedPropertyItem : extendedPropList) { createGroup.addExtendedProperty(extendedPropertyItem);
/** * Create a contacts groups batch result for negative case. * * @param groupId ID of the contact group. * @return ContactFeed object containing the batch. * @throws ServiceException the service exception. * @throws IOException Signals that an I/O exception has occurred. * @throws MalformedURLException error in the provided URLs. * @throws BatchInterruptedException Batch Interruption failure exception. */ public ContactGroupFeed retrieveBatchContactGroupFeed(final String groupId) throws BatchInterruptedException, MalformedURLException, IOException, ServiceException { final ContactGroupFeed batchFeed = new ContactGroupFeed(); final ContactGroupEntry retrieveEntry = new ContactGroupEntry(); final StringBuilder requestUrlBuilder = new StringBuilder("https://www.google.com/m8/feeds/groups/").append(emailAddress).append("/full/") .append(groupId); retrieveEntry.setId(requestUrlBuilder.toString()); BatchUtils.setBatchId(retrieveEntry, "retrieve"); BatchUtils.setBatchOperationType(retrieveEntry, BatchOperationType.QUERY); batchFeed.getEntries().add(retrieveEntry); return directInvokerContactsService.batch(new URL( "https://www.google.com/m8/feeds/groups/default/full/batch"), batchFeed); } }
/** * Sets the batch interruption information. * * @param batchInterrupted batch interruption information or <code>null</code> * to reset */ public void setBatchInterrupted(BatchInterrupted batchInterrupted) { if (batchInterrupted == null) { removeExtension(BatchInterrupted.class); } else { setExtension(batchInterrupted); } }
/** * Adds a new contact extended property. * * @param extendedProperty contact extended property */ public void addExtendedProperty(ExtendedProperty extendedProperty) { getExtendedProperties().add(extendedProperty); }
/** * Returns whether it has the contact extended properties. * * @return whether it has the contact extended properties */ public boolean hasExtendedProperties() { return hasRepeatingExtension(ExtendedProperty.class); }
/** * Default mutable constructor. */ public ContactGroupEntry() { super(); getCategories().add(CATEGORY); }
/** * Sets the system group. * * @param systemGroup system group or <code>null</code> to reset */ public void setSystemGroup(SystemGroup systemGroup) { if (systemGroup == null) { removeExtension(SystemGroup.class); } else { setExtension(systemGroup); } }