Merge 7.0.0-A3 changes into new projects (#3)

* Cherry pick (merge) changes from original projects in 7.0.0-A3)

Bump spring-surf-core-configservice from 8.5 to 8.6 (#144)

(cherry picked from commit 43e2592b264a6876da779d694f9a54f944c674c8)
Bump dependency.spring.version from 5.2.7.RELEASE to 5.2.8.RELEASE (#143)

(cherry picked from commit 9310346f19d6f4fb10317b6acbfb03df0bdefbd7)
Bump spring-surf-core-configservice from 8.6 to 8.7 (#145)

(cherry picked from commit 7ad131f31cd73b5ec103d279831fbc1fa8241496)
Bump spring-surf-core-configservice from 8.7 to 8.8 (#147)

(cherry picked from commit fcb5bd88e8331cfabf5a9a40e3c00e2aa013265a)
Bump mockito-core from 3.4.4 to 3.4.6 (#149)

(cherry picked from commit 1febbc71c8a52bb71620d218a15c2d7ff40350bb)
[SEARCH-2354] (#298)

Added support for DAYOFWEEK and DAYOFYEAR sql date functions

(cherry picked from commit 48bf24654945626eb8b26ff2ac0144bd92fe3302)
Bump jackson-annotations from 2.11.1 to 2.11.2 (#300)

(cherry picked from commit cde846f16f25e111b191eb8db4b46a967f40ff8e)
SEARCH-2273: Add detailed message when ignoring nodes in SOLR without… (#1111)

* SEARCH-2273: Add detailed message when ignoring nodes in SOLR without type or with types not registered in Dictionary Service.

* SEARCH-2273: Using non-registered type name.

* SEARCH-2273: Creating node without type using DB Service.

* SEARCH-2273: Check the right exception is produced when using a non registered TYPE.

* SEARCH-2273: Simplified case identification for exception message.

* SEARCH-2273: Remove unused library.

(cherry picked from commit f4bdc8c888dab01a1180715441c1669ac20e564d)
Bump dependency.spring.version from 5.2.6.RELEASE to 5.2.8.RELEASE (#1116)

(cherry picked from commit b7fc60bb60f483745f0461b9709b52e47d21e453)
Bump dependency.webscripts.version from 8.5 to 8.6 (#1117)

(cherry picked from commit 137013790b7852e549f7316c60b5305dff5f68f8)
SEARCH-800: Get values in DBResultSetRow in the same way they are rec… (#1114)

* SEARCH-800: Get values in DBResultSetRow in the same way they are recovered in SolrJSONResultSetRow.
This will provide the same behaviour when using getValue() method from Search ResultSet.

* SEARCH-800: Testing that using TRANSACTIONAL query consistency allows getting values using "getValue" method.

(cherry picked from commit 695113f4c40e34dcd8663d28e0ee56c956930a5e)
MNT-21317 Move on Update Folder Rule triggers unexpectedly for MOVED content. (#1115)

* MNT-21317_fix folder rule trigger

* MNT-21317_folder rule test case added

* Update .travis.yml

* Update OnPropertyUpdateRuleTrigger.java

* MNT-21317 updated test

(cherry picked from commit 33ca87046019416875fd23b72293e84b912f4cd9)
Bump aspectjrt from 1.9.5 to 1.9.6 (#1124)

(cherry picked from commit 330bb0820d2ce9608612eba9fed5acd76786853a)
Bump groovy-all from 2.4.19 to 2.4.20 (#1125)

(cherry picked from commit 4ab253bb21348f23a4df7e79ded43c16a9347e7c)
Bump dependency.webscripts.version from 8.6 to 8.7 (#1127)

(cherry picked from commit ac270757a7ff4bcd477375008902cf53bc220838)
Bump mariadb-java-client from 2.6.1 to 2.6.2 (#1128)

(cherry picked from commit 1f633aef1020aaeb31a71e0e4fed883f5a677f0f)
Bump gytheio-messaging-camel from 0.11.3 to 0.11.6 (#1095)

Bumps gytheio-messaging-camel from 0.11.3 to 0.11.6.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

(cherry picked from commit 16179db5fc4524c339097f1f3a9a6409dd895b11)
Bump dependency.webscripts.version from 8.7 to 8.8 (#1133)

(cherry picked from commit d363862d653e85e9366367817a82353580b2c6ce)
Bump dependency.transform.model.version from 1.0.2.10 to 1.0.2.11 (#1143)

(cherry picked from commit beaccd28608d2c70ef9eaf640d47a2e86a59ced4)
ATS-811: Updated T-engines to 2.3.3 (#1145)

(cherry picked from commit cbe6d78767741cb2b5f38d17cf4556dbda7c5311)
MNT-21614: LDAP sync communication error leads to group members deletion (#1149)

* Catch reported exceptions to filter ldap sync aborts

(cherry picked from commit 7e8cbd044e9ec2d31e05d072c0d47aa2d22ef771)
Bump commons-net from 3.6 to 3.7 (#1153)

(cherry picked from commit 3b5503bbf1c231a844536c54c639ad41a9c1b6aa)
ATS-817: Updated T-engines to 2.3.4 (#1151)

(cherry picked from commit b7f9ae0b71b599e27a59787ec3fe584ab64f1330)
[REPO-5239] - Added filter by displayName to /groups endpoint (#706)

* [REPO-5239] - Added filter by displayName to /groups endpoint

* [REPO-5239] - minor fix, brackets style

* [REPO-5239] Refactoring

* [REPO-5239] Fix to avoid the usage of displayName filter implemented in authorityService.getAuthoritiesInfo

(cherry picked from commit a01b80448ef48c5bb68978159b0ea134382ee653)

* Include branch in build

* More changes as a result of merging to alfresco-enterprise-repo. Dependencies now defined in community

* ACS-222: tests jobs using AIMS fail (#1464)

* Added a 3 minutes sleep after the curl request is succeeded preventing tests from starting immediately

Reimplemented from commit a6abc8a2c952d8c8d894bdeb50efe42f695d13cf on acs-packaging master. Now takes a second
optional parameter for the extra wait, so no all uses have to wait. Only AIMS.

* Merge commit to do with base-tomcat:8.5.51
This commit is contained in:
Alan Davis
2020-08-11 12:37:46 +01:00
committed by GitHub
parent 4dd068a98a
commit c7fbb97f76
25 changed files with 720 additions and 144 deletions

View File

@@ -705,7 +705,7 @@
<dependency>
<groupId>org.gytheio</groupId>
<artifactId>gytheio-messaging-camel</artifactId>
<version>0.11.3</version>
<version>${dependency.gytheio.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
@@ -1027,18 +1027,18 @@
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.5</version>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
<version>3.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.19</version>
<version>2.4.20</version>
<classifier>indy</classifier>
<scope>test</scope>
</dependency>

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.repo.rule.ruletrigger;
import java.io.Serializable;
@@ -141,7 +141,7 @@ public class OnPropertyUpdateRuleTrigger extends RuleTriggerAbstractBase
for (QName name : keys)
{
// Skip rule firing on this content property for performance reasons
if (name.equals(ContentModel.PROP_PREFERENCE_VALUES))
if (name.equals(ContentModel.PROP_PREFERENCE_VALUES) || name.equals(ContentModel.PROP_CASCADE_CRC))
{
continue;
}

View File

@@ -240,6 +240,11 @@ public class DBResultSet extends AbstractResultSet
nodeRefs[n+1] = nodeRef == null ? null : tenantService.getBaseName(nodeRef);
}
}
}
}
public NodeService getNodeService()
{
return nodeService;
}
}

View File

@@ -25,11 +25,13 @@
*/
package org.alfresco.repo.search.impl.querymodel.impl.db;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.repo.search.AbstractResultSetRow;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.namespace.QName;
/**
* @author Andy
@@ -82,6 +84,13 @@ public class DBResultSetRow extends AbstractResultSetRow
public float getScore(String selectorName)
{
throw new UnsupportedOperationException();
}
@Override
protected Map<QName, Serializable> getDirectProperties()
{
DBResultSet rs = (DBResultSet) getResultSet();
return rs.getNodeService().getProperties(rs.getNodeRef(getIndex()));
}

View File

@@ -54,6 +54,7 @@ import javax.naming.InvalidNameException;
import javax.naming.Name;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
@@ -882,6 +883,16 @@ public class LDAPUserRegistry implements UserRegistry, LDAPNameResolver, Initial
continue;
}
}
catch (ServiceUnavailableException | CommunicationException e)
{
// MNT-21614: Check & fail if communication breaks due to ServiceUnavailableException or CommunicationException
if (e.getMessage() != null)
{
Object[] params = {e.getLocalizedMessage() };
throw new AlfrescoRuntimeException("synchronization.err.ldap.search", params, e);
}
continue;
}
catch (NamingException e)
{
// Check if it is a timeout and fail

View File

@@ -865,7 +865,22 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
}
else
{
throw new AlfrescoRuntimeException("Nodes with no type are ignored by SOLR");
QName typeQName = null;
TypeDefinition typeDefinition = null;
String errorMessage = "NodeId " + nodeId + " with nodeRef " + nodeRef;
typeQName = nodeDAO.getNodeType(nodeId);
if (typeQName != null)
{
errorMessage += " has type " + typeQName + ", but this type is not registered in DictionaryService.";
}
else
{
errorMessage += " has no type.";
}
throw new AlfrescoRuntimeException(errorMessage + " It will be ignored by SOLR.");
}
}

View File

@@ -25,6 +25,7 @@
*/
package org.alfresco.repo.rule.ruletrigger;
import java.util.Random;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.repo.content.MimetypeMap;
@@ -426,7 +427,33 @@ public class RuleTriggerTest extends BaseSpringTest
// Check to see if the rule type has been triggered
assertTrue(ruleType.rulesTriggered);
assertEquals(3, ruleType.triggerCount);
}
}
@Test
public void testOnPropertyUpdateRuleTrigger()
{
NodeRef nodeRef1 = this.nodeService.createNode(this.rootNodeRef,
ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_CONTAINER).getChildRef();
ContentWriter contentWriter = this.contentService.getWriter(nodeRef1, ContentModel.PROP_CONTENT, true);
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.setEncoding("UTF-8");
contentWriter.putContent("some content");
Random rand=new Random();
this.nodeService.setProperty(nodeRef1, ContentModel.PROP_CASCADE_CRC, rand.nextLong());
// Terminate the transaction
TestTransaction.flagForCommit();
TestTransaction.end();
TestTransaction.start();
TestRuleType contentUpdate = createTestRuleType(ON_PROPERTY_UPDATE_TRIGGER);
this.nodeService.setProperty(nodeRef1, ContentModel.PROP_CASCADE_CRC, rand.nextLong());
assertFalse(contentUpdate.rulesTriggered);
assertEquals("trigger count not matching",0,contentUpdate.triggerCount);
}
private TestRuleType createTestRuleType(String ruleTriggerName)
{

View File

@@ -994,6 +994,30 @@ public class DBQueryTest implements DictionaryListener
results.getResultSetMetaData();
results.close();
}
@Test
public void testGetValueForTransactionalQuery()
{
String query = "=TYPE:\"cm:folder\" ";
queryUsingGetValue(SearchService.LANGUAGE_FTS_ALFRESCO, query);
}
public void queryUsingGetValue(String ql, String query)
{
SearchParameters sp = new SearchParameters();
sp.setLanguage(ql);
sp.setQueryConsistency(QueryConsistency.TRANSACTIONAL);
sp.setQuery(query);
sp.addStore(rootNodeRef.getStoreRef());
ResultSet results = serviceRegistry.getSearchService().query(sp);
for (int i = 0; i < results.length(); i++) {
ResultSetRow row = results.getRow(i);
assertNotNull(row.getValue(ContentModel.PROP_NODE_UUID));
}
results.getResultSetMetaData();
results.close();
}
private static class UnknownDataType implements Serializable
{

View File

@@ -34,10 +34,10 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import javax.naming.CompositeName;
import javax.naming.Name;
import javax.naming.CommunicationException;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.InitialDirContext;
@@ -144,4 +144,52 @@ public class LDAPUserRegistryTest
are.getCause().getMessage().contains(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE));
}
}
/**
* Test for MNT-21614: Check & fail if communication breaks due to javax.naming.ServiceUnavailableException
*/
@Test
public void testTimeoutDuringSyncForServiceUnavailableException() throws Exception
{
LDAPUserRegistry userRegistry = createRegistry();
when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any()))
.thenThrow(new ServiceUnavailableException(" test."));
try
{
userRegistry.getGroups(new Date());
fail("The process should fail with an exception");
}
catch (AlfrescoRuntimeException are)
{
assertEquals("The error message is not of the right format.",
"synchronization.err.ldap.search", are.getMsgId());
assertTrue("The error message was not caused by timeout.",
are.getCause().getMessage().contains(" test."));
}
}
/**
* Test for MNT-21614: Check & fail if communication breaks due to javax.naming.CommunicationException
*/
@Test
public void testTimeoutDuringSyncForCommunicationException() throws Exception
{
LDAPUserRegistry userRegistry = createRegistry();
when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any()))
.thenThrow(new CommunicationException(" test."));
try
{
userRegistry.getGroups(new Date());
fail("The process should fail with an exception");
}
catch (AlfrescoRuntimeException are)
{
assertEquals("The error message is not of the right format.",
"synchronization.err.ldap.search", are.getMsgId());
assertTrue("The error message was not caused by timeout.",
are.getCause().getMessage().contains(" test."));
}
}
}

View File

@@ -35,6 +35,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.dictionary.DictionaryDAO;
import org.alfresco.repo.dictionary.M2Model;
@@ -68,6 +69,7 @@ import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* Tests tracking component
@@ -1491,4 +1493,99 @@ public class SOLRTrackingComponentTest extends BaseSpringTest
return txs;
}
}
@Test
public void testGetNodeMetaDataWithNoType()
{
long startTime = System.currentTimeMillis();
SOLRTest st = new SOLRTestWithNoType(txnHelper, fileFolderService, nodeDAO, qnameDAO, nodeService, dictionaryService, rootNodeRef, "testNodeMetaDataNullPropertyValue", true, true);
List<Long> createdTransactions = st.buildTransactions();
List<Transaction> txns = getTransactions(null, startTime-1000, null, null, 100);
int[] updates = new int[] {2};
int[] deletes = new int[] {0};
List<Transaction> checkedTransactions = checkTransactions(txns, createdTransactions, updates, deletes);
NodeParameters nodeParameters = new NodeParameters();
nodeParameters.setTransactionIds(getTransactionIds(checkedTransactions));
getNodes(nodeParameters, st);
NodeMetaDataParameters nodeMetaDataParams = new NodeMetaDataParameters();
nodeMetaDataParams.setNodeIds(st.getNodeIds());
try
{
getNodeMetaData(nodeMetaDataParams, null, st);
}
catch (AlfrescoRuntimeException are)
{
if (!are.getMessage().contains("It will be ignored by SOLR"))
{
throw are;
}
}
}
private static class SOLRTestWithNoType extends SOLRTest
{
private NodeRef container;
private NodeRef content;
SOLRTestWithNoType(
RetryingTransactionHelper txnHelper, FileFolderService fileFolderService,
NodeDAO nodeDAO, QNameDAO qnameDAO, NodeService nodeService, DictionaryService dictionaryService,
NodeRef rootNodeRef, String containerName, boolean doNodeChecks, boolean doMetaDataChecks)
{
super(txnHelper, fileFolderService, nodeDAO, qnameDAO, nodeService, dictionaryService,rootNodeRef, containerName, doNodeChecks, doMetaDataChecks);
}
public int getExpectedNumNodes()
{
return 2;
}
protected List<Long> buildTransactionsInternal()
{
ArrayList<Long> txs = new ArrayList<Long>(2);
txs.add(txnHelper.doInTransaction(new RetryingTransactionCallback<Long>()
{
public Long execute() throws Throwable
{
PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_NAME, "ContainerWithNoType");
container = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_FOLDER,
props).getChildRef();
Long containerId = nodeDAO.getNodePair(container).getFirst();
content = nodeDAO.newNode(
containerId,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"),
null,
QName.createQName("{nonExisting}nonExisting"),
I18NUtil.getLocale(),
null,
null).getChildNode().getNodeRef();
return nodeDAO.getNodeRefStatus(container).getDbTxnId();
}
}));
setExpectedNodeStatus(container, NodeStatus.UPDATED);
setExpectedNodeStatus(content, NodeStatus.UPDATED);
return txs;
}
}
}