Search in sources :

Example 21 with CmisService

use of org.apache.chemistry.opencmis.commons.server.CmisService in project alfresco-repository by Alfresco.

the class CMISTest method testIsLatestMajorVersionMNT10868.

/**
 * MNT-10868 CMIS: Incorrect value of Latest Major version on Versions and Properties tabs.
 */
@Test
public void testIsLatestMajorVersionMNT10868() {
    CallContext context = new SimpleCallContext("admin", "admin", CmisVersion.CMIS_1_0);
    String repositoryId = null;
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    CmisService cmisService = factory.getService(context);
    try {
        // get repository id
        List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
        assertTrue(repositories.size() > 0);
        RepositoryInfo repo = repositories.get(0);
        repositoryId = repo.getId();
        final String folderName = "testfolder" + GUID.generate();
        final String docName = "testdoc.txt" + GUID.generate();
        final FileInfo fileInfo = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<FileInfo>() {

            @Override
            public FileInfo execute() throws Throwable {
                NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();
                FileInfo folderInfo = fileFolderService.create(companyHomeNodeRef, folderName, ContentModel.TYPE_FOLDER);
                nodeService.setProperty(folderInfo.getNodeRef(), ContentModel.PROP_NAME, folderName);
                FileInfo fileInfo = fileFolderService.create(folderInfo.getNodeRef(), docName, ContentModel.TYPE_CONTENT);
                nodeService.setProperty(fileInfo.getNodeRef(), ContentModel.PROP_NAME, docName);
                nodeService.addAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_VERSIONABLE, null);
                return fileInfo;
            }
        });
        ObjectData objectData = cmisService.getObjectByPath(repositoryId, "/" + folderName + "/" + docName, null, true, IncludeRelationships.NONE, null, false, true, null);
        PropertyData<?> pd = getPropIsLatestMajorVersion(objectData);
        if (pd != null) {
            assertTrue("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION should be true as major version was created", (Boolean) pd.getValues().get(0));
        }
        nodeService.setProperty(fileInfo.getNodeRef(), ContentModel.PROP_TITLE, docName);
        // Create minor version
        transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>() {

            public Object execute() throws Throwable {
                // get an updating writer
                ContentWriter writer = contentService.getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
                writer.setMimetype("text/plain");
                writer.putContent("New Version");
                return null;
            }
        });
        objectData = cmisService.getObjectByPath(repositoryId, "/" + folderName + "/" + docName, null, true, IncludeRelationships.NONE, null, false, true, null);
        pd = getPropIsLatestMajorVersion(objectData);
        if (pd != null) {
            assertFalse("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION should be false as minor version was created", (Boolean) pd.getValues().get(0));
        }
    } finally {
        cmisService.close();
    }
}
Also used : RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) ObjectData(org.apache.chemistry.opencmis.commons.data.ObjectData) CallContext(org.apache.chemistry.opencmis.commons.server.CallContext) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ContentWriter(org.alfresco.service.cmr.repository.ContentWriter) CmisService(org.apache.chemistry.opencmis.commons.server.CmisService) FileInfo(org.alfresco.service.cmr.model.FileInfo) UnfileObject(org.apache.chemistry.opencmis.commons.enums.UnfileObject) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 22 with CmisService

use of org.apache.chemistry.opencmis.commons.server.CmisService in project alfresco-repository by Alfresco.

