mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-1033 : Spring upgrade to 5.3.2 (#213)
- Update test as per5de549d7d4
- before spring 5.3.0, AbstractFallbackSQLExceptionTranslator was translating org.postgresql.util.PSQLException as UncategorizedSQLException - now it returns null (ref.e9cded560d (diff-c6aa1c6a4b11e8a722808e945c4c5b6ef471c42871c7ce830554dde81ad7f2c2L89)
) Co-authored-by: CezarLeahu <35226487+CezarLeahu@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
package org.alfresco.util.transaction;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.transaction.HeuristicMixedException;
|
||||
import javax.transaction.HeuristicRollbackException;
|
||||
@@ -136,6 +138,8 @@ public class SpringAwareUserTransaction
|
||||
/** make sure that we clean up the thread transaction stack properly */
|
||||
private boolean finalized = false;
|
||||
|
||||
private Collection<String> labels = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* Creates a user transaction that defaults to {@link TransactionDefinition#PROPAGATION_REQUIRED}.
|
||||
*
|
||||
@@ -200,6 +204,21 @@ public class SpringAwareUserTransaction
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate one or more labels with this transaction attribute.
|
||||
* <p>This may be used for applying specific transactional behavior
|
||||
* or follow a purely descriptive nature.
|
||||
*/
|
||||
public void setLabels(Collection<String> labels) {
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getLabels()
|
||||
{
|
||||
return this.labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link UserTransaction } must rollback regardless of the error. The
|
||||
* {@link #rollback() rollback} behaviour is implemented by simulating a caught
|
||||
|
2
pom.xml
2
pom.xml
@@ -55,7 +55,7 @@
|
||||
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>0.0.11</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.spring.version>5.2.12.RELEASE</dependency.spring.version>
|
||||
<dependency.spring.version>5.3.2</dependency.spring.version>
|
||||
<dependency.antlr.version>3.5.2</dependency.antlr.version>
|
||||
<dependency.jackson.version>2.11.3</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.11.2</dependency.jackson-databind.version>
|
||||
|
@@ -243,7 +243,7 @@ public class QuickShareRestApiTest extends BaseWebScriptTest
|
||||
// get content thumbnail for node (authenticated)
|
||||
rsp = sendRequest(new GetRequest(AUTH_CONTENT_THUMBNAIL_URL.replace("{node_ref_3}", testNodeRef_3).replace("{thumbnailname}", "doclib")), expectedStatusOK, USER_ONE);
|
||||
String type = rsp.getContentType();
|
||||
assertEquals(TEST_MIMETYPE_PNG, type);
|
||||
assertEquals(TEST_MIMETYPE_PNG + ";charset=UTF-8", type);
|
||||
|
||||
// As user two ...
|
||||
|
||||
@@ -279,7 +279,7 @@ public class QuickShareRestApiTest extends BaseWebScriptTest
|
||||
// get content thumbnail for share (note: can be unauthenticated)
|
||||
rsp = sendRequest(new GetRequest(SHARE_CONTENT_THUMBNAIL_URL.replace("{shared_id}", sharedId).replace("{thumbnailname}", "doclib")), expectedStatusOK, USER_TWO);
|
||||
type = rsp.getContentType();
|
||||
assertEquals(TEST_MIMETYPE_PNG, type);
|
||||
assertEquals(TEST_MIMETYPE_PNG + ";charset=UTF-8", type);
|
||||
|
||||
// As user one ...
|
||||
|
||||
|
@@ -29,8 +29,6 @@ import javax.transaction.RollbackException;
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.domain.dialect.Dialect;
|
||||
import org.alfresco.repo.domain.dialect.PostgreSQLDialect;
|
||||
@@ -45,17 +43,12 @@ import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.ReadOnlyServerException;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.BaseSpringTest;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.dao.TransientDataAccessResourceException;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
@@ -192,7 +185,7 @@ public class TransactionServiceImplTest extends BaseSpringTest
|
||||
@SuppressWarnings("unused")
|
||||
int i = 0;
|
||||
}
|
||||
catch (UncategorizedSQLException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
// or this - for PostgreSQL (org.postgresql.util.PSQLException: ERROR: transaction is read-only)
|
||||
if (dialect instanceof PostgreSQLDialect)
|
||||
|
Reference in New Issue
Block a user