Merged V3.2 to HEAD

18021: AVM - fix AVMNodeService.getChildByName
    18065: (record-only) 
    18254: WCM/AVM - ETHREEOH-2057 (Submitting WCM Content through WF JSF Error - due to AVM Sync issue)
    18442: ETHREEOH-4004 - rework test
    18467: ETHTREEOH-4004 - test fix (avoid conversion, replace UTF-16 with UTF-8)
    18835: (record-only) Merged V3.1 to V3.2 (record-only)
        18783: (record-only) MT: ensure group (EMAIL_CONTRIBUTORS) bootstraps tenant admin user (when creating tenant) - fixed by r14588
    19146: (record-only) Undo previous/unwanted commit (version.properties)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19288 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-03-15 13:31:38 +00:00
parent a974734210
commit deb5fc9c08
4 changed files with 99 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ import java.util.SortedMap;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.avm.util.AVMUtil;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.repo.node.AbstractNodeServiceImpl;
import org.alfresco.service.cmr.avm.AVMException;
@@ -1731,7 +1732,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
try
{
AVMNodeDescriptor child = fAVMService.lookup(avmVersionPath.getFirst(),
avmVersionPath.getSecond());
AVMUtil.extendAVMPath(avmVersionPath.getSecond(), childName));
if (child == null)
{
return null;

View File

@@ -576,6 +576,86 @@ public class AVMServiceLocalTest extends TestCase
}
}
public void testSimpleUpdateLD6() throws Exception
{
try
{
logger.debug("created 2 stores: main, layer");
fService.createDirectory("main:/", "a");
fService.createDirectory("main:/a", "b");
logger.debug("created dirs: main:/a, main:/a/b");
fService.createLayeredDirectory("main:/", "layer:/", "layer");
logger.debug("created layered dir: layer:/layer -> main:/");
List<AVMDifference> diffs = fSyncService.compare(-1, "layer:/layer", -1, "main:/", null);
assertEquals(0, diffs.size());
fService.createDirectory("layer:/layer/a", "xyz");
fService.createFile("layer:/layer/a/xyz", "index.html").close();
logger.debug("created: layer:/layer/a/xyz, layer:/layer/a/xyz/index.html");
diffs = fSyncService.compare(-1, "layer:/layer", -1, "main:/", null);
assertEquals(1, diffs.size());
assertEquals("[layer:/layer/a/xyz[-1] > main:/a/xyz[-1]]", diffs.toString());
fService.createStore("main--workflow1");
logger.debug("created store: main--workflow1");
fService.createLayeredDirectory("main:/a", "main--workflow1:/", "a");
logger.debug("created layered dir: main--workflow1:/a -> main:/a");
diffs = fSyncService.compare(-1, "main--workflow1:/a", -1, "main:/a", null);
assertEquals(0, diffs.size());
diffs = new ArrayList<AVMDifference>(1);
diffs.add(new AVMDifference(-1, "layer:/layer/a/xyz/index.html", -1, "main--workflow1:/a/xyz/index.html", AVMDifference.NEWER));
diffs.add(new AVMDifference(-1, "layer:/layer/a/xyz", -1, "main--workflow1:/a/xyz", AVMDifference.NEWER));
// ETHREEOH-2057
fSyncService.update(diffs, null, false, false, false, false, "one", "one");
logger.debug("updated: added: main--workflow1:/a/xyz, main--workflow1:/a/xyz/index.html");
diffs = fSyncService.compare(-1, "layer:/layer/a", -1, "main:/a", null);
assertEquals(1, diffs.size());
assertEquals("[layer:/layer/a/xyz[-1] > main:/a/xyz[-1]]", diffs.toString());
diffs = fSyncService.compare(-1, "main--workflow1:/a", -1, "main:/a", null);
assertEquals(1, diffs.size());
assertEquals("[main--workflow1:/a/xyz[-1] > main:/a/xyz[-1]]", diffs.toString());
fSyncService.update(diffs, null, false, false, true, true, "two", "two");
fSyncService.flatten("main--workflow1:/a", "main:/a");
logger.debug("updated & flattened");
diffs = fSyncService.compare(-1, "main--workflow1:/a", -1, "main:/a", null);
assertEquals(0, diffs.size());
diffs = fSyncService.compare(-1, "main--workflow1:/a", -1, "layer:/layer/a", null);
assertEquals(0, diffs.size());
recursiveList("main");
recursiveList("layer");
}
catch (Exception e)
{
e.printStackTrace(System.err);
throw e;
}
finally
{
if (fService.getStore("main--workflow1") != null) { fService.purgeStore("main--workflow1"); }
}
}
public void testDeleteLD1() throws Exception
{
try

View File

@@ -267,9 +267,14 @@ public class AVMServiceTestBase extends TestCase
fService.createFile("main:/a/b/c", "bar").close();
writer = fService.getContentWriter("main:/a/b/c/bar");
/*
// Force a conversion
writer.setEncoding("UTF-16");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent(new ByteArrayInputStream("I am main:/a/b/c/bar".getBytes("UTF-16")));
*/
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("I am main:/a/b/c/bar");
fService.createSnapshot("main", null, null);

View File

@@ -24,6 +24,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.alfresco.repo.avm.util.AVMUtil;
import org.alfresco.repo.domain.DbAccessControlList;
@@ -410,6 +411,9 @@ public class AVMSyncServiceImpl implements AVMSyncService
Map<String, Integer> storeVersions = new HashMap<String, Integer>();
Set<String> destStores = new HashSet<String>();
Map<String, AVMDifference> diffsToUpdate = new TreeMap<String, AVMDifference>();
for (AVMDifference diff : diffList)
{
if (excluder != null && (excluder.matches(diff.getSourcePath()) ||
@@ -417,10 +421,17 @@ public class AVMSyncServiceImpl implements AVMSyncService
{
continue;
}
if (!diff.isValid())
{
throw new AVMSyncException("Malformed AVMDifference.");
}
diffsToUpdate.put(diff.getSourcePath(), diff);
}
for (AVMDifference diff : diffsToUpdate.values())
{
if (logger.isDebugEnabled())
{
logger.debug("update: " + diff);