the class CMISTest method testSecondaryTypes.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testSecondaryTypes() {
    final String aspectName = "P:cm:indexControl";
    // get repository id
    final String repositoryId = withCmisService(new CmisServiceCallback<String>() {

        @Override
        public String execute(CmisService cmisService) {
            List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
            assertTrue(repositories.size() > 0);
            RepositoryInfo repo = repositories.get(0);
            final String repositoryId = repo.getId();
            return repositoryId;
        }
    }, CmisVersion.CMIS_1_1);
    final String objectId = withCmisService(new CmisServiceCallback<String>() {

        @Override
        public String execute(CmisService cmisService) {
            final PropertiesImpl properties = new PropertiesImpl();
            String objectTypeId = "cmis:document";
            properties.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, objectTypeId));
            String fileName = "textFile" + GUID.generate();
            properties.addProperty(new PropertyStringImpl(PropertyIds.NAME, fileName));
            final ContentStreamImpl contentStream = new ContentStreamImpl(fileName, MimetypeMap.MIMETYPE_TEXT_PLAIN, "Simple text plain document");
            String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.MAJOR, null, null);
            return objectId;
        }
    }, CmisVersion.CMIS_1_1);
    final Holder<String> objectIdHolder = new Holder<String>(objectId);
    withCmisService(new CmisServiceCallback<Void>() {

        @Override
        public Void execute(CmisService cmisService) {
            final PropertiesImpl properties = new PropertiesImpl();
            properties.addProperty(new PropertyStringImpl(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, Arrays.asList(aspectName)));
            cmisService.updateProperties(repositoryId, objectIdHolder, null, properties, null);
            return null;
        }
    }, CmisVersion.CMIS_1_1);
    final Properties currentProperties = withCmisService(new CmisServiceCallback<Properties>() {

        @Override
        public Properties execute(CmisService cmisService) {
            Properties properties = cmisService.getProperties(repositoryId, objectIdHolder.getValue(), null, null);
            return properties;
        }
    }, CmisVersion.CMIS_1_1);
    List<String> secondaryTypeIds = (List<String>) currentProperties.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
    assertTrue(secondaryTypeIds.contains(aspectName));
    // We don't actually want to add these! (REPO-2926)
    final Set<String> sysAspectsToAdd = new HashSet<>(Arrays.asList("P:sys:undeletable", "P:sys:hidden"));
    // Pre-condition of further test is that these aspects are not present
    assertEquals(0, secondaryTypeIds.stream().filter(sysAspectsToAdd::contains).count());
    // We also want to check that existing sys aspects aren't accidentally removed
    assertTrue(secondaryTypeIds.contains("P:sys:localized"));
    // Check we can remove an aspect - through its absence
    secondaryTypeIds.remove(aspectName);
    // Check that attempts to update/add sys:* aspects are ignored
    secondaryTypeIds.addAll(sysAspectsToAdd);
    final PropertiesImpl newProperties = new PropertiesImpl();
    newProperties.addProperty(new PropertyStringImpl(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypeIds));
    final String updatedName = "My_new_name_" + UUID.randomUUID().toString();
    newProperties.replaceProperty(new PropertyStringImpl(PropertyIds.NAME, updatedName));
    withCmisService(new CmisServiceCallback<Void>() {

        @Override
        public Void execute(CmisService cmisService) {
            Holder<String> latestObjectIdHolder = getHolderOfObjectOfLatestVersion(cmisService, repositoryId, objectIdHolder);
            // This will result in aspectName being removed
            // but that shouldn't mean that, for example, a cmis:name prop update gets ignored (MNT-18340)
            cmisService.updateProperties(repositoryId, latestObjectIdHolder, null, newProperties, null);
            return null;
        }
    }, CmisVersion.CMIS_1_1);
    Properties currentProperties1 = withCmisService(new CmisServiceCallback<Properties>() {

        @Override
        public Properties execute(CmisService cmisService) {
            Holder<String> latestObjectIdHolder = getHolderOfObjectOfLatestVersion(cmisService, repositoryId, objectIdHolder);
            Properties properties = cmisService.getProperties(repositoryId, latestObjectIdHolder.getValue(), null, null);
            return properties;
        }
    }, CmisVersion.CMIS_1_1);
    secondaryTypeIds = (List<String>) currentProperties1.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
    assertFalse(secondaryTypeIds.contains(aspectName));
    assertEquals(updatedName, currentProperties1.getProperties().get(PropertyIds.NAME).getFirstValue());
    // sys aspects must not be added through CMIS (REPO-2926)
    assertEquals(0, secondaryTypeIds.stream().filter(sysAspectsToAdd::contains).count());
    // Check pre-existing sys aspects aren't accidentally removed
    assertTrue(secondaryTypeIds.contains("P:sys:localized"));
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) PropertiesImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) Holder(org.apache.chemistry.opencmis.commons.spi.Holder) Properties(org.apache.chemistry.opencmis.commons.data.Properties) PropertyIdImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl) CmisService(org.apache.chemistry.opencmis.commons.server.CmisService) PropertyStringImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl) ObjectInFolderList(org.apache.chemistry.opencmis.commons.data.ObjectInFolderList) ArrayList(java.util.ArrayList) ObjectList(org.apache.chemistry.opencmis.commons.data.ObjectList) List(java.util.List) HashSet(java.util.HashSet) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 23 with CmisService

