Class RandomTextSourceNode
- java.lang.Object
-
- org.nuxeo.ecm.platform.importer.source.RandomTextSourceNode
-
- All Implemented Interfaces:
SourceNode
public class RandomTextSourceNode extends Object implements SourceNode
RandomSourceNode
to be used for load testing- Author:
- Thierry Delprat
-
-
Field Summary
Fields Modifier and Type Field Description static int
BIG_NB_NODES_FACTOR
Used to generate a big number of children nodes whennonUniformRepartition
istrue
.protected static Integer
blobSizeInKB
protected static boolean
CACHE_CHILDREN
protected List<SourceNode>
cachedChildren
protected static String[]
DC_COVERAGE
protected static String[]
DC_LANGUAGE
protected static String[]
DC_NATURE
protected static String[]
DC_RIGHTS
protected static String[]
DC_SOURCE
protected static String[]
DC_SUBJECTS
static int
DEFAULT_NB_DATA_NODES_PER_FOLDER
protected boolean
folderish
protected static RandomTextGenerator
gen
protected int
idx
protected int
level
static int
MAX_DEPTH
protected static int
maxNode
protected static int
minFoldersPerNode
protected static int
minGlobalFolders
protected String
name
protected static AtomicInteger
nbFolders
protected static AtomicInteger
nbNodes
protected static AtomicInteger
nbVisitedFolders
protected static boolean
nonUniformRepartition
Used ingetMaxChildren()
andgetMaxFolderish()
.protected boolean
onlyText
protected static Random
RANDOM
protected static AtomicLong
size
static int
SMALL_NB_BODES_DIVIDER
Used to generate a small number of children nodes whennonUniformRepartition
istrue
.protected boolean
withProperties
-
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 BlobHolder
getBlobHolder()
protected String
getBlobMimeType()
List<SourceNode>
getChildren()
protected String
getGaussian(String[] words)
int
getLevel()
protected int
getMaxChildren()
protected int
getMaxFolderish()
protected int
getMidRandom(int target)
String
getName()
static Integer
getNbNodes()
protected int
getNonUniform(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 Long
getSize()
String
getSourcePath()
static RandomTextSourceNode
init(int maxSize)
static RandomTextSourceNode
init(int maxSize, Integer blobSizeInKB, boolean onlyText)
static RandomTextSourceNode
init(int maxSize, Integer blobSizeInKB, boolean onlyText, boolean nonUniform, boolean withProperties, String lang)
static RandomTextSourceNode
init(int maxSize, Integer blobSizeInKB, boolean onlyText, DictionaryHolder dictionaryHolder, boolean nonUniform, boolean withProperties)
boolean
isFolderish()
-
-
-
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 whennonUniformRepartition
istrue
.- 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 whennonUniformRepartition
istrue
.- 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:
getBlobHolder
in 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:
getChildren
in interfaceSourceNode
-
getName
public String getName()
- Specified by:
getName
in interfaceSourceNode
-
isFolderish
public boolean isFolderish()
- Specified by:
isFolderish
in interfaceSourceNode
-
getNbNodes
public static Integer getNbNodes()
-
getSize
public static Long getSize()
-
getLevel
public int getLevel()
-
getSourcePath
public String getSourcePath()
- Specified by:
getSourcePath
in interfaceSourceNode
-
-