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

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

Introduction

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

Prototype

public static String randomAlphanumeric(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 alpha-numeric characters.

Usage

From source file:ca.quadrilateral.btester.propertygenerator.RandomCharacterPropertyGenerator.java

public Character generateProperty() {
    return RandomStringUtils.randomAlphanumeric(1).charAt(0);
}

From source file:com.bstek.dorado.view.widget.base.toolbar.MenuButton.java

protected Menu getEmbededMenu(boolean create) {
    Menu menu = embededMenuRef.get();
    if (menu == null && create) {
        String menuId = RandomStringUtils.randomAlphanumeric(16);
        menu = new Menu();
        menu.setId(menuId);//from w  w w  .ja  v a 2 s . com
        embededMenuRef.set(menu);
        super.setMenu(menuId);
    }
    return menu;
}

From source file:net.sourceforge.fenixedu.domain.ExternalApplication.java

public ExternalApplication() {
    super();
    setRootDomainObject(Bennu.getInstance());
    setSecret(RandomStringUtils.randomAlphanumeric(115));
    setState(ExternalApplicationState.ACTIVE);
}

From source file:com.tango.BucketSyncer.S32GCSMirrorTest.java

public static String random(int size) {
    return RandomStringUtils.randomAlphanumeric(size) + "_" + System.currentTimeMillis();
}

From source file:com.xtructure.xevolution.operator.impl.UTestCopyMutateOperator.java

License:asdf

public void crossoverReturnsExpectedGenome() throws OperationFailedException {
    Genome<String> g1 = new GenomeImpl(1, RandomStringUtils.randomAlphanumeric(10));

    Genome<String> child = new CopyMutateOperator<String>(GENETICS_FACTORY).mutate(99, g1);
    assertThat("", //
            child.getId(), isEqualTo(g1.getBaseId().createChild(99)));
    assertThat("", //
            child.getData(), isEqualTo(g1.getData()));
}

From source file:com.kixeye.chassis.scala.transport.serde.ScalaCaseClassTest.java

@Test
public void testJsonSerDe() throws Exception {
    final JsonJacksonMessageSerDe serDe = new JsonJacksonMessageSerDe();

    final TestObject obj = new TestObject(RandomStringUtils.randomAlphanumeric(64),
            new SomeOtherObject(RandomStringUtils.randomAlphanumeric(64)));

    final byte[] serializedObj = serDe.serialize(obj);

    dumpToLog(serDe, serializedObj);//  w w  w . jav a  2  s  . c o m

    final TestObject deserializedObj = serDe.deserialize(serializedObj, 0, serializedObj.length,
            TestObject.class);

    Assert.assertEquals(obj, deserializedObj);
}

From source file:eu.vital.vitalcep.cep.CepProcess.java

public void startCEP() throws FileNotFoundException, IOException {

    this.fileName = RandomStringUtils.randomAlphanumeric(8);

    try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(cepFolder//+"/"+dolceFile
            + "/" + fileName + "_dolce"), "utf-8"))) {
        writer.write(dolce);/*from  w w w.  j  a  v a  2s  .  c  o  m*/
        writer.close();

        String cmd = cepFolder + "/bcep -d " + cepFolder + "/" + fileName + "_dolce -mi " + mqin + " -mo "
                + mqout + " -f " + cepFolder + "/" + confFile + " &>/dev/null &";

        logger.debug("starting bCEP with command: " + cmd);
        try {

            Process pr = Runtime.getRuntime().exec(cmd);

            is = pr.getInputStream();
            es = pr.getErrorStream();

            be = new Buffer_eraser();
            be.start();

            PID = getPid(pr);

            if (PID == -1) {
                java.util.logging.Logger.getLogger(CepProcess.class.getName()).log(Level.SEVERE,
                        "couldn't create the process");
                isUp = false;
            } else {
                isUp = true;
                logger.debug("new bCEP created: " + PID);
                logger.debug("mqin: " + mqin);
                logger.debug("mqout: " + mqout);
            }
        } catch (IOException e) {
            java.util.logging.Logger.getLogger(CepProcess.class.getName()).log(Level.SEVERE, e.getMessage());
            PID = -3;
            isUp = false;

        }
    } catch (IOException ex) {
        PID = -2;
        isUp = false;
        this.fileName = "";
        java.util.logging.Logger.getLogger(CepProcess.class.getName()).log(Level.SEVERE, ex.getMessage());
    }

}

From source file:io.fabric8.kubernetes.ResourceIT.java

@Before
public void init() {
    currentNamespace = session.getNamespace();
    pod1 = new PodBuilder().withNewMetadata()
            .withName("resource-pod-" + RandomStringUtils.randomAlphanumeric(6).toLowerCase()).endMetadata()
            .withNewSpec().addNewContainer().withName("nginx").withImage("nginx").endContainer().endSpec()
            .build();//from  w ww .  j ava  2s .  c  o m

    client.resource(pod1).inNamespace(currentNamespace).createOrReplace();
}

From source file:com.tera.gapi.itest.service.CAccountPoolService.java

@Override
public void ensureCapacity(int capacity) {
    for (int i = 0; i < capacity + EXTRA_CAPACITY; i++) {
        String accountName = "INT_TEST_" + RandomStringUtils.randomAlphanumeric(10);
        requestedAccountNames.add(accountName);
        accountChangeService.newAccount(accountName);
    }/*w w  w.j ava2 s.c  o  m*/
    validateCapacity(capacity);
    log.info("Set account capacity to {}", this.capacity);
}

From source file:net.nelz.simplesm.aop.UpdateMultiCacheAdviceTest.java

@Test
public void testGetCacheKeys() throws Exception {
    final int size = 10;
    final List<Object> sources = new ArrayList<Object>();
    for (int ix = 0; ix < size; ix++) {
        sources.add(RandomStringUtils.randomAlphanumeric(3 + ix));
    }//  www  .  j av  a 2s.c o m

    final String namespace = RandomStringUtils.randomAlphabetic(20);
    final AnnotationData annotationData = new AnnotationData();
    annotationData.setNamespace(namespace);
    final List<String> results = cut.getCacheKeys(sources, annotationData);

    assertEquals(size, results.size());
    for (int ix = 0; ix < size; ix++) {
        final String result = results.get(ix);
        assertTrue(result.indexOf(namespace) != -1);
        final String source = (String) sources.get(ix);
        assertTrue(result.indexOf(source) != -1);
    }
}