Merged V2.2 to HEAD

7653: Update and added deployment icons
   7655: Fixed multithreaded test case to handle case where threads can't get started due to lack of available DB connections.
   7657: AR-1903: Text attachments should be treated the same way as other attachments.
   7661: Fixed duplicate index creation for column that is also declared unique
   7662: Additional indexes related to permissions
   7664: Fixed query for specific property types
   7667: Used existing attachable aspect for email attachments - effectively reversing association direction.
   7682: Added AVM Console page to webapp (admin user protected)
   7683: Merged V2.1 to V2.2
      7642: Fix for WCM-949
      7668: Debugging output for getAPath(). Possible partial fix for LazyInitialization errors seen by some customers
      7672: Fixed sub optimal tree pruning in filesystem deployment


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8442 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-06 21:28:43 +00:00
parent ab80624ce0
commit ecb74c1447
19 changed files with 215 additions and 79 deletions

View File

@@ -26,13 +26,16 @@ package org.alfresco.repo.avm;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import org.alfresco.repo.remote.ClientTicketHolder;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.util.Pair;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import junit.framework.TestCase;
@@ -47,22 +50,22 @@ public class AVMTestRemote extends TestCase
* The AVMRemote.
*/
private AVMRemote fAVMRemote;
/**
* The Sync service.
*/
private AVMSyncService fAVMSync;
/**
* The Authentication Service.
*/
private AuthenticationService fAuthService;
/**
* The application context.
*/
private FileSystemXmlApplicationContext fContext;
@Override
protected void setUp() throws Exception
{
@@ -85,7 +88,19 @@ public class AVMTestRemote extends TestCase
}
fContext.close();
}
public void testGetAPath()
throws Exception
{
fAVMRemote.createStore("test2932");
fAVMRemote.createDirectory("test2932:/", "a");
fAVMRemote.createFile("test2932:/a", "foo.txt").close();
AVMNodeDescriptor found = fAVMRemote.lookup(-1, "test2932:/a/foo.txt");
Pair<Integer, String> path = fAVMRemote.getAPath(found);
assertEquals(path.getSecond(), "test2932:/a/foo.txt");
explorePaths("foo--admin:/");
}
/**
* Do a simple hello world test.
*/
@@ -105,7 +120,23 @@ public class AVMTestRemote extends TestCase
fail();
}
}
public void explorePaths(String path)
throws Exception
{
Map<String, AVMNodeDescriptor> listing = fAVMRemote.getDirectoryListing(-1, path);
for (Map.Entry<String, AVMNodeDescriptor> entry : listing.entrySet())
{
Pair<Integer, String> childPath = fAVMRemote.getAPath(entry.getValue());
System.out.println(childPath);
if (entry.getValue().isDirectory())
{
explorePaths(entry.getValue().getPath());
}
}
}
/**
* Test reading and writing.
*/
@@ -118,7 +149,7 @@ public class AVMTestRemote extends TestCase
// Create a directory.
fAVMRemote.createDirectory("test2933:/", "a");
// Write out a file.
OutputStream out =
OutputStream out =
fAVMRemote.createFile("test2933:/a", "foo.txt");
byte [] buff = "This is a plain old text file.\n".getBytes();
out.write(buff);
@@ -126,7 +157,7 @@ public class AVMTestRemote extends TestCase
out.write(buff);
out.close();
// Read back that file.
InputStream in =
InputStream in =
fAVMRemote.getFileInputStream(-1, "test2933:/a/foo.txt");
buff = new byte[1024];
assertEquals(49, in.read(buff));
@@ -171,7 +202,7 @@ public class AVMTestRemote extends TestCase
fail();
}
}
/**
* Test a call that should return null;
*/
@@ -187,7 +218,7 @@ public class AVMTestRemote extends TestCase
fail();
}
}
/**
* Test the sync service.
*/