Merge branch 'develop' into feature/REPO-2626_HB2.0

This commit is contained in:
Ancuta Morarasu
2017-09-14 10:41:43 +03:00
9 changed files with 116 additions and 53 deletions

View File

@@ -3668,6 +3668,64 @@ public class CMISTest
AuthenticationUtil.popAuthentication();
}
}
@Test
public void testCreateDocWithVersioningStateNone() throws Exception
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
try
{
// 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 NodeRef documentNodeRef = withCmisService(new CmisServiceCallback<NodeRef>()
{
@Override
public NodeRef 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 nodeId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.NONE, null, null);
return new NodeRef(nodeId.substring(0, nodeId.indexOf(';')));
}
}, CmisVersion.CMIS_1_1);
// check versioning properties
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<List<Void>>()
{
@Override
public List<Void> execute() throws Throwable
{
assertTrue(nodeService.exists(documentNodeRef));
assertFalse(nodeService.hasAspect(documentNodeRef, ContentModel.ASPECT_VERSIONABLE));
return null;
}
});
}
finally
{
AuthenticationUtil.popAuthentication();
}
}
/**
* MNT-14951: Test that the list of parents can be retrieved for a folder.

View File

@@ -1,28 +1,28 @@
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.content.transform.magick;
import java.io.File;
@@ -120,12 +120,24 @@ public class ImageMagickContentTransformerTest extends AbstractContentTransforme
}
}
public void testGifToPng() throws Exception
{
ImageTransformationOptions options = new ImageTransformationOptions();
transform(MimetypeMap.MIMETYPE_IMAGE_GIF, MimetypeMap.MIMETYPE_IMAGE_PNG, options);
}
public void testJpegToPng() throws Exception
{
ImageTransformationOptions options = new ImageTransformationOptions();
transform(MimetypeMap.MIMETYPE_IMAGE_JPEG, MimetypeMap.MIMETYPE_IMAGE_PNG, options);
}
public void testPageSourceOptions() throws Exception
{
// Test empty source options
ImageTransformationOptions options = new ImageTransformationOptions();
this.transform(MimetypeMap.MIMETYPE_PDF, MimetypeMap.MIMETYPE_IMAGE_PNG, options);
// Test first page
options = new ImageTransformationOptions();
List<TransformationSourceOptions> sourceOptionsList = new ArrayList<TransformationSourceOptions>();