mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merge pull request #4 from Alfresco/develop
sync feature branch with develop
This commit is contained in:
43
pom.xml
43
pom.xml
@@ -30,6 +30,8 @@
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<licenseName>community</licenseName>
|
||||
|
||||
<index.subsystem.name>buildonly</index.subsystem.name>
|
||||
<dir.root>${project.build.directory}/alf_data</dir.root>
|
||||
<img.exe>convert</img.exe>
|
||||
@@ -1147,10 +1149,51 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
|
||||
<organizationName>Alfresco Software Limited</organizationName>
|
||||
<failOnMissingHeader>true</failOnMissingHeader>
|
||||
<failOnNotUptodateHeader>true</failOnNotUptodateHeader>
|
||||
<licenseResolver>classpath://alfresco</licenseResolver>
|
||||
<licenseName>${licenseName}</licenseName>
|
||||
<roots>
|
||||
<root>src</root>
|
||||
</roots>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
<include>**/*.jsp</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-licenses</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>check-file-header</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-license-headers</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>1.13</version>
|
||||
</plugin>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
|
@@ -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;
|
||||
|
||||
import static org.alfresco.repo.content.transform.TransformerDebugLogTest.assertDebugEntriesEquals;
|
||||
@@ -32,6 +32,9 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -43,7 +46,7 @@ import org.mockito.MockitoAnnotations;
|
||||
|
||||
/**
|
||||
* Test class for TransformerDebug.
|
||||
*
|
||||
*
|
||||
* @author Alan Davis
|
||||
*/
|
||||
public class TransformerDebugTest
|
||||
@@ -52,7 +55,7 @@ public class TransformerDebugTest
|
||||
private NodeService nodeService;
|
||||
|
||||
@Mock
|
||||
private MimetypeService mimetypeService;
|
||||
private MimetypeService mimetypeService;
|
||||
|
||||
@Mock
|
||||
private ContentTransformerRegistry transformerRegistry;
|
||||
@@ -62,30 +65,30 @@ public class TransformerDebugTest
|
||||
|
||||
@Mock
|
||||
private TransformationOptions options;
|
||||
|
||||
|
||||
@Mock
|
||||
private AbstractContentTransformerLimits transformer1;
|
||||
|
||||
|
||||
@Mock
|
||||
private AbstractContentTransformerLimits transformer2;
|
||||
|
||||
|
||||
@Mock
|
||||
private AbstractContentTransformerLimits transformer3;
|
||||
|
||||
|
||||
@Mock
|
||||
private AbstractContentTransformerLimits transformer4;
|
||||
|
||||
|
||||
private TransformerDebug transformerDebug;
|
||||
|
||||
|
||||
private TransformerLog log;
|
||||
|
||||
private TransformerDebugLog debug;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
|
||||
log = new TransformerLog();
|
||||
debug = new TransformerDebugLog();
|
||||
|
||||
@@ -95,7 +98,7 @@ public class TransformerDebugTest
|
||||
mockMimetypes(mimetypeService,
|
||||
"application/pdf", "pdf",
|
||||
"text/plain", "txt");
|
||||
|
||||
|
||||
when(transformer1.getName()).thenReturn("transformer1");
|
||||
when(transformer2.getName()).thenReturn("transformer2");
|
||||
when(transformer3.getName()).thenReturn("transformer3");
|
||||
@@ -110,6 +113,25 @@ public class TransformerDebugTest
|
||||
debug.setTransformerConfig(transformerConfig);
|
||||
}
|
||||
|
||||
// Replaces any transformer reference numbers N.N.N with "0" before checking
|
||||
private String[] unnumbered(String actual[])
|
||||
{
|
||||
for (int i = actual.length-1; i >= 0; i--)
|
||||
{
|
||||
StringJoiner sj = new StringJoiner("\n");
|
||||
String[] bits = actual[i].split("\n");
|
||||
for (String bit: bits)
|
||||
{
|
||||
Pattern p = Pattern.compile("^[0-9.]*");
|
||||
Matcher m = p.matcher(bit);
|
||||
bit = m.replaceFirst("0");
|
||||
sj.add(bit);
|
||||
}
|
||||
actual[i] = sj.toString();
|
||||
}
|
||||
return actual;
|
||||
}
|
||||
|
||||
// Replaces any times with " NN ms" before checking
|
||||
private String[] untimed(String[] actual)
|
||||
{
|
||||
@@ -124,20 +146,20 @@ public class TransformerDebugTest
|
||||
public void alf18373Test()
|
||||
{
|
||||
long sourceSize = 1024*1024*3/2;
|
||||
|
||||
|
||||
transformerDebug.pushAvailable("sourceUrl", "application/pdf", "text/plain", options);
|
||||
|
||||
|
||||
transformerDebug.unavailableTransformer(transformer1, "application/pdf", "text/plain", 50);
|
||||
transformerDebug.unavailableTransformer(transformer2, "application/pdf", "text/plain", 0);
|
||||
transformerDebug.unavailableTransformer(transformer3, "application/pdf", "text/plain", 50);
|
||||
transformerDebug.unavailableTransformer(transformer4, "application/pdf", "text/plain", 50);
|
||||
|
||||
|
||||
List<ContentTransformer> transformers = Arrays.asList(new ContentTransformer[] {});
|
||||
|
||||
|
||||
transformerDebug.availableTransformers(transformers, sourceSize, options, "ContentService.transform(...)");
|
||||
|
||||
transformerDebug.popAvailable();
|
||||
|
||||
|
||||
// "0 --c) [---] transformer4<<Component>> > 50 KB\n"+
|
||||
// "0 --d) [---] transformer3<<Component>> > 50 KB\n"+
|
||||
assertDebugEntriesEquals(new String[] {
|
||||
@@ -146,8 +168,8 @@ public class TransformerDebugTest
|
||||
"0 --a) [---] transformer1<<Component>> > 50 KB\n"+
|
||||
"0 --b) [---] transformer3<<Component>> > 50 KB\n"+
|
||||
"0 --c) [---] transformer4<<Component>> > 50 KB\n"+
|
||||
"0 Finished in NN ms Transformer NOT called\n"}, untimed(debug.getEntries(10)));
|
||||
"0 Finished in NN ms Transformer NOT called"}, unnumbered(untimed(debug.getEntries(10))));
|
||||
assertLogEntriesEquals(new String[] {
|
||||
"0 pdf txt WARN 1.5 MB NN ms No transformers as file is > 50 KB"}, untimed(log.getEntries(10)));
|
||||
"0 pdf txt WARN 1.5 MB NN ms No transformers as file is > 50 KB"}, unnumbered(untimed(log.getEntries(10))));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user