This test sometimes fails:
Tests run: 98, Failures: 0, Errors: 1, Skipped: 6, Time elapsed: 2.558 sec <<< FAILURE! - in org.nuxeo.ecm.core.TestSQLRepositoryAPI testCopy(org.nuxeo.ecm.core.TestSQLRepositoryAPI) Time elapsed: 0.009 sec <<< ERROR! org.nuxeo.ecm.core.api.ClientException: Failed to copy document: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437 at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:435) at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:441) at org.nuxeo.ecm.core.TestSQLRepositoryAPI.testCopy(TestSQLRepositoryAPI.java:2197) ... Caused by: org.nuxeo.ecm.core.api.DocumentException: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437 at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.copy(SQLSession.java:328) at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:418) ... 50 more Caused by: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437 at org.nuxeo.ecm.core.storage.sql.PersistenceContext.checkFreeName(PersistenceContext.java:1290) at org.nuxeo.ecm.core.storage.sql.PersistenceContext.copy(PersistenceContext.java:1346) at org.nuxeo.ecm.core.storage.sql.SessionImpl.copy(SessionImpl.java:1015) at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.copy(ConnectionImpl.java:271) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.copy(SQLSession.java:325) ... 51 more
This is due to the fact that copy() tries to find a free name if copying to a folder with a document of the same name as the source. But if the test runs really fast and the second copy happens in the same millisecond as the first one, we get the same name chosen twice in SQLSession.findFreeName.