Merged V3.1 to HEAD

13424: ETHREEOH-1242: Sample LDAP authentication config breaks site invites in Share
   13427: Fixes for ETHREEOH-1157: Propagate exceptions using ReportedException
   13428: Fix ETHREEOH-1493: Upgrade from 2.1-A to 3.1 uses incorrect patch id and fixes_to_schema
   13429: Specific fix for ETHREEOH-1157: duplicate/triplicate users not properly prohibited
   13436: Merged V2.2 to V3.1
      13435: Merged V2.1 to V2.2  
         12307: Merged DEV/V2.1SP7 to 2.1 
            11927: ETWOONE-396 
            12112: ETWOONE-396
   13437: Fixed ETHREEOH-1498: Mismatched closing XML tag in ehcache-custom.xml.sample.cluster
   13439: Fix for ETHREEOH-1157: JSF Dialogs Absorbing Exceptions
   13456: Fixed ETHREEOH-1472: Changes to systemBootstrap cause bootstrapping ACP's not to work
   13469: Upgrade patch to update internal version2Store counter (follow-on fix for ETHREEOH-1540)
   13491: Chaining example for DOC-84
   13492: Fixed paths in zip file
   13494: Fixed GenericBootstrapPatch when overriding bootstrap views
   13495: Added @version javadoc
   13496: Minor logging updates
   13497: Fixed ETHREEOH-1431: Authentication case sensitivity switch doesn't work
   13500: Temporary fix for Sharepoint issue raised last week
   13502: ETHREEOH-1575: It's impossible to create Change Request task
   13511: Fix for ETHREEOH-1549: Impossible to create HTML web content
   13529: Fix for ETHREEOH-1595
   13531: Fix for ETHREEOH-1607: Error on chaining example xml - malformed comment
   13537: Build fix ... exclude the system user from auto creation
   13538: Build Fix - further contraints to aviod auto-creation of guest
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V2.1:r12307
      Merged /alfresco/BRANCHES/V2.2:r13435
      Merged /alfresco/BRANCHES/V3.1:r
                   13424,13427-13429,13436-13437,13439,13442-13450,13452,13454-13456,
                   13469-13473,13475-13476,13479-13480,13491-13500,13502,13511,13529-13538


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-13 01:52:39 +00:00
parent fec1149d8c
commit 65b8cd4a8b
27 changed files with 1829 additions and 1548 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,14 +26,19 @@ package org.alfresco.repo.version;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.version.common.counter.VersionCounterService;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.namespace.QName;
@@ -55,6 +60,8 @@ public class VersionMigratorTest extends BaseVersionStoreTest
protected VersionMigrator versionMigrator;
protected PolicyComponent policyComponent;
protected DictionaryService dictionaryService;
protected CheckOutCheckInService cociService;
protected VersionCounterService versionCounterService;
public VersionMigratorTest()
{
@@ -71,6 +78,9 @@ public class VersionMigratorTest extends BaseVersionStoreTest
this.version2Service = (Version2ServiceImpl)applicationContext.getBean("versionService");
this.versionNodeService = (NodeService)applicationContext.getBean("versionNodeService"); // note: auto-switches between V1 and V2
this.cociService = (CheckOutCheckInService)applicationContext.getBean("CheckoutCheckinService");
this.versionCounterService = (VersionCounterService)applicationContext.getBean("versionCounterService");
// Version1Service is used to create the version nodes in Version1Store (workspace://lightWeightVersionStore)
version1Service.setDbNodeService(dbNodeService);
version1Service.setNodeService(dbNodeService);
@@ -243,4 +253,100 @@ public class VersionMigratorTest extends BaseVersionStoreTest
logger.info("testMigrateMultipleVersions: Migrated from oldVHNodeRef = " + oldVHNodeRef + " to newVHNodeRef = " + newVHNodeRef);
}
public void test_ETHREEOH_1540() throws Exception
{
// Create the node used for tests
NodeRef nodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}MyVersionableNode"),
TEST_TYPE_QNAME,
this.nodeProperties).getChildRef();
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null);
nodeService.setProperty(nodeRef, ContentModel.PROP_NAME, "name");
// Add the initial content to the node
ContentWriter contentWriter = this.contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
contentWriter.setMimetype("text/plain");
contentWriter.setEncoding("UTF-8");
contentWriter.putContent("my content");
VersionHistory vh1 = version1Service.getVersionHistory(nodeRef);
assertNull(vh1);
version2Service.useDeprecatedV1 = true;
// note: for testing only - not recommended !!!
versionCounterService.setVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, VersionModel.STORE_ID), 100);
// Add the version aspect to the created node
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
vh1 = version1Service.getVersionHistory(nodeRef);
assertNull(vh1);
NodeRef workingCopyNodeRef = cociService.checkout(nodeRef);
vh1 = version1Service.getVersionHistory(nodeRef);
assertNull(vh1);
int v1count = 3;
for (int i = 1; i <= v1count; i++)
{
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>();
versionProperties.put(Version.PROP_DESCRIPTION, "This is a test checkin - " + i);
cociService.checkin(workingCopyNodeRef, versionProperties);
vh1 = version1Service.getVersionHistory(nodeRef);
assertEquals(i, vh1.getAllVersions().size());
workingCopyNodeRef = cociService.checkout(nodeRef);
vh1 = version1Service.getVersionHistory(nodeRef);
assertEquals(i, vh1.getAllVersions().size());
}
NodeRef oldVHNodeRef = version1Service.getVersionHistoryNodeRef(nodeRef);
version2Service.useDeprecatedV1 = false;
// Migrate and delete old version history !
NodeRef versionedNodeRef = versionMigrator.v1GetVersionedNodeRef(oldVHNodeRef);
//int nextVersionNumber = versionCounterService.nextVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, VersionModel.STORE_ID));
//versionCounterService.setVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID), nextVersionNumber);
// to force the error: https://issues.alfresco.com/jira/browse/ETHREEOH-1540
versionCounterService.setVersionNumber(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID), 0);
NodeRef newVHNodeRef = versionMigrator.migrateVersionHistory(oldVHNodeRef, versionedNodeRef);
versionMigrator.v1DeleteVersionHistory(oldVHNodeRef);
VersionHistory vh2 = version2Service.getVersionHistory(nodeRef);
assertEquals(v1count, vh2.getAllVersions().size());
int v2count = 3;
for (int i = 1; i <= v2count; i++)
{
versionProperties = new HashMap<String, Serializable>();
versionProperties.put(Version.PROP_DESCRIPTION, "This is a test checkin - " + (v1count + i));
cociService.checkin(workingCopyNodeRef, versionProperties);
vh2 = version2Service.getVersionHistory(nodeRef);
assertEquals((v1count + i), vh2.getAllVersions().size());
workingCopyNodeRef = cociService.checkout(nodeRef);
vh2 = version2Service.getVersionHistory(nodeRef);
assertEquals((v1count + i), vh2.getAllVersions().size());
}
logger.info("testMigrateOneCheckoutVersion: Migrated from oldVHNodeRef = " + oldVHNodeRef + " to newVHNodeRef = " + newVHNodeRef);
}
}