/** * Default mutable constructor. */ public ContactGroupFeed() { super(ContactGroupEntry.class); getCategories().add(ContactGroupEntry.CATEGORY); }
/** * Declare the extensions of the feeds for the Google Contacts service. */ private void declareExtensions() { new ContactFeed().declareExtensions(extProfile); new ContactGroupFeed().declareExtensions(extProfile); new ProfileFeed().declareExtensions(extProfile); BatchUtils.declareExtensions(extProfile); }
final ContactGroupFeed requestFeed = new ContactGroupFeed(); requestFeed.getEntries().add(retreiveContactGroup(messageContext, entryElement)); } else if (Constants.INSERT.equals(entryType)) { requestFeed.getEntries().add(createContactGroup(entryElement)); } else if (Constants.UPDATE.equals(entryType)) { requestFeed.getEntries().add(updateContactGroup(messageContext, entryElement)); } else if (Constants.DELETE.equals(entryType)) { requestFeed.getEntries().add(deleteContactGroup(messageContext, entryElement)); } else { throw new ValidationException("Batch operation type is not found");
/** * Positive test case for retrieveAllContactGroups method with mandatory parameters. * * @throws Exception the exception */ @Test(priority = 1, groups = { "wso2.esb" }, description = "Google Contacts {retrieveAllContactGroups} method {mandatory parameters} Integration Tests") public void testRetrieveAllContactGroupsMandatoryParameters() throws Exception { SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_retrieveAllContactGroups_mandatory.xml"); ContactGroupFeed groupFeed = directInvoker.retrieveAllContactGroups(); Assert.assertEquals(String.valueOf(groupFeed.getTotalResults()), (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//openSearch:totalResults/text())", nameSpaceMap)); Assert.assertEquals(groupFeed.getEntries().get(groupFeed.getEntries().size() - 1).getTitle().getPlainText(), (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:entry[last()]/atom:title/text())", nameSpaceMap)); }
/** * Positive test case for RetrieveContactGroupsByQuery method with optional parameters. * * @throws Exception the exception */ @Test(priority = 2, groups = { "wso2.esb" }, description = "Google Contacts {retrieveContactGroupsByQuery} integration test with optional parameters.") public void testRetrieveContactGroupsByQueryWithOptionalParameters() throws Exception { final Map<String, String> parametersMap = new HashMap<String, String>(); parametersMap.put("reqUrl", "https://www.google.com/m8/feeds/groups/default/full"); Query contactQuery = (Query) loadObjectFromFile("api_retrieveContactGroupsByQuery_optional.xml", parametersMap); SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_retrieveContactGroupsByQuery_optional.xml", parametersMap); ContactGroupFeed feed = directInvoker.getDirectInvokerContactsService().query(contactQuery, ContactGroupFeed.class); // Assert Total Results. Assert.assertEquals(Integer.parseInt((String) xPathEvaluate(esbSoapResponse.getBody() .getFirstElement(), "string(//openSearch:totalResults/text())", nameSpaceMap)), feed.getTotalResults()); // Assert Items Per Page. Assert.assertEquals(Integer.parseInt((String) xPathEvaluate(esbSoapResponse.getBody() .getFirstElement(), "string(//openSearch:itemsPerPage/text())", nameSpaceMap)), feed.getItemsPerPage()); // Assert Start Index. Assert.assertEquals( Integer.parseInt((String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//openSearch:startIndex/text())", nameSpaceMap)), feed.getStartIndex()); }
/** * Negative test case for batch create contacts group scenario. * * @throws Exception */ @Test(priority = 1, groups = { "wso2.esb" }, description = "Google Contacts {batchCreateContactGroups} method {negative scenario} Integration Tests") public void testBatchCreateContactGroupsNegativeScenario() throws Exception { SOAPEnvelope esbSoapResponse = sendSOAPRequest(proxyUrl, "esb_batchCreateContactGroups_negative.xml"); final ContactGroupFeed directResponse = directInvoker.retrieveBatchContactGroupFeed("aaddd3324dd"); // Assert for the Error result. Assert.assertEquals( (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//atom:entry[batch:id = 'retrieve']/atom:title/text())", nameSpaceMap), directResponse.getEntries().get(0).getTitle().getPlainText()); // Assert for the error response code. Assert.assertEquals( (String) xPathEvaluate(esbSoapResponse.getBody().getFirstElement(), "string(//batch:status/@code)", nameSpaceMap), Integer.toString(directResponse.getEntries().get(0).getBatchStatus().getCode())); }
/** * Declare the extensions of the feeds for the Google Contacts service. */ private void declareExtensions() { new ContactFeed().declareExtensions(extProfile); new ContactGroupFeed().declareExtensions(extProfile); new ProfileFeed().declareExtensions(extProfile); BatchUtils.declareExtensions(extProfile); }
/** * 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); } }
/** * Declare the extensions of the feeds for the Google Contacts service. */ private void declareExtensions() { new ContactFeed().declareExtensions(extProfile); new ContactGroupFeed().declareExtensions(extProfile); new ProfileFeed().declareExtensions(extProfile); BatchUtils.declareExtensions(extProfile); }
/** * Default mutable constructor. */ public ContactGroupFeed() { super(ContactGroupEntry.class); getCategories().add(ContactGroupEntry.CATEGORY); }
/** * Default mutable constructor. */ public ContactGroupFeed() { super(ContactGroupEntry.class); getCategories().add(ContactGroupEntry.CATEGORY); }