Sascha Homeier created CMIS-1041:
------------------------------------
Summary: Commons Properties API inconsistence between List and Map
Key: CMIS-1041
URL: https://issues.apache.org/jira/browse/CMIS-1041
Project: Chemistry
Issue Type: Bug
Components: opencmis-commons
Affects Versions: OpenCMIS 1.1.0
Reporter: Sascha Homeier
Priority: Minor
_org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl,_ the
provided implementation of the _MutableProperties_ Interface in Commons API is
backed by a List and Map to provide these two different views via
_getPropertyList_ and_ getProperties_.
If a Property with the same ID is added twice via _addProperty_ the Map
replaces the old property while the List appends the new one.
Junit Test:
{code}@Test
public void testProperties_OpenCMISImpl() throws Exception
{
MutableProperties properties = new PropertiesImpl();
PropertyData<String> propertyOne = new
PropertyStringImpl("my:test", "testOne");
PropertyData<String> propertyTwo = new
PropertyStringImpl("my:test", "testTwo");
properties.addProperty(propertyOne);
Assert.assertEquals(1, properties.getProperties().size());
Assert.assertEquals(1, properties.getPropertyList().size());
properties.addProperty(propertyTwo);
// map replaces old property by new one, so only one entry here
Assert.assertEquals(1, properties.getProperties().size());
// list appends at the end, so two entries here
Assert.assertEquals(2, properties.getPropertyList().size());
}{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)