use of org.apache.chemistry.opencmis.commons.server.CmisService in project alfresco-repository by Alfresco.

the class CMISTest method testIntegerBoudaries.

/**
 * Test for MNT-9089
 */
@Test
public void testIntegerBoudaries() throws Exception {
    AuthenticationUtil.pushAuthentication();
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    try {
        final FileInfo fileInfo = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<FileInfo>() {

            @Override
            public FileInfo execute() throws Throwable {
                NodeRef companyHomeNodeRef = repositoryHelper.getCompanyHome();
                QName testIntTypeQName = QName.createQName("http://testCMISIntegersModel/1.0/", "testintegerstype");
                String folderName = GUID.generate();
                FileInfo folderInfo = fileFolderService.create(companyHomeNodeRef, folderName, ContentModel.TYPE_FOLDER);
                nodeService.setProperty(folderInfo.getNodeRef(), ContentModel.PROP_NAME, folderName);
                assertNotNull(folderInfo);
                String docName = GUID.generate();
                FileInfo fileInfo = fileFolderService.create(folderInfo.getNodeRef(), docName, testIntTypeQName);
                assertNotNull(fileInfo);
                nodeService.setProperty(fileInfo.getNodeRef(), ContentModel.PROP_NAME, docName);
                return fileInfo;
            }
        });
        // get repository id
        withCmisService(new CmisServiceCallback<Void>() {

            @Override
            public Void execute(CmisService cmisService) {
                List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
                assertTrue(repositories.size() > 0);
                RepositoryInfo repo = repositories.get(0);
                String repositoryId = repo.getId();
                String objectIdStr = fileInfo.getNodeRef().toString();
                TypeDefinition typeDef = cmisService.getTypeDefinition(repositoryId, "D:tcim:testintegerstype", null);
                PropertyIntegerDefinitionImpl intNoBoundsTypeDef = (PropertyIntegerDefinitionImpl) typeDef.getPropertyDefinitions().get("tcim:int");
                PropertyIntegerDefinitionImpl longNoBoundsTypeDef = (PropertyIntegerDefinitionImpl) typeDef.getPropertyDefinitions().get("tcim:long");
                PropertyIntegerDefinitionImpl intWithBoundsTypeDef = (PropertyIntegerDefinitionImpl) typeDef.getPropertyDefinitions().get("tcim:intwithbounds");
                PropertyIntegerDefinitionImpl longWithBoundsTypeDef = (PropertyIntegerDefinitionImpl) typeDef.getPropertyDefinitions().get("tcim:longwithbounds");
                BigInteger minInteger = BigInteger.valueOf(Integer.MIN_VALUE);
                BigInteger maxInteger = BigInteger.valueOf(Integer.MAX_VALUE);
                BigInteger minLong = BigInteger.valueOf(Long.MIN_VALUE);
                BigInteger maxLong = BigInteger.valueOf(Long.MAX_VALUE);
                // test for default boundaries
                assertTrue(intNoBoundsTypeDef.getMinValue().equals(minInteger));
                assertTrue(intNoBoundsTypeDef.getMaxValue().equals(maxInteger));
                assertTrue(longNoBoundsTypeDef.getMinValue().equals(minLong));
                assertTrue(longNoBoundsTypeDef.getMaxValue().equals(maxLong));
                // test for pre-defined boundaries
                assertTrue(intWithBoundsTypeDef.getMinValue().equals(BigInteger.valueOf(-10L)));
                assertTrue(intWithBoundsTypeDef.getMaxValue().equals(BigInteger.valueOf(10L)));
                assertTrue(longWithBoundsTypeDef.getMinValue().equals(BigInteger.valueOf(-10L)));
                assertTrue(longWithBoundsTypeDef.getMaxValue().equals(BigInteger.valueOf(10L)));
                try // try to overfloat long without boundaries
                {
                    BigInteger aValue = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(1L));
                    setProperiesToObject(cmisService, repositoryId, objectIdStr, "tcim:long", aValue);
                    fail();
                } catch (Exception e) {
                    assertTrue(e instanceof CmisConstraintException);
                }
                try // try to overfloat int without boundaries
                {
                    BigInteger aValue = BigInteger.valueOf(Integer.MAX_VALUE).add(BigInteger.valueOf(1L));
                    setProperiesToObject(cmisService, repositoryId, objectIdStr, "tcim:int", aValue);
                    fail();
                } catch (Exception e) {
                    assertTrue(e instanceof CmisConstraintException);
                }
                try // try to overfloat int with boundaries
                {
                    BigInteger aValue = BigInteger.valueOf(11l);
                    setProperiesToObject(cmisService, repositoryId, objectIdStr, "tcim:intwithbounds", aValue);
                    fail();
                } catch (Exception e) {
                    assertTrue(e instanceof CmisConstraintException);
                }
                try // try to overfloat long with boundaries
                {
                    BigInteger aValue = BigInteger.valueOf(11l);
                    setProperiesToObject(cmisService, repositoryId, objectIdStr, "tcim:longwithbounds", aValue);
                    fail();
                } catch (Exception e) {
                    assertTrue(e instanceof CmisConstraintException);
                }
                return null;
            }
        }, CmisVersion.CMIS_1_0);
    } catch (Exception e) {
        fail(e.getMessage());
    } finally {
        AuthenticationUtil.popAuthentication();
    }
}
Also used : PropertyIntegerDefinitionImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) QName(org.alfresco.service.namespace.QName) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisUpdateConflictException(org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException) CmisConstraintException(org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException) CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) IOException(java.io.IOException) CmisInvalidArgumentException(org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) TypeDefinition(org.apache.chemistry.opencmis.commons.definitions.TypeDefinition) NodeRef(org.alfresco.service.cmr.repository.NodeRef) FileInfo(org.alfresco.service.cmr.model.FileInfo) CmisService(org.apache.chemistry.opencmis.commons.server.CmisService) BigInteger(java.math.BigInteger) ObjectInFolderList(org.apache.chemistry.opencmis.commons.data.ObjectInFolderList) ArrayList(java.util.ArrayList) ObjectList(org.apache.chemistry.opencmis.commons.data.ObjectList) List(java.util.List) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Example 24 with CmisService

