Example usage for org.apache.commons.lang RandomStringUtils randomNumeric

List of usage examples for org.apache.commons.lang RandomStringUtils randomNumeric

Introduction

In this page you can find the example usage for org.apache.commons.lang RandomStringUtils randomNumeric.

Prototype

public static String randomNumeric(int count) 

Source Link

Document

Creates a random string whose length is the number of characters specified.

Characters will be chosen from the set of numeric characters.

Usage

From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java

/**
 * Convenience method to provide an ExpressionExperiment that can be used to fill non-nullable associations in test
 * objects. This implementation does NOT fill in associations of the created object.
 * //from w w w.ja  v  a2 s.  c  om
 * @return
 */
public ExpressionExperiment getTestPersistentExpressionExperiment(Collection<BioAssay> bioAssays) {
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    ee.setName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH) + "_testee");
    ee.setBioAssays(bioAssays);
    ee = (ExpressionExperiment) persisterHelper.persist(ee);
    return ee;
}

From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java

/**
 * Convenience method to provide an ExpressionExperiment that can be used to fill non-nullable associations in test
 * objects. This implementation does NOT fill in associations of the created object except for the creation of
 * persistent BioMaterials and BioAssays so that database taxon lookups for this experiment will work.
 * /*www.  j av a 2s. com*/
 * @param taxon the experiment will have this taxon
 * @return
 */
public ExpressionExperiment getTestPersistentExpressionExperiment(Taxon taxon) {
    BioAssay ba = null;
    BioMaterial bm = null;
    ArrayDesign ad = null;

    bm = this.getTestPersistentBioMaterial(taxon);
    ad = this.getTestPersistentArrayDesign(4, true, true);
    ba = this.getTestPersistentBioAssay(ad, bm);
    Set<BioAssay> bas1 = new HashSet<BioAssay>();
    bas1.add(ba);

    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    ee.setName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH) + "_testee");
    ee.setShortName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH) + "_testee");
    ee.setBioAssays(bas1);
    ee.setExperimentalDesign(ExperimentalDesign.Factory.newInstance());
    ee = (ExpressionExperiment) persisterHelper.persist(ee);
    return ee;
}

From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java

/**
 * Note that if you want a 'preferred' qt or other special properites you have to set it yourself.
 * /*from  www .j a v  a 2s  .  co m*/
 * @return
 */
public static QuantitationType getTestNonPersistentQuantitationType() {
    QuantitationType qt = QuantitationType.Factory.newInstance();
    qt.setName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH) + "_testqt");
    qt.setDescription(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH) + "_testqt");
    qt.setRepresentation(PrimitiveType.DOUBLE);
    qt.setIsBackground(false);
    qt.setIsBackgroundSubtracted(false);
    qt.setIsNormalized(false);
    qt.setIsPreferred(false);
    qt.setIsRatio(false);
    qt.setIsMaskedPreferred(false);
    qt.setGeneralType(GeneralType.QUANTITATIVE);
    qt.setType(StandardQuantitationType.AMOUNT);
    qt.setScale(ScaleType.LINEAR);
    return qt;
}