List of usage examples for org.apache.commons.lang RandomStringUtils randomNumeric
public static String randomNumeric(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of numeric characters.
From source file:org.talend.components.azurestorage.AzureStorageBaseTestIT.java
public static String getRandomTestUID() { return RandomStringUtils.randomNumeric(10); }
From source file:org.talend.components.azurestorage.table.runtime.it.TAzureStorageInputTableTestIT.java
public void createSampleDataset(String table) throws Throwable { tableClient.getTableReference(table).createIfNotExists(); TAzureStorageOutputTableProperties props = new TAzureStorageOutputTableProperties("tests"); props = (TAzureStorageOutputTableProperties) setupConnectionProperties(props); props.setupProperties();/* w ww . j a v a2s .c o m*/ props.schema.schema.setValue(getDynamicSchema()); props.actionOnTable.setValue(ActionOnTable.Default); props.actionOnData.setValue(ActionOnData.Insert); props.schemaListener.afterSchema(); props.tableName.setValue(table); Writer<?> writer = createWriter(props); writer.open("test-uid"); for (String p : partitions) { for (String r : rows) { IndexedRecord entity = new GenericData.Record(getWriteSchema()); entity.put(0, p); entity.put(1, r); entity.put(2, RandomStringUtils.random(50)); entity.put(3, RandomStringUtils.randomNumeric(10)); writer.write(entity); } } writer.close(); }
From source file:org.trustedanalytics.servicebroker.gearpump.service.externals.GearPumpDriverExec.java
private String createOutputReportFilePath(String gearPumpDestinationFolderPath) { return String.format("%s/output-%d-%s.conf", gearPumpDestinationFolderPath, System.currentTimeMillis(), RandomStringUtils.randomNumeric(4)); }
From source file:rascal.storage.AbstractTempDirectoryIntegrationTest.java
@Before public void setUpTempDirectory() throws IOException { File tempDirRoot = new File(System.getProperty("java.io.tmpdir")); tempDir = new File(tempDirRoot, TEMP_DIR_NAME_PREFIX + RandomStringUtils.randomNumeric(TEMP_DIR_SUFFIX_LENGTH)); if (!tempDir.mkdir()) { throw new IOException("Can't create temprorary directory for testing"); }//from w ww . jav a2 s . c om }
From source file:rascal.storage.loose.LooseStorageNodeWritableChannel.java
private void initObjectFile() throws IOException { File objectDir = storageLayout.getObjectDirForName(objectName); if (!objectDir.isDirectory()) { if (objectDir.exists() || !objectDir.mkdir()) { throw new IOException("Can't create object directory"); }/*from w w w. j a v a 2 s.com*/ } tempObjectFile = new File(objectDir, TEMP_FILE_NAME_PREFIX + RandomStringUtils.randomNumeric(TEMP_FILE_NAME_SUFFEX_LENGTH)); if (!tempObjectFile.createNewFile()) { throw new IOException("Can't create temp file for object"); } realObjectFile = storageLayout.getObjectFileForName(objectName); initTempObjectFileChannel(); }
From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java
/** * Non-persistent/*from w w w .ja va2s.c o m*/ * * @return */ public ExperimentalDesign getExperimentalDesign(Collection<FactorValue> allFactorValues) { ExperimentalDesign ed = ExperimentalDesign.Factory.newInstance(); ed.setName("Experimental Design " + RandomStringUtils.randomNumeric(10)); ed.setDescription(RandomStringUtils.randomNumeric(10) + ": A test experimental design."); log.debug("experimental design => experimental factors"); ed.setExperimentalFactors(getExperimentalFactors(ed, allFactorValues)); // set test experimental factors return ed; }
From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java
/** * @return/*from w w w.ja v a 2s.c om*/ */ protected Collection<ExperimentalFactor> getExperimentalFactors(ExperimentalDesign ed, Collection<FactorValue> allFactorValues) { Collection<ExperimentalFactor> efCol = new HashSet<ExperimentalFactor>(); for (int i = 0; i < NUM_EXPERIMENTAL_FACTORS; i++) { ExperimentalFactor ef = ExperimentalFactor.Factory.newInstance(); ef.setExperimentalDesign(ed); ef.setName("Experimental Factor " + RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); ef.setDescription(i + ": A test experimental factor"); ef.setType(FactorType.CATEGORICAL); VocabCharacteristic c = VocabCharacteristic.Factory.newInstance(); c.setCategory("OrganismPart"); c.setName("OrganismPart"); ef.setCategory(c); log.debug("experimental factor => factor values"); ef.setFactorValues(getFactorValues(ef, allFactorValues)); efCol.add(ef); } return efCol; }
From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java
/** * @return Collection//from w ww. j a v a 2 s .co m */ protected Collection<FactorValue> getFactorValues(ExperimentalFactor ef, Collection<FactorValue> allFactorValues) { Collection<FactorValue> fvCol = new HashSet<FactorValue>(); for (int i = 0; i < NUM_FACTOR_VALUES; i++) { FactorValue fv = FactorValue.Factory.newInstance(); fv.setValue("Factor value " + RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); fv.setExperimentalFactor(ef); fvCol.add(fv); } allFactorValues.addAll(fvCol); return fvCol; }
From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java
/** * @return A lighter-weight EE, with no data, and the ADs have no sequences. *//* w ww. j a v a 2 s . c om*/ public ExpressionExperiment getTestPersistentBasicExpressionExperiment() { ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance(); ee.setShortName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); ee.setName("Expression Experiment " + RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); ee.setDescription("A test expression experiment"); ee.setSource("http://www.ncbi.nlm.nih.gov/geo/"); DatabaseEntry de1 = this.getTestPersistentDatabaseEntry(geo); ee.setAccession(de1); ArrayDesign adA = this.getTestPersistentArrayDesign(0, false, false); ArrayDesign adB = this.getTestPersistentArrayDesign(0, false, false); Collection<FactorValue> allFactorValues = new HashSet<FactorValue>(); ExperimentalDesign ed = getExperimentalDesign(allFactorValues); ee.setExperimentalDesign(ed); ee.setOwner(this.getTestPersistentContact()); Collection<BioAssay> bioAssays = new HashSet<BioAssay>(); Collection<BioMaterial> bioMaterials = getBioMaterials(allFactorValues); Collection<BioAssay> bioAssaysA = getBioAssays(bioMaterials, adA); Collection<BioAssay> bioAssaysB = getBioAssays(bioMaterials, adB); bioAssays.addAll(bioAssaysA); bioAssays.addAll(bioAssaysB); ee.setBioAssays(bioAssays); Collection<QuantitationType> quantitationTypes = new HashSet<QuantitationType>(); for (int quantitationTypeNum = 0; quantitationTypeNum < NUM_QUANTITATION_TYPES; quantitationTypeNum++) { QuantitationType q = getTestNonPersistentQuantitationType(); if (quantitationTypes.size() == 0) { q.setIsPreferred(true); } quantitationTypes.add(q); } assert quantitationTypes.size() > 0; ee.setQuantitationTypes(quantitationTypes); ee = (ExpressionExperiment) persisterHelper.persist(ee); return ee; }
From source file:ubic.gemma.testing.PersistentDummyObjectHelper.java
/** * Add an expressionExperiment to the database for testing purposes. Includes associations * /*from www . ja va 2s . c o m*/ * @param dosequence Should the array design get all the sequence information filled in? (true = slower) */ public ExpressionExperiment getTestExpressionExperimentWithAllDependencies(boolean dosequence) { ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance(); ee.setShortName(RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); ee.setName("Expression Experiment " + RandomStringUtils.randomNumeric(RANDOM_STRING_LENGTH)); ee.setDescription("A test expression experiment"); ee.setSource("http://www.ncbi.nlm.nih.gov/geo/"); DatabaseEntry de1 = this.getTestPersistentDatabaseEntry(geo); ee.setAccession(de1); LocalFile file = LocalFile.Factory.newInstance(); try { file.setLocalURL(new URL("file:///just/a/placeholder/" + ee.getShortName())); } catch (MalformedURLException e) { } ee.setRawDataFile(file); ArrayDesign adA = this.getTestPersistentArrayDesign(this.getTestElementCollectionSize(), false, dosequence); ArrayDesign adB = this.getTestPersistentArrayDesign(this.getTestElementCollectionSize(), false, dosequence); Collection<FactorValue> allFactorValues = new HashSet<FactorValue>(); ExperimentalDesign ed = getExperimentalDesign(allFactorValues); ee.setExperimentalDesign(ed); ee.setOwner(this.getTestPersistentContact()); Collection<BioAssay> bioAssays = new HashSet<BioAssay>(); Collection<BioMaterial> bioMaterials = getBioMaterials(allFactorValues); Collection<BioAssay> bioAssaysA = getBioAssays(bioMaterials, adA); Collection<BioAssay> bioAssaysB = getBioAssays(bioMaterials, adB); bioAssays.addAll(bioAssaysA); bioAssays.addAll(bioAssaysB); ee.setBioAssays(bioAssays); log.debug("expression experiment => design element data vectors"); Collection<RawExpressionDataVector> vectors = new HashSet<RawExpressionDataVector>(); Collection<QuantitationType> quantitationTypes = new HashSet<QuantitationType>(); for (int quantitationTypeNum = 0; quantitationTypeNum < NUM_QUANTITATION_TYPES; quantitationTypeNum++) { QuantitationType q = getTestNonPersistentQuantitationType(); if (quantitationTypes.size() == 0) { q.setIsPreferred(true); } quantitationTypes.add(q); } assert quantitationTypes.size() > 0; vectors.addAll(getDesignElementDataVectors(ee, quantitationTypes, bioAssaysA, adA)); vectors.addAll(getDesignElementDataVectors(ee, quantitationTypes, bioAssaysB, adB)); ee.setQuantitationTypes(quantitationTypes); ee.setRawExpressionDataVectors(vectors); ArrayDesignsForExperimentCache c = persisterHelper.prepare(ee); ee = persisterHelper.persist(ee, c); return ee; }