Update WCM submit tests - to poll (rather than sleep) and also add test for bulk import with single submits

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16993 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-10-16 16:30:24 +00:00
parent 3731cb9b42
commit e197ee5805
3 changed files with 258 additions and 68 deletions

View File

@@ -28,6 +28,7 @@ import java.util.List;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -41,6 +42,8 @@ import org.alfresco.wcm.sandbox.SandboxService;
import org.alfresco.wcm.util.WCMUtil; import org.alfresco.wcm.util.WCMUtil;
import org.alfresco.wcm.webproject.WebProjectInfo; import org.alfresco.wcm.webproject.WebProjectInfo;
import org.alfresco.wcm.webproject.WebProjectService; import org.alfresco.wcm.webproject.WebProjectService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -51,12 +54,17 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
*/ */
public class AbstractWCMServiceImplTest extends TestCase public class AbstractWCMServiceImplTest extends TestCase
{ {
private static Log logger = LogFactory.getLog(AbstractWCMServiceImplTest.class);
private static final String PREVIEW_CONFIG_LOCATION = "classpath:wcm/wcm-test-preview-context.xml"; private static final String PREVIEW_CONFIG_LOCATION = "classpath:wcm/wcm-test-preview-context.xml";
// override jbpm.job.executor idleInterval to 5s (was 1.5m) for WCM unit tests // override jbpm.job.executor idleInterval to 5s (was 1.5m) for WCM unit tests
private static final String SUBMIT_CONFIG_LOCATION = "classpath:wcm/wcm-jbpm-context.xml"; private static final String SUBMIT_CONFIG_LOCATION = "classpath:wcm/wcm-jbpm-context.xml";
protected static final long SUBMIT_DELAY = 15000L; // (in millis) 15s - to allow async submit direct workflow to complete (as per 5s idleInterval above) protected static final long SUBMIT_DELAY = 15000L; // (in millis) 15s - to allow async submit direct workflow to complete (as per 5s idleInterval above)
protected static final long POLL_DELAY = 5000L; // (in millis) 5s
protected static final int POLL_MAX_ATTEMPTS = 5;
// note: all tests share same context (when run via WCMTestSuite) // note: all tests share same context (when run via WCMTestSuite)
protected static ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {ApplicationContextHelper.CONFIG_LOCATIONS[0], SUBMIT_CONFIG_LOCATION, PREVIEW_CONFIG_LOCATION});; protected static ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {ApplicationContextHelper.CONFIG_LOCATIONS[0], SUBMIT_CONFIG_LOCATION, PREVIEW_CONFIG_LOCATION});;
@@ -179,4 +187,42 @@ public class AbstractWCMServiceImplTest extends TestCase
{ {
personService.deletePerson(userName); personService.deletePerson(userName);
} }
protected int pollForSnapshotCount(final String stagingStoreId, final int expectedCnt) throws InterruptedException
{
long start = System.currentTimeMillis();
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
int attempts = 0;
try
{
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
int cnt = 0;
while (cnt != expectedCnt)
{
Thread.sleep(POLL_DELAY);
cnt = sbService.listSnapshots(stagingStoreId, false).size();
attempts++;
if (attempts > POLL_MAX_ATTEMPTS)
{
throw new AlfrescoRuntimeException("Too many poll attempts");
}
}
}
finally
{
AuthenticationUtil.setFullyAuthenticatedUser(currentUser);
}
logger.debug("pollForSnapshotCount: "+stagingStoreId+" in "+(System.currentTimeMillis()-start)+" msecs ("+attempts+" attempts)");
return attempts;
}
} }

View File

