Search in sources :

Example 26 with TestSite

use of org.alfresco.rest.api.tests.RepoService.TestSite in project alfresco-remote-api by Alfresco.

the class TestCMIS method testAspects.

@Test
public void testAspects() 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 person1 = network1.createUser(personInfo);
    String person1Id = person1.getId();
    final List<NodeRef> folders = new ArrayList<NodeRef>();
    final List<NodeRef> documents = new ArrayList<NodeRef>();
    TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

        @Override
        public Void doWork() throws Exception {
            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);
            for (int i = 0; i < 3; i++) {
                name = GUID.generate();
                NodeRef docNodeRef = repoService.createDocument(folderNodeRef, name, "test content");
                assertFalse(repoService.getAspects(docNodeRef).contains(ContentModel.ASPECT_TITLED));
                documents.add(docNodeRef);
            }
            return null;
        }
    }, person1Id, network1.getId());
    final NodeRef doc1NodeRef = documents.get(0);
    final NodeRef doc2NodeRef = documents.get(1);
    final NodeRef doc3NodeRef = documents.get(2);
    publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
    CmisSession atomCmisSession10 = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
    CmisSession atomCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_11);
    CmisSession browserCmisSession11 = publicApiClient.createPublicApiCMISSession(Binding.browser, CMIS_VERSION_11);
    // Test that adding aspects works for both 1.0 and 1.1
    // 1.0
    {
        AlfrescoDocument doc = (AlfrescoDocument) atomCmisSession10.getObject(doc1NodeRef.getId());
        doc = (AlfrescoDocument) doc.addAspect("P:cm:titled");
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc1NodeRef);
                assertTrue("Missing aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                return null;
            }
        }, person1Id, network1.getId());
        doc.removeAspect("P:cm:titled");
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc1NodeRef);
                assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                return null;
            }
        }, person1Id, network1.getId());
    }
    // 1.1 atom (secondary types)
    {
        final Document doc = (Document) atomCmisSession11.getObject(doc2NodeRef.getId());
        final List<SecondaryType> secondaryTypesList = doc.getSecondaryTypes();
        final List<String> secondaryTypes = new ArrayList<String>();
        if (secondaryTypesList != null) {
            for (SecondaryType secondaryType : secondaryTypesList) {
                secondaryTypes.add(secondaryType.getId());
            }
        }
        secondaryTypes.add("P:sys:temporary");
        secondaryTypes.add("P:cm:titled");
        Map<String, Object> properties = new HashMap<String, Object>();
        {
            // create a document with 2 secondary types
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc1 = (Document) doc.updateProperties(properties);
        checkSecondaryTypes(doc1, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:titled" })), null);
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc2NodeRef);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                return null;
            }
        }, person1Id, network1.getId());
        secondaryTypes.add("P:cm:author");
        properties = new HashMap<String, Object>();
        {
            // create a document with 2 secondary types
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc2 = (Document) doc1.updateProperties(properties);
        checkSecondaryTypes(doc2, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:titled", "P:cm:author" })), null);
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc2NodeRef);
                String title = (String) repoService.getProperty(doc2NodeRef, ContentModel.PROP_TITLE);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                assertEquals(null, title);
                return null;
            }
        }, person1Id, network1.getId());
        // remove a secondary type
        secondaryTypes.remove("P:cm:titled");
        properties = new HashMap<String, Object>();
        {
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc3 = (Document) doc2.updateProperties(properties);
        checkSecondaryTypes(doc3, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:author" })), new HashSet<String>(Arrays.asList(new String[] { "P:cm:titled" })));
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc2NodeRef);
                String title = (String) repoService.getProperty(doc2NodeRef, ContentModel.PROP_TITLE);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                assertEquals(null, title);
                return null;
            }
        }, person1Id, network1.getId());
    }
    // 1.1 browser (secondary types)
    {
        Document doc = (Document) browserCmisSession11.getObject(doc3NodeRef.getId());
        final List<SecondaryType> secondaryTypesList = doc.getSecondaryTypes();
        final List<String> secondaryTypes = new ArrayList<String>();
        if (secondaryTypesList != null) {
            for (SecondaryType secondaryType : secondaryTypesList) {
                secondaryTypes.add(secondaryType.getId());
            }
        }
        secondaryTypes.add("P:sys:temporary");
        secondaryTypes.add("P:cm:titled");
        Map<String, Object> properties = new HashMap<String, Object>();
        {
            // create a document with 2 secondary types
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc1 = (Document) doc.updateProperties(properties);
        checkSecondaryTypes(doc1, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:titled" })), null);
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc3NodeRef);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                return null;
            }
        }, person1Id, network1.getId());
        secondaryTypes.add("P:cm:author");
        properties = new HashMap<String, Object>();
        {
            // create a document with 2 secondary types
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc2 = (Document) doc1.updateProperties(properties);
        checkSecondaryTypes(doc2, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:titled", "P:cm:author" })), null);
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc3NodeRef);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
                return null;
            }
        }, person1Id, network1.getId());
        secondaryTypes.remove("P:cm:titled");
        properties = new HashMap<String, Object>();
        {
            // create a document with 2 secondary types
            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        }
        Document doc3 = (Document) doc2.updateProperties(properties);
        checkSecondaryTypes(doc3, new HashSet<String>(Arrays.asList(new String[] { "P:sys:temporary", "P:cm:author" })), new HashSet<String>(Arrays.asList(new String[] { "P:cm:titled" })));
        TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

            @Override
            public Void doWork() throws Exception {
                Set<QName> aspects = repoService.getAspects(doc3NodeRef);
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_AUTHOR));
                assertTrue("Missing aspects in current set " + aspects, aspects.contains(ContentModel.ASPECT_TEMPORARY));
                assertFalse("Unexpected aspect in current set " + aspects, aspects.contains(ContentModel.ASPECT_TITLED));
                return null;
            }
        }, person1Id, network1.getId());
    }
}
Also used : AlfrescoDocument(org.alfresco.cmis.client.AlfrescoDocument) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AlfrescoDocument(org.alfresco.cmis.client.AlfrescoDocument) Document(org.apache.chemistry.opencmis.client.api.Document) NodeRef(org.alfresco.service.cmr.repository.NodeRef) SiteInformation(org.alfresco.rest.api.tests.RepoService.SiteInformation) ArrayList(java.util.ArrayList) AbstractList(java.util.AbstractList) List(java.util.List) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) HashSet(java.util.HashSet) AlfrescoObjectFactoryImpl(org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl) CmisSession(org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession) SecondaryType(org.apache.chemistry.opencmis.client.api.SecondaryType) TestSite(org.alfresco.rest.api.tests.RepoService.TestSite) QName(org.alfresco.service.namespace.QName) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisPermissionDeniedException(org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) TenantRunAsWork(org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork) TestNetwork(org.alfresco.rest.api.tests.RepoService.TestNetwork) FileableCmisObject(org.apache.chemistry.opencmis.client.api.FileableCmisObject) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) TestPerson(org.alfresco.rest.api.tests.RepoService.TestPerson) Map(java.util.Map) MimetypeMap(org.alfresco.repo.content.MimetypeMap) HashMap(java.util.HashMap) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 27 with TestSite

