Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

101658: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      101404: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         101273: Merged DEV to V4.2-GUB-FIX (4.2.5)
            100792 : MNT-13722 : CLONE - Ghost versions when Document is created with CheckinType CHECKOUT
               - Added init-method for CMISConnector. Test is added,
      101597: Merged DEV to 5.0.N (5.0.2)
         101560 : MNT-13813 : CLONE - Ghost versions when Document is created with CheckinType CHECKOUT
            - Fix to test failure


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@101705 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tatyana Valkevych
2015-04-10 21:18:10 +00:00
parent e4cdb0c431
commit 5df0a574c2

View File

@@ -125,6 +125,7 @@ import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.test.AssertThrows;
public class TestCMIS extends EnterpriseTestApi
{
@@ -1049,7 +1050,6 @@ public class TestCMIS extends EnterpriseTestApi
String siteName = "site" + System.currentTimeMillis();
SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PRIVATE);
TestSite site = repoService.createSite(null, siteInfo);
String name = GUID.generate();
NodeRef folderNodeRef = repoService.createFolder(site.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), name);
folders.add(folderNodeRef);
@@ -2333,4 +2333,52 @@ public class TestCMIS extends EnterpriseTestApi
}
}
}
@Test
public void testDoNotShowCheckedOutedNodeInFolder() throws Exception
{
final TestNetwork network = getTestFixture().getRandomNetwork();
String username = String.format(TEST_USER_NAME_PATTERN, System.currentTimeMillis());
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null, null, null, null, null, null);
TestPerson person = network.createUser(personInfo);
String personId = person.getId();
final String siteName = String.format(TEST_SITE_NAME_PATTERN, System.currentTimeMillis());
TenantUtil.runAsUserTenant(new TenantRunAsWork<TestSite>()
{
@Override
public TestSite doWork() throws Exception
{
SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PRIVATE);
return repoService.createSite(null, siteInfo);
}
}, personId, network.getId());
publicApiClient.setRequestContext(new RequestContext(network.getId(), personId));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_11);
Folder docLibrary = (Folder) cmisSession.getObjectByPath(String.format(DOCUMENT_LIBRARY_PATH_PATTERN, siteName));
assertEquals(0, docLibrary.getChildren().getTotalNumItems());
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);
docLibrary.createDocument(properties, fileContent, VersioningState.CHECKEDOUT);
// there should be only one document
assertEquals(1, docLibrary.getChildren().getTotalNumItems());
Document obj = (Document)docLibrary.getChildren().iterator().next();
// and it should be a PWC
assertTrue(obj.isPrivateWorkingCopy());
}
}