mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
MNT-16449: CMIS delete version fails on versions other than latest (most recent) version
- add commented-out test to demonstrate the issue (we can then decide to prioritise accordingly) - note: this scenario works via V1 REST API git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130525 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.api.tests;
|
package org.alfresco.rest.api.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -2229,6 +2229,82 @@ public class TestCMIS extends EnterpriseTestApi
|
|||||||
}
|
}
|
||||||
assertTrue("The aspects should have P:cm:generalclassifiable", mandatoryAspects.contains("P:cm:generalclassifiable"));
|
assertTrue("The aspects should have P:cm:generalclassifiable", mandatoryAspects.contains("P:cm:generalclassifiable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO comment-in once we have fixed MNT-16449 - CMIS delete version fails on versions other than latest (most recent) version
|
||||||
|
/*
|
||||||
|
@Test
|
||||||
|
public void testMNT_16449() throws Exception
|
||||||
|
{
|
||||||
|
final TestNetwork network1 = getTestFixture().getRandomNetwork();
|
||||||
|
|
||||||
|
String username = "user" + System.currentTimeMillis();
|
||||||
|
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null,
|
||||||
|
null, null, null, null, null);
|
||||||
|
TestPerson person = network1.createUser(personInfo);
|
||||||
|
String personId = person.getId();
|
||||||
|
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
|
||||||
|
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.browser, CMIS_VERSION_11,
|
||||||
|
"org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
|
||||||
|
|
||||||
|
Folder homeFolder = (Folder)cmisSession.getObjectByPath("/User Homes/" + personId);
|
||||||
|
assertNotNull(homeFolder.getId());
|
||||||
|
|
||||||
|
// create a doc
|
||||||
|
String name = String.format(TEST_DOCUMENT_NAME_PATTERN, GUID.generate());
|
||||||
|
|
||||||
|
Map<String, Object> properties = new HashMap<String, Object>();
|
||||||
|
properties.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
|
||||||
|
properties.put(PropertyIds.NAME, name);
|
||||||
|
|
||||||
|
ContentStreamImpl fileContent = new ContentStreamImpl();
|
||||||
|
ByteArrayInputStream stream = new ByteArrayInputStream(GUID.generate().getBytes());
|
||||||
|
fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||||
|
fileContent.setStream(stream);
|
||||||
|
|
||||||
|
Document doc = homeFolder.createDocument(properties, fileContent, VersioningState.MAJOR);
|
||||||
|
|
||||||
|
String versionLabel = doc.getVersionLabel();
|
||||||
|
assertEquals("1.0", versionLabel);
|
||||||
|
|
||||||
|
Document docVersionToDelete = null;
|
||||||
|
Document latestDoc = doc;
|
||||||
|
|
||||||
|
int cnt = 4;
|
||||||
|
for (int i = 1; i <= cnt; i++)
|
||||||
|
{
|
||||||
|
// update content to create new versions (1.1, 1.2, 1.3, 1.4)
|
||||||
|
fileContent = new ContentStreamImpl();
|
||||||
|
{
|
||||||
|
ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
|
||||||
|
writer.putContent("Ipsum and so on and so on "+i);
|
||||||
|
ContentReader reader = writer.getReader();
|
||||||
|
fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||||
|
fileContent.setStream(reader.getContentInputStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
latestDoc.setContentStream(fileContent, true);
|
||||||
|
|
||||||
|
latestDoc = latestDoc.getObjectOfLatestVersion(false);
|
||||||
|
versionLabel = latestDoc.getVersionLabel();
|
||||||
|
assertEquals("1."+i, versionLabel);
|
||||||
|
|
||||||
|
assertEquals(1+i, cmisSession.getAllVersions(latestDoc.getId()).size());
|
||||||
|
|
||||||
|
if (i == 2)
|
||||||
|
{
|
||||||
|
docVersionToDelete = latestDoc; // ie. 1.2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO this fails unless we fix MNT-16449 (note: deleting the latest version 1.4 works ok)
|
||||||
|
// delete 1.2
|
||||||
|
docVersionToDelete.delete(false);
|
||||||
|
|
||||||
|
// eg. 1.0, 1.2, 1.3, 1.4 (not 1.1)
|
||||||
|
assertEquals(cnt, cmisSession.getAllVersions(doc.getId()).size());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMnt11631() throws Exception
|
public void testMnt11631() throws Exception
|
||||||
|
Reference in New Issue
Block a user