use of org.alfresco.rest.api.tests.RepoService.TestSite in project alfresco-remote-api by Alfresco.

the class TestCMIS method testCMIS.

/**
 * Tests OpenCMIS api.
 */
@SuppressWarnings("unchecked")
@Test
public void testCMIS() throws Exception {
    // Test Case cloud-2353
    // Test Case cloud-2354
    // Test Case cloud-2356
    // Test Case cloud-2378
    // Test Case cloud-2357
    // Test Case cloud-2358
    // Test Case cloud-2360
    final TestNetwork network1 = getTestFixture().getRandomNetwork();
    Iterator<String> personIt = network1.getPersonIds().iterator();
    final String personId = personIt.next();
    assertNotNull(personId);
    Person person = repoService.getPerson(personId);
    assertNotNull(person);
    // Create a site
    final TestSite site = TenantUtil.runAsUserTenant(new TenantRunAsWork<TestSite>() {

        @Override
        public TestSite doWork() throws Exception {
            String siteName = "site" + System.currentTimeMillis();
            SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PRIVATE);
            TestSite site = network1.createSite(siteInfo);
            return site;
        }
    }, personId, network1.getId());
    publicApiClient.setRequestContext(new RequestContext(network1.getId(), personId));
    CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
    Nodes nodesProxy = publicApiClient.nodes();
    Comments commentsProxy = publicApiClient.comments();
    String expectedContent = "Ipsum and so on";
    Document doc = null;
    Folder documentLibrary = (Folder) cmisSession.getObjectByPath("/Sites/" + site.getSiteId() + "/documentLibrary");
    FolderNode expectedDocumentLibrary = (FolderNode) CMISNode.createNode(documentLibrary);
    Document testDoc = null;
    Folder testFolder = null;
    FolderNode testFolderNode = null;
    // create some sub-folders and documents
    {
        for (int i = 0; i < 3; i++) {
            Map<String, String> properties = new HashMap<String, String>();
            {
                properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
                properties.put(PropertyIds.NAME, "folder-" + i);
            }
            Folder f = documentLibrary.createFolder(properties);
            FolderNode fn = (FolderNode) CMISNode.createNode(f);
            if (testFolder == null) {
                testFolder = f;
                testFolderNode = fn;
            }
            expectedDocumentLibrary.addFolder(fn);
            for (int k = 0; k < 3; k++) {
                properties = new HashMap<String, String>();
                {
                    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
                    properties.put(PropertyIds.NAME, "folder-" + k);
                }
                Folder f1 = f.createFolder(properties);
                FolderNode childFolder = (FolderNode) CMISNode.createNode(f1);
                fn.addFolder(childFolder);
            }
            for (int j = 0; j < 3; j++) {
                properties = new HashMap<String, String>();
                {
                    properties.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
                    properties.put(PropertyIds.NAME, "doc-" + j);
                }
                ContentStreamImpl fileContent = new ContentStreamImpl();
                {
                    ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
                    writer.putContent(expectedContent);
                    ContentReader reader = writer.getReader();
                    fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
                    fileContent.setStream(reader.getContentInputStream());
                }
                Document d = f.createDocument(properties, fileContent, VersioningState.MAJOR);
                if (testDoc == null) {
                    testDoc = d;
                }
                CMISNode childDocument = CMISNode.createNode(d);
                fn.addNode(childDocument);
            }
        }
        for (int i = 0; i < 10; i++) {
            Map<String, String> properties = new HashMap<String, String>();
            {
                properties.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
                properties.put(PropertyIds.NAME, "doc-" + i);
            }
            ContentStreamImpl fileContent = new ContentStreamImpl();
            {
                ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
                writer.putContent(expectedContent);
                ContentReader reader = writer.getReader();
                fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
                fileContent.setStream(reader.getContentInputStream());
            }
            documentLibrary.createDocument(properties, fileContent, VersioningState.MAJOR);
        }
    }
    // try to add and remove ratings, comments, tags to folders created by CMIS
    {
        Aggregate aggregate = new Aggregate(1, null);
        NodeRating expectedNodeRating = new NodeRating("likes", true, aggregate);
        Comment expectedComment = new Comment("commenty", "commenty", false, null, person, person);
        Tag expectedTag = new Tag("taggy");
        NodeRating rating = nodesProxy.createNodeRating(testFolder.getId(), expectedNodeRating);
        expectedNodeRating.expected(rating);
        assertNotNull(rating.getId());
        // REPO-2028 - remove lucene tests
        // Tag tag = nodesProxy.createNodeTag(testFolder.getId(), expectedTag);
        // expectedTag.expected(tag);
        // assertNotNull(tag.getId());
        Comment comment = commentsProxy.createNodeComment(testFolder.getId(), expectedComment);
        expectedComment.expected(comment);
        assertNotNull(comment.getId());
    }
    // try to add and remove ratings, comments, tags to documents created by CMIS
    {
        Aggregate aggregate = new Aggregate(1, null);
        NodeRating expectedNodeRating = new NodeRating("likes", true, aggregate);
        Comment expectedComment = new Comment("commenty", "commenty", false, null, person, person);
        Tag expectedTag = new Tag("taggy");
        NodeRating rating = nodesProxy.createNodeRating(testDoc.getId(), expectedNodeRating);
        expectedNodeRating.expected(rating);
        assertNotNull(rating.getId());
        // REPO-2028 - remove lucene tests
        // Tag tag = nodesProxy.createNodeTag(testDoc.getId(), expectedTag);
        // expectedTag.expected(tag);
        // assertNotNull(tag.getId());
        Comment comment = commentsProxy.createNodeComment(testDoc.getId(), expectedComment);
        expectedComment.expected(comment);
        assertNotNull(comment.getId());
    }
    // descendants
    {
        List<Tree<FileableCmisObject>> descendants = documentLibrary.getDescendants(4);
        expectedDocumentLibrary.checkDescendants(descendants);
    }
    // upload/setContent
    {
        Map<String, String> fileProps = new HashMap<String, String>();
        {
            fileProps.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
            fileProps.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
        }
        ContentStreamImpl fileContent = new ContentStreamImpl();
        {
            ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
            writer.putContent(expectedContent);
            ContentReader reader = writer.getReader();
            fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
            fileContent.setStream(reader.getContentInputStream());
        }
        doc = documentLibrary.createDocument(fileProps, fileContent, VersioningState.MAJOR);
        String nodeId = stripCMISSuffix(doc.getId());
        final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
        ContentReader reader = TenantUtil.runAsUserTenant(new TenantRunAsWork<ContentReader>() {

            @Override
            public ContentReader doWork() throws Exception {
                ContentReader reader = repoService.getContent(nodeRef, ContentModel.PROP_CONTENT);
                return reader;
            }
        }, personId, network1.getId());
        String actualContent = reader.getContentString();
        assertEquals(expectedContent, actualContent);
    }
    // get content
    {
        ContentStream stream = doc.getContentStream();
        StringWriter writer = new StringWriter();
        IOUtils.copy(stream.getStream(), writer, "UTF-8");
        String actualContent = writer.toString();
        assertEquals(expectedContent, actualContent);
    }
    // get children
    {
        Folder folder = (Folder) cmisSession.getObjectByPath("/Sites/" + site.getSiteId() + "/documentLibrary/" + testFolder.getName());
        ItemIterable<CmisObject> children = folder.getChildren();
        testFolderNode.checkChildren(children);
    }
    // REPO-2028 - remove lucene tests
    // query
    // {
    // Folder folder = (Folder)cmisSession.getObjectByPath("/Sites/" + site.getSiteId() + "/documentLibrary/" + testFolder.getName());
    // String folderId = folder.getId();
    // 
    // Set<String> expectedFolderNames = new HashSet<String>();
    // for(CMISNode n : testFolderNode.getFolderNodes().values())
    // {
    // expectedFolderNames.add((String)n.getProperty("cmis:name"));
    // }
    // int expectedNumFolders = expectedFolderNames.size();
    // int numMatchingFoldersFound = 0;
    // List<CMISNode> results = cmisSession.query("SELECT * FROM cmis:folder WHERE IN_TREE('" + folderId + "')", false, 0, Integer.MAX_VALUE);
    // for(CMISNode node : results)
    // {
    // String name = (String)node.getProperties().get("cmis:name");
    // if(expectedFolderNames.contains(name))
    // {
    // numMatchingFoldersFound++;
    // }
    // }
    // assertEquals(expectedNumFolders, numMatchingFoldersFound);
    // 
    // Set<String> expectedDocNames = new HashSet<String>();
    // for(CMISNode n : testFolderNode.getDocumentNodes().values())
    // {
    // expectedDocNames.add((String)n.getProperty("cmis:name"));
    // }
    // int expectedNumDocs = expectedDocNames.size();
    // int numMatchingDocsFound = 0;
    // results = cmisSession.query("SELECT * FROM cmis:document where IN_TREE('" + folderId + "')", false, 0, Integer.MAX_VALUE);
    // for(CMISNode node : results)
    // {
    // String name = (String)node.getProperties().get("cmis:name");
    // if(expectedDocNames.contains(name))
    // {
    // numMatchingDocsFound++;
    // }
    // }
    // assertEquals(expectedNumDocs, numMatchingDocsFound);
    // }
    // versioning
    {
        String nodeId = stripCMISSuffix(doc.getId());
        final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
        // checkout
        ObjectId pwcId = doc.checkOut();
        Document pwc = (Document) cmisSession.getObject(pwcId.getId());
        Boolean isCheckedOut = TenantUtil.runAsUserTenant(new TenantRunAsWork<Boolean>() {

            @Override
            public Boolean doWork() throws Exception {
                Boolean isCheckedOut = repoService.isCheckedOut(nodeRef);
                return isCheckedOut;
            }
        }, personId, network1.getId());
        assertTrue(isCheckedOut);
        // checkin with new content
        expectedContent = "Big bad wolf";
        ContentStreamImpl fileContent = new ContentStreamImpl();
        {
            ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
            writer.putContent(expectedContent);
            ContentReader reader = writer.getReader();
            fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
            fileContent.setStream(reader.getContentInputStream());
        }
        ObjectId checkinId = pwc.checkIn(true, Collections.EMPTY_MAP, fileContent, "checkin 1");
        doc = (Document) cmisSession.getObject(checkinId.getId());
        isCheckedOut = TenantUtil.runAsUserTenant(new TenantRunAsWork<Boolean>() {

            @Override
            public Boolean doWork() throws Exception {
                Boolean isCheckedOut = repoService.isCheckedOut(nodeRef);
                return isCheckedOut;
            }
        }, personId, network1.getId());
        assertFalse(isCheckedOut);
        // check that the content has been updated
        ContentStream stream = doc.getContentStream();
        StringWriter writer = new StringWriter();
        IOUtils.copy(stream.getStream(), writer, "UTF-8");
        String actualContent = writer.toString();
        assertEquals(expectedContent, actualContent);
        List<Document> allVersions = doc.getAllVersions();
        assertEquals(2, allVersions.size());
        assertEquals("2.0", allVersions.get(0).getVersionLabel());
        assertEquals(CMIS_VERSION_10, allVersions.get(1).getVersionLabel());
    }
    {
        // https://issues.alfresco.com/jira/browse/PUBLICAPI-95
        // Test that documents are created with autoVersion=true
        Map<String, String> fileProps = new HashMap<String, String>();
        {
            fileProps.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
            fileProps.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
        }
        ContentStreamImpl fileContent = new ContentStreamImpl();
        {
            ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
            writer.putContent("Ipsum and so on");
            ContentReader reader = writer.getReader();
            fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
            fileContent.setStream(reader.getContentInputStream());
        }
        {
            // a versioned document
            Document autoVersionedDoc = documentLibrary.createDocument(fileProps, fileContent, VersioningState.MAJOR);
            String objectId = autoVersionedDoc.getId();
            String bareObjectId = stripCMISSuffix(objectId);
            final NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, bareObjectId);
            Boolean autoVersion = TenantUtil.runAsUserTenant(new TenantRunAsWork<Boolean>() {

                @Override
                public Boolean doWork() throws Exception {
                    Boolean autoVersion = (Boolean) repoService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION);
                    return autoVersion;
                }
            }, personId, network1.getId());
            assertEquals(Boolean.TRUE, autoVersion);
        }
        // https://issues.alfresco.com/jira/browse/PUBLICAPI-92
        // Test that a get on an objectId without a version suffix returns the current version of the document
        {
            // do a few checkout, checkin cycles to create some versions
            fileProps = new HashMap<String, String>();
            {
                fileProps.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
                fileProps.put(PropertyIds.NAME, "mydoc-" + GUID.generate() + ".txt");
            }
            Document autoVersionedDoc = documentLibrary.createDocument(fileProps, fileContent, VersioningState.MAJOR);
            String objectId = autoVersionedDoc.getId();
            String bareObjectId = stripCMISSuffix(objectId);
            for (int i = 0; i < 3; i++) {
                Document doc1 = (Document) cmisSession.getObject(bareObjectId);
                ObjectId pwcId = doc1.checkOut();
                Document pwc = (Document) cmisSession.getObject(pwcId.getId());
                ContentStreamImpl contentStream = new ContentStreamImpl();
                {
                    ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
                    expectedContent = GUID.generate();
                    writer.putContent(expectedContent);
                    ContentReader reader = writer.getReader();
                    contentStream.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
                    contentStream.setStream(reader.getContentInputStream());
                }
                pwc.checkIn(true, Collections.EMPTY_MAP, contentStream, "checkin " + i);
            }
            // get the object, supplying an objectId without a version suffix
            Document doc1 = (Document) cmisSession.getObject(bareObjectId);
            String versionLabel = doc1.getVersionLabel();
            ContentStream cs = doc1.getContentStream();
            String content = IOUtils.toString(cs.getStream());
            assertEquals("4.0", versionLabel);
            assertEquals(expectedContent, content);
        }
    }
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) CMISNode(org.alfresco.rest.api.tests.client.data.CMISNode) FolderNode(org.alfresco.rest.api.tests.client.data.FolderNode) HashMap(java.util.HashMap) AlfrescoDocument(org.alfresco.cmis.client.AlfrescoDocument) Document(org.apache.chemistry.opencmis.client.api.Document) AlfrescoFolder(org.alfresco.cmis.client.AlfrescoFolder) Folder(org.apache.chemistry.opencmis.client.api.Folder) NodeRating(org.alfresco.rest.api.tests.client.data.NodeRating) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentStream(org.apache.chemistry.opencmis.commons.data.ContentStream) StringWriter(java.io.StringWriter) SiteInformation(org.alfresco.rest.api.tests.RepoService.SiteInformation) ArrayList(java.util.ArrayList) AbstractList(java.util.AbstractList) List(java.util.List) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) FileableCmisObject(org.apache.chemistry.opencmis.client.api.FileableCmisObject) Comment(org.alfresco.rest.api.tests.client.data.Comment) AlfrescoObjectFactoryImpl(org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl) CmisSession(org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession) ObjectId(org.apache.chemistry.opencmis.client.api.ObjectId) TestSite(org.alfresco.rest.api.tests.RepoService.TestSite) Comments(org.alfresco.rest.api.tests.client.PublicApiClient.Comments) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) ContentReader(org.alfresco.service.cmr.repository.ContentReader) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisPermissionDeniedException(org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) Nodes(org.alfresco.rest.api.tests.client.PublicApiClient.Nodes) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) TenantRunAsWork(org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork) TestNetwork(org.alfresco.rest.api.tests.RepoService.TestNetwork) ItemIterable(org.apache.chemistry.opencmis.client.api.ItemIterable) Tag(org.alfresco.rest.api.tests.client.data.Tag) Aggregate(org.alfresco.rest.api.tests.client.data.NodeRating.Aggregate) Person(org.alfresco.rest.api.tests.client.data.Person) TestPerson(org.alfresco.rest.api.tests.RepoService.TestPerson) Map(java.util.Map) MimetypeMap(org.alfresco.repo.content.MimetypeMap) HashMap(java.util.HashMap) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 28 with TestSite

