Compare commits

...

3 Commits

Author SHA1 Message Date
Sara Aspery
29155113b2 DAUS MOCK - ignore test 2022-02-14 12:40:17 +00:00
Sara Aspery
0a7deae946 Merge branch 'master' into feature/DAUsMock_DO_NOT_MERGE_TO_MASTER 2022-02-14 12:31:34 +00:00
Sara Aspery
d05bf28c22 DAUS - mock DAU for ContentStore 2022-02-07 11:13:25 +00:00
2 changed files with 70 additions and 40 deletions

View File

@@ -1,40 +1,43 @@
/*
* #%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 - 2022 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.tenant;
import java.io.File;
import java.io.Serializable;
import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.repo.content.ContentLimitProvider;
import org.alfresco.repo.content.ContentLimitProvider.NoLimitProvider;
import org.alfresco.repo.content.ContentStore;
import org.alfresco.repo.content.filestore.FileContentStore;
import org.alfresco.repo.content.filestore.FileContentUrlProvider;
import org.alfresco.repo.content.filestore.FileContentStore;
import org.alfresco.repo.content.filestore.FileContentUrlProvider;
import org.alfresco.service.cmr.repository.DirectAccessUrl;
import org.springframework.context.ApplicationContext;
/**
@@ -42,7 +45,7 @@ import org.springframework.context.ApplicationContext;
*/
public class TenantRoutingFileContentStore extends AbstractTenantRoutingContentStore
{
private ContentLimitProvider contentLimitProvider = new NoLimitProvider();
private ContentLimitProvider contentLimitProvider = new NoLimitProvider();
private FileContentUrlProvider fileContentUrlProvider;
/**
@@ -51,14 +54,14 @@ public class TenantRoutingFileContentStore extends AbstractTenantRoutingContentS
public void setContentLimitProvider(ContentLimitProvider contentLimitProvider)
{
this.contentLimitProvider = contentLimitProvider;
}
/**
* Sets a new {@link FileContentUrlProvider} which will build the content url.
*/
public void setFileContentUrlProvider(FileContentUrlProvider fileContentUrlProvider)
{
this.fileContentUrlProvider = fileContentUrlProvider;
}
/**
* Sets a new {@link FileContentUrlProvider} which will build the content url.
*/
public void setFileContentUrlProvider(FileContentUrlProvider fileContentUrlProvider)
{
this.fileContentUrlProvider = fileContentUrlProvider;
}
protected ContentStore initContentStore(ApplicationContext ctx, String contentRoot)
@@ -76,11 +79,36 @@ public class TenantRoutingFileContentStore extends AbstractTenantRoutingContentS
{
fileContentStore.setContentLimitProvider(contentLimitProvider);
}
if(fileContentUrlProvider != null)
{
fileContentStore.setFileContentUrlProvider(fileContentUrlProvider);
if(fileContentUrlProvider != null)
{
fileContentStore.setFileContentUrlProvider(fileContentUrlProvider);
}
return fileContentStore;
}
// TODO: remove these temp methods
@Override
public boolean isContentDirectUrlEnabled()
{
return true;
}
@Override
public boolean isContentDirectUrlEnabled(String contentUrl)
{
return true;
}
@Override
public DirectAccessUrl requestContentDirectUrl(String contentUrl, boolean attachment, String fileName, String mimeType, Long validFor)
{
DirectAccessUrl directAccessUrl = new DirectAccessUrl();
directAccessUrl.setContentUrl(contentUrl);
directAccessUrl.setAttachment(attachment);
Date expiryTime = Date.from(Instant.now().plusSeconds(validFor));
directAccessUrl.setExpiryTime(expiryTime);
return directAccessUrl;
}
}

View File

@@ -40,6 +40,7 @@ import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.namespace.QName;
import org.alfresco.test_category.OwnJVMTestsCategory;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -146,6 +147,7 @@ public class ContentServiceImplTest extends BaseVersionStoreTest
}
}
@Ignore
@Test
public void testWhenRequestContentDirectUrlIsNotSupported()
{