use of org.apache.chemistry.opencmis.commons.server.CmisService in project alfresco-repository by Alfresco.

the class CMISTest method testSetDeleteAppendContentStreamVersioning.

/**
 * Test auto version behavior for setContentStream, deleteContentStream and appendContentStream according to ALF-21852.
 */
@Test
public void testSetDeleteAppendContentStreamVersioning() throws Exception {
    AuthenticationUtil.pushAuthentication();
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    final String DOC1 = "documentProperties1-" + GUID.generate();
    try {
        final FileInfo doc = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<FileInfo>() {

            @Override
            public FileInfo execute() throws Throwable {
                FileInfo document;
                // create document
                document = fileFolderService.create(repositoryHelper.getCompanyHome(), DOC1, ContentModel.TYPE_CONTENT);
                nodeService.setProperty(document.getNodeRef(), ContentModel.PROP_NAME, DOC1);
                Map<QName, Serializable> props = new HashMap<QName, Serializable>();
                props.put(ContentModel.PROP_TITLE, "Initial Title");
                props.put(ContentModel.PROP_DESCRIPTION, "Initial Description");
                nodeService.addAspect(document.getNodeRef(), ContentModel.ASPECT_TITLED, props);
                // apply versionable aspect with properties
                props = new HashMap<QName, Serializable>();
                // ContentModel.PROP_INITIAL_VERSION always true
                props.put(ContentModel.PROP_INITIAL_VERSION, true);
                props.put(ContentModel.PROP_AUTO_VERSION, true);
                props.put(ContentModel.PROP_AUTO_VERSION_PROPS, true);
                versionService.ensureVersioningEnabled(document.getNodeRef(), props);
                return document;
            }
        });
        withCmisService(new CmisServiceCallback<Void>() {

            @Override
            public Void execute(CmisService cmisService) {
                final String documentNodeRefId = doc.getNodeRef().toString();
                final String repositoryId = cmisService.getRepositoryInfos(null).get(0).getId();
                ObjectInfo objInfoInitialVersion = cmisService.getObjectInfo(repositoryId, documentNodeRefId);
                assertTrue("We had just created the document - it should be version 1.0", objInfoInitialVersion.getId().endsWith("1.0"));
                ContentStreamImpl contentStream = new ContentStreamImpl(null, MimetypeMap.MIMETYPE_TEXT_PLAIN, "Content " + GUID.generate());
                Holder<String> objectIdHolder = new Holder<>(documentNodeRefId);
                // Test setContentStream
                cmisService.setContentStream(repositoryId, objectIdHolder, true, null, contentStream, null);
                assertTrue("The \"output\" parameter should returns the newly created version id: 1.1", objectIdHolder.getValue().endsWith("1.1"));
                // we can use this new version id to get information about the cmis object
                ObjectInfo objInfoAfterSetContentStream = cmisService.getObjectInfo(repositoryId, objectIdHolder.getValue());
                assertTrue("The object info should reflect the version requested: 1.1", objInfoAfterSetContentStream.getId().endsWith("1.1"));
                // Test deleteContentStream
                cmisService.deleteContentStream(repositoryId, objectIdHolder, null, null);
                assertTrue("The \"output\" parameter should returns the newly created version id: 1.2", objectIdHolder.getValue().endsWith("1.2"));
                // we can use this new version id to get information about the cmis object
                objInfoAfterSetContentStream = cmisService.getObjectInfo(repositoryId, objectIdHolder.getValue());
                assertTrue("The object info should reflect the version requested: 1.2", objInfoAfterSetContentStream.getId().endsWith("1.2"));
                // Test appendContentStream
                cmisService.appendContentStream(repositoryId, objectIdHolder, null, contentStream, true, null);
                assertTrue("The \"output\" parameter should returns the newly created version id: 1.3", objectIdHolder.getValue().endsWith("1.3"));
                // we can use this new version id to get information about the cmis object
                objInfoAfterSetContentStream = cmisService.getObjectInfo(repositoryId, objectIdHolder.getValue());
                assertTrue("The object info should reflect the version requested: 1.3", objInfoAfterSetContentStream.getId().endsWith("1.3"));
                return null;
            }
        }, CmisVersion.CMIS_1_1);
    } finally {
        AuthenticationUtil.popAuthentication();
    }
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) Serializable(java.io.Serializable) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) Holder(org.apache.chemistry.opencmis.commons.spi.Holder) ObjectInfo(org.apache.chemistry.opencmis.commons.server.ObjectInfo) FileInfo(org.alfresco.service.cmr.model.FileInfo) CmisService(org.apache.chemistry.opencmis.commons.server.CmisService) 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 25 with CmisService