use of org.alfresco.rest.api.tests.RepoService.TestSite in project alfresco-remote-api by Alfresco.

the class TestCMIS method testSecondaryTypes.

@Test
public void testSecondaryTypes() 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 person1 = network1.createUser(personInfo);
    String person1Id = person1.getId();
    final String siteName = "site" + System.currentTimeMillis();
    TenantUtil.runAsUserTenant(new TenantRunAsWork<NodeRef>() {

        @Override
        public NodeRef doWork() throws Exception {
            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);
            return folderNodeRef;
        }
    }, person1Id, network1.getId());
    // Create a document...
    publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
    CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_11);
    Folder docLibrary = (Folder) cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
    String name = "mydoc-" + GUID.generate() + ".txt";
    final List<String> secondaryTypes = new ArrayList<String>();
    secondaryTypes.add("P:cm:summarizable");
    Map<String, Object> properties = new HashMap<String, Object>();
    {
        // create a document with 2 aspects
        properties.put(PropertyIds.OBJECT_TYPE_ID, TYPE_CMIS_DOCUMENT);
        properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
        properties.put("cm:summary", "My summary");
        properties.put(PropertyIds.NAME, name);
    }
    ContentStreamImpl fileContent = new ContentStreamImpl();
    {
        ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
        writer.putContent("Ipsum and so on");
        ContentReader reader = writer.getReader();
        fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
        fileContent.setStream(reader.getContentInputStream());
    }
    Document doc = docLibrary.createDocument(properties, fileContent, VersioningState.MAJOR);
    {
        // check that the secondary types and properties are present
        {
            checkSecondaryTypes(doc, Collections.singleton("P:cm:summarizable"), null);
            String summary = (String) doc.getProperty("cm:summary").getFirstValue();
            assertEquals("My summary", summary);
        }
        {
            doc = (Document) cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary/" + name);
            checkSecondaryTypes(doc, Collections.singleton("P:cm:summarizable"), null);
            String summary = (String) doc.getProperty("cm:summary").getFirstValue();
            assertEquals("My summary", summary);
        }
    }
    // update property and check
    {
        properties = new HashMap<String, Object>();
        {
            properties.put("cm:summary", "My updated summary");
        }
        doc.updateProperties(properties);
        {
            doc = (Document) cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary/" + name);
            checkSecondaryTypes(doc, Collections.singleton("P:cm:summarizable"), null);
            String summary = (String) doc.getProperty("cm:summary").getFirstValue();
            assertEquals("My updated summary", summary);
        }
        {
            checkSecondaryTypes(doc, Collections.singleton("P:cm:summarizable"), null);
            String summary = (String) doc.getProperty("cm:summary").getFirstValue();
            assertEquals("My updated summary", summary);
        }
    }
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) CmisSession(org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession) HashMap(java.util.HashMap) TestSite(org.alfresco.rest.api.tests.RepoService.TestSite) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) ContentReader(org.alfresco.service.cmr.repository.ContentReader) ArrayList(java.util.ArrayList) AlfrescoFolder(org.alfresco.cmis.client.AlfrescoFolder) Folder(org.apache.chemistry.opencmis.client.api.Folder) AlfrescoDocument(org.alfresco.cmis.client.AlfrescoDocument) Document(org.apache.chemistry.opencmis.client.api.Document) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisPermissionDeniedException(org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) SiteInformation(org.alfresco.rest.api.tests.RepoService.SiteInformation) TestNetwork(org.alfresco.rest.api.tests.RepoService.TestNetwork) FileableCmisObject(org.apache.chemistry.opencmis.client.api.FileableCmisObject) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) TestPerson(org.alfresco.rest.api.tests.RepoService.TestPerson) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 29 with TestSite

