mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
99376: BENCH-371: BM-0004: Copy Alfresco and set up build plan - Modify FileContentStore to service 'spoof://' URLs - SpoofedTextContentReader to generate consistent text for URL - Fix FileContentStoreTest so that tests actually execute - Add override for @After so that no NPEs are thrown - Add tests for the 'spoof://' protocol - Some additional checks for IllegalArgumentException on SpoofedTextContentReader construction - Force delete of 'spoof' to return false but not fail with an exception This is handled neatly by the EagerContentStoreCleaner, which accepts that the stores may protect data according to their own needs e.g. Centera - Add spoofing option to FileFolderPerformanceTester 290 files/s for 1K files vs 460 files/s for spoofed text files (no binary streaming required) - Start FileFolderLoader component that will be used by the API git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@99502 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,11 +18,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
@@ -46,6 +41,11 @@ import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Abstract base class that provides a set of tests for implementations
|
||||
* of {@link ContentStore}.
|
||||
|
@@ -26,6 +26,7 @@ import org.alfresco.repo.content.cleanup.ContentStoreCleanerTest;
|
||||
import org.alfresco.repo.content.filestore.FileContentStoreTest;
|
||||
import org.alfresco.repo.content.filestore.NoRandomAccessFileContentStoreTest;
|
||||
import org.alfresco.repo.content.filestore.ReadOnlyFileContentStoreTest;
|
||||
import org.alfresco.repo.content.filestore.SpoofedTextContentReaderTest;
|
||||
import org.alfresco.repo.content.replication.ContentStoreReplicatorTest;
|
||||
import org.alfresco.repo.content.replication.ReplicatingContentStoreTest;
|
||||
|
||||
@@ -47,6 +48,7 @@ public class ContentFullContextTestSuite extends TestSuite
|
||||
// These tests need a full context, at least for now
|
||||
suite.addTestSuite(ContentStoreCleanerTest.class);
|
||||
//suite.addTestSuite(CharsetFinderTest.class);
|
||||
suite.addTest(new JUnit4TestAdapter(SpoofedTextContentReaderTest.class));
|
||||
suite.addTest(new JUnit4TestAdapter(FileContentStoreTest.class));
|
||||
suite.addTest(new JUnit4TestAdapter(NoRandomAccessFileContentStoreTest.class));
|
||||
suite.addTest(new JUnit4TestAdapter(ReadOnlyFileContentStoreTest.class));
|
||||
|
@@ -18,14 +18,9 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.filestore;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.alfresco.repo.content.AbstractWritableContentStoreTest;
|
||||
import org.alfresco.repo.content.ContentContext;
|
||||
@@ -35,12 +30,21 @@ import org.alfresco.repo.content.ContentLimitProvider.SimpleFixedLimitProvider;
|
||||
import org.alfresco.repo.content.ContentLimitViolationException;
|
||||
import org.alfresco.repo.content.ContentStore;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.TempFileProvider;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tests read and write functionality for the store.
|
||||
*
|
||||
@@ -64,6 +68,13 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
getName());
|
||||
|
||||
store.setDeleteEmptyDirs(true);
|
||||
// Do not need super class's transactions
|
||||
}
|
||||
|
||||
@After
|
||||
public void after()
|
||||
{
|
||||
// Do not need super class's transactions
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +87,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
* Checks that the store disallows concurrent writers to be issued to the same URL.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void testConcurrentWriteDetection() throws Exception
|
||||
{
|
||||
ByteBuffer buffer = ByteBuffer.wrap("Something".getBytes());
|
||||
@@ -98,6 +110,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void testRootLocation() throws Exception
|
||||
{
|
||||
ContentStore store = getStore();
|
||||
@@ -111,6 +124,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
* Ensures that the size is something other than <tt>-1</tt> or <tt>Long.MAX_VALUE</tt>
|
||||
*/
|
||||
@Override
|
||||
@Test
|
||||
public void testSpaceFree() throws Exception
|
||||
{
|
||||
ContentStore store = getStore();
|
||||
@@ -123,6 +137,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
* Ensures that the size is something other than <tt>-1</tt> or <tt>Long.MAX_VALUE</tt>
|
||||
*/
|
||||
@Override
|
||||
@Test
|
||||
public void testSpaceTotal() throws Exception
|
||||
{
|
||||
ContentStore store = getStore();
|
||||
@@ -135,6 +150,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
/**
|
||||
* Empty parent directories should be removed when a URL is removed.
|
||||
*/
|
||||
@Test
|
||||
public void testDeleteRemovesEmptyDirs() throws Exception
|
||||
{
|
||||
ContentStore store = getStore();
|
||||
@@ -161,6 +177,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
/**
|
||||
* Only non-empty directories should be deleted.
|
||||
*/
|
||||
@Test
|
||||
public void testDeleteLeavesNonEmptyDirs()
|
||||
{
|
||||
ContentStore store = getStore();
|
||||
@@ -198,6 +215,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
/**
|
||||
* Empty parent directories are not deleted if the store is configured not to.
|
||||
*/
|
||||
@Test
|
||||
public void testNoParentDirsDeleted() throws Exception
|
||||
{
|
||||
store.setDeleteEmptyDirs(false);
|
||||
@@ -221,6 +239,7 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
* the expected exception.
|
||||
* @since Thor
|
||||
*/
|
||||
@Test
|
||||
public void testWriteFileWithSizeLimit() throws Exception
|
||||
{
|
||||
ContentWriter writer = getWriter();
|
||||
@@ -247,9 +266,10 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
assertTrue("Stream close not detected", writer.isClosed());
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Test for MNT-12301 case.
|
||||
*/
|
||||
@Test
|
||||
public void testFileAccessOutsideStoreRoot()
|
||||
{
|
||||
String url = FileContentStore.STORE_PROTOCOL + ContentStore.PROTOCOL_DELIMITER + "../somefile.bin";
|
||||
@@ -295,6 +315,31 @@ public class FileContentStoreTest extends AbstractWritableContentStoreTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the store is able to produce readers for spoofed text.
|
||||
*
|
||||
* @since 5.1
|
||||
*/
|
||||
@Test
|
||||
public void testSpoofedContent() throws Exception
|
||||
{
|
||||
String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 0L, 1024L);
|
||||
ContentContext ctx = new ContentContext(null, url);
|
||||
try
|
||||
{
|
||||
store.getWriter(ctx);
|
||||
fail("FileContentStore should report that all 'spoof' content exists.");
|
||||
}
|
||||
catch (ContentExistsException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
assertFalse("Deletion should be 'false'.", store.delete(url));
|
||||
assertTrue("All spoofed content already exists!", store.exists(url));
|
||||
ContentReader reader = store.getReader(url);
|
||||
assertTrue(reader instanceof SpoofedTextContentReader);
|
||||
assertEquals(1024L, reader.getContentString().getBytes("UTF-8").length);
|
||||
}
|
||||
|
||||
private void assertDirExists(File root, String dir)
|
||||
{
|
||||
|
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.content.filestore;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.repo.content.AbstractContentReader;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.junit.Before;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
* Text spoofing as a {@link ContentReader}
|
||||
*
|
||||
* @see SpoofedTextContentReader
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 5.1
|
||||
*/
|
||||
@Category(OwnJVMTestsCategory.class)
|
||||
public class SpoofedTextContentReaderTest extends TestCase
|
||||
{
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
// Nothing
|
||||
}
|
||||
|
||||
public void testStaticUrlHandlingErr()
|
||||
{
|
||||
try
|
||||
{
|
||||
SpoofedTextContentReader.createContentUrl(null, 12345L, 1024L);
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
try
|
||||
{
|
||||
SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, -1L);
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
try
|
||||
{
|
||||
SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, 1024L, (String) null);
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
try
|
||||
{
|
||||
SpoofedTextContentReader.createContentUrl(Locale.FRENCH, 12345L, 1024L);
|
||||
fail();
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
try
|
||||
{
|
||||
SpoofedTextContentReader.createContentUrl(
|
||||
Locale.ENGLISH, 12345L, 1024L,
|
||||
"1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ",
|
||||
"1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ",
|
||||
"1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ", "1234567890ABCDEFGHIJ");
|
||||
fail();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testStaticUrlForm_01()
|
||||
{
|
||||
// To URL
|
||||
String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, 1024L, "harry");
|
||||
assertTrue(url.startsWith("spoof://{"));
|
||||
assertTrue(url.contains("\"locale\":\"en\""));
|
||||
assertTrue(url.contains("\"seed\":\"12345\""));
|
||||
assertTrue(url.contains("\"size\":\"1024\""));
|
||||
assertTrue(url.contains("\"words\":[\"harry\"]"));
|
||||
assertTrue(url.endsWith("}"));
|
||||
// From Reader
|
||||
SpoofedTextContentReader reader = new SpoofedTextContentReader(url);
|
||||
assertNotNull(reader.getTextGenerator());
|
||||
assertEquals(Locale.ENGLISH, reader.getLocale());
|
||||
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, reader.getMimetype());
|
||||
assertEquals("UTF-8", reader.getEncoding());
|
||||
assertEquals(12345L, reader.getSeed());
|
||||
assertEquals(1024L, reader.getSize());
|
||||
assertNotNull(reader.getWords());
|
||||
assertEquals(1, reader.getWords().length);
|
||||
assertEquals("harry", reader.getWords()[0]);
|
||||
}
|
||||
|
||||
public void testStaticUrlForm_02()
|
||||
{
|
||||
// To URL
|
||||
String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, 1024L);
|
||||
assertTrue(url.startsWith("spoof://{"));
|
||||
assertTrue(url.contains("\"locale\":\"en\""));
|
||||
assertTrue(url.contains("\"seed\":\"12345\""));
|
||||
assertTrue(url.contains("\"size\":\"1024\""));
|
||||
assertTrue(url.contains("\"words\":[]"));
|
||||
assertTrue(url.endsWith("}"));
|
||||
// From Reader
|
||||
SpoofedTextContentReader reader = new SpoofedTextContentReader(url);
|
||||
assertNotNull(reader.getTextGenerator());
|
||||
assertEquals(Locale.ENGLISH, reader.getLocale());
|
||||
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, reader.getMimetype());
|
||||
assertEquals("UTF-8", reader.getEncoding());
|
||||
assertEquals(12345L, reader.getSeed());
|
||||
assertEquals(1024L, reader.getSize());
|
||||
assertNotNull(reader.getWords());
|
||||
assertEquals(0, reader.getWords().length);
|
||||
}
|
||||
|
||||
public void testGetContentString_01()
|
||||
{
|
||||
// To URL
|
||||
String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, 56L, "harry");
|
||||
// To Reader
|
||||
ContentReader reader = new SpoofedTextContentReader(url);
|
||||
String readerText = reader.getContentString();
|
||||
assertEquals("harry have voice the from countered growth invited ", readerText);
|
||||
// Cannot repeat
|
||||
try
|
||||
{
|
||||
reader.getContentString();
|
||||
fail("Should not be able to reread content.");
|
||||
}
|
||||
catch (ContentIOException e)
|
||||
{
|
||||
// Expected
|
||||
}
|
||||
// Get a new Reader
|
||||
reader = reader.getReader();
|
||||
// Get exactly the same text
|
||||
assertEquals(readerText, reader.getContentString());
|
||||
}
|
||||
|
||||
public void testGetContentBinary_01() throws Exception
|
||||
{
|
||||
// To URL
|
||||
String url = SpoofedTextContentReader.createContentUrl(Locale.ENGLISH, 12345L, 56L, "harry");
|
||||
// To Reader
|
||||
ContentReader reader = new SpoofedTextContentReader(url);
|
||||
InputStream is = reader.getContentInputStream();
|
||||
try
|
||||
{
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(is);
|
||||
assertEquals(56L, bytes.length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
// Compare readers
|
||||
ContentReader copyOne = reader.getReader();
|
||||
ContentReader copyTwo = reader.getReader();
|
||||
// Get exactly the same binaries
|
||||
assertTrue(AbstractContentReader.compareContentReaders(copyOne, copyTwo));
|
||||
}
|
||||
}
|
@@ -52,6 +52,7 @@ import org.junit.runners.Suite.SuiteClasses;
|
||||
// These need to come afterwards, as they insert extra
|
||||
// interceptors which would otherwise confuse things
|
||||
FileFolderServiceImplTest.class,
|
||||
// TODO
|
||||
FileFolderDuplicateChildTest.class,
|
||||
FileFolderServicePropagationTest.class
|
||||
})
|
||||
|
@@ -24,12 +24,14 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.content.filestore.SpoofedTextContentReader;
|
||||
import org.alfresco.repo.content.transform.AbstractContentTransformerTest;
|
||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||
import org.alfresco.repo.dictionary.M2Model;
|
||||
@@ -41,6 +43,7 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -164,9 +167,10 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
* <p>
|
||||
* Each creation (file or folder) uses the <b>PROPAGATION REQUIRED</b> transaction declaration.
|
||||
*
|
||||
* @param parentNodeRef the level zero parent
|
||||
* @param randomOrder true if each thread must put the children into the folders in a random order
|
||||
* @return Returns the average time (ms) to create the <b>files only</b>
|
||||
* @param parentNodeRef the level zero parent
|
||||
* @param randomOrder true if each thread must put the children into the folders in a random order
|
||||
* @param realFile <tt>true</tt> if a real binary must be streamed into the node
|
||||
* @return Returns the average time (ms) to create the <b>files only</b>
|
||||
*/
|
||||
private void buildStructure(
|
||||
final NodeRef parentNodeRef,
|
||||
@@ -175,6 +179,7 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
final int folderCount,
|
||||
final int batchCount,
|
||||
final int filesPerBatch,
|
||||
final boolean realFile,
|
||||
final double[] dumpPoints)
|
||||
{
|
||||
RetryingTransactionCallback<NodeRef[]> createFoldersCallback = new RetryingTransactionCallback<NodeRef[]>()
|
||||
@@ -240,11 +245,25 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
GUID.generate(),
|
||||
ContentModel.TYPE_CONTENT);
|
||||
NodeRef nodeRef = fileInfo.getNodeRef();
|
||||
// write the content
|
||||
ContentWriter writer = fileFolderService.getWriter(nodeRef);
|
||||
writer.setEncoding("UTF-8");
|
||||
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
writer.putContent(dataFile);
|
||||
if (realFile)
|
||||
{
|
||||
// write the content
|
||||
ContentWriter writer = fileFolderService.getWriter(nodeRef);
|
||||
writer.setEncoding("UTF-8");
|
||||
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
writer.putContent(dataFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Spoof some content
|
||||
String contentUrl = SpoofedTextContentReader.createContentUrl(
|
||||
Locale.ENGLISH,
|
||||
(long) Math.random() * 1000L,
|
||||
(long) Math.random() * 1024L);
|
||||
SpoofedTextContentReader reader = new SpoofedTextContentReader(contentUrl);
|
||||
ContentData contentData = reader.getContentData();
|
||||
nodeService.setProperty(nodeRef, ContentModel.PROP_CONTENT, contentData);
|
||||
}
|
||||
}
|
||||
// done
|
||||
return null;
|
||||
@@ -264,10 +283,11 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
|
||||
if (percentComplete > 0)
|
||||
{
|
||||
logger.debug("\n" +
|
||||
System.out.println("\n" +
|
||||
"[" + Thread.currentThread().getName() + "] \n" +
|
||||
" Created " + (currentBatchCount*filesPerBatch) + " files in each of " + folderCount +
|
||||
" folders (" + (randomOrder ? "shuffled" : "in order") + "): \n" +
|
||||
" folders (" + (randomOrder ? "shuffled" : "in order") + ")" +
|
||||
" with " + (realFile ? "real files" : "spoofed content") + " :\n" +
|
||||
" Progress: " + String.format("%9.2f", percentComplete) + " percent complete \n" +
|
||||
" Average: " + String.format("%10.2f", average) + " ms per file \n" +
|
||||
" Average: " + String.format("%10.2f", 1000.0/average) + " files per second");
|
||||
@@ -276,7 +296,7 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
};
|
||||
|
||||
// kick off the required number of threads
|
||||
logger.debug("\n" +
|
||||
System.out.println("\n" +
|
||||
"Starting " + threadCount +
|
||||
" threads loading " + (batchCount * filesPerBatch) +
|
||||
" files in each of " + folderCount +
|
||||
@@ -463,8 +483,8 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
readStructure(rootFolderRef, 1, 1, new double[] {0.25, 0.50, 0.75});
|
||||
}
|
||||
*/
|
||||
// Load: 800 ordered files per folder (into 3 folders) using 4 threads
|
||||
public void test_4_ordered_3_2_100() throws Exception
|
||||
/** Load: 800 ordered files per folder (into 3 folders) using 4 threads using spoofed text */
|
||||
public void test_4_ordered_3_2_100_spoofed() throws Exception
|
||||
{
|
||||
buildStructure(
|
||||
rootFolderRef,
|
||||
@@ -473,6 +493,7 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
3,
|
||||
2,
|
||||
100,
|
||||
false,
|
||||
new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90});
|
||||
|
||||
System.out.println("rootFolderRef: "+rootFolderRef);
|
||||
@@ -480,8 +501,8 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
readStructure(rootFolderRef, 4, 5, new double[] {0.25, 0.50, 0.75});
|
||||
}
|
||||
|
||||
// Load: 800 shuffled files per folder (into 3 folders) using 4 threads
|
||||
public void test_4_shuffled_3_2_100() throws Exception
|
||||
/** Load: 800 shuffled files per folder (into 3 folders) using 4 threads using spoofed text */
|
||||
public void test_4_shuffled_3_2_100_spoofed() throws Exception
|
||||
{
|
||||
buildStructure(
|
||||
rootFolderRef,
|
||||
@@ -490,6 +511,25 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
3,
|
||||
2,
|
||||
100,
|
||||
false,
|
||||
new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90});
|
||||
|
||||
System.out.println("rootFolderRef: "+rootFolderRef);
|
||||
|
||||
readStructure(rootFolderRef, 4, 5, new double[] {0.25, 0.50, 0.75});
|
||||
}
|
||||
|
||||
/** Load: 800 shuffled files per folder (into 3 folders) using 4 threads using real text */
|
||||
public void test_4_shuffled_3_2_100_real() throws Exception
|
||||
{
|
||||
buildStructure(
|
||||
rootFolderRef,
|
||||
4,
|
||||
true,
|
||||
3,
|
||||
2,
|
||||
100,
|
||||
true,
|
||||
new double[] {0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90});
|
||||
|
||||
System.out.println("rootFolderRef: "+rootFolderRef);
|
||||
@@ -497,23 +537,6 @@ public class FileFolderPerformanceTester extends TestCase
|
||||
readStructure(rootFolderRef, 4, 5, new double[] {0.25, 0.50, 0.75});
|
||||
}
|
||||
|
||||
/*
|
||||
// Load: 50000 ordered files per folder (into 1 folder) using 1 thread
|
||||
public void test_1_ordered_1_5000_10() throws Exception
|
||||
{
|
||||
buildStructure(
|
||||
rootFolderRef,
|
||||
1,
|
||||
false,
|
||||
1,
|
||||
5000,
|
||||
10,
|
||||
new double[] {0.01, 0.02, 0.03, 0.04, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90});
|
||||
|
||||
readStructure(rootFolderRef, 1, 1, new double[] {0.25, 0.50, 0.75});
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a bunch of files and folders in a folder and then run multi-threaded directory
|
||||
* listings against it.
|
||||
|
Reference in New Issue
Block a user