mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'master' into feature/ags-reorg
This commit is contained in:
18
.travis.yml
18
.travis.yml
@@ -55,7 +55,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext01TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext02TestSuite"
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext04TestSuite"
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContext05TestSuite"
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContext06TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - AppContextExtraTestSuite"
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AppContextExtraTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - MiscContextTestSuite"
|
||||
@@ -113,7 +113,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=MiscContextTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - SearchTestSuite"
|
||||
@@ -205,7 +205,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext02TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext03TestSuite"
|
||||
@@ -213,7 +213,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext03TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContext04TestSuite"
|
||||
@@ -221,7 +221,7 @@ jobs:
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.3.10
|
||||
- docker run -d -p 8090:8090 -e JAVA_OPTS=" -Xms256m -Xmx256m" alfresco/alfresco-transform-core-aio:2.4.0
|
||||
script: travis_wait 20 mvn -B test -pl remote-api -Dtest=AppContext04TestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Remote-api - AppContextExtraTestSuite"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
TRANSFORMERS_TAG=2.3.10
|
||||
TRANSFORMERS_TAG=2.4.0
|
||||
SOLR6_TAG=2.0.1
|
||||
POSTGRES_TAG=13.1
|
||||
ACTIVEMQ_TAG=5.16.1
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
6
pom.xml
6
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<dependency.alfresco-hb-data-sender.version>1.0.12</dependency.alfresco-hb-data-sender.version>
|
||||
<dependency.alfresco-mmt.version>6.0</dependency.alfresco-mmt.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.4</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-trashcan-cleaner.version>2.4.1</dependency.alfresco-trashcan-cleaner.version>
|
||||
<dependency.alfresco-jlan.version>7.1</dependency.alfresco-jlan.version>
|
||||
<dependency.alfresco-server-root.version>6.0.1</dependency.alfresco-server-root.version>
|
||||
<dependency.alfresco-messaging-repo.version>1.2.15</dependency.alfresco-messaging-repo.version>
|
||||
@@ -622,7 +622,7 @@
|
||||
<dependency>
|
||||
<groupId>com.drewnoakes</groupId>
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.15.0</version>
|
||||
<version>2.16.0</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>11.23-SNAPSHOT</version>
|
||||
<version>11.35-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -1997,7 +1997,14 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
|
||||
private void sendInviteEmail(InviteSender inviteSender, List<String> invitePropNames, String inviteId, String emailTemplateXpath, String emailSubjectKey, Map<String, Object> executionVariables)
|
||||
{
|
||||
if (isSendEmails())
|
||||
// Do nothing if emails disabled.
|
||||
if (isSendEmails() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// send email to the invitee if possible - but don't fail the invitation if email cannot be sent
|
||||
try
|
||||
{
|
||||
Map<String, String> properties = makePropertiesFromContextVariables(executionVariables, invitePropNames);
|
||||
|
||||
@@ -2008,6 +2015,11 @@ public class InvitationServiceImpl implements InvitationService, NodeServicePoli
|
||||
|
||||
inviteSender.sendMail(emailTemplateXpath, emailSubjectKey, properties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Swallow exception
|
||||
logger.error("unable to send invite email", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -52,6 +52,7 @@ import java.util.Set;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import static org.alfresco.repo.content.MimetypeMap.MIMETYPE_PDF;
|
||||
import static org.alfresco.repo.content.transform.magick.ImageTransformationOptions.OPT_COMMAND_OPTIONS;
|
||||
import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_ENLARGEMENT;
|
||||
import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_PDF_ENLARGEMENT;
|
||||
import static org.alfresco.repo.rendition2.RenditionDefinition2.ALPHA_REMOVE;
|
||||
@@ -122,6 +123,7 @@ public class TransformationOptionsConverter implements InitializingBean
|
||||
IMAGE_OPTIONS.addAll(RESIZE_OPTIONS);
|
||||
IMAGE_OPTIONS.add(AUTO_ORIENT);
|
||||
IMAGE_OPTIONS.add(ALPHA_REMOVE);
|
||||
IMAGE_OPTIONS.add(OPT_COMMAND_OPTIONS);
|
||||
}
|
||||
|
||||
private static Set<String> PDF_OPTIONS = new HashSet<>(Arrays.asList(new String[]
|
||||
@@ -284,6 +286,8 @@ public class TransformationOptionsConverter implements InitializingBean
|
||||
}
|
||||
opts.setSourceOptionsList(sourceOptionsList);
|
||||
}
|
||||
|
||||
ifSet(options, OPT_COMMAND_OPTIONS, (v) -> opts.setCommandOptions(v));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -361,13 +365,11 @@ public class TransformationOptionsConverter implements InitializingBean
|
||||
{
|
||||
ImageTransformationOptions opts = (ImageTransformationOptions) options;
|
||||
|
||||
// TODO We don't support this any more for security reasons, however it might be possible to
|
||||
// extract some of the well know values and add them to the newer ImageMagick transform options.
|
||||
// From a security viewpoint it would be better not to support the option of passing anything to
|
||||
// ImageMagick. It might be possible to extract some of the well know values and add them to the
|
||||
// T-Engine engine_config.
|
||||
String commandOptions = opts.getCommandOptions();
|
||||
if (commandOptions != null && !commandOptions.isBlank())
|
||||
{
|
||||
logger.error("ImageMagick commandOptions are no longer supported for security reasons: " + commandOptions);
|
||||
}
|
||||
ifSet(commandOptions != null && !commandOptions.isBlank(), map, OPT_COMMAND_OPTIONS, commandOptions);
|
||||
|
||||
ImageResizeOptions imageResizeOptions = opts.getResizeOptions();
|
||||
if (imageResizeOptions != null)
|
||||
|
@@ -78,14 +78,15 @@ public class SchemaDifferenceHelper
|
||||
|
||||
public String findPatchCausingDifference(Difference difference)
|
||||
{
|
||||
for (SchemaUpgradeScriptPatch patch: optionalUpgradePatches)
|
||||
String differenceText = describe(difference);
|
||||
for (SchemaUpgradeScriptPatch patch : optionalUpgradePatches)
|
||||
{
|
||||
if (!isPatchApplied(patch))
|
||||
{
|
||||
List<String> problemPatterns = getProblemsPatterns(patch);
|
||||
for (String problemPattern: problemPatterns)
|
||||
for (String problemPattern : problemPatterns)
|
||||
{
|
||||
if (describe(difference).matches(problemPattern))
|
||||
if (differenceText.matches(problemPattern))
|
||||
{
|
||||
return patch.getId();
|
||||
}
|
||||
|
@@ -162,28 +162,16 @@ CREATE TABLE alf_authority_alias
|
||||
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE alf_server
|
||||
(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
version BIGINT NOT NULL,
|
||||
ip_address VARCHAR(39) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY ip_address (ip_address)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE alf_transaction
|
||||
(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
version BIGINT NOT NULL,
|
||||
server_id BIGINT,
|
||||
change_txn_id VARCHAR(56) NOT NULL,
|
||||
commit_time_ms BIGINT,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_alf_txn_ctms (commit_time_ms, id),
|
||||
KEY idx_alf_txn_ctms_sc (commit_time_ms),
|
||||
key idx_alf_txn_id_ctms (id, commit_time_ms),
|
||||
KEY fk_alf_txn_svr (server_id),
|
||||
CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
|
||||
key idx_alf_txn_id_ctms (id, commit_time_ms)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE alf_store
|
||||
|
@@ -2474,38 +2474,6 @@
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_server">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
<type>bigint</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>true</autoincrement>
|
||||
</column>
|
||||
<column name="version" order="2">
|
||||
<type>bigint</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="ip_address" order="3">
|
||||
<type>varchar(39)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
</columns>
|
||||
<primarykey name="PRIMARY">
|
||||
<columnnames>
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys/>
|
||||
<indexes>
|
||||
<index name="ip_address" unique="true">
|
||||
<columnnames>
|
||||
<columnname>ip_address</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_store">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
@@ -2652,17 +2620,12 @@
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="server_id" order="3">
|
||||
<type>bigint</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="change_txn_id" order="4">
|
||||
<column name="change_txn_id" order="3">
|
||||
<type>varchar(56)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="commit_time_ms" order="5">
|
||||
<column name="commit_time_ms" order="4">
|
||||
<type>bigint</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
@@ -2673,13 +2636,6 @@
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys>
|
||||
<foreignkey name="fk_alf_txn_svr">
|
||||
<localcolumn>server_id</localcolumn>
|
||||
<targettable>alf_server</targettable>
|
||||
<targetcolumn>id</targetcolumn>
|
||||
</foreignkey>
|
||||
</foreignkeys>
|
||||
<indexes>
|
||||
<index name="idx_alf_txn_ctms" unique="false">
|
||||
<columnnames>
|
||||
@@ -2698,11 +2654,6 @@
|
||||
<columnname>commit_time_ms</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
<index name="fk_alf_txn_svr" unique="false">
|
||||
<columnnames>
|
||||
<columnname>server_id</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_usage_delta">
|
||||
|
@@ -174,31 +174,18 @@ CREATE UNIQUE INDEX auth_id ON alf_authority_alias (auth_id, alias_id);
|
||||
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
|
||||
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
|
||||
|
||||
CREATE SEQUENCE alf_server_seq START WITH 1 INCREMENT BY 1;
|
||||
CREATE TABLE alf_server
|
||||
(
|
||||
id INT8 NOT NULL,
|
||||
version INT8 NOT NULL,
|
||||
ip_address VARCHAR(39) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX ip_address ON alf_server (ip_address);
|
||||
|
||||
CREATE SEQUENCE alf_transaction_seq START WITH 1 INCREMENT BY 1;
|
||||
CREATE TABLE alf_transaction
|
||||
(
|
||||
id INT8 NOT NULL,
|
||||
version INT8 NOT NULL,
|
||||
server_id INT8,
|
||||
change_txn_id VARCHAR(56) NOT NULL,
|
||||
commit_time_ms INT8,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
|
||||
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
|
||||
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
|
||||
CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
|
||||
|
||||
CREATE SEQUENCE alf_store_seq START WITH 1 INCREMENT BY 1;
|
||||
CREATE TABLE alf_store
|
||||
|
@@ -44,7 +44,6 @@
|
||||
<sequence name="alf_prop_unique_ctx_seq"/>
|
||||
<sequence name="alf_prop_value_seq"/>
|
||||
<sequence name="alf_qname_seq"/>
|
||||
<sequence name="alf_server_seq"/>
|
||||
<sequence name="alf_store_seq"/>
|
||||
<sequence name="alf_transaction_seq"/>
|
||||
<sequence name="alf_usage_delta_seq"/>
|
||||
@@ -2545,38 +2544,6 @@
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_server">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
<type>int8</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="version" order="2">
|
||||
<type>int8</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="ip_address" order="3">
|
||||
<type>varchar(39)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
</columns>
|
||||
<primarykey name="alf_server_pkey">
|
||||
<columnnames>
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys/>
|
||||
<indexes>
|
||||
<index name="ip_address" unique="true">
|
||||
<columnnames>
|
||||
<columnname>ip_address</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_store">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
@@ -2723,17 +2690,12 @@
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="server_id" order="3">
|
||||
<type>int8</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="change_txn_id" order="4">
|
||||
<column name="change_txn_id" order="3">
|
||||
<type>varchar(56)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="commit_time_ms" order="5">
|
||||
<column name="commit_time_ms" order="4">
|
||||
<type>int8</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
@@ -2744,19 +2706,7 @@
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys>
|
||||
<foreignkey name="fk_alf_txn_svr">
|
||||
<localcolumn>server_id</localcolumn>
|
||||
<targettable>alf_server</targettable>
|
||||
<targetcolumn>id</targetcolumn>
|
||||
</foreignkey>
|
||||
</foreignkeys>
|
||||
<indexes>
|
||||
<index name="fk_alf_txn_svr" unique="false">
|
||||
<columnnames>
|
||||
<columnname>server_id</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
<index name="idx_alf_txn_ctms" unique="false">
|
||||
<columnnames>
|
||||
<columnname>commit_time_ms</columnname>
|
||||
|
@@ -56,6 +56,7 @@
|
||||
<ref bean="patch.db-V5.2-remove-jbpm-tables-from-db" />
|
||||
<ref bean="patch.db-V6.0-change-set-indexes" />
|
||||
<ref bean="patch.db-V6.3-add-indexes-node-transaction" />
|
||||
<ref bean="patch.db-V7.1.0-remove-alf_server-table" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
@@ -0,0 +1,31 @@
|
||||
--
|
||||
-- Title: Remove alf_server table
|
||||
-- Database: MySQL
|
||||
-- Since: V6.3
|
||||
-- Author: David Edwards
|
||||
-- Author: Alex Mukha
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
DROP TABLE alf_server;
|
||||
|
||||
ALTER TABLE alf_transaction
|
||||
DROP FOREIGN KEY fk_alf_txn_svr,
|
||||
DROP COLUMN server_id;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V7.1.0-remove-alf_server-table';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V7.1.0-remove-alf_server-table', 'Remove alf_server table',
|
||||
0, 15000, -1, 15001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'alf_server table and constraints removed'
|
||||
);
|
@@ -0,0 +1,26 @@
|
||||
--
|
||||
-- Title: Remove alf_server table
|
||||
-- Database: PostgreSQL
|
||||
-- Since: V6.3
|
||||
-- Author: Bruno Bossola
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
ALTER TABLE alf_transaction
|
||||
DROP CONSTRAINT IF EXISTS fk_alf_txn_svr,
|
||||
DROP COLUMN IF EXISTS server_id;
|
||||
|
||||
DROP TABLE IF EXISTS alf_server;
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V7.1.0-remove-alf_server-table';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V7.1.0-remove-alf_server-table', 'Removes alf_server table and constraints',
|
||||
0, 15000, -1, 15001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'alf_server table and constraints removed'
|
||||
);
|
@@ -0,0 +1,7 @@
|
||||
(?i).*expected column .*alf_transaction\.change_txn_id\.order="3".*
|
||||
(?i).*expected column .*alf_transaction\.commit_time_ms\.order="4".*
|
||||
(?i).*unexpected column found in database with path: .*alf_transaction\.server_id
|
||||
(?i).*unexpected foreign key found in database with path: .*alf_transaction\.fk_alf_txn_svr
|
||||
(?i).*unexpected index found in database with path: .*alf_transaction\.fk_alf_txn_svr
|
||||
(?i).*unexpected sequence found in database with path: .*alf_server_seq
|
||||
(?i).*unexpected table found in database with path: .*alf_server
|
@@ -403,3 +403,7 @@ patch.db-V5.2-remove-jbpm-tables-from-db.description=Removes all JBPM related ta
|
||||
patch.db-V6.0-change-set-indexes.description=Add additional indexes to support acl tracking.
|
||||
|
||||
patch.db-V6.3-add-indexes-node-transaction.description=Create additional indexes on alf_node and alf_transaction
|
||||
|
||||
patch.db-V7.1.0-remove-alf_server-table.description=Removes alf_server table and constraints
|
||||
|
||||
|
||||
|
@@ -1409,4 +1409,22 @@
|
||||
<value>classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/add-indexes-node-transaction.sql</value>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
<bean id="patch.db-V7.1.0-remove-alf_server-table" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V7.1.0-remove-alf_server-table</value></property>
|
||||
<property name="description"><value>patch.db-V7.1.0-remove-alf_server-table.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>15000</value></property>
|
||||
<property name="targetSchema"><value>15001</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/7.1.0/${db.script.dialect}/remove-alf_server-table.sql</value>
|
||||
</property>
|
||||
<property name="problemsPatternFileUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/7.1.0/remove-alf_server-table.patterns</value>
|
||||
</property>
|
||||
<property name="ignored"><value>${system.remove-alf_server-table-from-db.ignored}</value></property>
|
||||
</bean>
|
||||
<!--
|
||||
-->
|
||||
|
||||
</beans>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
repository.name=Main Repository
|
||||
|
||||
# Schema number
|
||||
version.schema=15000
|
||||
version.schema=15001
|
||||
|
||||
# Directory configuration
|
||||
|
||||
@@ -1239,3 +1239,6 @@ system.new-node-transaction-indexes.ignored=true
|
||||
# Allows the configuration of maximum limits of the temp files to be deleted or the maximum time allowed to run for the job
|
||||
system.tempFileCleaner.maxFilesToDelete=
|
||||
system.tempFileCleaner.maxTimeToRun=
|
||||
|
||||
# Property to long running migration to remove alf_server in v7+ patch.db-V7.1.0-remove-alf_server-table
|
||||
system.remove-alf_server-table-from-db.ignored=true
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -565,4 +565,18 @@ public class TransformationOptionsConverterTest
|
||||
"timeout=-1 "
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommandOptionsFromOldOptions()
|
||||
{
|
||||
ImageTransformationOptions oldOptions = new ImageTransformationOptions();
|
||||
oldOptions.setCommandOptions("-resize 350x50> -background none -gravity center");
|
||||
|
||||
assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG,
|
||||
"ImageTransformationOptions [commandOptions=-resize 350x50> -background none -gravity center, " +
|
||||
"resizeOptions=null, autoOrient=true]]",
|
||||
"autoOrient=true " + // this is a default - so is also set when uploading a logo
|
||||
"commandOptions=-resize 350x50> -background none -gravity center " +
|
||||
"timeout=-1 ");
|
||||
}
|
||||
}
|
@@ -33,23 +33,44 @@ import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathConstants;
|
||||
import javax.xml.xpath.XPathExpression;
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
||||
import org.alfresco.repo.domain.schema.SchemaBootstrap;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.test.junitrules.ApplicationContextInit;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.rules.RuleChain;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
@Category({OwnJVMTestsCategory.class})
|
||||
public class SchemaBootstrapTest
|
||||
{
|
||||
private static final String BOOTSTRAP_TEST_CONTEXT = "classpath*:alfresco/dbscripts/test-bootstrap-context.xml";
|
||||
private static final String BOOTSTRAP_TEST_CONTEXT = "classpath*:alfresco/dbscripts/bootstrap-context-test.xml";
|
||||
private static final String MAIN_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml";
|
||||
private static final String TEST_SCHEMA_REFERENCE_FILE = "classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Test-Schema-Reference-ALF.xml";
|
||||
private static final List<String> TEST_SCHEMA_REFERENCE_URLS = Arrays.asList(
|
||||
"classpath:alfresco/dbscripts/create/${db.script.dialect}/Test-Schema-Reference-ALF.xml",
|
||||
"classpath:alfresco/dbscripts/create/${db.script.dialect}/Schema-Reference-ACT.xml");
|
||||
TEST_SCHEMA_REFERENCE_FILE,
|
||||
"classpath:alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ACT.xml");
|
||||
|
||||
private static ApplicationContextInit APP_CONTEXT_INIT = ApplicationContextInit.createStandardContextWithOverrides(BOOTSTRAP_TEST_CONTEXT);
|
||||
|
||||
@@ -59,6 +80,17 @@ public class SchemaBootstrapTest
|
||||
private SchemaBootstrap schemaBootstrap;
|
||||
private SchemaUpgradeScriptPatch optionalPatch;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception
|
||||
{
|
||||
ResourcePatternResolver rpr = new PathMatchingResourcePatternResolver(SchemaBootstrapTest.class.getClassLoader());
|
||||
Document schemaRefXML = loadXML(rpr.getResource(MAIN_SCHEMA_REFERENCE_FILE));
|
||||
Node indexes = getIndexesNode(schemaRefXML);
|
||||
indexes.appendChild(createTestIndex(schemaRefXML));
|
||||
Resource testSchemaRef = rpr.getResource(TEST_SCHEMA_REFERENCE_FILE);
|
||||
updateTestSchemaReferenceFile(testSchemaRef, schemaRefXML);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
@@ -83,4 +115,47 @@ public class SchemaBootstrapTest
|
||||
+ optionalPatch.getId() + " has been run"));
|
||||
}
|
||||
|
||||
private static void updateTestSchemaReferenceFile(Resource testSchemaRef, Document newDoc) throws Exception
|
||||
{
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
StreamResult result = new StreamResult(testSchemaRef.getFile());
|
||||
DOMSource source = new DOMSource(newDoc);
|
||||
transformer.transform(source, result);
|
||||
}
|
||||
|
||||
private static Element createTestIndex(Document document)
|
||||
{
|
||||
Element testIndex = document.createElement("index");
|
||||
testIndex.setAttribute("name", "idx_alf_node_test");
|
||||
testIndex.setAttribute("unique", "false");
|
||||
|
||||
Element columnNames = document.createElement("columnnames");
|
||||
for (String colName: Arrays.asList("acl_id", "audit_creator"))
|
||||
{
|
||||
Element columnName = document.createElement("columnname");
|
||||
columnName.setNodeValue(colName);
|
||||
columnNames.appendChild(columnName);
|
||||
}
|
||||
testIndex.appendChild(columnNames);
|
||||
|
||||
return testIndex;
|
||||
}
|
||||
|
||||
private static Node getIndexesNode(Document document) throws XPathExpressionException
|
||||
{
|
||||
XPathFactory xPathfactory = XPathFactory.newInstance();
|
||||
XPath xpath = xPathfactory.newXPath();
|
||||
XPathExpression expr = xpath.compile("/schema/objects/table[@name='alf_node']/indexes");
|
||||
Node indexes = (Node)expr.evaluate(document, XPathConstants.NODE);
|
||||
return indexes;
|
||||
}
|
||||
|
||||
private static Document loadXML(Resource resource) throws Exception
|
||||
{
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder;
|
||||
builder = factory.newDocumentBuilder();
|
||||
return builder.parse(resource.getInputStream());
|
||||
}
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ import org.alfresco.repo.admin.patch.AppliedPatch;
|
||||
import org.alfresco.repo.admin.patch.PatchService;
|
||||
import org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch;
|
||||
import org.alfresco.repo.domain.dialect.Dialect;
|
||||
import org.alfresco.util.schemacomp.model.DbObject;
|
||||
import org.alfresco.util.schemacomp.model.Index;
|
||||
import org.alfresco.util.schemacomp.model.Schema;
|
||||
import org.alfresco.util.schemacomp.model.Table;
|
||||
@@ -125,8 +126,7 @@ public class SchemaDifferenceHelperUnitTest
|
||||
|
||||
private Difference createDifference()
|
||||
{
|
||||
Difference difference = new Difference(Where.IN_BOTH_BUT_DIFFERENCE, mock(DbProperty.class), mock(DbProperty.class));
|
||||
return difference;
|
||||
return new Difference(Where.IN_BOTH_BUT_DIFFERENCE, new DbProperty(mock(DbObject.class)), new DbProperty(mock(DbObject.class)));
|
||||
}
|
||||
|
||||
private Index createTableIndex(String tableName)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,38 +25,38 @@
|
||||
*/
|
||||
package org.alfresco.util.schemacomp;
|
||||
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.domain.schema.SchemaBootstrap;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.testing.category.DBTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* Test intended for use in the continuous integration system that checks whether the
|
||||
* schema reference file (for whichever database the tests are being run against)
|
||||
* is in sync with the actual schema. If the test fails (and the schema comparator is
|
||||
* in working order) then the most likely cause is that a new up-to-date schema reference file
|
||||
* needs to be created.
|
||||
* Test intended for use in the continuous integration system that checks
|
||||
* whether the schema reference file (for whichever database the tests are being
|
||||
* run against) is in sync with the actual schema. If the test fails (and the
|
||||
* schema comparator is in working order) then the most likely cause is that a
|
||||
* new up-to-date schema reference file needs to be created.
|
||||
* <p>
|
||||
* Schema reference files are created using the {@link DbToXML} tool.
|
||||
* <p>
|
||||
* Note: if no reference file exists then the test will pass, this is to allow piece meal
|
||||
* introduction of schmea reference files.
|
||||
* Note: if no reference file exists then the test will pass, this is to allow
|
||||
* piece meal introduction of schmea reference files.
|
||||
*
|
||||
* @see DbToXML
|
||||
* @author Matt Ward
|
||||
*/
|
||||
@Category({OwnJVMTestsCategory.class, DBTests.class})
|
||||
@Category({ OwnJVMTestsCategory.class, DBTests.class })
|
||||
public class SchemaReferenceFileTest
|
||||
{
|
||||
private ClassPathXmlApplicationContext ctx;
|
||||
@@ -74,12 +74,28 @@ public class SchemaReferenceFileTest
|
||||
{
|
||||
ByteArrayOutputStream buff = new ByteArrayOutputStream();
|
||||
PrintWriter out = new PrintWriter(buff);
|
||||
int numProblems = schemaBootstrap.validateSchema(null, out);
|
||||
int maybeProblems = schemaBootstrap.validateSchema(null, out);
|
||||
out.flush();
|
||||
|
||||
if (numProblems > 0)
|
||||
if (maybeProblems > 0)
|
||||
{
|
||||
fail(buff.toString());
|
||||
List<String> errors = computeRealErrors(buff);
|
||||
assertTrue("\n"+buff, errors.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> computeRealErrors(ByteArrayOutputStream buff)
|
||||
{
|
||||
String[] lines = buff.toString().split("\\n");
|
||||
|
||||
List<String> errors = new ArrayList<>();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
String line = lines[i].trim();
|
||||
if (line.isEmpty())
|
||||
break;
|
||||
errors.add(line);
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,6 @@
|
||||
<sequence name="alf_prop_unique_ctx_seq"/>
|
||||
<sequence name="alf_prop_value_seq"/>
|
||||
<sequence name="alf_qname_seq"/>
|
||||
<sequence name="alf_server_seq"/>
|
||||
<sequence name="alf_store_seq"/>
|
||||
<sequence name="alf_transaction_seq"/>
|
||||
<sequence name="alf_usage_delta_seq"/>
|
||||
@@ -2551,38 +2550,6 @@
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_server">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
<type>int8</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="version" order="2">
|
||||
<type>int8</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="ip_address" order="3">
|
||||
<type>varchar(39)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
</columns>
|
||||
<primarykey name="alf_server_pkey">
|
||||
<columnnames>
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys/>
|
||||
<indexes>
|
||||
<index name="ip_address" unique="true">
|
||||
<columnnames>
|
||||
<columnname>ip_address</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
</indexes>
|
||||
</table>
|
||||
<table name="alf_store">
|
||||
<columns>
|
||||
<column name="id" order="1">
|
||||
@@ -2729,17 +2696,12 @@
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="server_id" order="3">
|
||||
<type>int8</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="change_txn_id" order="4">
|
||||
<column name="change_txn_id" order="3">
|
||||
<type>varchar(56)</type>
|
||||
<nullable>false</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
</column>
|
||||
<column name="commit_time_ms" order="5">
|
||||
<column name="commit_time_ms" order="4">
|
||||
<type>int8</type>
|
||||
<nullable>true</nullable>
|
||||
<autoincrement>false</autoincrement>
|
||||
@@ -2750,19 +2712,7 @@
|
||||
<columnname order="1">id</columnname>
|
||||
</columnnames>
|
||||
</primarykey>
|
||||
<foreignkeys>
|
||||
<foreignkey name="fk_alf_txn_svr">
|
||||
<localcolumn>server_id</localcolumn>
|
||||
<targettable>alf_server</targettable>
|
||||
<targetcolumn>id</targetcolumn>
|
||||
</foreignkey>
|
||||
</foreignkeys>
|
||||
<indexes>
|
||||
<index name="fk_alf_txn_svr" unique="false">
|
||||
<columnnames>
|
||||
<columnname>server_id</columnname>
|
||||
</columnnames>
|
||||
</index>
|
||||
<index name="idx_alf_txn_ctms" unique="false">
|
||||
<columnnames>
|
||||
<columnname>commit_time_ms</columnname>
|
||||
|
Reference in New Issue
Block a user