use of org.alfresco.rest.api.tests.RepoService.TestSite in project alfresco-remote-api by Alfresco.

the class TestCMIS method testPublicApi110.

@Test
public void testPublicApi110() throws Exception {
    Iterator<TestNetwork> networksIt = getTestFixture().networksIterator();
    final TestNetwork network1 = networksIt.next();
    Iterator<String> personIt = network1.getPersonIds().iterator();
    final String person1Id = personIt.next();
    final String person2Id = personIt.next();
    final List<NodeRef> nodes = new ArrayList<NodeRef>(5);
    // Create some favourite targets, sites, files and folders
    TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>() {

        @Override
        public Void doWork() throws Exception {
            String siteName1 = "site" + GUID.generate();
            SiteInformation siteInfo1 = new SiteInformation(siteName1, siteName1, siteName1, SiteVisibility.PUBLIC);
            TestSite site1 = network1.createSite(siteInfo1);
            String siteName2 = "site" + GUID.generate();
            SiteInformation siteInfo2 = new SiteInformation(siteName2, siteName2, siteName2, SiteVisibility.PRIVATE);
            TestSite site2 = network1.createSite(siteInfo2);
            NodeRef nodeRef1 = repoService.createDocument(site1.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc1", "Test Doc1 Title", "Test Doc1 Description", "Test Content");
            nodes.add(nodeRef1);
            NodeRef nodeRef2 = repoService.createDocument(site1.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc2", "Test Doc2 Title", "Test Doc2 Description", "Test Content");
            nodes.add(nodeRef2);
            NodeRef nodeRef3 = repoService.createDocument(site2.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc2", "Test Doc2 Title", "Test Doc2 Description", "Test Content");
            nodes.add(nodeRef3);
            repoService.createAssociation(nodeRef2, nodeRef1, ASSOC_ORIGINAL);
            repoService.createAssociation(nodeRef3, nodeRef1, ASSOC_ORIGINAL);
            site1.inviteToSite(person2Id, SiteRole.SiteCollaborator);
            return null;
        }
    }, person1Id, network1.getId());
    {
        OperationContext cmisOperationCtxOverride = new OperationContextImpl();
        cmisOperationCtxOverride.setIncludeRelationships(IncludeRelationships.BOTH);
        publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2Id, cmisOperationCtxOverride));
        CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
        CmisObject o1 = cmisSession.getObject(nodes.get(0).getId());
        List<Relationship> relationships = o1.getRelationships();
        assertEquals(1, relationships.size());
        Relationship r = relationships.get(0);
        CmisObject source = r.getSource();
        CmisObject target = r.getTarget();
        String sourceVersionSeriesId = (String) source.getProperty(PropertyIds.VERSION_SERIES_ID).getFirstValue();
        String targetVersionSeriesId = (String) target.getProperty(PropertyIds.VERSION_SERIES_ID).getFirstValue();
        assertEquals(nodes.get(1).getId(), sourceVersionSeriesId);
        assertEquals(nodes.get(0).getId(), targetVersionSeriesId);
    }
}
Also used : OperationContext(org.apache.chemistry.opencmis.client.api.OperationContext) CmisSession(org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession) TestSite(org.alfresco.rest.api.tests.RepoService.TestSite) ArrayList(java.util.ArrayList) OperationContextImpl(org.apache.chemistry.opencmis.client.runtime.OperationContextImpl) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisPermissionDeniedException(org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) NodeRef(org.alfresco.service.cmr.repository.NodeRef) SiteInformation(org.alfresco.rest.api.tests.RepoService.SiteInformation) Relationship(org.apache.chemistry.opencmis.client.api.Relationship) TestNetwork(org.alfresco.rest.api.tests.RepoService.TestNetwork) FileableCmisObject(org.apache.chemistry.opencmis.client.api.FileableCmisObject) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) ArrayList(java.util.ArrayList) AbstractList(java.util.AbstractList) List(java.util.List) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 30 with TestSite