use of org.apache.chemistry.opencmis.commons.server.CmisService in project alfresco-repository by Alfresco.

the class CMISTest method testIsLatestMajorVersion.

/**
 * MNT-10223
 * Check the IsLatestMajorVersion for a doc with minor version.
 */
@SuppressWarnings("unused")
@Test
public void testIsLatestMajorVersion() {
    final TestContext testContext = new TestContext();
    // create simple text plain content
    final PropertiesImpl properties = new PropertiesImpl();
    String objectTypeId = "cmis:document";
    properties.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, objectTypeId));
    String fileName = "textFile" + GUID.generate();
    properties.addProperty(new PropertyStringImpl(PropertyIds.NAME, fileName));
    final ContentStreamImpl contentStream = new ContentStreamImpl(fileName, MimetypeMap.MIMETYPE_TEXT_PLAIN, "Simple text plain document");
    withCmisService(new CmisServiceCallback<String>() {

        @Override
        public String execute(CmisService cmisService) {
            List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
            assertTrue(repositories.size() > 0);
            RepositoryInfo repo = repositories.get(0);
            String repositoryId = repo.getId();
            String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.MINOR, null, null);
            ObjectData cmidDoc = cmisService.getObject(repositoryId, objectId, null, true, IncludeRelationships.NONE, null, false, false, null);
            List<PropertyData<?>> properties = cmidDoc.getProperties().getPropertyList();
            boolean found = false;
            PropertyData<?> propIsLatestMajorVersion = null;
            for (PropertyData<?> property : properties) {
                if (property.getId().equals(PropertyIds.IS_LATEST_MAJOR_VERSION)) {
                    found = true;
                    propIsLatestMajorVersion = property;
                    break;
                }
            }
            // properties..contains(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION);
            assertTrue("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION property was not found", found);
            if (found) {
                assertFalse("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION should be false as minor version was created", (Boolean) propIsLatestMajorVersion.getValues().get(0));
            }
            return objectId;
        }
    });
}
Also used : ContentStreamImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl) PropertyData(org.apache.chemistry.opencmis.commons.data.PropertyData) PropertiesImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) ObjectData(org.apache.chemistry.opencmis.commons.data.ObjectData) PropertyIdImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl) CmisService(org.apache.chemistry.opencmis.commons.server.CmisService) PropertyStringImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl) ObjectInFolderList(org.apache.chemistry.opencmis.commons.data.ObjectInFolderList) ArrayList(java.util.ArrayList) ObjectList(org.apache.chemistry.opencmis.commons.data.ObjectList) List(java.util.List) VersionableAspectTest(org.alfresco.repo.version.VersionableAspectTest) Test(org.junit.Test)

Aggregations

CmisService (org.apache.chemistry.opencmis.commons.server.CmisService)31 VersionableAspectTest (org.alfresco.repo.version.VersionableAspectTest)30 Test (org.junit.Test)30 ArrayList (java.util.ArrayList)26 List (java.util.List)23 ObjectInFolderList (org.apache.chemistry.opencmis.commons.data.ObjectInFolderList)23 ObjectList (org.apache.chemistry.opencmis.commons.data.ObjectList)23 RepositoryInfo (org.apache.chemistry.opencmis.commons.data.RepositoryInfo)23 FileInfo (org.alfresco.service.cmr.model.FileInfo)18 NodeRef (org.alfresco.service.cmr.repository.NodeRef)17 ObjectData (org.apache.chemistry.opencmis.commons.data.ObjectData)14 HashMap (java.util.HashMap)11 PropertiesImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl)11 Holder (org.apache.chemistry.opencmis.commons.spi.Holder)11 PropertyStringImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl)10 Map (java.util.Map)9 MimetypeMap (org.alfresco.repo.content.MimetypeMap)9 QName (org.alfresco.service.namespace.QName)8 ContentStreamImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl)8 PropertyIdImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl)8