diff --git a/src/main/java/org/alfresco/repo/transfer/TransferVersionCheckerImpl.java b/src/main/java/org/alfresco/repo/transfer/TransferVersionCheckerImpl.java
index 569be8836a..815040f7ff 100644
--- a/src/main/java/org/alfresco/repo/transfer/TransferVersionCheckerImpl.java
+++ b/src/main/java/org/alfresco/repo/transfer/TransferVersionCheckerImpl.java
@@ -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 .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2017 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.repo.transfer;
import org.alfresco.service.cmr.transfer.TransferVersion;
@@ -32,7 +32,7 @@ import org.apache.commons.logging.LogFactory;
/**
* This is an implementation of TransferVersionChecker.
*
- * It allows transfer to the same edition/major/minor but ignores revision.
+ * It allows transfer to the same major version.
*/
public class TransferVersionCheckerImpl implements TransferVersionChecker
{
@@ -42,26 +42,16 @@ public class TransferVersionCheckerImpl implements TransferVersionChecker
{
logger.debug("checkTransferVersions from:" + from + ", to:" + to);
- if(from == null || to == null || to.getEdition() == null || to.getVersionMajor() == null || to.getVersionMinor() == null)
+ if(from == null || to == null || from.getVersionMajor() == null || to.getVersionMajor() == null)
{
return false;
}
-
- if(!from.getEdition().equalsIgnoreCase(to.getEdition()))
- {
- return false;
- }
-
+
if(!from.getVersionMajor().equalsIgnoreCase(to.getVersionMajor()))
{
return false;
}
-
- if(!from.getVersionMinor().equalsIgnoreCase(to.getVersionMinor()))
- {
- return false;
- }
-
+
// ignore revisions
return true;
diff --git a/src/test/java/org/alfresco/AllUnitTestsSuite.java b/src/test/java/org/alfresco/AllUnitTestsSuite.java
index 8afcc5d6df..e11c14d4dc 100644
--- a/src/test/java/org/alfresco/AllUnitTestsSuite.java
+++ b/src/test/java/org/alfresco/AllUnitTestsSuite.java
@@ -74,6 +74,7 @@ import org.junit.runners.Suite;
org.alfresco.repo.transfer.ContentChunkerImplTest.class,
org.alfresco.repo.transfer.HttpClientTransmitterImplTest.class,
org.alfresco.repo.transfer.manifest.TransferManifestTest.class,
+ org.alfresco.repo.transfer.TransferVersionCheckerImplTest.class,
org.alfresco.repo.urlshortening.BitlyUrlShortenerTest.class,
org.alfresco.service.cmr.calendar.CalendarRecurrenceHelperTest.class,
org.alfresco.service.cmr.calendar.CalendarTimezoneHelperTest.class,
diff --git a/src/test/java/org/alfresco/AppContext04TestSuite.java b/src/test/java/org/alfresco/AppContext04TestSuite.java
index 80623ab2ca..93a51c28fe 100644
--- a/src/test/java/org/alfresco/AppContext04TestSuite.java
+++ b/src/test/java/org/alfresco/AppContext04TestSuite.java
@@ -81,7 +81,6 @@ import org.junit.runners.Suite;
org.alfresco.repo.transfer.TransferServiceCallbackTest.class,
org.alfresco.repo.transfer.TransferServiceImplTest.class,
org.alfresco.repo.transfer.TransferServiceToBeRefactoredTest.class,
- org.alfresco.repo.transfer.TransferVersionCheckerImplTest.class,
org.alfresco.repo.transfer.manifest.ManifestIntegrationTest.class,
org.alfresco.repo.transfer.script.ScriptTransferServiceTest.class,
org.alfresco.util.schemacomp.DbToXMLTest.class,
diff --git a/src/test/java/org/alfresco/repo/transfer/TransferVersionCheckerImplTest.java b/src/test/java/org/alfresco/repo/transfer/TransferVersionCheckerImplTest.java
index 2d74d6d812..f4d8dddfe4 100644
--- a/src/test/java/org/alfresco/repo/transfer/TransferVersionCheckerImplTest.java
+++ b/src/test/java/org/alfresco/repo/transfer/TransferVersionCheckerImplTest.java
@@ -1,45 +1,46 @@
-/*
- * #%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 .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2017 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.repo.transfer;
import org.alfresco.service.cmr.transfer.TransferVersion;
-import org.alfresco.test_category.BaseSpringTestsCategory;
-import org.alfresco.util.BaseAlfrescoSpringTest;
-import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Unit test for TransferVersionChecker
* @author mrogers
*/
-@Category(BaseSpringTestsCategory.class)
-public class TransferVersionCheckerImplTest extends BaseAlfrescoSpringTest
+public class TransferVersionCheckerImplTest
{
/**
* Test TransferVersionCheckerImpl
*/
+ @Test
public void testTransferVersionCheckerImpl()
{
@@ -61,11 +62,10 @@ public class TransferVersionCheckerImplTest extends BaseAlfrescoSpringTest
assertTrue("not equals", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "1", EDITION)));
assertTrue("not equals", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "2", EDITION)));
- // These should not match
- assertFalse("not equals minor different", checker.checkTransferVersions(e, new TransferVersionImpl("3", "4", "0", EDITION)));
- assertFalse("not equals major different", checker.checkTransferVersions(e, new TransferVersionImpl("4", "3", "0", EDITION)));
- assertFalse("not equals edition different", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "0", "Whatever")));
- assertFalse("not equals edition null ", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "0", null)));
+ assertTrue("Checker should not flag minor difference", checker.checkTransferVersions(e, new TransferVersionImpl("3", "4", "0", EDITION)));
+ assertFalse("Checker should flag major difference", checker.checkTransferVersions(e, new TransferVersionImpl("4", "3", "0", EDITION)));
+ assertTrue("Checker should not flag edition difference", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "0", "Whatever")));
+ assertTrue("Checker should not flag edition absence", checker.checkTransferVersions(e, new TransferVersionImpl("3", "3", "0", null)));
}
}