[MNT-24807] Fix failing tests

This commit is contained in:
cezary-witkowski
2025-01-15 12:51:08 +01:00
parent 911ea4db23
commit c118f713f2
3 changed files with 60 additions and 56 deletions

View File

@@ -42,6 +42,9 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.event.v1.model.ContentInfo; import org.alfresco.repo.event.v1.model.ContentInfo;
@@ -69,9 +72,6 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.PathUtil; import org.alfresco.util.PathUtil;
import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
/** /**
* Helper for {@link NodeResource} objects. * Helper for {@link NodeResource} objects.
@@ -189,7 +189,8 @@ public class NodeResourceHelper implements InitializingBean
{ {
result = primaryParent.getQName().getPrefixedQName(namespaceService).getPrefixString(); result = primaryParent.getQName().getPrefixedQName(namespaceService).getPrefixString();
} }
} catch (NamespaceException namespaceException) }
catch (NamespaceException namespaceException)
{ {
LOGGER.error("Cannot return a valid primary association QName: " + namespaceException.getMessage()); LOGGER.error("Cannot return a valid primary association QName: " + namespaceException.getMessage());
} }
@@ -241,7 +242,7 @@ public class NodeResourceHelper implements InitializingBean
final MLText mlTextValue = (MLText) v; final MLText mlTextValue = (MLText) v;
final HashMap<String, String> localizedValues = new HashMap<>(mlTextValue.size()); final HashMap<String, String> localizedValues = new HashMap<>(mlTextValue.size());
mlTextValue.forEach((locale, text) -> { mlTextValue.forEach((locale, text) -> {
Serializable replacedValue = propertyReplacer.replace(k, v); Serializable replacedValue = propertyReplacer.replace(k, text);
localizedValues.put(locale.toString(), replacedValue.toString()); localizedValues.put(locale.toString(), replacedValue.toString());
}); });
filteredProps.put(getQNamePrefixString(k), localizedValues); filteredProps.put(getQNamePrefixString(k), localizedValues);
@@ -317,10 +318,10 @@ public class NodeResourceHelper implements InitializingBean
} }
/** /**
* Returns the QName in the format prefix:local, but in the exceptional case where there is no registered prefix * Returns the QName in the format prefix:local, but in the exceptional case where there is no registered prefix returns it in the form {uri}local.
* returns it in the form {uri}local.
* *
* @param k QName * @param k
* QName
* @return a String representing the QName in the format prefix:local or {uri}local. * @return a String representing the QName in the format prefix:local or {uri}local.
*/ */
public String getQNamePrefixString(QName k) public String getQNamePrefixString(QName k)
@@ -369,7 +370,8 @@ public class NodeResourceHelper implements InitializingBean
try try
{ {
return nodeService.getProperties(nodeRef); return nodeService.getProperties(nodeRef);
} finally }
finally
{ {
MLPropertyInterceptor.setMLAware(toRestore); MLPropertyInterceptor.setMLAware(toRestore);
} }
@@ -431,7 +433,8 @@ public class NodeResourceHelper implements InitializingBean
/** /**
* Gathers node's secondary parents. * Gathers node's secondary parents.
* *
* @param nodeRef - node reference * @param nodeRef
* - node reference
* @return a list of node's secondary parents. * @return a list of node's secondary parents.
*/ */
public List<String> getSecondaryParents(final NodeRef nodeRef) public List<String> getSecondaryParents(final NodeRef nodeRef)

View File

@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.event2.replacer; package org.alfresco.repo.event2;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@@ -32,6 +32,7 @@ import java.util.UUID;
import org.junit.Test; import org.junit.Test;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.event2.replacer.PropertyReplacer;
import org.alfresco.repo.transfer.TransferModel; import org.alfresco.repo.transfer.TransferModel;
public class PropertyReplacerUnitTest public class PropertyReplacerUnitTest

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2023 Alfresco Software Limited * Copyright (C) 2005 - 2025 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -34,8 +34,8 @@ import org.junit.runners.Suite.SuiteClasses;
EventConsolidatorUnitTest.class, EventConsolidatorUnitTest.class,
EventJSONSchemaUnitTest.class, EventJSONSchemaUnitTest.class,
EnqueuingEventSenderUnitTest.class, EnqueuingEventSenderUnitTest.class,
NodeResourceHelperUnitTest.class NodeResourceHelperUnitTest.class,
PropertyReplacerUnitTest.class
}) })
public class RepoEvent2UnitSuite public class RepoEvent2UnitSuite
{ {}
}