@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { List<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (name != null) { attrs.add(new XmlWriter.Attribute("name", name)); } if (val != null) { attrs.add(new XmlWriter.Attribute("value", val)); } if (realm != null) { attrs.add(new XmlWriter.Attribute("realm", realm)); } generateStartElement(w, Namespaces.gNs, EXTENDED_PROPERTY, attrs, null); // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, EXTENDED_PROPERTY); }
while (extendedPropertyIterator.hasNext()) { OMElement extendedPropertyElement = (OMElement) extendedPropertyIterator.next(); ExtendedProperty extendedProperty = new ExtendedProperty(); String nameAttribute = extendedPropertyElement.getAttributeValue(new QName(Constants.NAME)); if (nameAttribute != null) { extendedProperty.setName(nameAttribute); XmlBlob xmlBlob = new XmlBlob(); xmlBlob.setBlob(infoElement.toString()); extendedProperty.setXmlBlob(xmlBlob); } else { String valueAttribute = extendedPropertyElement.getAttributeValue(new QName(Constants.VALUE)); if (valueAttribute != null) { extendedProperty.setValue(valueAttribute);
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
super.declareExtensions(extProfile); extProfile.declare(CalendarEventEntry.class, QuickAddProperty.getDefaultDescription()); extProfile.declare(CalendarEventEntry.class, ExtendedProperty.getDefaultDescription());
/** * 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()); }
@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { List<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (name != null) { attrs.add(new XmlWriter.Attribute("name", name)); } if (val != null) { attrs.add(new XmlWriter.Attribute("value", val)); } if (realm != null) { attrs.add(new XmlWriter.Attribute("realm", realm)); } generateStartElement(w, Namespaces.gNs, EXTENDED_PROPERTY, attrs, null); // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, EXTENDED_PROPERTY); }
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
super.declareExtensions(extProfile); extProfile.declare(CalendarEventEntry.class, QuickAddProperty.getDefaultDescription()); extProfile.declare(CalendarEventEntry.class, ExtendedProperty.getDefaultDescription());
/** * 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()); }
@Override public void generate(XmlWriter w, ExtensionProfile extProfile) throws IOException { List<XmlWriter.Attribute> attrs = new ArrayList<XmlWriter.Attribute>(); if (name != null) { attrs.add(new XmlWriter.Attribute("name", name)); } if (val != null) { attrs.add(new XmlWriter.Attribute("value", val)); } if (realm != null) { attrs.add(new XmlWriter.Attribute("realm", realm)); } generateStartElement(w, Namespaces.gNs, EXTENDED_PROPERTY, attrs, null); // Invoke ExtensionPoint. generateExtensions(w, extProfile); w.endElement(Namespaces.gNs, EXTENDED_PROPERTY); }
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
super.declareExtensions(extProfile); extProfile.declare(CalendarEventEntry.class, QuickAddProperty.getDefaultDescription()); extProfile.declare(CalendarEventEntry.class, ExtendedProperty.getDefaultDescription());