Merge pull request #4 from Alfresco/develop

sync feature branch with develop
This commit is contained in:
Andrei Rebegea
2017-08-04 09:00:38 +03:00
committed by GitHub
2 changed files with 108 additions and 43 deletions

43
pom.xml
View File

@@ -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>

View File

@@ -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;
@@ -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)
{
@@ -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))));
}
}