mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
42804: Merged BRANCHES/DEV/BELARUS/V4.1-BUG-FIX-2012_10_17 to BRANCHES/DEV/V4.1-BUG-FIX: 42748: ALF-14200: Adding Invalid Aspects Via CMIS ATOM API Results in NullPointerException 42810: Fix for ALF-15276 - sys:locale Attribute No Longer Available From jsnode 42814: ALF-15276 - small improvement to remove duplicated data from response 42824: ALF-15048: Merged PATCHES/V4.0.2 to V4.1-BUG-FIX 42724: ALF-16048: CLONE - Version history doesn't go beyond two versions (0.1 and 0.2) when dragged and dropped via CIFS from Mac Lion OSx 42739: ALF-16048: New files missing from previous check in 42742: ALF-16048: Another missing file. 42839: ALF-16417: Fix "Hybrid Sync - can retain invalid cloud tickets in a local cache" - retry once for invalid auth - also externalise the implicit/default cache config 42849: NodeDAO: Added new method to retrieve specific store ID - public Pair<Long, StoreRef> getStore(StoreRef storeRef); 42857: Merged DEV to V4.1-BUG-FIX 42821: ALF-13506 : WCMQS Example Application Caching Causes Changes to Inconsistently Appear on the Editorial Web Site Concurrency was improved for AssetImpl class. The returned values of the collections were made unmodifiable in the classes which implement Resource interface. 42872: ALF-15601: "Performance issue using CMIS method getChildren() - gets version history" - avoids getting the version history (an expensive operation) if possible i.e. in the case of current version (live) nodes like for getChildren 42900: Merged DEV to V4.1-BUG-FIX 42734: ALF-15335 : 'external' authentication subsystem debug information too scarce Extended debug information in the authentication subsystem. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -5256,6 +5256,182 @@ public class ContentDiskDriverTest extends TestCase
|
||||
|
||||
} // testScenarioMSMacWord20011SaveWithBackup save
|
||||
|
||||
|
||||
/**
|
||||
* Simulates a Mac Lion Drag and Drop
|
||||
* 0. ALF-15158.diff already exists and is versionable
|
||||
* 1. Delete ALF-15158.diff
|
||||
* 2. Create new document ALF-15158.diff
|
||||
*/
|
||||
public void testMacDragAndDrop() throws Exception
|
||||
{
|
||||
logger.debug("testMacDragAndDrop(");
|
||||
|
||||
final String FILE_NAME = "ALF-15158.diff";
|
||||
|
||||
class TestContext
|
||||
{
|
||||
NetworkFile firstFileHandle;
|
||||
NodeRef file1NodeRef;
|
||||
};
|
||||
|
||||
final String TEST_DIR = TEST_ROOT_DOS_PATH + "\\MacDragAndDrop";
|
||||
|
||||
ServerConfiguration scfg = new ServerConfiguration("testServer");
|
||||
TestServer testServer = new TestServer("testServer", scfg);
|
||||
final SrvSession testSession = new TestSrvSession(666, testServer, "cifs", "remoteName");
|
||||
DiskSharedDevice share = getDiskSharedDevice();
|
||||
final TreeConnection testConnection = testServer.getTreeConnection(share);
|
||||
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
|
||||
|
||||
/**
|
||||
* Clean up just in case garbage is left from a previous run
|
||||
*/
|
||||
RetryingTransactionCallback<Void> deleteGarbageFileCB = new RetryingTransactionCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
driver.deleteFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NAME);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a file in the test directory
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
logger.debug("expect to get exception - cleaning garbage");
|
||||
tran.doInTransaction(deleteGarbageFileCB);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// expect to go here
|
||||
}
|
||||
|
||||
logger.debug("0) create new file");
|
||||
RetryingTransactionCallback<TestContext> createFileCB = new RetryingTransactionCallback<TestContext>() {
|
||||
@Override
|
||||
public TestContext execute() throws Throwable
|
||||
{
|
||||
|
||||
TestContext ctx = new TestContext();
|
||||
/**
|
||||
* Create the test directory we are going to use
|
||||
*/
|
||||
FileOpenParams createRootDirParams = new FileOpenParams(TEST_ROOT_DOS_PATH, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
|
||||
FileOpenParams createDirParams = new FileOpenParams(TEST_DIR, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
|
||||
driver.createDirectory(testSession, testConnection, createRootDirParams);
|
||||
driver.createDirectory(testSession, testConnection, createDirParams);
|
||||
|
||||
/**
|
||||
* Create the file we are going to use (FileA.pptx)
|
||||
*/
|
||||
FileOpenParams createFileParams = new FileOpenParams(TEST_DIR + "\\" + FILE_NAME, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
|
||||
ctx.firstFileHandle = driver.createFile(testSession, testConnection, createFileParams);
|
||||
assertNotNull(ctx.firstFileHandle);
|
||||
|
||||
driver.closeFile(testSession, testConnection, ctx.firstFileHandle);
|
||||
|
||||
ctx.file1NodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME);
|
||||
nodeService.addAspect(ctx.file1NodeRef, ContentModel.ASPECT_VERSIONABLE, null);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
};
|
||||
final TestContext testContext = tran.doInTransaction(createFileCB, false, true);
|
||||
|
||||
/**
|
||||
* 1) delete the old file
|
||||
*/
|
||||
logger.debug("1) delete old file");
|
||||
RetryingTransactionCallback<Void> renameOldFileCB = new RetryingTransactionCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
driver.deleteFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NAME);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
tran.doInTransaction(renameOldFileCB, false, true);
|
||||
|
||||
|
||||
/**
|
||||
* 2) CreateNewFile and write some new content
|
||||
*
|
||||
*/
|
||||
logger.debug("2) write some content");
|
||||
RetryingTransactionCallback<Void> restoreFileCB = new RetryingTransactionCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
FileOpenParams createFileParams = new FileOpenParams(TEST_DIR + "\\" + FILE_NAME, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
|
||||
testContext.firstFileHandle = driver.createFile(testSession, testConnection, createFileParams);
|
||||
|
||||
ClassPathResource fileResource = new ClassPathResource("filesys/ContentDiskDriverTest3.doc");
|
||||
assertNotNull("unable to find test resource filesys/ContentDiskDriverTest3.doc", fileResource);
|
||||
|
||||
byte[] buffer= new byte[1000];
|
||||
InputStream is = fileResource.getInputStream();
|
||||
try
|
||||
{
|
||||
long offset = 0;
|
||||
int i = is.read(buffer, 0, buffer.length);
|
||||
while(i > 0)
|
||||
{
|
||||
testContext.firstFileHandle.writeFile(buffer, i, 0, offset);
|
||||
offset += i;
|
||||
i = is.read(buffer, 0, buffer.length);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
|
||||
driver.closeFile(testSession, testConnection, testContext.firstFileHandle);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
tran.doInTransaction(restoreFileCB, false, true);
|
||||
|
||||
|
||||
logger.debug("3) validate results");
|
||||
/**
|
||||
* Now validate everything is correct
|
||||
*/
|
||||
RetryingTransactionCallback<Void> validateCB = new RetryingTransactionCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
NodeRef shuffledNodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME);
|
||||
|
||||
Map<QName, Serializable> props = nodeService.getProperties(shuffledNodeRef);
|
||||
|
||||
ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT);
|
||||
assertNotNull("data is null", data);
|
||||
assertEquals("size is wrong", 26112, data.getSize());
|
||||
assertEquals("mimeType is wrong", "application/msword",data.getMimetype());
|
||||
|
||||
assertTrue("versionable aspect missing", nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_VERSIONABLE));
|
||||
assertTrue("hidden aspect still applied", !nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_HIDDEN));
|
||||
assertTrue("temporary aspect still applied", !nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_TEMPORARY));
|
||||
|
||||
assertEquals("Node ref has changed", shuffledNodeRef, testContext.file1NodeRef);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
tran.doInTransaction(validateCB, true, true);
|
||||
|
||||
} // testMacDragAndDrop
|
||||
|
||||
/**
|
||||
* Test server
|
||||
*/
|
||||
|
Reference in New Issue
Block a user