Class RandomTextSourceNode
- java.lang.Object
-
- org.nuxeo.ecm.platform.importer.source.RandomTextSourceNode
-
- All Implemented Interfaces:
SourceNode
public class RandomTextSourceNode extends Object implements SourceNode
RandomSourceNodeto be used for load testing- Author:
- Thierry Delprat
-
-
Field Summary
Fields Modifier and Type Field Description static intBIG_NB_NODES_FACTORUsed to generate a big number of children nodes whennonUniformRepartitionistrue.protected static IntegerblobSizeInKBprotected static booleanCACHE_CHILDRENprotected List<SourceNode>cachedChildrenprotected static String[]DC_COVERAGEprotected static String[]DC_LANGUAGEprotected static String[]DC_NATUREprotected static String[]DC_RIGHTSprotected static String[]DC_SOURCEprotected static String[]DC_SUBJECTSstatic intDEFAULT_NB_DATA_NODES_PER_FOLDERprotected booleanfolderishprotected static RandomTextGeneratorgenprotected intidxprotected intlevelstatic intMAX_DEPTHprotected static intmaxNodeprotected static intminFoldersPerNodeprotected static intminGlobalFoldersprotected Stringnameprotected static AtomicIntegernbFoldersprotected static AtomicIntegernbNodesprotected static AtomicIntegernbVisitedFoldersprotected static booleannonUniformRepartitionUsed ingetMaxChildren()andgetMaxFolderish().protected booleanonlyTextprotected static RandomRANDOMprotected static AtomicLongsizestatic intSMALL_NB_BODES_DIVIDERUsed to generate a small number of children nodes whennonUniformRepartitionistrue.protected booleanwithProperties
-
Constructor Summary
Constructors Constructor Description RandomTextSourceNode(boolean folderish, int level, int idx, boolean onlyText)RandomTextSourceNode(boolean folderish, int level, int idx, boolean onlyText, boolean withProperties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BlobHoldergetBlobHolder()protected StringgetBlobMimeType()List<SourceNode>getChildren()protected StringgetGaussian(String[] words)intgetLevel()protected intgetMaxChildren()protected intgetMaxFolderish()protected intgetMidRandom(int target)StringgetName()static IntegergetNbNodes()protected intgetNonUniform(int target, boolean folderish)Allows to get a non uniform distribution of the number of nodes per folder.protected Map<String,Serializable>getRandomProperties(String content)static LonggetSize()StringgetSourcePath()static RandomTextSourceNodeinit(int maxSize)static RandomTextSourceNodeinit(int maxSize, Integer blobSizeInKB, boolean onlyText)static RandomTextSourceNodeinit(int maxSize, Integer blobSizeInKB, boolean onlyText, boolean nonUniform, boolean withProperties, String lang)static RandomTextSourceNodeinit(int maxSize, Integer blobSizeInKB, boolean onlyText, DictionaryHolder dictionaryHolder, boolean nonUniform, boolean withProperties)booleanisFolderish()
-
-
-
Field Detail
-
gen
protected static RandomTextGenerator gen
-
maxNode
protected static int maxNode
-
nonUniformRepartition
protected static boolean nonUniformRepartition
Used ingetMaxChildren()andgetMaxFolderish().
-
MAX_DEPTH
public static final int MAX_DEPTH
- See Also:
- Constant Field Values
-
DEFAULT_NB_DATA_NODES_PER_FOLDER
public static final int DEFAULT_NB_DATA_NODES_PER_FOLDER
- See Also:
- Constant Field Values
-
BIG_NB_NODES_FACTOR
public static final int BIG_NB_NODES_FACTOR
Used to generate a big number of children nodes whennonUniformRepartitionistrue.- See Also:
- Constant Field Values
-
SMALL_NB_BODES_DIVIDER
public static final int SMALL_NB_BODES_DIVIDER
Used to generate a small number of children nodes whennonUniformRepartitionistrue.- See Also:
- Constant Field Values
-
minGlobalFolders
protected static int minGlobalFolders
-
minFoldersPerNode
protected static int minFoldersPerNode
-
nbNodes
protected static AtomicInteger nbNodes
-
nbFolders
protected static AtomicInteger nbFolders
-
nbVisitedFolders
protected static AtomicInteger nbVisitedFolders
-
size
protected static AtomicLong size
-
RANDOM
protected static final Random RANDOM
-
name
protected String name
-
folderish
protected boolean folderish
-
level
protected int level
-
idx
protected int idx
-
blobSizeInKB
protected static Integer blobSizeInKB
-
cachedChildren
protected List<SourceNode> cachedChildren
-
CACHE_CHILDREN
protected static final boolean CACHE_CHILDREN
- See Also:
- Constant Field Values
-
onlyText
protected boolean onlyText
-
withProperties
protected boolean withProperties
-
DC_NATURE
protected static final String[] DC_NATURE
-
DC_SUBJECTS
protected static final String[] DC_SUBJECTS
-
DC_RIGHTS
protected static final String[] DC_RIGHTS
-
DC_LANGUAGE
protected static final String[] DC_LANGUAGE
-
DC_SOURCE
protected static final String[] DC_SOURCE
-
DC_COVERAGE
protected static final String[] DC_COVERAGE
-
-
Method Detail
-
init
public static RandomTextSourceNode init(int maxSize)
-
init
public static RandomTextSourceNode init(int maxSize, Integer blobSizeInKB, boolean onlyText)
-
init
public static RandomTextSourceNode init(int maxSize, Integer blobSizeInKB, boolean onlyText, boolean nonUniform, boolean withProperties, String lang)
-
init
public static RandomTextSourceNode init(int maxSize, Integer blobSizeInKB, boolean onlyText, DictionaryHolder dictionaryHolder, boolean nonUniform, boolean withProperties)
-
getBlobMimeType
protected String getBlobMimeType()
-
getBlobHolder
public BlobHolder getBlobHolder()
- Specified by:
getBlobHolderin interfaceSourceNode
-
getRandomProperties
protected Map<String,Serializable> getRandomProperties(String content)
-
getMidRandom
protected int getMidRandom(int target)
-
getNonUniform
protected int getNonUniform(int target, boolean folderish)Allows to get a non uniform distribution of the number of nodes per folder. Returns:- A small number of nodes 10% of the time, see
SMALL_NB_BODES_DIVIDER. - A big number of nodes 10% of the time, see
BIG_NB_NODES_FACTOR. - A random variation of the target number of nodes 80% of the time.
- A small number of nodes 10% of the time, see
-
getMaxChildren
protected int getMaxChildren()
-
getMaxFolderish
protected int getMaxFolderish()
-
getChildren
public List<SourceNode> getChildren()
- Specified by:
getChildrenin interfaceSourceNode
-
getName
public String getName()
- Specified by:
getNamein interfaceSourceNode
-
isFolderish
public boolean isFolderish()
- Specified by:
isFolderishin interfaceSourceNode
-
getNbNodes
public static Integer getNbNodes()
-
getSize
public static Long getSize()
-
getLevel
public int getLevel()
-
getSourcePath
public String getSourcePath()
- Specified by:
getSourcePathin interfaceSourceNode
-
-