mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Rework ETWOTWO-1236 To HEAD (rework not merge since deployment has been refactored)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14602 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,7 @@ import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -41,6 +42,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -1169,6 +1171,26 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
throw new AVMException(f.format(objs), e);
|
||||
}
|
||||
}
|
||||
|
||||
private class ComparatorFileDescriptorCaseSensitive implements Comparator<FileDescriptor>
|
||||
{
|
||||
public int compare(FileDescriptor o1, FileDescriptor o2)
|
||||
{
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private class ComparatorAVMNodeDescriptorCaseSensitive implements Comparator<AVMNodeDescriptor>
|
||||
{
|
||||
public int compare(AVMNodeDescriptor o1, AVMNodeDescriptor o2)
|
||||
{
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private ComparatorFileDescriptorCaseSensitive FILE_DESCRIPTOR_CASE_SENSITIVE = new ComparatorFileDescriptorCaseSensitive();
|
||||
private ComparatorAVMNodeDescriptorCaseSensitive AVM_DESCRIPTOR_CASE_SENSITIVE = new ComparatorAVMNodeDescriptorCaseSensitive();
|
||||
|
||||
/**
|
||||
* deployDirectoryPush (FSR only)
|
||||
*
|
||||
@@ -1195,10 +1217,18 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
List<Exception> errors,
|
||||
Lock lock)
|
||||
{
|
||||
Map<String, AVMNodeDescriptor> srcListing = fAVMService.getDirectoryListing(version, srcPath);
|
||||
List<FileDescriptor> dstListing = service.getListing(ticket, dstPath);
|
||||
Iterator<AVMNodeDescriptor> srcIter = srcListing.values().iterator();
|
||||
Map<String, AVMNodeDescriptor> rawSrcListing = fAVMService.getDirectoryListing(version, srcPath);
|
||||
List<FileDescriptor> rawDstListing = service.getListing(ticket, dstPath);
|
||||
|
||||
// Need to change from case insensitive order to case sensitive order
|
||||
TreeSet<FileDescriptor> dstListing = new TreeSet<FileDescriptor>(FILE_DESCRIPTOR_CASE_SENSITIVE);
|
||||
dstListing.addAll(rawDstListing);
|
||||
|
||||
TreeSet<AVMNodeDescriptor> srcListing = new TreeSet<AVMNodeDescriptor>(AVM_DESCRIPTOR_CASE_SENSITIVE);
|
||||
srcListing.addAll(rawSrcListing.values());
|
||||
|
||||
Iterator<FileDescriptor> dstIter = dstListing.iterator();
|
||||
Iterator<AVMNodeDescriptor> srcIter = srcListing.iterator();
|
||||
|
||||
lock.refreshLock();
|
||||
|
||||
@@ -1260,7 +1290,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
}
|
||||
|
||||
// Here with src and dst containing something
|
||||
int diff = src.getName().compareToIgnoreCase(dst.getName());
|
||||
int diff = src.getName().compareTo(dst.getName());
|
||||
if (diff < 0)
|
||||
{
|
||||
// src is less than dst - must be new content in src
|
||||
@@ -1626,6 +1656,8 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This thread processes the send queue
|
||||
* @author mrogers
|
||||
|
@@ -355,6 +355,59 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for ETWOTWO-1236
|
||||
* 1. create a file in a Web Project called "CamelCase.txt"
|
||||
* 2. submit the file to staging
|
||||
* 3. deploy it to an FSR, ideally on a *nix OS (the issues are more severe on *nix than on Windows)
|
||||
* 4. rename the file to "cAMELcASE.TXT"
|
||||
* 5. submit the change to staging
|
||||
* 6. deploy it to the same FSR
|
||||
*/
|
||||
|
||||
public void testCaseSensitivity() throws Exception
|
||||
{
|
||||
DeploymentReport report = new DeploymentReport();
|
||||
List<DeploymentCallback> callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
/**
|
||||
* Deploy CamelCase.txt
|
||||
*/
|
||||
fService.createFile("main:/", "CamelCase.txt").close();
|
||||
service.deployDifferenceFS(-1, "main:/", "default", "localhost", 44100, TEST_USER, TEST_PASSWORD, TEST_TARGET, null, false, false, false, callbacks);
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
System.out.println(event);
|
||||
}
|
||||
Set<DeploymentEvent> firstDeployment = new HashSet<DeploymentEvent>();
|
||||
firstDeployment.addAll(report.getEvents());
|
||||
assertTrue("Create missing: /CamelCase.txt", firstDeployment.contains(new DeploymentEvent(DeploymentEvent.Type.CREATED, null, "/CamelCase.txt")));
|
||||
|
||||
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
//fService.rename("main:/", "CamelCase.txt", "main:/", "cAMELcASE.TXT");
|
||||
fService.removeNode("main:/", "CamelCase.txt");
|
||||
fService.createFile("main:/", "cAMELcASE.TXT").close();
|
||||
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "default", "localhost", 44100, TEST_USER, TEST_PASSWORD, TEST_TARGET, null, false, false, false, callbacks);
|
||||
Set<DeploymentEvent> secondDeployment = new HashSet<DeploymentEvent>();
|
||||
secondDeployment.addAll(report.getEvents());
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
System.out.println(event);
|
||||
}
|
||||
|
||||
assertTrue("delete missing: /CamelCase.txt", secondDeployment.contains(new DeploymentEvent(DeploymentEvent.Type.DELETED, null, "/CamelCase.txt")));
|
||||
assertTrue("Create missing: /cAMELcASE.TXT", secondDeployment.contains(new DeploymentEvent(DeploymentEvent.Type.CREATED, null, "/cAMELcASE.TXT")));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -496,9 +549,14 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
assertTrue("big update no start", bigUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.START, null, TEST_TARGET)));
|
||||
assertTrue("big update no finish", bigUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.END, null, TEST_TARGET)));
|
||||
assertTrue("big update too small", bigUpdate.size() > 100);
|
||||
assertTrue("Update missing /avm/AVMServiceTest.java", bigUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.CREATED, null, "/avm/AVMServiceTest.java")));
|
||||
|
||||
/**
|
||||
* Now do a smaller update and check that just a few files update
|
||||
* Start
|
||||
* Delete /avm/hibernate
|
||||
* Update /avm/AVMServiceTest.java
|
||||
* End
|
||||
*/
|
||||
fService.removeNode("main:/avm/hibernate");
|
||||
fService.getFileOutputStream("main:/avm/AVMServiceTest.java").close();
|
||||
@@ -513,8 +571,8 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
{
|
||||
System.out.println(event);
|
||||
}
|
||||
assertEquals(4, smallUpdate.size());
|
||||
|
||||
assertEquals(4, smallUpdate.size());
|
||||
assertTrue("Start missing", smallUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.START, null, TEST_TARGET)));
|
||||
assertTrue("End missing", smallUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.DELETED, null, "/avm/hibernate")));
|
||||
assertTrue("Update missing", smallUpdate.contains(new DeploymentEvent(DeploymentEvent.Type.UPDATED, null, "/avm/AVMServiceTest.java")));
|
||||
|
@@ -450,9 +450,9 @@ public class AVMNodeDescriptor implements Serializable
|
||||
switch (fType)
|
||||
{
|
||||
case AVMNodeType.PLAIN_FILE :
|
||||
return "[PF:" + fID + "]";
|
||||
return "[PF:" + fID + ":" + fName + ": FILE]";
|
||||
case AVMNodeType.PLAIN_DIRECTORY :
|
||||
return "[PD:" + fID + "]";
|
||||
return "[PF:" + fID + ":" + fName + ": DIR]";
|
||||
case AVMNodeType.LAYERED_FILE :
|
||||
return "[LF:" + fID + ":" + fIndirection + "]";
|
||||
case AVMNodeType.LAYERED_DIRECTORY :
|
||||
|
Reference in New Issue
Block a user