mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
WCM Services - "sandbox service" - cleanup (for consistency)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12174 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -154,7 +154,7 @@ public final class AVM extends BaseScopableProcessorExtension
|
||||
SandboxService sbService = this.services.getSandboxService();
|
||||
|
||||
// get modified items - not including deleted
|
||||
List<AVMNodeDescriptor> nodes = sbService.listChangedItemsWebApp(storeId, webapp, false);
|
||||
List<AVMNodeDescriptor> nodes = sbService.listChangedWebApp(storeId, webapp, false);
|
||||
|
||||
List<AVMNode> items = new ArrayList<AVMNode>(nodes.size());
|
||||
|
||||
|
@@ -144,7 +144,7 @@ public class AVM extends BaseTemplateProcessorExtension
|
||||
SandboxService sbService = this.services.getSandboxService();
|
||||
|
||||
// get modified items - not including deleted
|
||||
List<AVMNodeDescriptor> nodes = sbService.listChangedItemsWebApp(storeId, webapp, false);
|
||||
List<AVMNodeDescriptor> nodes = sbService.listChangedWebApp(storeId, webapp, false);
|
||||
|
||||
List<AVMTemplateNode> items = new ArrayList<AVMTemplateNode>(nodes.size());
|
||||
|
||||
|
@@ -60,15 +60,10 @@ public interface SandboxInfo
|
||||
public String getCreator();
|
||||
|
||||
/**
|
||||
* The sandbox root relative path - eg. for WCM, typically /www
|
||||
* The sandbox root relative path - eg. for WCM web project with webapps, typically /www/avm_webapps
|
||||
*/
|
||||
public String getSandboxRootPath();
|
||||
|
||||
/**
|
||||
* The webapps root relative path - eg. for WCM, typically /www/avm_webapps
|
||||
*/
|
||||
public String getWebAppsPath();
|
||||
|
||||
/**
|
||||
* A list of ids of the stores within this sandbox.
|
||||
* The "main" store should come first in this list;
|
||||
|
@@ -85,11 +85,6 @@ public class SandboxInfoImpl implements SandboxInfo
|
||||
}
|
||||
|
||||
public String getSandboxRootPath()
|
||||
{
|
||||
return "/"+JNDIConstants.DIR_DEFAULT_WWW;
|
||||
}
|
||||
|
||||
public String getWebAppsPath()
|
||||
{
|
||||
return JNDIConstants.DIR_DEFAULT_WWW_APPBASE;
|
||||
}
|
||||
|
@@ -148,56 +148,56 @@ public interface SandboxService
|
||||
public void deleteSandbox(String sbStoreId);
|
||||
|
||||
/**
|
||||
* List changed items for given sandbox (eg. for user sandbox compared to staging sandbox)
|
||||
* List all changed assets for given sandbox (eg. for user sandbox compared to staging sandbox)
|
||||
* <p>
|
||||
* Note: This will list new/modified/deleted items from the root directory and below, including all web apps
|
||||
* Note: This will list all new/modified/deleted assets from the sandbox root directory (eg. /www/avm_webapps) - ie. across all web apps
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param includeDeleted if true, include deleted items as well as new/modified items
|
||||
* @return List<AVMNodeDescriptor> list of changed items
|
||||
* @param includeDeleted if true, include deleted assets as well as new/modified assets
|
||||
* @return List<AVMNodeDescriptor> list of all changed assets
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItems(String sbStoreId, boolean includeDeleted);
|
||||
public List<AVMNodeDescriptor> listChangedAll(String sbStoreId, boolean includeDeleted);
|
||||
|
||||
/**
|
||||
* List changed items for given sandbox and web app (eg. in user sandbox)
|
||||
* List changed assets for given sandbox and web app (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will list new/modified/deleted items for the given web app
|
||||
* Note: This will list new/modified/deleted assets for the given web app
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param webApp web app to filter by
|
||||
* @param includeDeleted if true, include deleted items as well as new/modified items
|
||||
* @return List<AVMNodeDescriptor> list of changed items
|
||||
* @param includeDeleted if true, include deleted assets as well as new/modified assets
|
||||
* @return List<AVMNodeDescriptor> list of changed assets
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItemsWebApp(String sbStoreId, String webApp, boolean includeDeleted);
|
||||
public List<AVMNodeDescriptor> listChangedWebApp(String sbStoreId, String webApp, boolean includeDeleted);
|
||||
|
||||
/**
|
||||
* List changed items for given sandbox path (eg. between user sandbox and staging sandbox)
|
||||
* List changed assets for given sandbox path (eg. between user sandbox and staging sandbox)
|
||||
* <p>
|
||||
* Note: This will list new/modified/deleted items from the directory and below. The destination path will be dervied.
|
||||
* Note: This will list new/modified/deleted assets from the directory and below. The destination path will be dervied.
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param relativePath relative path to filter by (eg. /www/avm_webapps/ROOT/MyFolderToList)
|
||||
* @param includeDeleted if true, include deleted items as well as new/modified items
|
||||
* @return List<AVMNodeDescriptor> list of changed items
|
||||
* @param includeDeleted if true, include deleted assets as well as new/modified assets
|
||||
* @return List<AVMNodeDescriptor> list of changed assets
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItemsDir(String sbStoreId, String relativePath, boolean includeDeleted);
|
||||
public List<AVMNodeDescriptor> listChanged(String sbStoreId, String relativePath, boolean includeDeleted);
|
||||
|
||||
/**
|
||||
* List changed (new/modified/deleted) items between any two sandbox paths
|
||||
* List changed (new/modified/deleted) assets between any two sandbox paths
|
||||
*
|
||||
* @param srcSandboxStoreId source sandbox store id
|
||||
* @param srcRelativePath source relative path to filter by (eg. /www/avm_webapps/ROOT/MyFolderToList)
|
||||
* @param dstSandboxStoreId destination sandbox store id
|
||||
* @param dstRelativePath destination relative path to filter by (eg. /www/avm_webapps/ROOT/MyFolderToList)
|
||||
* @param includeDeleted if true, include deleted items as well as new/modified items
|
||||
* @return List<AVMNodeDescriptor> list of changed items
|
||||
* @param includeDeleted if true, include deleted assets as well as new/modified assets
|
||||
* @return List<AVMNodeDescriptor> list of changed assets
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItems(String srcSandboxStoreId, String srcRelativePath, String dstSandboxStoreId, String dstRelativePath, boolean includeDeleted);
|
||||
public List<AVMNodeDescriptor> listChanged(String srcSandboxStoreId, String srcRelativePath, String dstSandboxStoreId, String dstRelativePath, boolean includeDeleted);
|
||||
|
||||
/**
|
||||
* Submit all changed items for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
* Submit all changed assets for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
* <p>
|
||||
* Note: This will submit new/modified/deleted items from the sandbox root directory (eg. /www) and below, including all web apps
|
||||
* Note: This will submit all new/modified/deleted assets from the sandbox root directory (eg. /www/avm_webapps) - ie. across all web apps
|
||||
* <p>
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param submitLabel label for submitted snapshot
|
||||
@@ -206,95 +206,103 @@ public interface SandboxService
|
||||
public void submitAll(String sbStoreId, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Submit all changed items for given sandbox and web app (eg. in user sandbox)
|
||||
* Submit changed assets for given sandbox and web app (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will submit new/modified/deleted items for the given web app
|
||||
* Note: This will submit new/modified/deleted assets for the given web app
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param webApp web app to filter by
|
||||
* @param submitLabel label for submitted snapshot
|
||||
* @param submitComment comment for submitted snapshot
|
||||
*/
|
||||
public void submitAllWebApp(String sbStoreId, String webApp, String submitLabel, String submitComment);
|
||||
public void submitWebApp(String sbStoreId, String webApp, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Submit all changed items for given sandbox path (eg. in user sandbox)
|
||||
* Submit changed asset(s) for given sandbox path (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will submit new/modified/deleted items from the directory and below
|
||||
* Note: This will submit new/modified/deleted asset(s) for given path (either file or directory and below)
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param relativePath relative path to filter by (eg. /www/avm_webapps/ROOT/MyFolderToRevert)
|
||||
* @param relativePath relative path to filter by (eg. /www/avm_webapps or /www/avm_webapps/ROOT/MyFolderToSubmit)
|
||||
* @param submitLabel label for submitted snapshot
|
||||
* @param submitComment comment for submitted snapshot
|
||||
*/
|
||||
public void submitAllDir(String sbStoreId, String relativePath, String submitLabel, String submitComment);
|
||||
public void submit(String sbStoreId, String relativePath, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Submit list of changed items for given sandbox path (eg. in user sandbox)
|
||||
* Submit list of changed assets for given sandbox (eg. in user sandbox)
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param itemPaths list of items, as relative paths (eg. /www/avm_webapps/ROOT/MyFolderToRevert)
|
||||
* @param assetPaths list of assets, as relative paths (eg. /www/avm_webapps/ROOT/MyFolderToSubmit)
|
||||
* @param submitLabel label for submitted snapshot
|
||||
* @param submitComment comment for submitted snapshot
|
||||
*/
|
||||
public void submitList(String sbStoreId, List<String> relativePaths, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Submit list of changed items for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
* Submit list of changed assets for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param itemNodes list of items, as AVM node descriptors
|
||||
* @param assetNodes list of assets, as AVM node descriptors
|
||||
* @param submitLabel label for submitted snapshot
|
||||
* @param submitComment comment for submitted snapshot
|
||||
*/
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> items, String submitLabel, String submitComment);
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> assets, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Submit list of changed items for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
* Submit list of changed assets for given sandbox (eg. from user sandbox to staging sandbox)
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param items list of items, as AVM node descriptors
|
||||
* @param expirationDates map of <path, date> for those items set with an expiration date, or can be null (if no expiration dates)
|
||||
* @param assets list of assets, as AVM node descriptors
|
||||
* @param expirationDates map of <path, date> for those assets set with an expiration date, or can be null (if no expiration dates)
|
||||
* @param submitLabel label for submitted snapshot
|
||||
* @param submitComment comment for submitted snapshot
|
||||
*/
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> items, Map<String, Date> expirationDates, String submitLabel, String submitComment);
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> assets, Map<String, Date> expirationDates, String submitLabel, String submitComment);
|
||||
|
||||
/**
|
||||
* Revert all changed items for given sandbox (eg. in user sandbox)
|
||||
* Revert all changed assets for given sandbox (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will revert new/modified/deleted items from the sandbox root directory (eg. /www) and below, including all web apps
|
||||
* Note: This will revert all new/modified/deleted assets from the sandbox store root directory (eg. /www/avm_webapps) - ie. across all web apps
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
*/
|
||||
public void revertAll(String sbStoreId);
|
||||
|
||||
/**
|
||||
* Revert all changed items for given sandbox and web app (eg. in user sandbox)
|
||||
* Revert changed assets for given sandbox and web app (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will revert new/modified/deleted items for the given web app
|
||||
* Note: This will revert new/modified/deleted assets for the given web app
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param webApp web app to filter by
|
||||
*/
|
||||
public void revertAllWebApp(String sbStoreId, String webApp);
|
||||
public void revertWebApp(String sbStoreId, String webApp);
|
||||
|
||||
/**
|
||||
* Revert all changed items for given sandbox path (eg. in user sandbox)
|
||||
* Revert changed asset(s) for given sandbox path (eg. in user sandbox)
|
||||
* <p>
|
||||
* Note: This will revert new/modified/deleted items from the directory and below
|
||||
* Note: This will revert new/modified/deleted asset(s) for given path (either file or directory and below)
|
||||
*
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param relativePath relative path to filter by (eg. /www/avm_webapps/ROOT/MyFolderToRevert)
|
||||
*/
|
||||
public void revertAllDir(String sbStoreId, String relativePath);
|
||||
public void revert(String sbStoreId, String relativePath);
|
||||
|
||||
/**
|
||||
* Revert list of changed items for given sandbox (eg. in user sandbox)
|
||||
* Revert list of changed assets for given sandbox (eg. in user sandbox)
|
||||
*
|
||||
* @param items list of AVM node descriptors
|
||||
* @param sbStoreId sandbox store id
|
||||
* @param assetPaths list of assets, as relative paths (eg. /www/avm_webapps/ROOT/MyFolderToRevert)
|
||||
*/
|
||||
public void revertListNodes(String sbStoreId, List<AVMNodeDescriptor> items);
|
||||
public void revertList(String sbStoreId, List<String> relativePaths);
|
||||
|
||||
/**
|
||||
* Revert list of changed assets for given sandbox (eg. in user sandbox)
|
||||
*
|
||||
* @param assets list of AVM node descriptors
|
||||
*/
|
||||
public void revertListNodes(String sbStoreId, List<AVMNodeDescriptor> assets);
|
||||
|
||||
/**
|
||||
* Revert sandbox to a specific snapshot version ID (ie. for staging sandbox)
|
||||
|
@@ -348,33 +348,33 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedItems(java.lang.String, boolean)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedAll(java.lang.String, boolean)
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItems(String sbStoreId, boolean includeDeleted)
|
||||
public List<AVMNodeDescriptor> listChangedAll(String sbStoreId, boolean includeDeleted)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
String avmDirectoryPath = WCMUtil.buildStoreRootPath(sbStoreId); // currently <sbStoreId>:/www
|
||||
return listChangedItemsDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), includeDeleted);
|
||||
String avmDirectoryPath = WCMUtil.buildSandboxRootPath(sbStoreId); // currently <sbStoreId>:/www/avm_webapps
|
||||
return listChanged(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), includeDeleted);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedItemsWebApp(java.lang.String, java.lang.String, boolean)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedWebApp(java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItemsWebApp(String sbStoreId, String webApp, boolean includeDeleted)
|
||||
public List<AVMNodeDescriptor> listChangedWebApp(String sbStoreId, String webApp, boolean includeDeleted)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("webApp", webApp);
|
||||
|
||||
// filter by current webapp
|
||||
String avmDirectoryPath = WCMUtil.buildStoreWebappPath(sbStoreId, webApp);
|
||||
return listChangedItemsDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), includeDeleted);
|
||||
return listChanged(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), includeDeleted);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedItemsDir(java.lang.String, java.lang.String, boolean)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChanged(java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItemsDir(String sbStoreId, String relativePath, boolean includeDeleted)
|
||||
public List<AVMNodeDescriptor> listChanged(String sbStoreId, String relativePath, boolean includeDeleted)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("relativePath", relativePath);
|
||||
@@ -389,13 +389,13 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
|
||||
String stagingSandboxId = WCMUtil.buildStagingStoreName(wpStoreId);
|
||||
|
||||
return listChangedItems(sbStoreId, relativePath, stagingSandboxId, relativePath, includeDeleted);
|
||||
return listChanged(sbStoreId, relativePath, stagingSandboxId, relativePath, includeDeleted);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChangedItems(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#listChanged(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
|
||||
*/
|
||||
public List<AVMNodeDescriptor> listChangedItems(String srcSandboxStoreId, String srcRelativePath, String dstSandboxStoreId, String dstRelativePath, boolean includeDeleted)
|
||||
public List<AVMNodeDescriptor> listChanged(String srcSandboxStoreId, String srcRelativePath, String dstSandboxStoreId, String dstRelativePath, boolean includeDeleted)
|
||||
{
|
||||
ParameterCheck.mandatoryString("srcSandboxStoreId", srcSandboxStoreId);
|
||||
ParameterCheck.mandatoryString("srcRelativePath", srcRelativePath);
|
||||
@@ -406,16 +406,16 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
String avmSrcPath = srcSandboxStoreId + AVM_STORE_SEPARATOR + srcRelativePath;
|
||||
String avmDstPath = dstSandboxStoreId + AVM_STORE_SEPARATOR + dstRelativePath;
|
||||
|
||||
return listChangedItems(-1, avmSrcPath, -1, avmDstPath, includeDeleted);
|
||||
return listChanged(-1, avmSrcPath, -1, avmDstPath, includeDeleted);
|
||||
}
|
||||
|
||||
private List<AVMNodeDescriptor> listChangedItems(int srcVersion, String srcPath, int dstVersion, String dstPath, boolean includeDeleted)
|
||||
private List<AVMNodeDescriptor> listChanged(int srcVersion, String srcPath, int dstVersion, String dstPath, boolean includeDeleted)
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
List<AVMDifference> diffs = avmSyncService.compare(srcVersion, srcPath, dstVersion, dstPath, nameMatcher);
|
||||
|
||||
List<AVMNodeDescriptor> items = new ArrayList<AVMNodeDescriptor>(diffs.size());
|
||||
List<AVMNodeDescriptor> assets = new ArrayList<AVMNodeDescriptor>(diffs.size());
|
||||
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
@@ -424,16 +424,16 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
AVMNodeDescriptor node = avmService.lookup(-1, sourcePath, includeDeleted);
|
||||
if (node != null)
|
||||
{
|
||||
items.add(node);
|
||||
assets.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("listModifiedItems: "+items.size()+" items in "+(System.currentTimeMillis()-start)+" ms (between "+srcVersion+","+srcPath+" and "+dstVersion+","+dstPath);
|
||||
logger.trace("listChanged: "+assets.size()+" assets in "+(System.currentTimeMillis()-start)+" ms (between "+srcVersion+","+srcPath+" and "+dstVersion+","+dstPath);
|
||||
}
|
||||
|
||||
return items;
|
||||
return assets;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -443,40 +443,43 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
String avmDirectoryPath = WCMUtil.buildStoreRootPath(sbStoreId); // currently <sbStoreId>:/www
|
||||
submitAllDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), submitLabel, submitComment);
|
||||
String avmDirectoryPath = WCMUtil.buildSandboxRootPath(sbStoreId); // currently <sbStoreId>:/www/avm_webapps
|
||||
submit(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitAllWebApp(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitWebApp(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void submitAllWebApp(String sbStoreId, String webApp, String submitLabel, String submitComment)
|
||||
public void submitWebApp(String sbStoreId, String webApp, String submitLabel, String submitComment)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("webApp", webApp);
|
||||
|
||||
String avmDirectoryPath = WCMUtil.buildStoreWebappPath(sbStoreId, webApp);
|
||||
submitAllDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), submitLabel, submitComment);
|
||||
submit(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath), submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitAllDir(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submit(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void submitAllDir(String sbStoreId, String relativePath, String submitLabel, String submitComment)
|
||||
public void submit(String sbStoreId, String relativePath, String submitLabel, String submitComment)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("relativePath", relativePath);
|
||||
|
||||
List<AVMNodeDescriptor> items = listChangedItemsDir(sbStoreId, relativePath, true);
|
||||
List<AVMNodeDescriptor> assets = listChanged(sbStoreId, relativePath, true);
|
||||
|
||||
submitListNodes(sbStoreId, items, submitLabel, submitComment);
|
||||
submitListNodes(sbStoreId, assets, submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitList(java.lang.String, java.util.List, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void submitList(String sbStoreId, List<String> relativePaths, String submitLabel, String submitComment)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
List<AVMNodeDescriptor> items = new ArrayList<AVMNodeDescriptor>(relativePaths.size());
|
||||
List<AVMNodeDescriptor> assets = new ArrayList<AVMNodeDescriptor>(relativePaths.size());
|
||||
|
||||
for (String relativePath : relativePaths)
|
||||
{
|
||||
@@ -484,27 +487,27 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
AVMNodeDescriptor node = avmService.lookup(-1, sbStoreId + WCMUtil.AVM_STORE_SEPARATOR + relativePath, true);
|
||||
if (node != null)
|
||||
{
|
||||
items.add(node);
|
||||
assets.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
submitListNodes(sbStoreId, items, null, submitLabel, submitComment);
|
||||
submitListNodes(sbStoreId, assets, null, submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitListNodes(java.lang.String, java.util.List, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> items, String submitLabel, String submitComment)
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> assets, String submitLabel, String submitComment)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
submitListNodes(sbStoreId, items, null, submitLabel, submitComment);
|
||||
submitListNodes(sbStoreId, assets, null, submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#submitListNodes(java.lang.String, java.util.List, java.util.Map, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> items, Map<String, Date> expirationDates, final String submitLabel, final String submitComment)
|
||||
public void submitListNodes(String sbStoreId, List<AVMNodeDescriptor> assets, Map<String, Date> expirationDates, final String submitLabel, final String submitComment)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
@@ -516,13 +519,13 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
throw new AlfrescoRuntimeException("Not an author sandbox: "+sbStoreId);
|
||||
}
|
||||
|
||||
// construct diffs for selected items for submission
|
||||
// construct diffs for selected assets for submission
|
||||
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
|
||||
String stagingSandboxId = WCMUtil.buildStagingStoreName(wpStoreId);
|
||||
|
||||
final List<AVMDifference> diffs = new ArrayList<AVMDifference>(items.size());
|
||||
final List<AVMDifference> diffs = new ArrayList<AVMDifference>(assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor item : assets)
|
||||
{
|
||||
String relativePath = WCMUtil.getStoreRelativePath(item.getPath());
|
||||
|
||||
@@ -580,46 +583,68 @@ public class SandboxServiceImpl extends WCMUtil implements SandboxService
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
String avmDirectoryPath = WCMUtil.buildStoreRootPath(sbStoreId); // currently <sbStoreId>:/www
|
||||
revertAllDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath));
|
||||
String avmDirectoryPath = WCMUtil.buildSandboxRootPath(sbStoreId); // currently <sbStoreId>:/www/avm_webapps
|
||||
revert(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertAll(java.lang.String, java.lang.String)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertWebApp(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void revertAllWebApp(String sbStoreId, String webApp)
|
||||
public void revertWebApp(String sbStoreId, String webApp)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("webApp", webApp);
|
||||
|
||||
String avmDirectoryPath = WCMUtil.buildStoreWebappPath(sbStoreId, webApp);
|
||||
revertAllDir(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath));
|
||||
revert(sbStoreId, WCMUtil.getStoreRelativePath(avmDirectoryPath));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertAllDir(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void revertAllDir(String sbStoreId, String relativePath)
|
||||
public void revert(String sbStoreId, String relativePath)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatoryString("relativePath", relativePath);
|
||||
|
||||
List<AVMNodeDescriptor> items = listChangedItemsDir(sbStoreId, relativePath, true);
|
||||
List<AVMNodeDescriptor> assets = listChanged(sbStoreId, relativePath, true);
|
||||
|
||||
revertListNodes(sbStoreId, items);
|
||||
revertListNodes(sbStoreId, assets);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertList(java.lang.String, java.util.List)
|
||||
*/
|
||||
public void revertList(String sbStoreId, List<String> relativePaths)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
List<AVMNodeDescriptor> assets = new ArrayList<AVMNodeDescriptor>(relativePaths.size());
|
||||
|
||||
for (String relativePath : relativePaths)
|
||||
{
|
||||
// convert each path into an AVM node descriptor
|
||||
AVMNodeDescriptor node = avmService.lookup(-1, sbStoreId + WCMUtil.AVM_STORE_SEPARATOR + relativePath, true);
|
||||
if (node != null)
|
||||
{
|
||||
assets.add(node);
|
||||
}
|
||||
}
|
||||
|
||||
revertListNodes(sbStoreId, assets);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertListNodes(java.lang.String, java.util.List)
|
||||
*/
|
||||
public void revertListNodes(String sbStoreId, List<AVMNodeDescriptor> items)
|
||||
public void revertListNodes(String sbStoreId, List<AVMNodeDescriptor> assets)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>(items.size());
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>(assets.size());
|
||||
|
||||
List<WorkflowTask> tasks = null;
|
||||
for (AVMNodeDescriptor node : items)
|
||||
for (AVMNodeDescriptor node : assets)
|
||||
{
|
||||
if (tasks == null)
|
||||
{
|
||||
|
@@ -485,7 +485,7 @@ public class SandboxServiceImplTest extends TestCase
|
||||
assertEquals(2, sbService.listSandboxes(wpStoreId).size());
|
||||
}
|
||||
|
||||
// list changed (in this test, new) items in user sandbox compared to staging sandbox
|
||||
// list changed (in this test, new) assets in user sandbox compared to staging sandbox
|
||||
public void testListNewItems1()
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-listNewItems1", TEST_WEBPROJ_NAME+" listNewItems1", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
@@ -493,6 +493,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
|
||||
assertEquals(2, sbService.listSandboxes(wpStoreId).size());
|
||||
|
||||
// add web app (in addition to default ROOT web app)
|
||||
String myWebApp = "myWebApp";
|
||||
wpService.createWebApp(wpStoreId, myWebApp, "this is my web app");
|
||||
|
||||
// Invite web users
|
||||
wpService.inviteWebUser(wpStoreId, USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR);
|
||||
sbService.createAuthorSandbox(wpStoreId, USER_ONE);
|
||||
@@ -504,79 +508,79 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String sbStoreId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(sbStoreId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(sbStoreId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxRootRelativePath = sbInfo.getSandboxRootPath();
|
||||
String authorSandboxWebAppRelativePath = sbInfo.getWebAppsPath() + "/" + wpInfo.getDefaultWebApp();
|
||||
String authorSandboxMyWebAppRelativePath = sbInfo.getSandboxRootPath() + "/" + myWebApp; // in this case, my web app is 'myWebApp'
|
||||
String authorSandboxMyWebAppPath = sbStoreId + AVM_STORE_SEPARATOR + authorSandboxMyWebAppRelativePath;
|
||||
|
||||
String authorSandboxRootPath = sbStoreId + AVM_STORE_SEPARATOR + authorSandboxRootRelativePath;
|
||||
String authorSandboxWebAppPath = sbStoreId + AVM_STORE_SEPARATOR + authorSandboxWebAppRelativePath;
|
||||
String authorSandboxDefaultWebAppRelativePath = sbInfo.getSandboxRootPath() + "/" + wpInfo.getDefaultWebApp(); // in this case, default web app is 'ROOT'
|
||||
String authorSandboxDefaultWebAppPath = sbStoreId + AVM_STORE_SEPARATOR + authorSandboxDefaultWebAppRelativePath;
|
||||
|
||||
avmLockingAwareService.createFile(authorSandboxMyWebAppPath, "myFile1");
|
||||
|
||||
avmLockingAwareService.createFile(authorSandboxRootPath, "myFile1");
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("myFile1", assets.get(0).getName());
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(1, items.size());
|
||||
assertEquals("myFile1", items.get(0).getName());
|
||||
avmLockingAwareService.createDirectory(authorSandboxDefaultWebAppPath, "myDir1");
|
||||
avmLockingAwareService.createFile(authorSandboxDefaultWebAppPath+"/myDir1", "myFile2");
|
||||
avmLockingAwareService.createDirectory(authorSandboxDefaultWebAppPath+"/myDir1", "myDir2");
|
||||
avmLockingAwareService.createFile(authorSandboxDefaultWebAppPath+"/myDir1/myDir2", "myFile3");
|
||||
avmLockingAwareService.createFile(authorSandboxDefaultWebAppPath+"/myDir1/myDir2", "myFile4");
|
||||
avmLockingAwareService.createDirectory(authorSandboxDefaultWebAppPath+"/myDir1", "myDir3");
|
||||
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebAppPath, "myDir1");
|
||||
avmLockingAwareService.createFile(authorSandboxWebAppPath+"/myDir1", "myFile2");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebAppPath+"/myDir1", "myDir2");
|
||||
avmLockingAwareService.createFile(authorSandboxWebAppPath+"/myDir1/myDir2", "myFile3");
|
||||
avmLockingAwareService.createFile(authorSandboxWebAppPath+"/myDir1/myDir2", "myFile4");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebAppPath+"/myDir1", "myDir3");
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(2, assets.size()); // new dir with new dirs/files is returned as single change
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(2, items.size()); // new dir with new dirs/files is returned as single change
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myFile1") && item.isFile())
|
||||
if (asset.getName().equals("myFile1") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
items = sbService.listChangedItemsWebApp(sbStoreId, wpInfo.getDefaultWebApp(), false);
|
||||
assertEquals(1, items.size());
|
||||
assets = sbService.listChangedWebApp(sbStoreId, wpInfo.getDefaultWebApp(), false);
|
||||
assertEquals(1, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
items = sbService.listChangedItemsDir(sbStoreId, authorSandboxWebAppRelativePath+"/myDir1", false);
|
||||
assertEquals(1, items.size());
|
||||
assets = sbService.listChanged(sbStoreId, authorSandboxDefaultWebAppRelativePath+"/myDir1", false);
|
||||
assertEquals(1, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list changed (in this test, new) items in two different user sandboxes compared to each other
|
||||
// list changed (in this test, new) assets in two different user sandboxes compared to each other
|
||||
public void testListNewItems2()
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-listNewItems2", TEST_WEBPROJ_NAME+" listNewItems2", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
@@ -592,16 +596,16 @@ public class SandboxServiceImplTest extends TestCase
|
||||
SandboxInfo sbInfo1 = sbService.getAuthorSandbox(wpStoreId);
|
||||
String sbStoreId = sbInfo1.getSandboxId();
|
||||
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(sbStoreId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(sbStoreId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxRootPath = sbStoreId + AVM_STORE_SEPARATOR + sbInfo1.getSandboxRootPath();
|
||||
|
||||
avmLockingAwareService.createFile(authorSandboxRootPath, "myFile1");
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(1, items.size());
|
||||
assertEquals("myFile1", items.get(0).getName());
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("myFile1", assets.get(0).getName());
|
||||
|
||||
// Switch to USER_TWO
|
||||
AuthenticationUtil.setCurrentUser(USER_TWO);
|
||||
@@ -609,30 +613,30 @@ public class SandboxServiceImplTest extends TestCase
|
||||
SandboxInfo sbInfo2 = sbService.getAuthorSandbox(wpStoreId);
|
||||
sbStoreId = sbInfo2.getSandboxId();
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, true);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedAll(sbStoreId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
authorSandboxRootPath = sbStoreId + AVM_STORE_SEPARATOR + sbInfo2.getSandboxRootPath();
|
||||
|
||||
avmLockingAwareService.createFile(authorSandboxRootPath, "myFile2");
|
||||
avmLockingAwareService.createFile(authorSandboxRootPath, "myFile3");
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myFile2") && item.isFile())
|
||||
if (asset.getName().equals("myFile2") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile3") && item.isFile())
|
||||
else if (asset.getName().equals("myFile3") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,31 +646,31 @@ public class SandboxServiceImplTest extends TestCase
|
||||
sbInfo1 = sbService.getAuthorSandbox(wpStoreId, USER_ONE);
|
||||
sbInfo2 = sbService.getAuthorSandbox(wpStoreId, USER_TWO);
|
||||
|
||||
items = sbService.listChangedItems(sbInfo1.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo2.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(1, items.size());
|
||||
assertEquals("myFile1", items.get(0).getName());
|
||||
assets = sbService.listChanged(sbInfo1.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo2.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("myFile1", assets.get(0).getName());
|
||||
|
||||
items = sbService.listChangedItems(sbInfo2.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo1.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChanged(sbInfo2.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo1.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myFile2") && item.isFile())
|
||||
if (asset.getName().equals("myFile2") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile3") && item.isFile())
|
||||
else if (asset.getName().equals("myFile3") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list changed (in this test, new) items in two different user sandboxes compared to each other - without locking
|
||||
// list changed (in this test, new) assets in two different user sandboxes compared to each other - without locking
|
||||
public void testListNewItems3()
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-listNewItems2", TEST_WEBPROJ_NAME+" listNewItems2", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
@@ -682,16 +686,16 @@ public class SandboxServiceImplTest extends TestCase
|
||||
SandboxInfo sbInfo1 = sbService.getAuthorSandbox(wpStoreId);
|
||||
String sbStoreId = sbInfo1.getSandboxId();
|
||||
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(sbStoreId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(sbStoreId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxRootPath = sbStoreId + AVM_STORE_SEPARATOR + sbInfo1.getSandboxRootPath();
|
||||
|
||||
avmNonLockingAwareService.createFile(authorSandboxRootPath, "myFile1");
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(1, items.size());
|
||||
assertEquals("myFile1", items.get(0).getName());
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("myFile1", assets.get(0).getName());
|
||||
|
||||
// Switch to USER_TWO
|
||||
AuthenticationUtil.setCurrentUser(USER_TWO);
|
||||
@@ -699,8 +703,8 @@ public class SandboxServiceImplTest extends TestCase
|
||||
SandboxInfo sbInfo2 = sbService.getAuthorSandbox(wpStoreId);
|
||||
sbStoreId = sbInfo2.getSandboxId();
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, true);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedAll(sbStoreId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
authorSandboxRootPath = sbStoreId + AVM_STORE_SEPARATOR + sbInfo2.getSandboxRootPath();
|
||||
|
||||
@@ -708,26 +712,26 @@ public class SandboxServiceImplTest extends TestCase
|
||||
avmNonLockingAwareService.createFile(authorSandboxRootPath, "myFile2");
|
||||
avmNonLockingAwareService.createFile(authorSandboxRootPath, "myFile3");
|
||||
|
||||
items = sbService.listChangedItems(sbStoreId, false);
|
||||
assertEquals(3, items.size());
|
||||
assets = sbService.listChangedAll(sbStoreId, false);
|
||||
assertEquals(3, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myFile1") && item.isFile())
|
||||
if (asset.getName().equals("myFile1") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile2") && item.isFile())
|
||||
else if (asset.getName().equals("myFile2") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile3") && item.isFile())
|
||||
else if (asset.getName().equals("myFile3") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,35 +741,35 @@ public class SandboxServiceImplTest extends TestCase
|
||||
sbInfo1 = sbService.getAuthorSandbox(wpStoreId, USER_ONE);
|
||||
sbInfo2 = sbService.getAuthorSandbox(wpStoreId, USER_TWO);
|
||||
|
||||
items = sbService.listChangedItems(sbInfo1.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo2.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(1, items.size());
|
||||
assertEquals("myFile1", items.get(0).getName());
|
||||
assets = sbService.listChanged(sbInfo1.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo2.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(1, assets.size());
|
||||
assertEquals("myFile1", assets.get(0).getName());
|
||||
|
||||
items = sbService.listChangedItems(sbInfo2.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo1.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(3, items.size());
|
||||
assets = sbService.listChanged(sbInfo2.getSandboxId(), sbInfo1.getSandboxRootPath(), sbInfo1.getSandboxId(), sbInfo2.getSandboxRootPath(), false);
|
||||
assertEquals(3, assets.size());
|
||||
|
||||
for (AVMNodeDescriptor item : items)
|
||||
for (AVMNodeDescriptor asset : assets)
|
||||
{
|
||||
if (item.getName().equals("myFile1") && item.isFile())
|
||||
if (asset.getName().equals("myFile1") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile2") && item.isFile())
|
||||
else if (asset.getName().equals("myFile2") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myFile3") && item.isFile())
|
||||
else if (asset.getName().equals("myFile3") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// submit new items in user sandbox to staging sandbox
|
||||
// submit new assets in user sandbox to staging sandbox
|
||||
public void testSubmitNewItems1()
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-submitNewItems1", TEST_WEBPROJ_NAME+" submitNewItems1", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
@@ -784,10 +788,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
avmLockingAwareService.createFile(authorSandboxWebppPath, "myFile1");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir1");
|
||||
@@ -797,44 +801,44 @@ public class SandboxServiceImplTest extends TestCase
|
||||
avmLockingAwareService.createFile(authorSandboxWebppPath+"/myDir1/myDir2", "myFile4");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath+"/myDir1", "myDir3");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size()); // new dir with new dirs/files is returned as single change
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size()); // new dir with new dirs/files is returned as single change
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
assertEquals(2, listing.size());
|
||||
|
||||
for (AVMNodeDescriptor item : listing.values())
|
||||
for (AVMNodeDescriptor asset : listing.values())
|
||||
{
|
||||
if (item.getName().equals("myFile1") && item.isFile())
|
||||
if (asset.getName().equals("myFile1") && asset.isFile())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// submit changed items in user sandbox to staging sandbox
|
||||
public void testSubmitChangedItems1() throws IOException
|
||||
// submit changed assets in user sandbox to staging sandbox
|
||||
public void testSubmitChangedAssets1() throws IOException
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-submitChangedItems1", TEST_WEBPROJ_NAME+" submitChangedItems1", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-submitChangedAssets1", TEST_WEBPROJ_NAME+" submitChangedAssets1", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
|
||||
final String wpStoreId = wpInfo.getStoreId();
|
||||
final String webApp = wpInfo.getDefaultWebApp();
|
||||
@@ -851,10 +855,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
final String MYFILE1 = "This is myFile1";
|
||||
OutputStream out = avmLockingAwareService.createFile(authorSandboxWebppPath, "myFile1");
|
||||
@@ -870,18 +874,18 @@ public class SandboxServiceImplTest extends TestCase
|
||||
out.write(buff);
|
||||
out.close();
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + ":" + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + ":" + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
@@ -894,10 +898,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
final String MYFILE1_MODIFIED = "This is myFile1 ... modified by "+USER_TWO;
|
||||
out = avmLockingAwareService.getFileOutputStream(authorSandboxWebppPath+"/myFile1");
|
||||
@@ -911,11 +915,11 @@ public class SandboxServiceImplTest extends TestCase
|
||||
out.write(buff);
|
||||
out.close();
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
stagingSandboxWebppPath = stagingSandboxId + ":" + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
stagingSandboxWebppPath = stagingSandboxId + ":" + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
InputStream in = avmLockingAwareService.getFileInputStream(-1, stagingSandboxWebppPath+"/myFile1");
|
||||
buff = new byte[1024];
|
||||
@@ -929,11 +933,11 @@ public class SandboxServiceImplTest extends TestCase
|
||||
in.close();
|
||||
assertEquals(MYFILE2, new String(buff, 0, MYFILE2.length()));
|
||||
|
||||
// submit (modified items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, null, null);
|
||||
// submit (modified assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, null, null);
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
in = avmLockingAwareService.getFileInputStream(-1, stagingSandboxWebppPath+"/myFile1");
|
||||
@@ -949,7 +953,7 @@ public class SandboxServiceImplTest extends TestCase
|
||||
assertEquals(MYFILE2_MODIFIED, new String(buff, 0, MYFILE1_MODIFIED.length()));
|
||||
}
|
||||
|
||||
// submit deleted items in user sandbox to staging sandbox
|
||||
// submit deleted assets in user sandbox to staging sandbox
|
||||
public void testSubmitDeletedItems1() throws IOException
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-submitDeletedItems1", TEST_WEBPROJ_NAME+" submitDeletedItems1", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
@@ -969,10 +973,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
final String MYFILE1 = "This is myFile1";
|
||||
OutputStream out = avmLockingAwareService.createFile(authorSandboxWebppPath, "myFile1");
|
||||
@@ -989,18 +993,18 @@ public class SandboxServiceImplTest extends TestCase
|
||||
out.write(buff);
|
||||
out.close();
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
@@ -1013,35 +1017,35 @@ public class SandboxServiceImplTest extends TestCase
|
||||
authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
avmLockingAwareService.removeNode(authorSandboxWebppPath+"/myFile1");
|
||||
avmLockingAwareService.removeNode(authorSandboxWebppPath+"/myDir1/myDir2");
|
||||
|
||||
// do not list deleted
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// do list deleted
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, true);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, true);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
assertNotNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myFile1"));
|
||||
assertNotNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myDir1"));
|
||||
assertNotNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myDir1/myDir2"));
|
||||
assertNotNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myDir1/myFile2"));
|
||||
|
||||
// submit (deleted items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, null, null);
|
||||
// submit (deleted assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, null, null);
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
assertNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myFile1"));
|
||||
@@ -1051,10 +1055,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
assertNotNull(avmLockingAwareService.lookup(-1, stagingSandboxWebppPath+"/myDir1/myFile2"));
|
||||
}
|
||||
|
||||
// revert all (changed) items in user sandbox
|
||||
// revert all (changed) assets in user sandbox
|
||||
public void testRevertAll() throws IOException
|
||||
{
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-revertChangedItems", TEST_WEBPROJ_NAME+" revertChangedItems", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-revertChangedAssets", TEST_WEBPROJ_NAME+" revertChangedAssets", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
|
||||
|
||||
final String wpStoreId = wpInfo.getStoreId();
|
||||
final String webApp = wpInfo.getDefaultWebApp();
|
||||
@@ -1071,10 +1075,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
final String MYFILE1 = "This is myFile1";
|
||||
OutputStream out = avmLockingAwareService.createFile(authorSandboxWebppPath, "myFile1");
|
||||
@@ -1090,18 +1094,18 @@ public class SandboxServiceImplTest extends TestCase
|
||||
out.write(buff);
|
||||
out.close();
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
@@ -1114,10 +1118,10 @@ public class SandboxServiceImplTest extends TestCase
|
||||
authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
final String MYFILE1_MODIFIED = "This is myFile1 ... modified by "+USER_TWO;
|
||||
out = avmLockingAwareService.getFileOutputStream(authorSandboxWebppPath+"/myFile1");
|
||||
@@ -1131,11 +1135,11 @@ public class SandboxServiceImplTest extends TestCase
|
||||
out.write(buff);
|
||||
out.close();
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(2, assets.size());
|
||||
|
||||
// check staging before
|
||||
stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
InputStream in = avmLockingAwareService.getFileInputStream(-1, stagingSandboxWebppPath+"/myFile1");
|
||||
buff = new byte[1024];
|
||||
@@ -1149,11 +1153,11 @@ public class SandboxServiceImplTest extends TestCase
|
||||
in.close();
|
||||
assertEquals(MYFILE2, new String(buff, 0, MYFILE2.length()));
|
||||
|
||||
// revert (modified items) !
|
||||
sbService.revertAllWebApp(authorSandboxId, webApp);
|
||||
// revert (modified assets) !
|
||||
sbService.revertWebApp(authorSandboxId, webApp);
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
in = avmLockingAwareService.getFileInputStream(-1, stagingSandboxWebppPath+"/myFile1");
|
||||
@@ -1189,30 +1193,30 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir1");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir2");
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir3");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(3, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(3, assets.size());
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
List<VersionDescriptor> sbVersions = sbService.listSnapshots(stagingSandboxId, fromDate, new Date(), false);
|
||||
assertEquals(0, sbVersions.size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
@@ -1224,8 +1228,8 @@ public class SandboxServiceImplTest extends TestCase
|
||||
// more changes ...
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir4");
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
// check staging after
|
||||
listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
@@ -1259,41 +1263,41 @@ public class SandboxServiceImplTest extends TestCase
|
||||
String authorSandboxId = sbInfo.getSandboxId();
|
||||
|
||||
// no changes yet
|
||||
List<AVMNodeDescriptor> items = sbService.listChangedItems(authorSandboxId, true);
|
||||
assertEquals(0, items.size());
|
||||
List<AVMNodeDescriptor> assets = sbService.listChangedAll(authorSandboxId, true);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String authorSandboxWebppPath = authorSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir1");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(1, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(1, assets.size());
|
||||
|
||||
// check staging before
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getWebAppsPath() + "/" + webApp;
|
||||
String stagingSandboxWebppPath = stagingSandboxId + AVM_STORE_SEPARATOR + sbInfo.getSandboxRootPath() + "/" + webApp;
|
||||
assertEquals(0, avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false).size());
|
||||
|
||||
List<VersionDescriptor> sbVersions = sbService.listSnapshots(stagingSandboxId, fromDate, new Date(), false);
|
||||
assertEquals(0, sbVersions.size());
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
items = sbService.listChangedItemsWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, items.size());
|
||||
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
|
||||
assertEquals(0, assets.size());
|
||||
|
||||
// check staging after
|
||||
Map<String, AVMNodeDescriptor> listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
assertEquals(1, listing.size());
|
||||
for (AVMNodeDescriptor item : listing.values())
|
||||
for (AVMNodeDescriptor asset : listing.values())
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1303,25 +1307,25 @@ public class SandboxServiceImplTest extends TestCase
|
||||
// more changes ...
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir2");
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
// check staging after
|
||||
listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
assertEquals(2, listing.size());
|
||||
for (AVMNodeDescriptor item : listing.values())
|
||||
for (AVMNodeDescriptor asset : listing.values())
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir2") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir2") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1331,29 +1335,29 @@ public class SandboxServiceImplTest extends TestCase
|
||||
// more changes ...
|
||||
avmLockingAwareService.createDirectory(authorSandboxWebppPath, "myDir3");
|
||||
|
||||
// submit (new items) !
|
||||
sbService.submitAllWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
// submit (new assets) !
|
||||
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
|
||||
|
||||
// check staging after
|
||||
listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
assertEquals(3, listing.size());
|
||||
for (AVMNodeDescriptor item : listing.values())
|
||||
for (AVMNodeDescriptor asset : listing.values())
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir2") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir2") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir3") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir3") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,19 +1377,19 @@ public class SandboxServiceImplTest extends TestCase
|
||||
// check staging after
|
||||
listing = avmLockingAwareService.getDirectoryListing(-1, stagingSandboxWebppPath, false);
|
||||
assertEquals(2, listing.size());
|
||||
for (AVMNodeDescriptor item : listing.values())
|
||||
for (AVMNodeDescriptor asset : listing.values())
|
||||
{
|
||||
if (item.getName().equals("myDir1") && item.isDirectory())
|
||||
if (asset.getName().equals("myDir1") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.getName().equals("myDir2") && item.isDirectory())
|
||||
else if (asset.getName().equals("myDir2") && asset.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("The item '" + item.getName() + "' is not recognised");
|
||||
fail("The asset '" + asset.getName() + "' is not recognised");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2008 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
|
||||
@@ -29,7 +29,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.jscript.ScriptableHashMap;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.util.ISO8601DateFormat;
|
||||
import org.alfresco.wcm.sandbox.SandboxInfo;
|
||||
@@ -96,7 +95,7 @@ public class Sandbox implements Serializable
|
||||
*/
|
||||
public void submitAllWebApp(String webApp, String submitLabel, String submitComment)
|
||||
{
|
||||
getSandboxService().submitAllWebApp(getSandboxRef(), webApp, submitLabel, submitComment);
|
||||
getSandboxService().submitWebApp(getSandboxRef(), webApp, submitLabel, submitComment);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +111,7 @@ public class Sandbox implements Serializable
|
||||
*/
|
||||
public void revertAllWebApp(String webApp)
|
||||
{
|
||||
getSandboxService().revertAllWebApp(getSandboxRef(), webApp);
|
||||
getSandboxService().revertWebApp(getSandboxRef(), webApp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +177,7 @@ public class Sandbox implements Serializable
|
||||
*/
|
||||
public List<Asset> getModifiedAssets()
|
||||
{
|
||||
List<AVMNodeDescriptor> items = getSandboxService().listChangedItems(getSandboxRef(), true);
|
||||
List<AVMNodeDescriptor> items = getSandboxService().listChangedAll(getSandboxRef(), true);
|
||||
ArrayList<Asset> ret = new ArrayList<Asset>(items.size());
|
||||
|
||||
for(AVMNodeDescriptor item : items)
|
||||
@@ -195,7 +194,7 @@ public class Sandbox implements Serializable
|
||||
*/
|
||||
public List<Asset> getModifiedAssetsWebApp(String webApp)
|
||||
{
|
||||
List<AVMNodeDescriptor> items = getSandboxService().listChangedItemsWebApp(getSandboxRef(), webApp, true);
|
||||
List<AVMNodeDescriptor> items = getSandboxService().listChangedWebApp(getSandboxRef(), webApp, true);
|
||||
ArrayList<Asset> ret = new ArrayList<Asset>(items.size());
|
||||
|
||||
for(AVMNodeDescriptor item : items)
|
||||
|
Reference in New Issue
Block a user