/** * Serialize all the properties to the given paren element. For each and every * property ther will be a seperate property element created inside the parent element. * * @param parent element to which property elements should be added * @param props <code>Collection</code> of propertis */ public static void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props) { serializeMediatorProperties(parent, props, PROP_Q); }
/** * Serialize the property to the given paren element. There will be a element created with * the name property inside the parent element. * * @param parent element to which property elements should be added * @param mp a property to be serialized */ public static void serializeMediatorProperty(OMElement parent, MediatorProperty mp) { serializeMediatorProperty(parent, mp, PROP_Q); }
/** * Serialize all the properties to the given paren element. For each and every * property ther will be a seperate property element created inside the parent element. * * @param parent element to which property elements should be added * @param props <code>Collection</code> of propertis */ public static void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props) { serializeMediatorProperties(parent, props, PROP_Q); }
/** * Serialize the property to the given paren element. There will be a element created with * the name property inside the parent element. * * @param parent element to which property elements should be added * @param mp a property to be serialized */ public static void serializeMediatorProperty(OMElement parent, MediatorProperty mp) { serializeMediatorProperty(parent, mp, PROP_Q); }
protected void serializeProperties(PropertyInclude endpoint, OMElement element) { Collection<MediatorProperty> properties = endpoint.getProperties(); if (properties != null && properties.size() > 0) { MediatorPropertySerializer.serializeMediatorProperties(element, properties); } } }
/** * Serialize all the properties to the given paren element. For each and every * property ther will be a seperate element with the given name created inside the * parent element. * * @param parent element to which property elements should be added * @param props <code>Collection</code> of propertis * @param childElementName <code>QNmae</code> of the property element to be created */ public static void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props, QName childElementName) { for (MediatorProperty mp : props) { serializeMediatorProperty(parent, mp, childElementName); } }
protected void serializeProperties(PropertyInclude endpoint, OMElement element) { Collection<MediatorProperty> properties = endpoint.getProperties(); if (properties != null && properties.size() > 0) { MediatorPropertySerializer.serializeMediatorProperties(element, properties); } } }
/** * Serialize all the properties to the given paren element. For each and every * property ther will be a seperate element with the given name created inside the * parent element. * * @param parent element to which property elements should be added * @param props <code>Collection</code> of propertis * @param childElementName <code>QNmae</code> of the property element to be created */ public static void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props, QName childElementName) { for (MediatorProperty mp : props) { serializeMediatorProperty(parent, mp, childElementName); } }
/** * Test SerializeMediatorProperties for a property without name. * * @throws XMLStreamException */ @Test public void testSerializeWithoutPropertyName() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); propertyList.add(property); thrown.expect(SynapseException.class); thrown.expectMessage("Mediator property name missing"); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); }
/** * Test SerializeMediatorProperties for a property without value. * * @throws XMLStreamException */ @Test public void testSerializeWithoutPropertyValue() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); property.setName(NAME); propertyList.add(property); thrown.expect(SynapseException.class); thrown.expectMessage("Mediator property must have a literal value or be an expression"); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); } }
/** * Test SerializeMediatorProperties for correct insertion of properties. * * @throws XMLStreamException */ @Test public void testSerializeMediatorProperties() throws XMLStreamException { OMElement element = AXIOMUtil.stringToOM(XML); List<MediatorProperty> propertyList = new ArrayList<>(); MediatorProperty property = new MediatorProperty(); property.setName(NAME); property.setValue(VALUE); propertyList.add(property); MediatorPropertySerializer.serializeMediatorProperties(element, propertyList); OMElement firstElement = element.getFirstElement(); Assert.assertEquals("name of property must be added as an attribute", NAME, firstElement.getAttribute(new QName("name")).getAttributeValue()); Assert.assertEquals("value of property must be added as an attribute", VALUE, firstElement.getAttribute(new QName("value")).getAttributeValue()); }