final HttpServletRequest req=ServletTestRunner.localRequest.get();
Host host=new Host(req.getServerName(),"/webdav/autopub",req.getServerPort(),"admin@dotcms.com","admin",null,null);
// this is mostly capturing https://github.com/dotCMS/dotCMS/issues/2815
Folder demo=(Folder)host.child("demo.dotcms.com");
Folder webdavtest=demo.createFolder("webdavtest_"+System.currentTimeMillis());
Folder ff1=webdavtest.createFolder("ff1");
Folder ff2=webdavtest.createFolder("ff2");
java.io.File tmpDir1=new java.io.File(
APILocator.getFileAPI().getRealAssetPathTmpBinary()+java.io.File.separator+"webdavtest_1_"+System.currentTimeMillis());
tmpDir1.mkdirs();
java.io.File tmpDir2=new java.io.File(
APILocator.getFileAPI().getRealAssetPathTmpBinary()+java.io.File.separator+"webdavtest_2_"+System.currentTimeMillis());
tmpDir2.mkdirs();
java.io.File f1=new java.io.File(tmpDir1,"test.txt");
java.io.File f2=new java.io.File(tmpDir2,"test.txt");
FileWriter w = new FileWriter(f1,true); w.write("text1"); w.close();
w = new FileWriter(f2,true); w.write("text2"); w.close();
ff1.upload(f1);
ff2.upload(f2);
Thread.sleep(1000); // wait for the index
List<? extends Resource> children1 = ff1.children();
List<? extends Resource> children2 = ff2.children();
assertEquals(1,children1.size());
assertEquals(1,children2.size());
File r1 = (File)children1.get(0);
File r2 = (File)children2.get(0);