@@ -45,6 +45,8 @@ import org.alfresco.wcm.AbstractWCMServiceImplTest;
import org.alfresco.wcm.sandbox.SandboxInfo; import org.alfresco.wcm.sandbox.SandboxInfo;
import org.alfresco.wcm.util.WCMUtil; import org.alfresco.wcm.util.WCMUtil;
import org.alfresco.wcm.webproject.WebProjectInfo; import org.alfresco.wcm.webproject.WebProjectInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Asset Service implementation unit test * Asset Service implementation unit test
@@ -53,12 +55,12 @@ import org.alfresco.wcm.webproject.WebProjectInfo;
*/ */
public class AssetServiceImplTest extends AbstractWCMServiceImplTest public class AssetServiceImplTest extends AbstractWCMServiceImplTest
{ {
private static Log logger = LogFactory.getLog(AssetServiceImplTest.class);
// test data // test data
private static final String PREFIX = "created-by-admin-"; private static final String PREFIX = "created-by-admin-";
private static final String FILE = "This is file1 - admin"; private static final String FILE = "This is file1 - admin";
@Override @Override
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
@@ -384,6 +386,7 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
String wpStoreId = wpInfo.getStoreId(); String wpStoreId = wpInfo.getStoreId();
String defaultWebApp = wpInfo.getDefaultWebApp(); String defaultWebApp = wpInfo.getDefaultWebApp();
String stagingStoreId = wpInfo.getStagingStoreName();
// get admin sandbox // get admin sandbox
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId); SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId);
@@ -404,7 +407,7 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, defaultWebApp, "some existing folders and files", null); sbService.submitWebApp(sbStoreId, defaultWebApp, "some existing folders and files", null);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 1);
runCRUDforRoles(USER_ONE, WCMUtil.ROLE_CONTENT_MANAGER, wpStoreId, defaultWebApp, true, true, true); runCRUDforRoles(USER_ONE, WCMUtil.ROLE_CONTENT_MANAGER, wpStoreId, defaultWebApp, true, true, true);
@@ -415,7 +418,7 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
runCRUDforRoles(USER_FOUR, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, wpStoreId, defaultWebApp, true, false, false); runCRUDforRoles(USER_FOUR, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, wpStoreId, defaultWebApp, true, false, false);
} }
private void runCRUDforRoles(String user, String role, String wpStoreId, String defaultWebApp, boolean canCreate, boolean canUpdateExisting, boolean canDeleteExisting) throws IOException, InterruptedException private void runCRUDforRoles(String user, String role, final String wpStoreId, String defaultWebApp, boolean canCreate, boolean canUpdateExisting, boolean canDeleteExisting) throws IOException, InterruptedException
{ {
// switch to user - content manager // switch to user - content manager
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
@@ -426,6 +429,9 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
// switch to user // switch to user
AuthenticationUtil.setFullyAuthenticatedUser(user); AuthenticationUtil.setFullyAuthenticatedUser(user);
// get staging sandbox
String stagingStoreId = sbService.getStagingSandbox(wpStoreId).getSandboxId();
// get user's author sandbox // get user's author sandbox
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId); SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId);
String sbStoreId = sbInfo.getSandboxId(); String sbStoreId = sbInfo.getSandboxId();
@@ -658,10 +664,18 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
} }
} }
// switch to admin (content manager)
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
int snapCnt = sbService.listSnapshots(wpStoreId, false).size();
// switch to user
AuthenticationUtil.setFullyAuthenticatedUser(user);
// submit the changes // submit the changes
sbService.submitWebApp(sbStoreId, defaultWebApp, "some updates by "+user, null); sbService.submitWebApp(sbStoreId, defaultWebApp, "some updates by "+user, null);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, snapCnt+1);
} }
public void testRenameFile() public void testRenameFile()
@@ -921,6 +935,9 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-properties", TEST_WEBPROJ_NAME+"-properties", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null); WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-properties", TEST_WEBPROJ_NAME+"-properties", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
String defaultWebApp = wpInfo.getDefaultWebApp(); String defaultWebApp = wpInfo.getDefaultWebApp();
// get staging sandbox id
String stagingStoreId = sbService.getStagingSandbox(wpInfo.getStoreId()).getSandboxId();
// invite web user and auto-create their (author) sandbox // invite web user and auto-create their (author) sandbox
wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true); wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true);
@@ -955,7 +972,7 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment"); sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 1);
assertNull(assetService.getLockOwner(myFile1Asset)); assertNull(assetService.getLockOwner(myFile1Asset));
@@ -1076,6 +1093,9 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-simpleLock", TEST_WEBPROJ_NAME+"-simpleLock", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null); WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-simpleLock", TEST_WEBPROJ_NAME+"-simpleLock", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
String defaultWebApp = wpInfo.getDefaultWebApp(); String defaultWebApp = wpInfo.getDefaultWebApp();
// get staging sandbox id
String stagingStoreId = sbService.getStagingSandbox(wpInfo.getStoreId()).getSandboxId();
// invite web users and auto-create their (author) sandboxs // invite web users and auto-create their (author) sandboxs
wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true); wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true);
wpService.inviteWebUser(wpInfo.getStoreId(), USER_TWO, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true); wpService.inviteWebUser(wpInfo.getStoreId(), USER_TWO, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true);
@@ -1115,7 +1135,7 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment"); sbService.submitWebApp(sbStoreId, defaultWebApp, "submit1 label", "submit1 comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 1);
assertNull(assetService.getLockOwner(myFile1Asset)); assertNull(assetService.getLockOwner(myFile1Asset));
assertTrue(assetService.hasLockAccess(myFile1Asset)); assertTrue(assetService.hasLockAccess(myFile1Asset));
@@ -1135,6 +1155,9 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-partialSubmitWithNewFolder", TEST_WEBPROJ_NAME+"-partialSubmitWithNewFolder", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null); WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-partialSubmitWithNewFolder", TEST_WEBPROJ_NAME+"-partialSubmitWithNewFolder", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
String defaultWebApp = wpInfo.getDefaultWebApp(); String defaultWebApp = wpInfo.getDefaultWebApp();
// get staging sandbox id
String stagingStoreId = sbService.getStagingSandbox(wpInfo.getStoreId()).getSandboxId();
// get admin's sandbox // get admin's sandbox
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpInfo.getStoreId()); SandboxInfo sbInfo = sbService.getAuthorSandbox(wpInfo.getStoreId());
String sbStoreId = sbInfo.getSandboxId(); String sbStoreId = sbInfo.getSandboxId();
@@ -1176,7 +1199,8 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
// partial submit with new folder // partial submit with new folder
sbService.submitListAssets(sbStoreId, selectedAssetsToSubmit, "submit1 label", "submit1 comment"); sbService.submitListAssets(sbStoreId, selectedAssetsToSubmit, "submit1 label", "submit1 comment");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingStoreId, 1);
changedAssets = sbService.listChangedWebApp(sbStoreId, defaultWebApp, false); changedAssets = sbService.listChangedWebApp(sbStoreId, defaultWebApp, false);
assertEquals(1, changedAssets.size()); assertEquals(1, changedAssets.size());
@@ -1188,15 +1212,22 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
assertTrue(assetService.hasLockAccess(myFile2Asset)); assertTrue(assetService.hasLockAccess(myFile2Asset));
} }
public void testSimpleImport() // bulk import and submit all
public void testImportAndSubmit1() throws InterruptedException
{ {
// create web project (also creates staging sandbox and admin's author sandbox) // create web project (also creates staging sandbox and admin's author sandbox)
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-simpleImport", TEST_WEBPROJ_NAME+"-simpleImport", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null); WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-simpleImport", TEST_WEBPROJ_NAME+"-simpleImport", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
String defaultWebApp = wpInfo.getDefaultWebApp(); String defaultWebApp = wpInfo.getDefaultWebApp();
// get staging sandbox
SandboxInfo stagingInfo = sbService.getStagingSandbox(wpInfo.getStoreId());
String stagingStoreId = stagingInfo.getSandboxId();
// invite web user and auto-create their (author) sandbox // invite web user and auto-create their (author) sandbox
wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true); wpService.inviteWebUser(wpInfo.getStoreId(), USER_ONE, WCMUtil.ROLE_CONTENT_CONTRIBUTOR, true);
assertEquals(0, sbService.listSnapshots(stagingStoreId, false).size());
// switch to user // switch to user
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE); AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
@@ -1206,14 +1237,120 @@ public class AssetServiceImplTest extends AbstractWCMServiceImplTest
String path = sbInfo.getSandboxRootPath() + "/" + defaultWebApp; String path = sbInfo.getSandboxRootPath() + "/" + defaultWebApp;
assertEquals(0, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(0, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(0, sbService.listChanged(sbStoreId, path, false).size());
// create folder // create folder
assetService.createFolder(sbStoreId, path, "myFolder1", null); assetService.createFolder(sbStoreId, path, "myFolder1", null);
AssetInfo myFolder1Asset = assetService.getAsset(sbStoreId, path+"/myFolder1"); AssetInfo myFolder1Asset = assetService.getAsset(sbStoreId, path+"/myFolder1");
assertEquals(1, sbService.listChanged(sbStoreId, path, false).size());
assertEquals(0, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(1, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(0, assetService.listAssets(sbStoreId, path+"/myFolder1", false).size());
// bulk import // bulk import
String testFile = System.getProperty("user.dir") + "/source/test-resources/module/test.war"; String testFile = System.getProperty("user.dir") + "/source/test-resources/module/test.war";
File zipFile = new File(testFile); File zipFile = new File(testFile);
assetService.bulkImport(sbStoreId, myFolder1Asset.getPath(), zipFile, false); assetService.bulkImport(sbStoreId, myFolder1Asset.getPath(), zipFile, false);
assertEquals(0, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(1, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(9, assetService.listAssets(sbStoreId, path+"/myFolder1", false).size());
assertEquals(1, sbService.listChanged(sbStoreId, path, false).size());
sbService.submitWebApp(sbStoreId, defaultWebApp, "s1", "s1");
pollForSnapshotCount(stagingStoreId, 1);
assertEquals(1, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(9, assetService.listAssets(stagingStoreId, path+"/myFolder1", false).size());
assertEquals(1, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(9, assetService.listAssets(sbStoreId, path+"/myFolder1", false).size());
assertEquals(0, sbService.listChanged(sbStoreId, path, false).size());
// switch to admin
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
assertEquals(1, sbService.listSnapshots(stagingStoreId, false).size());
}
// bulk import and submit 1-by-1
public void testImportAndSubmit2() throws InterruptedException
{
long start = System.currentTimeMillis();
// create web project (also creates staging sandbox and admin's author sandbox)
WebProjectInfo wpInfo = wpService.createWebProject(TEST_WEBPROJ_DNS+"-import", TEST_WEBPROJ_NAME+"-import", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION, TEST_WEBPROJ_DEFAULT_WEBAPP, TEST_WEBPROJ_DONT_USE_AS_TEMPLATE, null);
logger.debug("create web project in "+(System.currentTimeMillis()-start)+" msecs");
String defaultWebApp = wpInfo.getDefaultWebApp();
// get staging sandbox
SandboxInfo stagingInfo = sbService.getStagingSandbox(wpInfo.getStoreId());
String stagingStoreId = stagingInfo.getSandboxId();
// get admin user's author sandbox
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpInfo.getStoreId());
String sbStoreId = sbInfo.getSandboxId();
String path = sbInfo.getSandboxRootPath() + "/" + defaultWebApp;
assertEquals(0, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(0, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(0, sbService.listSnapshots(stagingStoreId, false).size());
// bulk import
//String testFile = System.getProperty("user.dir") + "/source/test-resources/wcm/1001_files.zip";
String testFile = System.getProperty("user.dir") + "/source/test-resources/module/test.war";
start = System.currentTimeMillis();
File zipFile = new File(testFile);
assetService.bulkImport(sbStoreId, path, zipFile, false);
logger.debug("bulk import in "+(System.currentTimeMillis()-start)+" msecs");
int totalCnt = assetService.listAssets(sbStoreId, path, false).size();
int expectedChangeCnt = totalCnt;
int expectedSnapCnt = 0;
int expectedStageCnt = 0;
for (int i = 1; i <= totalCnt; i++)
{
assertEquals(expectedStageCnt, assetService.listAssets(stagingStoreId, path, false).size());
assertEquals(totalCnt, assetService.listAssets(sbStoreId, path, false).size());
assertEquals(expectedSnapCnt, sbService.listSnapshots(stagingStoreId, false).size());
List<AssetInfo> assets = sbService.listChanged(sbStoreId, path, false);
assertEquals(expectedChangeCnt, assets.size());
List<AssetInfo> submitAssets = new ArrayList<AssetInfo>(1);
submitAssets.add(assets.get(0));
start = System.currentTimeMillis();
sbService.submitListAssets(sbStoreId, submitAssets, "s1", "s1");
logger.debug("initiated submit of item "+i+" in "+(System.currentTimeMillis()-start)+" msecs");
start = System.currentTimeMillis();
expectedSnapCnt++;
pollForSnapshotCount(stagingStoreId, expectedSnapCnt);
expectedChangeCnt--;
expectedStageCnt++;
}
} }
} }

View File

@@ -916,7 +916,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1044,7 +1044,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1099,7 +1099,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (modified assets) ! // submit (modified assets) !
sbService.submitWebApp(authorSandboxId, webApp, "my label", null); sbService.submitWebApp(authorSandboxId, webApp, "my label", null);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1162,7 +1162,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitAll(authorSandboxId, "a submit label", "a submit comment"); sbService.submitAll(authorSandboxId, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
// check staging after // check staging after
List<AssetInfo> listing = assetService.listAssets(stagingSandboxId, -1, rootPath, false); List<AssetInfo> listing = assetService.listAssets(stagingSandboxId, -1, rootPath, false);
@@ -1196,7 +1196,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit all (modified assets) ! // submit all (modified assets) !
sbService.submitAll(authorSandboxId, "my label", null); sbService.submitAll(authorSandboxId, "my label", null);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
assets = sbService.listChangedAll(authorSandboxId, true); assets = sbService.listChangedAll(authorSandboxId, true);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1256,7 +1256,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1300,7 +1300,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (deleted assets) ! // submit (deleted assets) !
sbService.submitWebApp(authorSandboxId, webApp, "my label", null); sbService.submitWebApp(authorSandboxId, webApp, "my label", null);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1356,7 +1356,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1"); sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdA, 1);
assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false); assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1406,7 +1406,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (modified asset) // submit (modified asset)
sbService.submitWebApp(authorSandboxIdB, webAppB, "B1", "B1"); sbService.submitWebApp(authorSandboxIdB, webAppB, "B1", "B1");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 1);
// Switch back to Web Project A // Switch back to Web Project A
@@ -1416,7 +1416,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (deleted asset) // submit (deleted asset)
sbService.submitWebApp(authorSandboxIdA, webAppA, "A2", "A2"); sbService.submitWebApp(authorSandboxIdA, webAppA, "A2", "A2");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdA, 1);
// Switch back to Web Project B // Switch back to Web Project B
@@ -1427,7 +1427,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// ETHREEOH_2581 // ETHREEOH_2581
sbService.submitWebApp(authorSandboxIdB, webAppB, "B2", "B2"); sbService.submitWebApp(authorSandboxIdB, webAppB, "B2", "B2");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 1);
} }
public void testSubmitUpdatedItemWithLF() throws IOException, InterruptedException public void testSubmitUpdatedItemWithLF() throws IOException, InterruptedException
@@ -1470,7 +1470,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1"); sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdA, 1);
assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false); assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1529,7 +1529,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
assertEquals(AVMDifference.NEWER, assets.get(0).getDiffCode()); assertEquals(AVMDifference.NEWER, assets.get(0).getDiffCode());
// wait for submit to complete // wait for submit to complete
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 1);
assets = sbService.listChangedWebApp(authorSandboxIdB, webAppB, false); assets = sbService.listChangedWebApp(authorSandboxIdB, webAppB, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1577,7 +1577,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1"); sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdA, 1);
assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false); assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1623,7 +1623,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (deleted asset) // submit (deleted asset)
sbService.submitWebApp(authorSandboxIdB, webAppB, "B2", "B2"); sbService.submitWebApp(authorSandboxIdB, webAppB, "B2", "B2");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 1);
assertEquals(0, sbService.listChangedAll(authorSandboxIdB, true).size()); assertEquals(0, sbService.listChangedAll(authorSandboxIdB, true).size());
@@ -1672,7 +1672,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1"); sbService.submitWebApp(authorSandboxIdA, webAppA, "A1", "A1");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdA, 1);
assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false); assets = sbService.listChangedWebApp(authorSandboxIdA, webAppA, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1732,7 +1732,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
recursiveList(stagingSandboxIdB); recursiveList(stagingSandboxIdB);
recursiveList(authorSandboxIdB); recursiveList(authorSandboxIdB);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 1);
logger.debug("submit completed: created file b.txt in B staging sandbox"); logger.debug("submit completed: created file b.txt in B staging sandbox");
@@ -1763,7 +1763,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
recursiveList(stagingSandboxIdB); recursiveList(stagingSandboxIdB);
recursiveList(authorSandboxIdB); recursiveList(authorSandboxIdB);
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxIdB, 2);
logger.debug("submit completed: deleted file a.txt in B staging sandbox"); logger.debug("submit completed: deleted file a.txt in B staging sandbox");
@@ -1828,7 +1828,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -1997,7 +1997,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -2015,7 +2015,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
// check staging after // check staging after
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
@@ -2069,7 +2069,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assets = sbService.listChangedWebApp(authorSandboxId, webApp, false); assets = sbService.listChangedWebApp(authorSandboxId, webApp, false);
assertEquals(0, assets.size()); assertEquals(0, assets.size());
@@ -2098,7 +2098,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
// check staging after // check staging after
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
@@ -2128,7 +2128,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// submit (new assets) ! // submit (new assets) !
sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment"); sbService.submitWebApp(authorSandboxId, webApp, "a submit label", "a submit comment");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 3);
// check staging after // check staging after
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
@@ -2209,7 +2209,8 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
assetService.createFile(authorSandboxId, authorSandboxPath, "c1.txt", null); assetService.createFile(authorSandboxId, authorSandboxPath, "c1.txt", null);
sbService.submitWebApp(authorSandboxId, webApp, "s1", "s1"); sbService.submitWebApp(authorSandboxId, webApp, "s1", "s1");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingSandboxId, 1);
List<AssetInfo> listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); List<AssetInfo> listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
assertEquals(1, listing.size()); assertEquals(1, listing.size());
@@ -2227,7 +2228,8 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
assetService.createFile(authorSandboxId, authorSandboxPath, "c2.txt", null); assetService.createFile(authorSandboxId, authorSandboxPath, "c2.txt", null);
sbService.submitWebApp(authorSandboxId, webApp, "s2", "s2"); sbService.submitWebApp(authorSandboxId, webApp, "s2", "s2");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingSandboxId, 2);
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
assertEquals(2, listing.size()); assertEquals(2, listing.size());
@@ -2252,7 +2254,8 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
assetService.createFile(authorSandboxId, authorSandboxPath, "c3.txt", null); assetService.createFile(authorSandboxId, authorSandboxPath, "c3.txt", null);
sbService.submitWebApp(authorSandboxId, webApp, "s3", "s3"); sbService.submitWebApp(authorSandboxId, webApp, "s3", "s3");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingSandboxId, 3);
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
assertEquals(3, listing.size()); assertEquals(3, listing.size());
@@ -2281,7 +2284,8 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
assetService.createFile(authorSandboxId, authorSandboxPath, "c4.txt", null); assetService.createFile(authorSandboxId, authorSandboxPath, "c4.txt", null);
sbService.submitWebApp(authorSandboxId, webApp, "s4", "s4"); sbService.submitWebApp(authorSandboxId, webApp, "s4", "s4");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingSandboxId, 4);
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
assertEquals(4, listing.size()); assertEquals(4, listing.size());
@@ -2312,7 +2316,8 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
AssetInfo file = assetService.getAsset(authorSandboxId, authorSandboxPath+"/c2.txt"); AssetInfo file = assetService.getAsset(authorSandboxId, authorSandboxPath+"/c2.txt");
assetService.deleteAsset(file); assetService.deleteAsset(file);
sbService.submitWebApp(authorSandboxId, webApp, "s5", "s5"); sbService.submitWebApp(authorSandboxId, webApp, "s5", "s5");
Thread.sleep(SUBMIT_DELAY);
pollForSnapshotCount(stagingSandboxId, 5);
listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false); listing = assetService.listAssets(stagingSandboxId, -1, stagingSandboxPath, false);
assertEquals(3, listing.size()); assertEquals(3, listing.size());
@@ -2391,6 +2396,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
WebProjectInfo wpInfo = wpService.createWebProject(TEST_SANDBOX+"-submitAction", TEST_WEBPROJ_NAME+" submitAction", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION); WebProjectInfo wpInfo = wpService.createWebProject(TEST_SANDBOX+"-submitAction", TEST_WEBPROJ_NAME+" submitAction", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
String wpStoreId = wpInfo.getStoreId(); String wpStoreId = wpInfo.getStoreId();
String webApp = wpInfo.getDefaultWebApp(); String webApp = wpInfo.getDefaultWebApp();
String stagingSandboxId = wpInfo.getStagingStoreName();
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId); SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId);
final String sbStoreId = sbInfo.getSandboxId(); final String sbStoreId = sbInfo.getSandboxId();
@@ -2426,7 +2432,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
// first submit - all (note: within /www/avm_webapps) // first submit - all (note: within /www/avm_webapps)
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork()); transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assetService.createFile(sbStoreId, JNDIConstants.DIR_DEFAULT_WWW, "figs", null); assetService.createFile(sbStoreId, JNDIConstants.DIR_DEFAULT_WWW, "figs", null);
@@ -2459,7 +2465,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork()); transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
changedAssets = sbService.listChanged(sbStoreId, JNDIConstants.DIR_DEFAULT_WWW, true); changedAssets = sbService.listChanged(sbStoreId, JNDIConstants.DIR_DEFAULT_WWW, true);
assertEquals(0, changedAssets.size()); assertEquals(0, changedAssets.size());
@@ -2471,6 +2477,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
WebProjectInfo wpInfo = wpService.createWebProject(TEST_SANDBOX+"-revertListAction", TEST_WEBPROJ_NAME+" revertListAction", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION); WebProjectInfo wpInfo = wpService.createWebProject(TEST_SANDBOX+"-revertListAction", TEST_WEBPROJ_NAME+" revertListAction", TEST_WEBPROJ_TITLE, TEST_WEBPROJ_DESCRIPTION);
String wpStoreId = wpInfo.getStoreId(); String wpStoreId = wpInfo.getStoreId();
String webApp = wpInfo.getDefaultWebApp(); String webApp = wpInfo.getDefaultWebApp();
String stagingSandboxId = wpInfo.getStagingStoreName();
SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId); SandboxInfo sbInfo = sbService.getAuthorSandbox(wpStoreId);
final String sbStoreId = sbInfo.getSandboxId(); final String sbStoreId = sbInfo.getSandboxId();
@@ -2487,7 +2494,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription"); sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 1);
assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "foo"); assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "foo");
@@ -2499,7 +2506,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription"); sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 2);
assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "bar"); assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "bar");
@@ -2535,7 +2542,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
TransactionService transactionService = (TransactionService) ctx.getBean("transactionService"); TransactionService transactionService = (TransactionService) ctx.getBean("transactionService");
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork()); transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingSandboxId, 3);
snapshotVersions = sbService.listSnapshots(sbStoreId, false); snapshotVersions = sbService.listSnapshots(sbStoreId, false);
assertEquals(2, snapshotVersions.size()); assertEquals(2, snapshotVersions.size());
@@ -2569,7 +2576,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription"); sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 1);
assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "foo"); assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "foo");
@@ -2581,7 +2588,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription"); sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 2);
assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "bar"); assetService.createFileWebApp(sbStoreId, webApp, "/a/b/c", "bar");
@@ -2593,7 +2600,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription"); sbService.submitWebApp(sbStoreId, webApp, "submitLabel", "submitDescription");
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 3);
List<SandboxVersion> snapshotVersions = sbService.listSnapshots(stagingStoreId, false); List<SandboxVersion> snapshotVersions = sbService.listSnapshots(stagingStoreId, false);
assertEquals(3, snapshotVersions.size()); assertEquals(3, snapshotVersions.size());
@@ -2617,7 +2624,7 @@ public class SandboxServiceImplTest extends AbstractWCMServiceImplTest
TransactionService transactionService = (TransactionService) ctx.getBean("transactionService"); TransactionService transactionService = (TransactionService) ctx.getBean("transactionService");
transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork()); transactionService.getRetryingTransactionHelper().doInTransaction(new TxnWork());
Thread.sleep(SUBMIT_DELAY); pollForSnapshotCount(stagingStoreId, 4);
snapshotVersions = sbService.listSnapshots(stagingStoreId, false); snapshotVersions = sbService.listSnapshots(stagingStoreId, false);
assertEquals(4, snapshotVersions.size()); assertEquals(4, snapshotVersions.size());