/** * 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 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); }
protected void serializeProperties(PropertyInclude endpoint, OMElement element) { Collection<MediatorProperty> properties = endpoint.getProperties(); if (properties != null && properties.size() > 0) { MediatorPropertySerializer.serializeMediatorProperties(element, properties); } } }
protected void serializeProperties(PropertyInclude endpoint, OMElement element) { Collection<MediatorProperty> properties = endpoint.getProperties(); if (properties != null && properties.size() > 0) { MediatorPropertySerializer.serializeMediatorProperties(element, properties); } } }
/** * 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()); }