Compare commits

..

57 Commits

Author SHA1 Message Date
Travis CI User
93260c0bc8 [maven-release-plugin][skip ci] prepare release 7.199.304 2020-11-16 20:31:48 +00:00
Alexandru-Eusebiu Epure
c205c94caa Merge pull request #156 from Alfresco/fix/MNT-22036_API_always_applies_versioning_622
MNT-22036 : REST API always applies versioning
2020-11-16 21:56:33 +02:00
Epure Alexandru-Eusebiu
5135482fd2 Remove bad assertion of property count. 2020-11-16 21:34:32 +02:00
Alexandru-Eusebiu Epure
ed9aa57849 Merge pull request #149 from Alfresco/fix/MNT-22036_API_always_applies_versioning
MNT-22036 : REST API always applies versioning
  Add property boolean versioningEnabled
  Add versioningEnabled to node creation using multipart/form-data
  Add versioningEnabled to node creation using JSON
  Add unit tests for node creation using JSON.
(cherry picked from commit 09c2c95081)
2020-11-16 18:11:37 +02:00
Travis CI User
7b578827d1 [maven-release-plugin][skip ci] prepare for next development iteration 2020-11-09 11:08:00 +00:00
Travis CI User
11a5731ca7 [maven-release-plugin][skip ci] prepare release 7.199.303 2020-11-09 11:07:53 +00:00
evasques
ce48f64a14 MNT-21800 - CMIS Web Service Check Out returns error (#137)
* Fix/MNT-21800 CMIS Web Service Check Out returns error (#1232)

* MNT-21800 : CMIS Web Service Check Out returns error
   Integrate path into codebase.

(cherry picked from commit 51a7793668ba1c969c5de37603190244e3839cd0)

Co-authored-by: Alexandru-Eusebiu Epure <alexeusebiu@gmail.com>
2020-11-09 10:41:06 +00:00
Travis CI User
4a9a7ba4de [maven-release-plugin][skip ci] prepare for next development iteration 2020-11-06 17:25:29 +00:00
Travis CI User
0dc7d62d3f [maven-release-plugin][skip ci] prepare release 7.199.302 2020-11-06 17:25:22 +00:00
evasques
7f54671ca2 MNT-21967 - ClassCastException when using CMIS query with SCORE() function (#136)
* MNT-21967 - ClassCastException when using CMIS query with SCORE() function (#128)

* Added missing validation before if columnName is the expected column
before normalizing value to float, in case the column is Score

(cherry picked from commit acac23f29a)
2020-11-06 16:22:05 +00:00
Alan Davis
84e2ff5f1f Should be using TRAVIS_ACCESS_TOKEN rather than TRAVIS_ACCESS_TOKEN_TEMP [skip ci] 2020-10-14 08:31:28 +01:00
Travis CI User
75fbb557fe [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-13 17:02:09 +00:00
Travis CI User
d40fb4f988 [maven-release-plugin][skip ci] prepare release 7.199.301 2020-10-13 17:02:01 +00:00
Alan Davis
f50a76d20d Should be using TRAVIS_ACCESS_TOKEN rather than TRAVIS_ACCESS_TOKEN_TEMP to trigger downstream project builds 2020-10-13 17:33:20 +01:00
Travis CI User
c170ed725a [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-11 08:59:51 +00:00
Travis CI User
62ccbe9da2 [maven-release-plugin][skip ci] prepare release 7.199.300 2020-10-11 08:59:45 +00:00
Alan Davis
310689994d Switch to alfresco-community-repo project 2020-10-11 09:28:54 +01:00
Travis CI User
62a506da47 [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-09 09:27:29 +00:00
Travis CI User
399a29eef2 [maven-release-plugin][skip ci] prepare release 7.199.300-TEST5 2020-10-09 09:27:21 +00:00
Alan Davis
4167f6810e Add back in missing keystore scripts 2020-10-09 08:05:37 +01:00
Travis CI User
01fe638d60 [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-08 12:09:16 +00:00
Travis CI User
3ad2db96ab [maven-release-plugin][skip ci] prepare release 7.199.300-TEST4 2020-10-08 12:09:09 +00:00
Alan Davis
1c9366dcaf Only copy win64 and linux pdf-renderer to dist zip
Sort out what get included in dist jar and zip

(cherry picked from commit 779f8af717)

Remove READMEs that have been moved to the top level.

(cherry picked from commit 9826fd6bb0)
2020-10-08 12:27:35 +01:00
Travis CI User
9c1daf0795 [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-04 19:16:34 +00:00
Travis CI User
fb7a6a8a1f [maven-release-plugin][skip ci] prepare release 7.199.300-TEST3 2020-10-04 19:16:28 +00:00
Alan Davis
4307444e2d Merge commits for 6.2.2.3 changes to release/6.2.2
* [MNT-21766]: Significant degradation of performance as file and site count increase (#1217)
- Added the following indexes on alf_transaction:
idx_alf_txn_ctms_sc, cols (commit_time_ms)
idx_alf_txn_id_ctms, cols (id, commit_time_ms)
- Added the following indexes on alf_node:
idx_alf_node_ver, cols (version)
idx_alf_node_txn, cols (transaction_id)
- Created patch patch.db-V6.3-add-indexes-node-transaction
- Updated version.schema to 14002
- Added system property system.new-node-transaction-indexes.ignored, set
as true by default to not apply the patch automatically
- Created the MySQL update dbscripts to add the new indexes - and also
drop and recreate the pre-existing index idx_alf_txn_ctms on alf_transaction that was
inconsistent with the other DBMS: was indexing only commit_time_ms when
on all other DBMS index idx_alf_txn_ctms was on (commit_time_ms, id)
- Created the Postgres update dbscripts to add the new indexes

(cherry picked from commit d70746f63a6e6a2154d2e37c577955a17c42256e)

* Change schema upgrade from to 13005..13006 on patch apply

* Fixed merge from cherry pick, missing colon

(cherry picked from commit 73f94fc5ca0d2ea322d12a59cf3ae980ef94bf1c)
2020-10-04 19:50:40 +01:00
Travis CI User
89ae5bc193 [maven-release-plugin][skip ci] prepare for next development iteration 2020-10-02 10:38:02 +00:00
Travis CI User
fe537e97d5 [maven-release-plugin][skip ci] prepare release 7.199.300-TEST2 2020-10-02 10:37:55 +00:00
Alan Davis
c7b29613d4 REPO-5358 Deployment modules should extend each other
The alfresco-community-repo's deployment module now provides the basis for alfresco-enterprise-repo and acs-packaging
deployment modules. This makes it like the other branches and avoids duplication of licenses between projects.

(partial picked from commit c4d1f5824d)
2020-10-02 11:06:47 +01:00
Cezar.Leahu
4d1f6ae91e REPO-5111 Update build scripts [skip ci] 2020-09-30 22:30:52 +03:00
Travis CI User
1f2d85e252 [maven-release-plugin][skip ci] prepare for next development iteration 2020-09-27 10:25:31 +00:00
Travis CI User
efa330adf5 [maven-release-plugin][skip ci] prepare release 7.199.300-TEST1 2020-09-27 10:25:24 +00:00
Alan Davis
abde3fa4cb REPO-5271 Backport new structure to relaese/6.2.2 (#21)
- Simplify dependencies and standardise order
- README updated
- Green builds
- Changes to make Jars in enterprise war match
- Changes to make files in enterprise image match
- Added travis_wait 40 to the initial build as it can take 20 minutes to download artifacts
- Removed NodesTest.siteConsumerWillGet403OnFileWithDisabledInherittedPermissions introduced in 7.0.0 and fails in earlier versions.
- GetSiteMember[s]Tests changed in 7.0.0. Setting test back to previous values.
2020-09-27 10:53:02 +01:00
Cezar.Leahu
1d6a775f22 ACS-550 Add .gitignore
(cherry picked from commit 36ccfe2bea)
2020-09-03 11:24:33 +03:00
Iulian Aftene
6596825462 Merge pull request #12 from Alfresco/feature/REPO-5318_622
REPO-5318-Create l10n.properties release 6.2.2
2020-08-21 11:43:30 +03:00
aftene
30a9c0c065 REPO-5318-Create l10n.properties
- delete l10n.properties files from data-model, remote-api and repository
 - add new global l10n.properties file
2020-08-19 19:40:13 +03:00
Chris Shields
1399b363cc Merge remote-tracking branch 'acs-community-packaging/develop' into release/6.2.2 2020-07-21 10:45:00 +01:00
Chris Shields
6416432f42 Merge remote-tracking branch 'alfresco-remote-api/support/HF/7.147.N' into release/6.2.2 2020-07-21 10:44:59 +01:00
Chris Shields
1c7c87caee Merge remote-tracking branch 'alfresco-repository/support/HF/7.199.N' into release/6.2.2 2020-07-21 10:44:57 +01:00
Chris Shields
42de0e1607 Merge remote-tracking branch 'alfresco-data-model/support/HF/8.50.18.N' into release/6.2.2 2020-07-21 10:44:57 +01:00
Chris Shields
9da76f53e0 Merge remote-tracking branch 'alfresco-core/support/HF/7.34.N' into release/6.2.2 2020-07-21 10:44:57 +01:00
Chris Shields
c70fdd47a7 Moved remote-api support/HF/7.147.N into its own directory 2020-07-21 10:44:14 +01:00
Chris Shields
d96e726db4 Moved repository support/HF/7.199.N into its own directory 2020-07-21 10:43:42 +01:00
Chris Shields
fc66677977 Moved data-model support/HF/8.50.18.N into its own directory 2020-07-21 10:43:27 +01:00
Chris Shields
2a9f61076c Moved core support/HF/7.34.N into its own directory 2020-07-21 10:43:19 +01:00
Travis CI User
12c66a09d1 [maven-release-plugin][skip ci] prepare for next development iteration 2020-06-26 18:57:20 +00:00
Travis CI User
5882e3d002 [maven-release-plugin][skip ci] prepare release alfresco-remote-api-7.147.0 2020-06-26 18:57:13 +00:00
Ancuta Morarasu
c15bace290 ACS-248: [6.2.2] HF branch - version 7.147.0-SNAPSHOT 2020-06-26 21:39:06 +03:00
Travis CI User
40eb3f1649 [maven-release-plugin][skip ci] prepare for next development iteration 2020-06-26 18:30:40 +00:00
Travis CI User
edd5c3ac7b [maven-release-plugin][skip ci] prepare release alfresco-repository-7.199.0 2020-06-26 18:30:32 +00:00
Ancuta Morarasu
71eb5f3011 ACS-248: [6.2.2] HF branch - version 7.199.0-SNAPSHOT 2020-06-26 21:07:51 +03:00
Travis CI User
1bf2cf015c [maven-release-plugin][skip ci] prepare for next development iteration 2020-06-26 17:51:56 +00:00
Travis CI User
cd97fb3c3a [maven-release-plugin][skip ci] prepare release 8.50.18.0 2020-06-26 17:51:50 +00:00
Ancuta Morarasu
fc729dd26f ACS-248: [6.2.2] HF branch - version 8.50.18.0-SNAPSHOT 2020-06-26 20:43:59 +03:00
Travis CI User
8c21deee57 [maven-release-plugin][skip ci] prepare for next development iteration 2020-06-26 17:36:12 +00:00
Travis CI User
0cf79474a1 [maven-release-plugin][skip ci] prepare release 7.34.0 2020-06-26 17:36:06 +00:00
Ancuta Morarasu
5a840b7ecf ACS-248: [6.2.2] HF branch - version 7.34.0-SNAPSHOT 2020-06-26 20:32:04 +03:00
64 changed files with 679 additions and 1185 deletions

View File

@@ -131,8 +131,8 @@ apiKey=
#userKey is required if WhiteSource administrator has enabled "Enforce user level access" option
#userKey=
projectName=alfresco-repository
projectVersion=7.N
projectName=alfresco-community-repo
projectVersion=6.2.2
projectToken=
productName=ACS Community

View File

@@ -1,42 +0,0 @@
### Alfresco Core
[![Build Status](https://travis-ci.com/Alfresco/alfresco-core.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-core)
Alfresco Core is a library packaged as a jar file which is part of [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository).
The library contains the following:
* Various helpers and utils
* Canned queries interface and supporting classes
* Generic encryption supporting classes
Version 7 of the library uses Spring 5, Quartz 2.3 and does not have Hibernate dependency.
### Building and testing
The project can be built and tested by running Maven command:
~~~
mvn clean install
~~~
### Artifacts
The artifacts can be obtained by:
* downloading from [Alfresco repository](https://artifacts.alfresco.com/nexus/content/groups/public)
* getting as Maven dependency by adding the dependency to your pom file:
~~~
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-core</artifactId>
<version>version</version>
</dependency>
~~~
and Alfresco repository:
~~~
<repository>
<id>alfresco-maven-repo</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
~~~
The SNAPSHOT version of the artifact is **never** published.
### Old version history
The history for older versions can be found in [Alfresco SVN](https://svn.alfresco.com/repos/alfresco-open-mirror/services/alfresco-core/)
### Contributing guide
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.

View File

@@ -1,5 +1,6 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-core</artifactId>
<name>Alfresco Core</name>
<description>Alfresco core libraries and utils</description>
@@ -7,13 +8,14 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
@@ -22,10 +24,12 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -50,6 +54,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${dependency.spring.version}</version>
<!-- exclude spring-jcl which is brought in by spring-core -->
<!-- see https://issues.alfresco.com/jira/browse/REPO-4774 -->
<exclusions>
@@ -62,10 +67,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${dependency.spring.version}</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.2</version>
<!-- exclude c3p0 -->
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
<exclusions>
@@ -87,6 +94,7 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
@@ -106,6 +114,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.5</version>
</dependency>
<!-- provided dependencies -->
@@ -125,6 +134,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -322,7 +322,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
try
{
keyInfoManager = getKeyInfoManager(getKeyStoreParameters());
keyInfoManager = getKeyInfoManager(getKeyMetaDataFileLocation());
KeyStore ks = loadKeyStore(keyStoreParameters, keyInfoManager);
logger.debug("Initializing key managers");
@@ -355,7 +355,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
try
{
keyInfoManager = getKeyInfoManager(getKeyStoreParameters());
keyInfoManager = getKeyInfoManager(getKeyMetaDataFileLocation());
KeyStore ks = loadKeyStore(getKeyStoreParameters(), keyInfoManager);
logger.debug("Initializing trust managers");
@@ -376,7 +376,12 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
}
}
}
protected String getKeyMetaDataFileLocation()
{
return keyStoreParameters.getKeyMetaDataFileLocation();
}
protected InputStream getKeyStoreStream(String location) throws FileNotFoundException
{
if(location == null)
@@ -391,17 +396,9 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
return new FileOutputStream(getKeyStoreParameters().getLocation());
}
protected KeyInfoManager getKeyInfoManager(KeyStoreParameters keyStoreParameters) throws IOException
protected KeyInfoManager getKeyInfoManager(String metadataFileLocation) throws FileNotFoundException, IOException
{
return new KeyInfoManager(keyStoreParameters, keyResourceLoader);
}
@Deprecated
protected KeyInfoManager getKeyInfoManager(String metadataFileLocation) throws IOException
{
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setKeyMetaDataFileLocation(metadataFileLocation);
return new KeyInfoManager(keyStoreParameters, keyResourceLoader);
return new KeyInfoManager(metadataFileLocation, keyResourceLoader);
}
protected KeyMap cacheKeys(KeyStore ks, KeyInfoManager keyInfoManager)
@@ -566,7 +563,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
try
{
keyInfoManager = getKeyInfoManager(keyStoreParameters);
keyInfoManager = getKeyInfoManager(keyStoreParameters.getKeyMetaDataFileLocation());
ks = loadKeyStore(keyStoreParameters, keyInfoManager);
// Loaded
}
@@ -638,7 +635,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
try
{
keyInfoManager = getKeyInfoManager(getKeyStoreParameters());
keyInfoManager = getKeyInfoManager(getKeyMetaDataFileLocation());
Key key = getSecretKey(keyInfoManager.getKeyInformation(keyAlias));
encryptionKeysRegistry.registerKey(keyAlias, key);
keys.setKey(keyAlias, key);
@@ -681,7 +678,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
{
if(!keyStoreExists(keyStoreParameters.getLocation()))
{
keyInfoManager = getKeyInfoManager(keyStoreParameters);
keyInfoManager = getKeyInfoManager(keyStoreParameters.getKeyMetaDataFileLocation());
KeyStore ks = initialiseKeyStore(keyStoreParameters.getType(), keyStoreParameters.getProvider());
String keyStorePassword = keyInfoManager.getKeyStorePassword();
@@ -689,7 +686,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
{
throw new AlfrescoRuntimeException("Key store password is null for keystore at location "
+ getKeyStoreParameters().getLocation()
+ ". Either specify it as a JVM property or in key store meta data location.");
+ ", key store meta data location" + getKeyMetaDataFileLocation());
}
for(String keyAlias : keys.getKeyAliases())
@@ -768,13 +765,8 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
}
}
protected Key getSecretKey(KeyInformation keyInformation) throws AlfrescoRuntimeException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException
protected Key getSecretKey(KeyInformation keyInformation) throws NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException
{
if (keyInformation == null)
{
throw new AlfrescoRuntimeException("Unable to get secret key: no key information is provided");
}
byte[] keyData = keyInformation.getKeyData();
if(keyData == null)
@@ -804,7 +796,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
writeLock.lock();
try
{
keyInfoManager = getKeyInfoManager(getKeyStoreParameters());
keyInfoManager = getKeyInfoManager(getKeyMetaDataFileLocation());
KeyStore ks = loadKeyStore(getKeyStoreParameters(), keyInfoManager);
// loading Key
@@ -993,7 +985,7 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
public static class KeyInfoManager
{
private KeyResourceLoader keyResourceLoader;
private KeyStoreParameters keyStoreParameters;
private String metadataFileLocation;
private Properties keyProps;
private String keyStorePassword = null;
private Map<String, KeyInformation> keyInfo;
@@ -1013,10 +1005,10 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
}
}
KeyInfoManager(KeyStoreParameters keyStoreParameters, KeyResourceLoader keyResourceLoader) throws IOException, FileNotFoundException
KeyInfoManager(String metadataFileLocation, KeyResourceLoader keyResourceLoader) throws IOException, FileNotFoundException
{
this.keyResourceLoader = keyResourceLoader;
this.keyStoreParameters = keyStoreParameters;
this.metadataFileLocation = metadataFileLocation;
keyInfo = new HashMap<String, KeyInformation>(2);
loadKeyMetaData();
}
@@ -1033,73 +1025,31 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
* Where required, <tt>null</tt> values must be inserted into the map to indicate the presence
* of a key that is not protected by a password. They entry for {@link #KEY_KEYSTORE_PASSWORD}
* is required if the keystore is password protected.
*
* WARNING. Storing passwords (keyMetaDataFileLocation) on the file system is not following best security practices.
*
* <p/>Loading of keys info from system (JVM) properties takes precedence over metadata file.
* <p/>Set the unique ID of the keystore and remove the metadata file location property to use JVM properties lookup instead. The property lookup format is the following:
* <ul>
* <li>[keystore-id].password - keystore password</li>
* <li>[keystore-id].aliases - comma separated list of aliases for the keys in the keystore</li>
* <li>[keystore-id].[alias].keyData - key data bytes in base64</li>
* <li>[keystore-id].[alias].algorithm - key algorithm</li>
* <li>[keystore-id].[alias].password - key password</li>
* </ul>
*
*/
protected void loadKeyMetaData() throws IOException, FileNotFoundException
{
if (keyStoreParameters.getId() != null &&
(keyStoreParameters.getKeyMetaDataFileLocation() == null ||
keyStoreParameters.getKeyMetaDataFileLocation().isEmpty()))
keyProps = keyResourceLoader.loadKeyMetaData(metadataFileLocation);
if(keyProps != null)
{
Properties jvmProperties = System.getProperties();
keyStorePassword = jvmProperties.getProperty(keyStoreParameters.getId() + ".password");
String aliases = jvmProperties.getProperty(keyStoreParameters.getId() + ".aliases");
if (aliases == null || aliases.isEmpty())
String aliases = keyProps.getProperty("aliases");
if(aliases == null)
{
logger.warn("No aliases were specified for " + keyStoreParameters.getId()
+ " keystore");
throw new AlfrescoRuntimeException("Passwords file must contain an aliases key");
}
else
this.keyStorePassword = keyProps.getProperty(KEY_KEYSTORE_PASSWORD);
StringTokenizer st = new StringTokenizer(aliases, ",");
while(st.hasMoreTokens())
{
StringTokenizer st = new StringTokenizer(aliases, ",");
while(st.hasMoreTokens())
{
String keyAlias = st.nextToken();
keyInfo.put(keyAlias, loadKeyInformation(jvmProperties, keyAlias, keyStoreParameters.getId() + "."));
}
String keyAlias = st.nextToken();
keyInfo.put(keyAlias, loadKeyInformation(keyAlias));
}
}
else
{
logger.warn("Storing passwords (" + keyStoreParameters.getKeyMetaDataFileLocation()
+ ") on the file system is not following best security practices." +
" Please refer to documentation and use JVM properties instead");
keyProps = keyResourceLoader.loadKeyMetaData(keyStoreParameters.getKeyMetaDataFileLocation());
if(keyProps != null)
{
String aliases = keyProps.getProperty("aliases");
if(aliases == null)
{
throw new AlfrescoRuntimeException("Passwords file must contain an aliases key");
}
this.keyStorePassword = keyProps.getProperty(KEY_KEYSTORE_PASSWORD);
StringTokenizer st = new StringTokenizer(aliases, ",");
while(st.hasMoreTokens())
{
String keyAlias = st.nextToken();
keyInfo.put(keyAlias, loadKeyInformation(keyProps, keyAlias, ""));
}
}
else
{
// TODO
//throw new FileNotFoundException("Cannot find key metadata file " + getKeyMetaDataFileLocation());
}
// TODO
//throw new FileNotFoundException("Cannot find key metadata file " + getKeyMetaDataFileLocation());
}
}
@@ -1117,11 +1067,11 @@ public class AlfrescoKeyStoreImpl implements AlfrescoKeyStore
this.keyProps.remove(keyAlias);
}
protected KeyInformation loadKeyInformation(Properties keyProps, String keyAlias, String prefix)
protected KeyInformation loadKeyInformation(String keyAlias)
{
String keyPassword = keyProps.getProperty(prefix + keyAlias + ".password");
String keyData = keyProps.getProperty(prefix + keyAlias + ".keyData");
String keyAlgorithm = keyProps.getProperty(prefix + keyAlias + ".algorithm");
String keyPassword = keyProps.getProperty(keyAlias + ".password");
String keyData = keyProps.getProperty(keyAlias + ".keyData");
String keyAlgorithm = keyProps.getProperty(keyAlias + ".algorithm");
byte[] keyDataBytes = null;
if(keyData != null && !keyData.equals(""))

View File

@@ -22,15 +22,12 @@ import org.alfresco.util.PropertyCheck;
/**
* Stores Java keystore initialisation parameters.
*
* WARNING. Storing passwords (keyMetaDataFileLocation) on the file system is not following best security practices.
*
*
* @since 4.0
*
*/
public class KeyStoreParameters
{
private String id;
private String name;
private String type;
private String provider;
@@ -41,40 +38,8 @@ public class KeyStoreParameters
{
}
/**
* WARNING. Storing passwords (keyMetaDataFileLocation) on the file system is not following best security practices.
*
* <p/>Set the unique ID of the keystore and aliases to use Java system properties lookup instead. The property lookup format is:
* <ul>
* <li>[keystore-id].password - keystore password</li>
* <li>[keystore-id].aliases - comma separated list of aliases for the keys in the keystore</li>
* <li>[keystore-id].[alias].keydata - key data bytes in base64</li>
* <li>[keystore-id].[alias].algorithm - key algorithm</li>
* <li>[keystore-id].[alias].password - key password</li>
* </ul>
*
* Loading of keys info from system (JVM) properties takes precedence over metadata file.
*
* @param id unique identifier of the keystore
* @param name human readable name of the keystore
* @param type type of the keystore
* @param keyStoreProvider keystore provider
* @param keyMetaDataFileLocation path to keystore metadata file on the file system
* @param location path to keystore on the file system
*/
public KeyStoreParameters(String id, String name, String type, String keyStoreProvider,
String keyMetaDataFileLocation, String location)
{
this(name, type, keyStoreProvider, keyMetaDataFileLocation, location);
this.id = id;
}
/**
* Use {@link #KeyStoreParameters(String, String, String, String, String, String)} instead
*/
@Deprecated()
public KeyStoreParameters(String name, String type, String keyStoreProvider,
String keyMetaDataFileLocation, String location)
String keyMetaDataFileLocation, String location)
{
super();
this.name = name;
@@ -84,13 +49,8 @@ public class KeyStoreParameters
this.location = location;
}
public void init()
{
if (!PropertyCheck.isValidPropertyString(getId()))
{
setId(null);
}
if (!PropertyCheck.isValidPropertyString(getLocation()))
{
setLocation(null);
@@ -109,11 +69,6 @@ public class KeyStoreParameters
}
}
public String getId()
{
return id;
}
public String getName()
{
return name;
@@ -138,12 +93,7 @@ public class KeyStoreParameters
{
return location;
}
public void setId(String id)
{
this.id = id;
}
public void setName(String name)
{
this.name = name;

View File

@@ -1,388 +0,0 @@
/*
* Copyright (C) 2005-2020 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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/>.
*/
package org.alfresco.encryption;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class AlfrescoKeyStoreTest
{
@Mock
private EncryptionKeysRegistry encryptionKeysRegistry;
@Rule
public TestName testName = new TestName();
@Test
public void testSysPropConfig()
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
String alias2 = "mykey2";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-2.jks");
System.setProperty(keyStoreId + "." + "password", "ksPwd2");
System.setProperty(keyStoreId + "." + "aliases", alias1 + "," + alias2);
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "aliasPwd1");
System.setProperty(keyStoreId + "." + alias2 + "." + "password", "aliasPwd2");
try
{
AlfrescoKeyStore alfrescoKeyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
Set<String> expectedAliases = new HashSet<>();
expectedAliases.add(alias1);
expectedAliases.add(alias2);
Assert.assertEquals("The aliases are not correct", expectedAliases, alfrescoKeyStore.getKeyAliases());
Assert.assertNotNull("Failed to retrieve a key from keystore.", alfrescoKeyStore.getKey(alias1));
Assert.assertNotNull("Failed to retrieve a key from keystore.", alfrescoKeyStore.getKey(alias2));
}
finally
{
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
System.clearProperty(keyStoreId + "." + alias2 + "." + "password");
}
}
@Test
public void testSysPropConfigWithoutAliases()
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "password", "ksPwd1");
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "aliasPwd1");
try
{
AlfrescoKeyStore keyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
Assert.assertNull(keyStore.getKey(alias1));
}
finally
{
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
}
}
@Test
public void testMetaDataFileConfig()
{
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/ks1-metadata.properties");
AlfrescoKeyStore alfrescoKeyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
Set<String> expectedAliases = new HashSet<>();
expectedAliases.add(alias1);
Assert.assertEquals("The aliases are not correct", expectedAliases, alfrescoKeyStore.getKeyAliases());
Assert.assertNotNull("Failed to retrieve a key from keystore.", alfrescoKeyStore.getKey(alias1));
}
/**
* Config via System props should be default, but if the metadata file location is set, it will be used instead.
* This is done to maintain backwards compatibility and simplify testing use cases.
*/
@Test(expected = AlfrescoRuntimeException.class)
public void testConfigBothSystemAndFile()
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
String alias2 = "mykey2";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-2.jks");
// use metadata file from keystore with one key
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/ks1-metadata.properties");
System.setProperty(keyStoreId + "." + "password", "ksPwd2");
System.setProperty(keyStoreId + "." + "aliases", alias1 + "," + alias2);
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "aliasPwd1");
System.setProperty(keyStoreId + "." + alias2 + "." + "password", "aliasPwd2");
try
{
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
finally
{
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
System.clearProperty(keyStoreId + "." + alias2 + "." + "password");
}
}
@Test(expected = AlfrescoRuntimeException.class)
public void testValidateKeysWrongAliasMetadataFile() throws Exception
{
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/wrong-alias-metadata.properties");
AlfrescoKeyStoreImpl alfrescoKeyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
alfrescoKeyStore.setKeysToValidate(Collections.singleton(alias1));
alfrescoKeyStore.setValidateKeyChanges(true);
alfrescoKeyStore.setEncryptionKeysRegistry(encryptionKeysRegistry);
alfrescoKeyStore.validateKeys();
}
@Test
public void testEmptyKeysMetadataFile()
{
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/empty-alias-metadata.properties");
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
@Test(expected = AlfrescoRuntimeException.class)
public void testWrongKeystorePasswordMetadataFile()
{
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/wrong-keystore-password-metadata.properties");
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
@Test(expected = AlfrescoRuntimeException.class)
public void testWrongKeyPasswordMetadataFile()
{
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
keyStoreParameters.setKeyMetaDataFileLocation("classpath:keystore-tests/wrong-key-password-metadata.properties");
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
@Test(expected = AlfrescoRuntimeException.class)
public void testValidateKeysWrongAliasSysProps() throws Exception
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "aliases", "wrong-alias,another-wrong-alias");
System.setProperty(keyStoreId + "." + "password", "ksPwd1");
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "aliasPwd1");
try
{
AlfrescoKeyStoreImpl alfrescoKeyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
alfrescoKeyStore.setValidateKeyChanges(true);
alfrescoKeyStore.setKeysToValidate(Collections.singleton(alias1));
alfrescoKeyStore.setEncryptionKeysRegistry(encryptionKeysRegistry);
alfrescoKeyStore.validateKeys();
}
finally
{
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
}
}
@Test
public void testEmptyKeysSysProps()
{
String keyStoreId = testName.getMethodName() + "-keystore";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "aliases", "empty-alias,another-empty-alias");
System.setProperty(keyStoreId + "." + "password", "ksPwd1");
try
{
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
finally
{
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + "password");
}
}
@Test(expected = AlfrescoRuntimeException.class)
public void testWrongKeystorePasswordSysProps()
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "aliases", alias1);
System.setProperty(keyStoreId + "." + "password", "wrong-password");
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "aliasPwd1");
try
{
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
finally
{
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
}
}
@Test(expected = AlfrescoRuntimeException.class)
public void testWrongKeyPasswordSysProps()
{
String keyStoreId = testName.getMethodName() + "-keystore";
String alias1 = "mykey1";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "aliases", alias1);
System.setProperty(keyStoreId + "." + "password", "ksPwd1");
System.setProperty(keyStoreId + "." + alias1 + "." + "password", "wrong-key-password");
try
{
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
finally
{
System.clearProperty(keyStoreId + "." + "aliases");
System.clearProperty(keyStoreId + "." + "password");
System.clearProperty(keyStoreId + "." + alias1 + "." + "password");
}
}
/**
* No exception is expected. An empty keystore can be created.
*/
@Test
public void testConfigEmptyKeystore()
{
String keyStoreId = testName.getMethodName() + "-keystore";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:non-existing-path/some-keystore.jks");
new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
}
@Test(expected = AlfrescoRuntimeException.class)
public void testValidateKeysEmptyAliasSysProps() throws Exception
{
String keyStoreId = testName.getMethodName() + "-keystore";
KeyStoreParameters keyStoreParameters = new KeyStoreParameters();
keyStoreParameters.setId(keyStoreId);
keyStoreParameters.setName(testName.getMethodName());
keyStoreParameters.setType("JCEKS");
keyStoreParameters.setProvider("SunJCE");
keyStoreParameters.setLocation("classpath:keystore-tests/ks-test-1.jks");
System.setProperty(keyStoreId + "." + "password", "ksPwd1");
try
{
AlfrescoKeyStoreImpl alfrescoKeyStore = new AlfrescoKeyStoreImpl(keyStoreParameters, new SpringKeyResourceLoader());
alfrescoKeyStore.setValidateKeyChanges(true);
alfrescoKeyStore.setKeysToValidate(Collections.singleton("non-existing-alias"));
alfrescoKeyStore.setEncryptionKeysRegistry(encryptionKeysRegistry);
alfrescoKeyStore.validateKeys();
}
finally
{
System.clearProperty(keyStoreId + "." + "password");
}
}
}

View File

@@ -1,2 +0,0 @@
aliases=empty-alias
keystore.password=ksPwd1

View File

@@ -1,3 +0,0 @@
aliases=mykey1
keystore.password=ksPwd1
mykey1.password=aliasPwd1

View File

@@ -1,24 +0,0 @@
The keystores contained in this folder are used by tests.
==================
== ks-test-1.ks ==
==================
Keystore password: ksPwd1
Keystore type: JCEKS
Keystore provider: SunJCE
Your keystore contains 1 entry
mykey1: aliasPwd1
==================
== ks-test-2.ks ==
==================
Keystore password: ksPwd2
Keystore type: JCEKS
Keystore provider: SunJCE
Your keystore contains 2 entries
mykey1: aliasPwd1
mykey2: aliasPwd2

View File

@@ -1,3 +0,0 @@
aliases=non-existing-alias
keystore.password=ksPwd1
mykey1.password=aliasPwd1

View File

@@ -1,3 +0,0 @@
aliases=mykey1
keystore.password=ksPwd1
mykey1.password=wrong-key-password

View File

@@ -1,3 +0,0 @@
aliases=mykey1
keystore.password=wrong-password
mykey1.password=aliasPwd1

View File

@@ -1,47 +0,0 @@
### Alfresco Data Model
[![Build Status](https://travis-ci.com/Alfresco/alfresco-data-model.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-data-model)
Data model is a library packaged as a jar file which is part of [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository).
The library contains the following:
* Dictionary, Repository and Search Services interfaces
* Models for data types and Dictionary implementation
* Parsers
Please note that the data model uses version 2 of the Jackson libraries.
The upgrade from version 1 was not backward compatible, any projects
that are dependent on data model using Jackson 1.x should use the data-model 6.N branch.
Version 8.0 of data-model depends on alfresco-core 7.0 which is based on Spring 5.
### Building and testing
The project can be built and tested by running Maven command:
~~~
mvn clean install
~~~
### Artifacts
The artifacts can be obtained by:
* downloading from [Alfresco repository](https://artifacts.alfresco.com/nexus/content/groups/public)
* getting as Maven dependency by adding the dependency to your pom file:
~~~
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-data-model</artifactId>
<version>version</version>
</dependency>
~~~
and Alfresco repository:
~~~
<repository>
<id>alfresco-maven-repo</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
~~~
The SNAPSHOT version of the artifact is **never** published.
### Old version history
The history for older versions can be found in [Alfresco SVN](https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/data-model)
### Contributing guide
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.

View File

@@ -7,11 +7,11 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<properties>
<!-- Files to exclude from SonarQube analysis -->
<!-- Files to exclude from SonarQube analysis -->
<sonar.exclusions>
source/java/org/alfresco/repo/search/impl/parsers/CMIS*er.java,
source/java/org/alfresco/repo/search/impl/parsers/FTSParser.java,
@@ -147,7 +147,8 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<version>2.10.2</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
@@ -225,6 +226,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -22,7 +22,6 @@
<mimetype mimetype="application/vnd.ms-project" display="Microsoft Project">
<extension default="true">mpp</extension>
<extension>mpt</extension>
</mimetype>
<mimetype mimetype="image/vnd.adobe.photoshop" display="Adobe Photoshop">
@@ -109,28 +108,11 @@
<extension>acp</extension>
</mimetype>
<mimetype mimetype="application/vnd.visio" display="Microsoft Visio">
<extension default="true">vsd</extension>
<extension>vss</extension>
<extension>vst</extension>
<extension>vsd</extension>
</mimetype>
<mimetype mimetype="application/vnd.visio2013" display="Microsoft Visio 2013">
<extension>vsdx</extension>
</mimetype>
<mimetype mimetype="application/vnd.ms-visio.drawing.macroenabled.main+xml" display="Microsoft Visio macro-enabled drawing">
<extension>vsdm</extension>
</mimetype>
<mimetype mimetype="application/vnd.ms-visio.stencil.main+xml" display="Microsoft Visio stencil">
<extension>vssx</extension>
</mimetype>
<mimetype mimetype="application/vnd.ms-visio.stencil.macroenabled.main+xml" display="Microsoft Visio macro-enabled stencil">
<extension>vssm</extension>
</mimetype>
<mimetype mimetype="application/vnd.ms-visio.template.main+xml" display="Microsoft Visio template">
<extension>vstx</extension>
</mimetype>
<mimetype mimetype="application/vnd.ms-visio.template.macroenabled.main+xml" display="Microsoft Visio macro-enabled template">
<extension>vstm</extension>
</mimetype>
<mimetype mimetype="application/vnd.adobe.xdp+xml" display="Adobe Acrobat XML Data Package">
<extension>xdp</extension>
</mimetype>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
</project>

View File

@@ -20,7 +20,6 @@ RUN mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/mimetypes && \
mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/renditions && \
mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/transform/pipelines && \
mkdir /licenses && \
mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/keystore && \
mkdir ${TOMCAT_DIR}/alfresco-mmt && \
touch ${TOMCAT_DIR}/shared/classes/alfresco-global.properties
@@ -29,12 +28,10 @@ RUN mkdir -p ${TOMCAT_DIR}/shared/classes/alfresco/extension/mimetypes && \
# Copy the JDBC drivers for the database you are using to the lib/ directory.
# Copy the alfresco-mmt.jar
# Copy Licenses to the root of the Docker image
# Copy default keystore
COPY ${resource_path}/war ${TOMCAT_DIR}/webapps
COPY ${resource_path}/connector/* ${TOMCAT_DIR}/lib/
COPY ${resource_path}/alfresco-mmt/* ${TOMCAT_DIR}/alfresco-mmt/
COPY ${resource_path}/dependency/licenses/ /licenses/
COPY ${resource_path}/dependency/keystore/metadata-keystore ${TOMCAT_DIR}/shared/classes/alfresco/extension/keystore/
# Change the value of the shared.loader= property to the following:
# shared.loader=${catalina.base}/shared/classes
@@ -91,9 +88,9 @@ RUN mkdir -p ${TOMCAT_DIR}/conf/Catalina/localhost && \
chmod g+rwx ${TOMCAT_DIR}/temp && \
chmod g+rwx ${TOMCAT_DIR}/work && \
chmod o-w ${TOMCAT_DIR}/work && \
chmod 644 ${TOMCAT_DIR}/alfresco-mmt/alfresco-mmt-*.jar && \
find /licenses -type d -exec chmod 0755 {} \; && \
find /licenses -type f -exec chmod 0644 {} \;
chmod 664 ${TOMCAT_DIR}/alfresco-mmt/alfresco-mmt-*.jar && \
find /licenses -type d -exec chmod 0775 {} \; && \
find /licenses -type f -exec chmod 0664 {} \;
EXPOSE 10001

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<properties>
@@ -105,7 +105,7 @@
</execution>
<execution>
<id>unpack-licenses-and-keystore</id>
<id>unpack-licenses</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<profiles>

View File

@@ -10,16 +10,6 @@ services:
image: alfresco/alfresco-community-repo-base:latest
environment:
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS :
"
-Ddb.driver=org.postgresql.Driver
@@ -49,6 +39,10 @@ services:
-Dftp.port=1221
-Dcors.enabled=true
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=mp6yc0UD9e
-Dmetadata-keystore.metadata.algorithm=AES
"
ports:
- 8082:8080

View File

@@ -10,16 +10,6 @@ services:
image: alfresco/alfresco-community-repo-base:latest
environment:
CATALINA_OPTS : "-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
JAVA_TOOL_OPTIONS: "
-Dencryption.keystore.type=JCEKS
-Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
-Dencryption.keyAlgorithm=DESede
-Dencryption.keystore.location=/usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=oKIWzVdEdA
-Dmetadata-keystore.metadata.algorithm=DESede
"
JAVA_OPTS :
"
-Ddb.driver=org.postgresql.Driver
@@ -45,6 +35,10 @@ services:
-Dftp.port=1221
-Dcors.enabled=true
-Dcors.allowed.origins=http://localhost:4200,http://localhost:8080
-Dmetadata-keystore.password=mp6yc0UD9e
-Dmetadata-keystore.aliases=metadata
-Dmetadata-keystore.metadata.password=mp6yc0UD9e
-Dmetadata-keystore.metadata.algorithm=AES
"
ports:
- 8082:8080

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<modules>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<developers>

View File

@@ -7,12 +7,12 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<properties>
<scm-path>${project.parent.parent.scm.url}</scm-path>
<scm-revision>${build-number}</scm-revision>
<scm-path>local/development/workspace</scm-path>
<scm-revision>${buildNumber}</scm-revision>
</properties>
<dependencies>
@@ -41,6 +41,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
@@ -71,6 +72,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
@@ -99,6 +101,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>

17
pom.xml
View File

@@ -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>7.300-TEST2</version>
<version>7.199.304</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -23,7 +23,7 @@
<properties>
<acs.version.major>6</acs.version.major>
<acs.version.minor>2</acs.version.minor>
<acs.version.revision>3</acs.version.revision>
<acs.version.revision>2</acs.version.revision>
<acs.version.label />
<version.edition>Community</version.edition>
@@ -53,7 +53,7 @@
<dependency.activiti.version>5.23.0</dependency.activiti.version>
<dependency.transform.model.version>1.0.2.8</dependency.transform.model.version>
<dependency.alfresco-legacy-lucene.version>6.2</dependency.alfresco-legacy-lucene.version>
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
<dependency.alfresco-greenmail.version>6.1</dependency.alfresco-greenmail.version>
<dependency.spring.version>5.1.15.RELEASE</dependency.spring.version>
<dependency.antlr.version>3.5.2</dependency.antlr.version>
@@ -93,7 +93,7 @@
<alfresco.googledrive.version>3.2.0</alfresco.googledrive.version>
<alfresco.aos-module.version>1.3.1</alfresco.aos-module.version>
<dependency.postgresql.version>42.2.14</dependency.postgresql.version>
<dependency.postgresql.version>42.2.12</dependency.postgresql.version>
<dependency.mysql.version>8.0.19</dependency.mysql.version>
<dependency.mariadb.version>2.6.0</dependency.mariadb.version>
@@ -112,7 +112,7 @@
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
<url>https://github.com/Alfresco/alfresco-community-repo</url>
<tag>7.300-TEST2</tag>
<tag>7.199.304</tag>
</scm>
<distributionManagement>
@@ -172,11 +172,6 @@
<classifier>win64</classifier>
<type>tgz</type>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-pdf-renderer</artifactId>
<version>${dependency.alfresco-pdf-renderer.version}</version>
</dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-server-root</artifactId>
@@ -232,7 +227,7 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>

View File

@@ -1,41 +0,0 @@
### Alfresco Remote API
[![Build Status](https://travis-ci.com/Alfresco/alfresco-remote-api.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-remote-api)
Remote API is a library packaged as a jar file which is part of [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository).
The library contains the following:
* REST API framework
* WebScript implementations including [V1 REST APIs](https://community.alfresco.com/community/ecm/blog/2017/05/02/v1-rest-api-10-things-you-should-know)
* [OpenCMIS](https://chemistry.apache.org/java/opencmis.html) implementations
### Building and testing
The project can be built by running Maven command:
~~~
mvn clean install
~~~
The tests are combined in test classes split by test type or Spring application context used in the test, see classes in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test class name and a set of DB connection properties, for example:
~~~
mvn clean test -Dtest=SomeTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
~~~
### Artifacts
The artifacts can be obtained by:
* downloading from [Alfresco repository](https://artifacts.alfresco.com/nexus/content/groups/public)
* getting as Maven dependency by adding the dependency to your pom file:
~~~
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-remote-api</artifactId>
<version>version</version>
</dependency>
~~~
and Alfresco Maven repository:
~~~
<repository>
<id>alfresco-maven-repo</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
~~~
The SNAPSHOT version of the artifact is **never** published.
### Contributing guide
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<dependencies>
@@ -78,6 +78,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -239,54 +240,6 @@
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
</properties>
</profile>
<profile>
<id>osx-alfresco-pdf-renderer-test</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-pdf-renderer</artifactId>
<version>${dependency.alfresco-pdf-renderer.version}</version>
<classifier>osx</classifier>
<type>tgz</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>false</inherited>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>extract-alfresco-pdf-renderer-test</id>
<phase>generate-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<target>
<echo message="Extracting alfresco-pdf-renderer (OS-X) for testing..." />
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
<exec failonerror="true" executable="tar" dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer">
<arg value="xf" />
<arg value="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-osx.tgz" />
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
</properties>
</profile>
</profiles>
<build>
<pluginManagement>

View File

@@ -208,7 +208,7 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
{
match = container.getRegistry().findWebScript(req.getMethod(), getScriptUrl(req));
}
catch (NotFoundException notFoundEx)
catch (NotFoundException | IllegalArgumentException Ex)
{
getLogger().debug(req.getMethod() + " " + getScriptUrl(req) + "not found in Public API Container.");
}

View File

@@ -1831,6 +1831,19 @@ public class NodesImpl implements Nodes
{
versionMajor = Boolean.valueOf(str);
}
String versioningEnabledStringValue = parameters.getParameter("versioningEnabled");
if (null != versioningEnabledStringValue)
{
boolean versioningEnabled = Boolean.parseBoolean(versioningEnabledStringValue);
if (versioningEnabled)
{
versionMajor = (null != versionMajor) ? versionMajor : true;
}
else
{
versionMajor = null;
}
}
String versionComment = parameters.getParameter(PARAM_VERSION_COMMENT);
// Create the node
@@ -2891,6 +2904,7 @@ public class NodesImpl implements Nodes
String versionComment = null;
String relativePath = null;
String renditionNames = null;
boolean versioningEnabled = true;
Map<String, Object> qnameStrProps = new HashMap<>();
Map<QName, Serializable> properties = null;
@@ -2947,6 +2961,19 @@ public class NodesImpl implements Nodes
case "renditions":
renditionNames = getStringOrNull(field.getValue());
break;
case "versioningenabled":
String versioningEnabledStringValue = getStringOrNull(field.getValue());
if (null != versioningEnabledStringValue)
{
// MNT-22036 versioningenabled parameter was added to disable versioning of newly created nodes.
// The default API mechanism should not be changed/affected.
// Versioning is enabled by default when creating a node using form-data.
// To preserve this, versioningEnabled value must be 'true' for any given value typo/valuesNotSupported (except case-insensitive 'false')
// .equalsIgnoreCase("false") will return true only when the input value is 'false'
// !.equalsIgnoreCase("false") will return false only when the input value is 'false'
versioningEnabled = !versioningEnabledStringValue.equalsIgnoreCase("false");
}
break;
default:
{
@@ -3019,12 +3046,14 @@ public class NodesImpl implements Nodes
throw new ConstraintViolatedException(fileName + " already exists.");
}
}
// Note: pending REPO-159, we currently auto-enable versioning on new upload (but not when creating empty file)
if (versionMajor == null)
{
versionMajor = true;
}
// MNT-22036 add versioningEnabled property for newly created nodes.
versionMajor = versioningEnabled ? versionMajor : null;
// Create a new file.
NodeRef nodeRef = createNewFile(parentNodeRef, fileName, nodeTypeQName, content, properties, assocTypeQName, parameters, versionMajor, versionComment);

View File

@@ -5605,6 +5605,279 @@ public class NodeApiTest extends AbstractSingleNetworkSiteTest
assertTrue(((ArrayList) (propUpdateResponse.get("custom:locations"))).size() == 1);
}
@Test
public void versioningEnabledMultipartNodeCreationTest() throws Exception
{
setRequestContext(user1);
String myNodeId = getMyNodeId();
// Test Scenarios:
// 1: majorVersion not set - versioningEnabled not set Expect: MAJOR version
// 2: majorVersion not set - versioningEnabled false Expect: versioning disabled
// 3: majorVersion true - versioningEnabled false Expect: versioning disabled
// 4: majorVersion false - versioningEnabled false Expect: versioning disabled
// 5: majorVersion not set - versioningEnabled true Expect: MAJOR version
// 6: majorVersion true - versioningEnabled true Expect: MAJOR version
// 7: majorVersion false - versioningEnabled true Expect: Minor version
// 8: majorVersion not set - versioningEnabled False Expect: versioning disabled
// 9: majorVersion not set - versioningEnabled invalid Expect: MAJOR version
// Scenario 1:
String fileName = "myfile" + UUID.randomUUID() + ".txt";
File file = getResourceFile("quick-2.pdf");
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
MultiPartRequest reqBody = multiPartBuilder.build();
HttpResponse response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
Document documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
// Default behaviour, expect to be MAJOR Version 1.0
Map<String, Object> documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
// Scenario 2:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setVersioningEnabled("false");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
// Scenario 3:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setMajorVersion(true);
multiPartBuilder.setVersioningEnabled("false");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
// Scenario 4:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setMajorVersion(false);
multiPartBuilder.setVersioningEnabled("false");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
// Scenario 5:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setVersioningEnabled("true");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
// Scenario 6:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setMajorVersion(true);
multiPartBuilder.setVersioningEnabled("true");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
// Scenario 7:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setMajorVersion(false);
multiPartBuilder.setVersioningEnabled("true");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MINOR", documentProperties.get("cm:versionType"));
assertEquals("0.1", documentProperties.get("cm:versionLabel"));
// Scenario 8:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setVersioningEnabled("False");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
// Scenario 9:
fileName = "myfile" + UUID.randomUUID() + ".txt";
multiPartBuilder = MultiPartBuilder.create().setFileData(new FileData(fileName, file));
multiPartBuilder.setVersioningEnabled("invalid");
reqBody = multiPartBuilder.build();
response = post(getNodeChildrenUrl(myNodeId), reqBody.getBody(), null, reqBody.getContentType(), 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
}
@Test
public void versioningEnabledJSONNodeCreationTest() throws Exception
{
setRequestContext(user1);
String myNodeId = getMyNodeId();
// Test Scenarios:
// 1: majorVersion not set - versioningEnabled not set Expect: versioning disabled
// 2: majorVersion not set - versioningEnabled false Expect: versioning disabled
// 3: majorVersion true - versioningEnabled false Expect: versioning disabled
// 4: majorVersion false - versioningEnabled false Expect: versioning disabled
// 5: majorVersion not set - versioningEnabled true Expect: MAJOR version
// 6: majorVersion true - versioningEnabled true Expect: MAJOR version
// 7: majorVersion false - versioningEnabled true Expect: Minor version
// 8: majorVersion not set - versioningEnabled False Expect: versioning disabled
// 9: majorVersion not set - versioningEnabled invalid Expect: versioning disabled
// 10 majorVersion not set - versioningenabled true Expect: versioning disabled
Document d1 = new Document();
Map<String, String> requestHeaders = new HashMap<>();
//Scenario 1:
d1.setName("testDoc" + UUID.randomUUID());
d1.setNodeType(TYPE_CM_CONTENT);
HttpResponse response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
Document documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
Map<String, Object> documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 2:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","false");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 3:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","false");
requestHeaders.put("majorVersion","true");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 4:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","false");
requestHeaders.put("majorVersion","false");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 5:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","true");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
//Scenario 6:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","true");
requestHeaders.put("majorVersion","true");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MAJOR", documentProperties.get("cm:versionType"));
assertEquals("1.0", documentProperties.get("cm:versionLabel"));
//Scenario 7:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","true");
requestHeaders.put("majorVersion","false");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertEquals("MINOR", documentProperties.get("cm:versionType"));
assertEquals("0.1", documentProperties.get("cm:versionLabel"));
//Scenario 8:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","False");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 9:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningEnabled","invalid");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
//Scenario 10:
d1.setName("testDoc" + UUID.randomUUID());
requestHeaders = new HashMap<>();
requestHeaders.put("versioningenabled","true");
response = post(getNodeChildrenUrl(myNodeId), toJsonAsStringNonNull(d1),requestHeaders, null, null, 201);
documentResponse = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
documentProperties = documentResponse.getProperties();
assertNull(documentProperties);
}
@Test public void testAuditableProperties() throws Exception
{
setRequestContext(user1);

View File

@@ -43,7 +43,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* <i><b>multipart/form-data</b></i> builder.
@@ -57,6 +56,7 @@ public class MultiPartBuilder
private String updateNodeRef;
private String description;
private String contentTypeQNameStr;
private String versioningEnabled;
private List<String> aspects = Collections.emptyList();
private Boolean majorVersion;
private Boolean overwrite;
@@ -76,6 +76,7 @@ public class MultiPartBuilder
this.updateNodeRef = that.updateNodeRef;
this.description = that.description;
this.contentTypeQNameStr = that.contentTypeQNameStr;
this.versioningEnabled = that.versioningEnabled;
this.aspects = new ArrayList<>(that.aspects);
this.majorVersion = that.majorVersion;
this.overwrite = that.overwrite;
@@ -125,6 +126,12 @@ public class MultiPartBuilder
return this;
}
public MultiPartBuilder setVersioningEnabled(String versioningEnabled)
{
this.versioningEnabled = versioningEnabled;
return this;
}
public MultiPartBuilder setAspects(List<String> aspects)
{
this.aspects = aspects;
@@ -278,6 +285,7 @@ public class MultiPartBuilder
addPartIfNotNull(parts, "updatenoderef", updateNodeRef);
addPartIfNotNull(parts, "description", description);
addPartIfNotNull(parts, "contenttype", contentTypeQNameStr);
addPartIfNotNull(parts, "versioningenabled", versioningEnabled);
addPartIfNotNull(parts, "aspects", getCommaSeparated(aspects));
addPartIfNotNull(parts, "majorversion", majorVersion);
addPartIfNotNull(parts, "overwrite", overwrite);

View File

@@ -1,41 +0,0 @@
### Alfresco Repository
[![Build Status](https://travis-ci.com/Alfresco/alfresco-repository.svg?branch=master)](https://travis-ci.com/Alfresco/alfresco-repository)
Repository is a library packaged as a jar file which is part of [Alfresco Content Services Repository](https://community.alfresco.com/docs/DOC-6385-project-overview-repository).
The library contains the following:
* DAOs and SQL scripts
* Various Service implementations
* Utility classes
### Building and testing
The project can be built by running Maven command:
~~~
mvn clean install
~~~
The tests are combined in test classes split by test type or Spring application context used in the test, see classes in _src/test/java/org/alfresco_. All of these classes as well as individual tests can be run by specifying the test class name and a set of DB connection properties, for example:
~~~
mvn clean test -Dtest=SomeRepoTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql:alfresco -Ddb.username=alfresco -Ddb.password=alfresco
~~~
### Artifacts
The artifacts can be obtained by:
* downloading from [Alfresco repository](https://artifacts.alfresco.com/nexus/content/groups/public)
* getting as Maven dependency by adding the dependency to your pom file:
~~~
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>version</version>
</dependency>
~~~
and Alfresco Maven repository:
~~~
<repository>
<id>alfresco-maven-repo</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
~~~
The SNAPSHOT version of the artifact is **never** published.
### Contributing guide
Please use [this guide](CONTRIBUTING.md) to make a contribution to the project.

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>7.300-TEST2</version>
<version>7.199.304</version>
</parent>
<dependencies>
@@ -65,7 +65,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -75,21 +74,19 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
@@ -343,6 +340,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.5</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
@@ -467,7 +465,8 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<exclusions>
<version>2.3.2</version>
<exclusions>
<exclusion>
<groupId>com.mchange</groupId>
<artifactId>*</artifactId>
@@ -812,6 +811,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -1020,54 +1020,6 @@
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
</properties>
</profile>
<profile>
<id>osx-alfresco-pdf-renderer-test</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-pdf-renderer</artifactId>
<version>${dependency.alfresco-pdf-renderer.version}</version>
<classifier>osx</classifier>
<type>tgz</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>false</inherited>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>extract-alfresco-pdf-renderer-test</id>
<phase>generate-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<target>
<echo message="Extracting alfresco-pdf-renderer (OS-X) for testing..." />
<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
<exec failonerror="true" executable="tar" dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer">
<arg value="xf" />
<arg value="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-osx.tgz" />
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
</properties>
</profile>
</profiles>

View File

@@ -81,22 +81,19 @@ public class TransactionAwareHolder<T> extends Holder<T>
{
this.internalHolder = internalHolder;
this.value = internalHolder.getValue();
txListener = new TxAwareHolderListener();
}
@Override
public T getValue()
{
if (TransactionSynchronizationManager.isSynchronizationActive())
{
AlfrescoTransactionSupport.bindListener(txListener);
}
registerTxListenerIfNeeded();
return this.value;
}
@Override
public void setValue(T value)
{
registerTxListenerIfNeeded();
this.value = value;
}
@@ -109,6 +106,17 @@ public class TransactionAwareHolder<T> extends Holder<T>
'}';
}
// MNT-21800 CMIS Web Service Check Out returns error
private void registerTxListenerIfNeeded()
{
if (this.txListener == null && TransactionSynchronizationManager.isSynchronizationActive())
{
TxAwareHolderListener listener = new TxAwareHolderListener();
AlfrescoTransactionSupport.bindListener(listener);
this.txListener = listener;
}
}
private class TxAwareHolderListener extends TransactionListenerAdapter
{
@Override

View File

@@ -177,13 +177,13 @@ public class CMISResultSetRow implements ResultSetRow
context.setScore(getScore());
for (Column column : query.getColumns())
{
// When an SCORE selector is included, score must be adapted to range 0..1 due to CMIS specification
if (column.getFunction()!= null && column.getFunction().getName().equals(Score.NAME))
{
return getNormalisedScore();
}
else if (column.getAlias().equals(columnName))
if (column.getAlias().equals(columnName))
{
//When an SCORE selector is included, score must be adapted to range 0..1 due to CMIS specification
if (column.getFunction()!= null && column.getFunction().getName().equals(Score.NAME))
{
return getNormalisedScore();
}
return column.getFunction().getValue(column.getFunctionArguments(), context);
}
// Special case for one selector - ignore any table aliases

View File

@@ -43,7 +43,6 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.download.DownloadRequest;
import org.alfresco.service.cmr.download.DownloadStatus;
import org.alfresco.service.cmr.download.DownloadStatus.Status;
@@ -85,7 +84,6 @@ public class CreateDownloadArchiveAction extends ActionExecuterAbstractBase
private NodeService nodeService;
private RetryingTransactionHelper transactionHelper;
private DownloadStatusUpdateService updateService;
private DictionaryService dictionaryService;
private long maximumContentSize = -1l;
@@ -169,11 +167,6 @@ public class CreateDownloadArchiveAction extends ActionExecuterAbstractBase
this.updateService = updateService;
}
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* Create an archive file containing content from the repository.
*
@@ -253,7 +246,7 @@ public class CreateDownloadArchiveAction extends ActionExecuterAbstractBase
{
// perform the actual export
final File tempFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX);
final ZipDownloadExporter handler = new ZipDownloadExporter(tempFile, checkOutCheckInService, nodeService, transactionHelper, updateService, downloadStorage, dictionaryService, actionedUponNodeRef, estimator.getSize(), estimator.getFileCount());
final ZipDownloadExporter handler = new ZipDownloadExporter(tempFile, checkOutCheckInService, nodeService, transactionHelper, updateService, downloadStorage, actionedUponNodeRef, estimator.getSize(), estimator.getFileCount());
try {
exporterService.exportView(handler, crawlerParameters, null);

View File

@@ -39,7 +39,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.download.DownloadStatus;
import org.alfresco.service.cmr.download.DownloadStatus.Status;
import org.alfresco.service.cmr.repository.ContentData;
@@ -78,7 +77,6 @@ public class ZipDownloadExporter extends BaseExporter
private RetryingTransactionHelper transactionHelper;
private DownloadStorage downloadStorage;
private DictionaryService dictionaryService;
private DownloadStatusUpdateService updateService;
private Deque<Pair<String, NodeRef>> path = new LinkedList<Pair<String, NodeRef>>();
@@ -95,12 +93,11 @@ public class ZipDownloadExporter extends BaseExporter
* @param transactionHelper RetryingTransactionHelper
* @param updateService DownloadStatusUpdateService
* @param downloadStorage DownloadStorage
* @param dictionaryService DictionaryService
* @param downloadNodeRef NodeRef
* @param total long
* @param totalFileCount long
*/
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService, RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService, DownloadStorage downloadStorage, DictionaryService dictionaryService, NodeRef downloadNodeRef, long total, long totalFileCount)
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService, RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService, DownloadStorage downloadStorage, NodeRef downloadNodeRef, long total, long totalFileCount)
{
super(checkOutCheckInService, nodeService);
try
@@ -109,7 +106,6 @@ public class ZipDownloadExporter extends BaseExporter
this.updateService = updateService;
this.transactionHelper = transactionHelper;
this.downloadStorage = downloadStorage;
this.dictionaryService = dictionaryService;
this.downloadNodeRef = downloadNodeRef;
this.total = total;
@@ -138,7 +134,7 @@ public class ZipDownloadExporter extends BaseExporter
{
this.currentName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
path.push(new Pair<String, NodeRef>(currentName, nodeRef));
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))
if (ContentModel.TYPE_FOLDER.equals(nodeService.getType(nodeRef)))
{
String path = getPath() + PATH_SEPARATOR;
ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);

View File

@@ -179,7 +179,9 @@ CREATE TABLE alf_transaction
change_txn_id VARCHAR(56) NOT NULL,
commit_time_ms BIGINT,
PRIMARY KEY (id),
KEY idx_alf_txn_ctms (commit_time_ms),
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)
) ENGINE=InnoDB;
@@ -222,6 +224,8 @@ CREATE TABLE alf_node
KEY idx_alf_node_crd (audit_created, store_id, type_qname_id),
KEY idx_alf_node_mor (audit_modifier, store_id, type_qname_id),
KEY idx_alf_node_mod (audit_modified, store_id, type_qname_id),
KEY idx_alf_node_ver (version),
KEY idx_alf_node_txn (transaction_id),
CONSTRAINT fk_alf_node_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id),
CONSTRAINT fk_alf_node_store FOREIGN KEY (store_id) REFERENCES alf_store (id),
CONSTRAINT fk_alf_node_tqn FOREIGN KEY (type_qname_id) REFERENCES alf_qname (id),

View File

@@ -1681,6 +1681,16 @@
<columnname>type_qname_id</columnname>
</columnnames>
</index>
<index name="idx_alf_node_ver" unique="false">
<columnnames>
<columnname>version</columnname>
</columnnames>
</index>
<index name="idx_alf_node_txn" unique="false">
<columnnames>
<columnname>transaction_id</columnname>
</columnnames>
</index>
</indexes>
</table>
<table name="alf_node_aspects">
@@ -2674,6 +2684,18 @@
<index name="idx_alf_txn_ctms" unique="false">
<columnnames>
<columnname>commit_time_ms</columnname>
<columnname>id</columnname>
</columnnames>
</index>
<index name="idx_alf_txn_ctms_sc" unique="false">
<columnnames>
<columnname>commit_time_ms</columnname>
</columnnames>
</index>
<index name="idx_alf_txn_id_ctms" unique="false">
<columnnames>
<columnname>id</columnname>
<columnname>commit_time_ms</columnname>
</columnnames>
</index>
<index name="fk_alf_txn_svr" unique="false">

View File

@@ -196,6 +196,8 @@ CREATE TABLE alf_transaction
CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (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;
@@ -244,6 +246,8 @@ CREATE INDEX fk_alf_node_acl ON alf_node (acl_id);
CREATE INDEX fk_alf_node_store ON alf_node (store_id);
CREATE INDEX idx_alf_node_tqn ON alf_node (type_qname_id, store_id, id);
CREATE INDEX fk_alf_node_loc ON alf_node (locale_id);
CREATE INDEX idx_alf_node_ver ON alf_node (version);
CREATE INDEX idx_alf_node_txn ON alf_node (transaction_id);
CREATE INDEX fk_alf_store_root ON alf_store (root_node_id);
ALTER TABLE alf_store ADD CONSTRAINT fk_alf_store_root FOREIGN KEY (root_node_id) REFERENCES alf_node (id);

View File

@@ -1740,6 +1740,16 @@
<columnname>id</columnname>
</columnnames>
</index>
<index name="idx_alf_node_ver" unique="false">
<columnnames>
<columnname>version</columnname>
</columnnames>
</index>
<index name="idx_alf_node_txn" unique="false">
<columnnames>
<columnname>transaction_id</columnname>
</columnnames>
</index>
</indexes>
</table>
<table name="alf_node_aspects">
@@ -2753,6 +2763,17 @@
<columnname>id</columnname>
</columnnames>
</index>
<index name="idx_alf_txn_ctms_sc" unique="false">
<columnnames>
<columnname>commit_time_ms</columnname>
</columnnames>
</index>
<index name="idx_alf_txn_id_ctms" unique="false">
<columnnames>
<columnname>id</columnname>
<columnname>commit_time_ms</columnname>
</columnnames>
</index>
</indexes>
</table>
<table name="alf_usage_delta">

View File

@@ -54,6 +54,7 @@
<ref bean="patch.db-V5.1-metadata-query-indexes" />
<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" />
</list>
</property>
</bean>

View File

@@ -0,0 +1,35 @@
--
-- Title: Update alf_node and alf_transaction indexes for more performance
-- Database: MySQL
-- Since: V6.3
-- Author: Eva Vasques
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
DROP INDEX idx_alf_node_ver; --(optional)
CREATE INDEX idx_alf_node_ver ON alf_node (version);
DROP INDEX idx_alf_node_txn; --(optional)
CREATE INDEX idx_alf_node_txn ON alf_node (transaction_id);
DROP INDEX idx_alf_txn_ctms; --(optional)
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
DROP INDEX idx_alf_txn_ctms_sc; --(optional)
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
DROP INDEX idx_alf_txn_id_ctms; --(optional)
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V6.3-add-indexes-node-transaction';
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-V6.3-add-indexes-node-transaction', 'Create aditional indexes on alf_node and alf_transaction',
0, 13005, -1, 13006, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -0,0 +1,32 @@
--
-- Title: Update alf_node and alf_transaction indexes for more performance
-- Database: PostgreSQL
-- Since: V6.3
-- Author: Eva Vasques
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
DROP INDEX idx_alf_node_ver; --(optional)
CREATE INDEX idx_alf_node_ver ON alf_node (version);
DROP INDEX idx_alf_node_txn; --(optional)
CREATE INDEX idx_alf_node_txn ON alf_node (transaction_id);
DROP INDEX idx_alf_txn_ctms_sc; --(optional)
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
DROP INDEX idx_alf_txn_id_ctms; --(optional)
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V6.3-add-indexes-node-transaction';
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-V6.3-add-indexes-node-transaction', 'Create aditional indexes on alf_node and alf_transaction',
0, 13005, -1, 13006, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -89,19 +89,18 @@
<bean id="downloadContentServiceHelper" class="org.alfresco.repo.download.LocalContentServiceHelper">
<property name="contentService" ref="contentService"/>
</bean>
<bean id="createDownloadArchiveAction" class="org.alfresco.repo.download.CreateDownloadArchiveAction" parent="action-executer">
<property name="checkOutCheckInSerivce" ref="checkOutCheckInService"/>
<property name="contentServiceHelper" ref="downloadContentServiceHelper"/>
<property name="downloadStorage" ref="downloadStorage"/>
<property name="exporterService" ref="downloadExporterComponent"/>
<property name="maximumContentSize" value="${download.maxContentSize}"/>
<property name="nodeService" ref="nodeService"/>
<property name="publicAction" value="false"/>
<property name="transactionHelper" ref="retryingTransactionHelper"/>
<property name="updateService" ref="downloadStatusUpdateService"/>
<property name="dictionaryService" ref="dictionaryService"/>
</bean>
<bean id="createDownloadArchiveAction" class="org.alfresco.repo.download.CreateDownloadArchiveAction" parent="action-executer">
<property name="checkOutCheckInSerivce" ref="checkOutCheckInService"/>
<property name="contentServiceHelper" ref="downloadContentServiceHelper" />
<property name="downloadStorage" ref="downloadStorage" />
<property name="exporterService" ref="downloadExporterComponent" />
<property name="maximumContentSize" value="${download.maxContentSize}" />
<property name="nodeService" ref="nodeService" />
<property name="publicAction" value="false"/>
<property name="transactionHelper" ref="retryingTransactionHelper"/>
<property name="updateService" ref="downloadStatusUpdateService"/>
</bean>
<bean id="downloadExporterComponent" parent="exporterComponent">
<property name="exportSecondaryNodes" value="true"/>

View File

@@ -15,12 +15,10 @@
</bean>
<bean id="keyStoreParameters" class="org.alfresco.encryption.KeyStoreParameters" init-method="init">
<property name="id" value="metadata-keystore"/>
<property name="name" value="Key Store"/>
<property name="location" value="${encryption.keystore.location}"/>
<property name="provider" value="${encryption.keystore.provider}"/>
<property name="type" value="${encryption.keystore.type}"/>
<!-- This property is left for backwards compatibility -->
<property name="keyMetaDataFileLocation" value="${encryption.keystore.keyMetaData.location}"/>
</bean>
@@ -32,22 +30,18 @@
<!-- TODO i18n for key store names -->
<bean id="sslKeyStoreParameters" class="org.alfresco.encryption.KeyStoreParameters" init-method="init">
<property name="id" value="ssl-keystore"/>
<property name="name" value="SSL Key Store"/>
<property name="location" value="${encryption.ssl.keystore.location}"/>
<property name="type" value="${encryption.ssl.keystore.type}"/>
<property name="provider" value="${encryption.ssl.keystore.provider}"/>
<!-- This property is left for backwards compatibility -->
<property name="keyMetaDataFileLocation" value="${encryption.ssl.keystore.keyMetaData.location}"/>
</bean>
<bean id="sslTrustStoreParameters" class="org.alfresco.encryption.KeyStoreParameters" init-method="init">
<property name="id" value="ssl-truststore"/>
<property name="name" value="SSL Trust Store"/>
<property name="location" value="${encryption.ssl.truststore.location}"/>
<property name="type" value="${encryption.ssl.truststore.type}"/>
<property name="provider" value="${encryption.ssl.truststore.provider}"/>
<!-- This property is left for backwards compatibility -->
<property name="keyMetaDataFileLocation" value="${encryption.ssl.truststore.keyMetaData.location}"/>
</bean>
@@ -77,12 +71,10 @@
</bean>
<bean id="backupKeyStoreParameters" class="org.alfresco.encryption.KeyStoreParameters" init-method="init">
<property name="id" value="metadata-backup-keystore"/>
<property name="name" value="Backup Key Store"/>
<property name="location" value="${encryption.keystore.backup.location}"/>
<property name="provider" value="${encryption.keystore.backup.provider}"/>
<property name="type" value="${encryption.keystore.backup.type}"/>
<!-- This property is left for backwards compatibility -->
<property name="keyMetaDataFileLocation" value="${encryption.keystore.backup.keyMetaData.location}"/>
</bean>

View File

@@ -1,10 +1,7 @@
# This file and the keystore is deprecated
# Please generate a new keystore for new systems and use JVM properties for it's configuration
aliases=metadata
# The password protecting the keystore entries
keystore.password=mp6yc0UD9e
# The password protecting the alias: metadata
metadata.keyData=
metadata.algorithm=DESede
aliases=metadata
# The password protecting the keystore entries
keystore.password=mp6yc0UD9e
# The password protecting the alias: metadata
metadata.keyData=
metadata.algorithm=DESede
metadata.password=oKIWzVdEdA

View File

@@ -400,4 +400,6 @@ patch.updateAdminUserWhenDefault.result=\n\Successfully removed password2 proper
patch.db-V5.2-remove-jbpm-tables-from-db.description=Removes all JBPM related tables from the database.
patch.db-V6.0-change-set-indexes.description=Add additional indexes to support acl tracking.
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

View File

@@ -1397,5 +1397,17 @@
<value>classpath:alfresco/dbscripts/upgrade/6.0/${db.script.dialect}/change-set-indexes.sql</value>
</property>
</bean>
<bean id="patch.db-V6.3-add-indexes-node-transaction" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
<property name="id"><value>patch.db-V6.3-add-indexes-node-transaction</value></property>
<property name="description"><value>patch.db-V6.3-add-indexes-node-transaction.description</value></property>
<property name="fixesFromSchema"><value>0</value></property>
<property name="fixesToSchema"><value>13005</value></property>
<property name="targetSchema"><value>13006</value></property>
<property name="ignored"><value>${system.new-node-transaction-indexes.ignored}</value></property>
<property name="scriptUrl">
<value>classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/add-indexes-node-transaction.sql</value>
</property>
</bean>
</beans>

View File

@@ -3,7 +3,7 @@
repository.name=Main Repository
# Schema number
version.schema=13010
version.schema=13006
# Directory configuration
@@ -816,22 +816,20 @@ dir.keystore=classpath:alfresco/keystore
# general encryption parameters
encryption.keySpec.class=org.alfresco.encryption.DESEDEKeyGenerator
encryption.keyAlgorithm=AES
encryption.cipherAlgorithm=AES/CBC/PKCS5Padding
encryption.keyAlgorithm=DESede
encryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
# secret key keystore configuration
encryption.keystore.location=${dir.keystore}/keystore
# configuration via metadata is deprecated
encryption.keystore.keyMetaData.location=
encryption.keystore.keyMetaData.location=${dir.keystore}/keystore-passwords.properties
encryption.keystore.provider=
encryption.keystore.type=pkcs12
encryption.keystore.type=JCEKS
# backup secret key keystore configuration
encryption.keystore.backup.location=${dir.keystore}/backup-keystore
# configuration via metadata is deprecated
encryption.keystore.backup.keyMetaData.location=
encryption.keystore.backup.keyMetaData.location=${dir.keystore}/backup-keystore-passwords.properties
encryption.keystore.backup.provider=
encryption.keystore.backup.type=pkcs12
encryption.keystore.backup.type=JCEKS
# Should encryptable properties be re-encrypted with new encryption keys on botstrap?
encryption.bootstrap.reencrypt=false
@@ -844,13 +842,11 @@ encryption.mac.algorithm=HmacSHA1
encryption.ssl.keystore.location=${dir.keystore}/ssl.keystore
encryption.ssl.keystore.provider=
encryption.ssl.keystore.type=JCEKS
# configuration via metadata is deprecated
encryption.ssl.keystore.keyMetaData.location=
encryption.ssl.keystore.keyMetaData.location=${dir.keystore}/ssl-keystore-passwords.properties
encryption.ssl.truststore.location=${dir.keystore}/ssl.truststore
encryption.ssl.truststore.provider=
encryption.ssl.truststore.type=JCEKS
# configuration via metadata is deprecated
encryption.ssl.truststore.keyMetaData.location=
encryption.ssl.truststore.keyMetaData.location=${dir.keystore}/ssl-truststore-passwords.properties
# Re-encryptor properties
encryption.reencryptor.chunkSize=100
@@ -1317,3 +1313,6 @@ system.delete_not_exists.delete_batchsize=1000
system.delete_not_exists.read_only=false
system.delete_not_exists.timeout_seconds=-1
system.prop_table_cleaner.algorithm=V2
# Creates additional indexes on alf_node and alf_transaction. Recommended for large repositories.
system.new-node-transaction-indexes.ignored=true

View File

@@ -65,9 +65,6 @@ import org.junit.runners.Suite;
org.alfresco.repo.content.filestore.ReadOnlyFileContentStoreTest.class,
org.alfresco.repo.content.RoutingContentStoreTest.class,
org.alfresco.encryption.EncryptionTests.class,
org.alfresco.encryption.KeyStoreTests.class
// TODO REPO-2791 org.alfresco.repo.content.routing.StoreSelectorAspectContentStoreTest.class,
})
public class AppContext02TestSuite

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.encryption;
import java.io.Serializable;
@@ -270,6 +270,28 @@ public class EncryptionTests extends TestCase
mainEncryptor.setKeyProvider(mainKeyProvider);
}
}
public void testBootstrapReEncrypt()
{
try
{
// ensure that the backup key store is not available
backupKeyStoreParameters.setLocation("");
//backupKeyStore.reload();
mainKeyStore.reload();
reEncryptor.bootstrapReEncrypt();
fail("Should have caught missing backup key store");
}
catch(MissingKeyException e)
{
System.out.println("Successfully caught missing key exception");
}
catch(InvalidKeystoreException e)
{
fail("Unexpected exception: " + e.getMessage());
}
}
protected void testChangeKeysImpl(boolean cacheCiphers) throws Throwable
{

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.encryption;
import static org.junit.Assert.assertTrue;
@@ -37,7 +37,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -213,7 +212,7 @@ public class KeyStoreTests
TestAlfrescoKeyStore missingMainKeyStore = getKeyStore("main", "JCEKS", Collections.singletonMap(KeyProvider.ALIAS_METADATA, "metadata"),
Collections.singletonMap(KeyProvider.ALIAS_METADATA, generateEncodedKey()), generateKeystoreName(), generateKeystoreName());
missingMainKeyStore.setKeysToValidate(new HashSet<>(Collections.singletonList("metadata")));
encryptionKeysRegistry.unregisterKey(KeyProvider.ALIAS_METADATA);
keyStoreChecker.setMainKeyStore(missingMainKeyStore);
@@ -241,7 +240,7 @@ public class KeyStoreTests
// missing main keystore, missing backup keystore, metadata registered key -> error, re-instate the keystore
TestAlfrescoKeyStore missingMainKeyStore = getKeyStore("main", "JCEKS", Collections.singletonMap(KeyProvider.ALIAS_METADATA, "metadata"),
null, generateKeystoreName(), generateKeystoreName());
missingMainKeyStore.setKeysToValidate(new HashSet<>(Collections.singletonList("metadata")));
assertTrue("", encryptionKeysRegistry.isKeyRegistered("metadata"));
keyStoreChecker.setMainKeyStore(missingMainKeyStore);
@@ -269,7 +268,6 @@ public class KeyStoreTests
// create main keystore
TestAlfrescoKeyStore mainKeyStore = getKeyStore("main", "JCEKS", Collections.singletonMap(KeyProvider.ALIAS_METADATA, "metadata"),
null, generateKeystoreName(), generateKeystoreName());
mainKeyStore.setKeysToValidate(new HashSet<>(Collections.singletonList("metadata")));
createAndPopulateKeyStore(mainKeyStore);
// de-register metadata key
@@ -305,7 +303,6 @@ public class KeyStoreTests
TestAlfrescoKeyStore keyStore = getKeyStore("main", "JCEKS", Collections.singletonMap(KeyProvider.ALIAS_METADATA, "metadata"),
null, generateKeystoreName(), generateKeystoreName());
keyStore.setKeysToValidate(new HashSet<>(Collections.singletonList("metadata")));
createAndPopulateKeyStore(keyStore);
keyStoreChecker.setMainKeyStore(keyStore);
@@ -361,7 +358,6 @@ public class KeyStoreTests
TestAlfrescoKeyStore keyStore = getKeyStore("main", "JCEKS", Collections.singletonMap(KeyProvider.ALIAS_METADATA, "metadata"),
null, generateKeystoreName(), generateKeystoreName());
keyStore.setKeysToValidate(new HashSet<>(Collections.singletonList("metadata")));
createAndPopulateKeyStore(keyStore);
try

View File

@@ -34,7 +34,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.admin.RepoAdminService;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.download.DownloadService;
import org.alfresco.service.cmr.download.DownloadStatus;
@@ -70,11 +69,8 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.RuleChain;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -127,7 +123,6 @@ public class DownloadServiceIntegrationTest
private static PermissionService PERMISSION_SERVICE;
private static RetryingTransactionHelper TRANSACTION_HELPER;
private static IntegrityChecker INTEGRITY_CHECKER;
private static RepoAdminService REPO_ADMIN_SERVICE;
// Test Content
private NodeRef rootFolder;
@@ -141,41 +136,6 @@ public class DownloadServiceIntegrationTest
private Set<String> allEntries;
private NodeRef fileToCheckout;
// MNT-21671 Download as zip does not include custom folders.
// Define a custom model that is child of cm:folder
private static final String CUSTOM_FOLDER_MODEL_XML =
"<model name=\"custom:customModel\" xmlns=\"http://www.alfresco.org/model/dictionary/1.0\">" +
" <description>Custom Model</description>" +
" <author></author>" +
" <version>1.0</version>" +
" <imports>" +
" <import uri=\"http://www.alfresco.org/model/dictionary/1.0\" prefix=\"d\"/>" +
" <import uri=\"http://www.alfresco.org/model/content/1.0\" prefix=\"cm\"/>" +
" </imports>" +
" <namespaces>" +
" <namespace uri=\"custom.model\" prefix=\"custom\"/>" +
" </namespaces>" +
" <types>" +
" <type name=\"custom:folderx\">" +
" <title>Custom FolderX</title>" +
" <parent>cm:folder</parent>" +
" <properties>" +
" <property name=\"custom:invoice\">" +
" <type>d:text</type>" +
" </property>" +
" </properties>" +
" <associations>" +
" </associations>" +
" </type>" +
" </types>" +
" <aspects>" +
" </aspects>" +
"</model>";
@BeforeClass public static void init()
{
@@ -191,7 +151,6 @@ public class DownloadServiceIntegrationTest
INTEGRITY_CHECKER.setEnabled(true);
INTEGRITY_CHECKER.setFailOnViolation(true);
INTEGRITY_CHECKER.setTraceOn(true);
REPO_ADMIN_SERVICE = APP_CONTEXT_INIT.getApplicationContext().getBean("RepoAdminService", RepoAdminService.class);
}
/**
@@ -244,24 +203,6 @@ public class DownloadServiceIntegrationTest
allEntries.add("rootFolder/level1Folder2/fileToCheckout.txt");
PERMISSION_SERVICE.setPermission(level1Folder2, TEST_USER.getUsername(), PermissionService.ALL_PERMISSIONS, true);
PERMISSION_SERVICE.setPermission(fileToCheckout, TEST_USER.getUsername(), PermissionService.ALL_PERMISSIONS, true);
// MNT-21671 Download as zip does not include custom folders.
// deploy custom model
final String modelFileName1 = "model-MNT-21671.xml";
InputStream modelStream = null;
try
{
modelStream = new ByteArrayInputStream(CUSTOM_FOLDER_MODEL_XML.getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
REPO_ADMIN_SERVICE.deployModel(modelStream, modelFileName1);
final QName customFolderType = QName.createQName("{custom.model}folderx");
testNodes.createNode(rootFolder, "level1CustomFolder", customFolderType, AuthenticationUtil.getAdminUserName());
allEntries.add("rootFolder/level1CustomFolder/");
}
@Test public void createDownload() throws IOException, InterruptedException

View File

@@ -34,7 +34,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -85,7 +84,6 @@ import org.alfresco.util.testing.category.LuceneTests;
import org.alfresco.util.testing.category.RedundantTests;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource;
@@ -398,73 +396,8 @@ public class ImapMessageTest extends TestCase
}
}
@Test
public void testSearchTermWithNonEnglishLocale() throws Exception
{
folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
folder.open(Folder.READ_ONLY);
Locale defaultLocale = Locale.getDefault();
try
{
Locale.setDefault(Locale.FRENCH);
String dateStr = "12-Jul-2020";
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand()
{
@Override
public Object doCommand(IMAPProtocol protocol)
{
return protocol.command("UID SEARCH SINCE " + dateStr, null);
}
};
// UID SEARCH SINCE
Response[] ret = (Response[]) folder.doCommand(uid_search_since);
IMAPResponse response = (IMAPResponse) ret[0];
assertEquals("* SEARCH ", response.toString());
}
catch (MessagingException e)
{
fail("Date cannot be parsed");
}
finally
{
Locale.setDefault(defaultLocale);
}
}
@Test
public void testSearchTermWithNonEnglishLocaleFalsePositive() throws Exception
{
Locale defaultLocale = Locale.getDefault();
try
{
folder = (IMAPFolder) store.getFolder(TEST_FOLDER);
folder.open(Folder.READ_ONLY);
Locale.setDefault(Locale.FRENCH);
String dateStr = "12-juil.-2020";
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand()
{
@Override
public Object doCommand(IMAPProtocol protocol)
{
return protocol.command("UID SEARCH SINCE " + dateStr, null);
}
};
// UID SEARCH SINCE
Response[] ret = (Response[]) folder.doCommand(uid_search_since);
assertEquals("java.net.SocketException: Connection reset", ret[0].getException().toString());
}
catch (MessagingException e)
{
// expected
}
finally
{
Locale.setDefault(defaultLocale);
}
}
public void testUnmodifiedMessage() throws Exception
{
// Get test message UID
@@ -840,7 +773,7 @@ public class ImapMessageTest extends TestCase
txn.commit();
// Closing client connection
folder.forceClose();
folder.close(false);
store.close();
logger.debug("tearDown end");
}

View File

@@ -1151,7 +1151,7 @@ public class ImapServiceImplTest extends TestCase
* MNT-12773
* @throws AddressException
*/
public void testSearchTerms() throws AddressException
public void testSearchTerms() throws AddressException
{
List<AlfrescoImapFolder> mf = imapService.listMailboxes(user, IMAP_ROOT+"/"+TEST_IMAP_FOLDER_NAME+"/_*", false);
ArrayList<Long> res = new ArrayList<Long>();

View File

@@ -52,16 +52,9 @@ mimetype.config.cronExpression=0 0 0 ? JAN * 1970
rendition.config.cronExpression=0 0 0 ? JAN * 1970
local.transform.service.cronExpression=0 0 0 ? JAN * 1970
transform.service.cronExpression=0 0 0 ? JAN * 1970
system.delete_not_exists.batchsize=100000
system.delete_not_exists.delete_batchsize=1000
system.delete_not_exists.read_only=false
system.delete_not_exists.timeout_seconds=-1
system.prop_table_cleaner.algorithm=V2
# For testing only
encryption.keystore.keyMetaData.location=${dir.keystore}/keystore-passwords.properties
encryption.keyAlgorithm=DESede
encryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
encryption.keystore.type=JCEKS
encryption.keystore.backup.type=JCEKS