diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java
index 543fa88d21..fa3d09a7d1 100644
--- a/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java
+++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java
@@ -3132,26 +3132,18 @@ public class NodesImpl implements Nodes
// Write content
writeContent(nodeRef, fileName, content.getInputStream(), true);
}
-
+
if ((versionMajor != null) || (versionComment != null))
{
- behaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
- try
+ // by default, first version is major, unless specified otherwise
+ VersionType versionType = VersionType.MAJOR;
+ if ((versionMajor != null) && (!versionMajor))
{
- // by default, first version is major, unless specified otherwise
- VersionType versionType = VersionType.MAJOR;
- if ((versionMajor != null) && (!versionMajor))
- {
- versionType = VersionType.MINOR;
- }
-
- createVersion(nodeRef, false, versionType, versionComment);
-
- extractMetadata(nodeRef);
- } finally
- {
- behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
+ versionType = VersionType.MINOR;
}
+
+ createVersion(nodeRef, false, versionType, versionComment);
+ extractMetadata(nodeRef);
}
return nodeRef;
diff --git a/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java b/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
index 09b07d410b..4756d0958b 100644
--- a/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
+++ b/remote-api/src/test/java/org/alfresco/AppContext02TestSuite.java
@@ -51,6 +51,8 @@ import org.junit.runners.Suite;
org.alfresco.rest.api.tests.GroupsTest.class,
org.alfresco.rest.api.tests.ModulePackagesApiTest.class,
org.alfresco.rest.api.tests.NodeApiTest.class,
+ org.alfresco.rest.api.tests.NodeApiVersioningMultipartParameterizedTest.class,
+ org.alfresco.rest.api.tests.NodeApiVersioningJsonParameterizedTest.class,
org.alfresco.rest.api.tests.NodeAssociationsApiTest.class,
org.alfresco.rest.api.tests.NodeVersionsApiTest.class,
org.alfresco.rest.api.tests.NodeVersionRenditionsApiTest.class,
diff --git a/remote-api/src/test/java/org/alfresco/rest/api/tests/NodeApiVersioningJsonParameterizedTest.java b/remote-api/src/test/java/org/alfresco/rest/api/tests/NodeApiVersioningJsonParameterizedTest.java
new file mode 100644
index 0000000000..d9b85d6d89
--- /dev/null
+++ b/remote-api/src/test/java/org/alfresco/rest/api/tests/NodeApiVersioningJsonParameterizedTest.java
@@ -0,0 +1,179 @@
+/*
+ * #%L
+ * Alfresco Remote API
+ * %%
+ * Copyright (C) 2005 - 2022 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 .
+ * #L%
+ */
+package org.alfresco.rest.api.tests;
+
+import org.alfresco.rest.AbstractSingleNetworkSiteTest;
+import org.alfresco.rest.api.tests.client.HttpResponse;
+import org.alfresco.rest.api.tests.client.data.Document;
+import org.alfresco.rest.api.tests.util.RestApiUtil;
+import org.alfresco.service.cmr.repository.NodeService;
+import org.alfresco.service.cmr.security.AuthorityService;
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.namespace.NamespaceService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.*;
+
+import static org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsStringNonNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Parameterized.class)
+public class NodeApiVersioningJsonParameterizedTest extends AbstractSingleNetworkSiteTest
+{
+ private static final String TYPE_CM_CONTENT = "cm:content";
+ private static final String TYPE_CUSTOM_DOCUMENT = "custom:document";
+
+ private static final String VERSIONING_ENABLED_TRUE = "true";
+ private static final String VERSIONING_ENABLED_FALSE = "false";
+ private static final String VERSIONING_ENABLED_UNSET = null;
+
+ private static final Boolean MAJOR_VERSION_ENABLED_TRUE = true;
+ private static final Boolean MAJOR_VERSION_ENABLED_FALSE = false;
+ private static final Boolean MAJOR_VERSION_ENABLED_UNSET = null;
+
+ private static final String VERSION_NOT_EXPECTED = null;
+ private static final String EXPECTED_VERSION_0_1 = "0.1";
+ private static final String EXPECTED_VERSION_1_0 = "1.0";
+
+ private static final String EXPECTED_ASPECT_VERSIONABLE = "cm:versionable";
+ private static final String EXPECTED_ASPECT_NONE = null;
+
+ protected PermissionService permissionService;
+ protected AuthorityService authorityService;
+ private NodeService nodeService;
+ private NamespaceService namespaceService;
+
+
+ @Parameterized.Parameter(value = 0)
+ public String type;
+
+ @Parameterized.Parameter(value = 1)
+ public String versioningEnabled;
+
+ @Parameterized.Parameter(value = 2)
+ public Boolean majorVersion;
+
+ @Parameterized.Parameter(value = 3)
+ public String expectedVersion;
+
+ @Parameterized.Parameter(value = 4)
+ public String expectedAspect;
+
+ @Parameterized.Parameters //parameters source - MMT-22462 comments
+ public static Collection