use of org.alfresco.rest.api.tests.RepoService.TestSite in project alfresco-remote-api by Alfresco.

the class TestCMIS method testMNT_13057.

@Test
public void testMNT_13057() 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 person1 = network1.createUser(personInfo);
    String person1Id = person1.getId();
    String guid = GUID.generate();
    String name = guid + "_KRUIS_LOGO_100%_PMS.txt";
    String urlFileName = guid + "_KRUIS_LOGO_100%25_PMS.txt";
    final String siteName = "site" + System.currentTimeMillis();
    TenantUtil.runAsUserTenant(new TenantRunAsWork<NodeRef>() {

        @Override
        public NodeRef doWork() throws Exception {
            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);
            return folderNodeRef;
        }
    }, person1Id, network1.getId());
    // Create a document...
    publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
    CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_11);
    Folder docLibrary = (Folder) cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary");
    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();
    {
        ContentWriter writer = new FileContentWriter(TempFileProvider.createTempFile(GUID.generate(), ".txt"));
        writer.putContent("Ipsum");
        ContentReader reader = writer.getReader();
        fileContent.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
        fileContent.setStream(reader.getContentInputStream());
    }
    /* Create document */
    Document doc = docLibrary.createDocument(properties, fileContent, VersioningState.MAJOR);
    String id = doc.getId();
    assertNotNull(id);
    Map<String, String> params = new HashMap<String, String>();
    params.put("id", URLEncoder.encode(id));
    urlFileName += "?id=" + URLEncoder.encode(id);
    HttpResponse response = publicApiClient.get(network1.getId() + "/public/cmis/versions/1.1/atom/content/" + urlFileName, null);
    assertEquals(200, response.getStatusCode());
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) CmisSession(org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession) HashMap(java.util.HashMap) TestSite(org.alfresco.rest.api.tests.RepoService.TestSite) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) ContentReader(org.alfresco.service.cmr.repository.ContentReader) HttpResponse(org.alfresco.rest.api.tests.client.HttpResponse) AlfrescoFolder(org.alfresco.cmis.client.AlfrescoFolder) Folder(org.apache.chemistry.opencmis.client.api.Folder) AlfrescoDocument(org.alfresco.cmis.client.AlfrescoDocument) Document(org.apache.chemistry.opencmis.client.api.Document) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisPermissionDeniedException(org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) PublicApiException(org.alfresco.rest.api.tests.client.PublicApiException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) FileContentWriter(org.alfresco.repo.content.filestore.FileContentWriter) SiteInformation(org.alfresco.rest.api.tests.RepoService.SiteInformation) TestNetwork(org.alfresco.rest.api.tests.RepoService.TestNetwork) FileableCmisObject(org.apache.chemistry.opencmis.client.api.FileableCmisObject) CmisObject(org.apache.chemistry.opencmis.client.api.CmisObject) RequestContext(org.alfresco.rest.api.tests.client.RequestContext) TestPerson(org.alfresco.rest.api.tests.RepoService.TestPerson) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Aggregations

TestSite (org.alfresco.rest.api.tests.RepoService.TestSite)47 PublicApiException (org.alfresco.rest.api.tests.client.PublicApiException)42 Test (org.junit.Test)39 RequestContext (org.alfresco.rest.api.tests.client.RequestContext)35 TestNetwork (org.alfresco.rest.api.tests.RepoService.TestNetwork)33 TestPerson (org.alfresco.rest.api.tests.RepoService.TestPerson)31 NodeRef (org.alfresco.service.cmr.repository.NodeRef)29 SiteInformation (org.alfresco.rest.api.tests.RepoService.SiteInformation)27 ArrayList (java.util.ArrayList)23 VersionableAspectTest (org.alfresco.repo.version.VersionableAspectTest)19 CmisConstraintException (org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException)19 CmisInvalidArgumentException (org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException)19 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)19 CmisPermissionDeniedException (org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException)19 CmisUpdateConflictException (org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException)19 HashMap (java.util.HashMap)18 CmisSession (org.alfresco.rest.api.tests.client.PublicApiClient.CmisSession)18 TenantRunAsWork (org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork)17 List (java.util.List)15 AlfrescoDocument (org.alfresco.cmis.client.AlfrescoDocument)15