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

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

Introduction

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

Prototype

public static String randomAlphabetic(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 alphabetic characters.

Usage

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testTransitionInvalidPackageId() throws Exception {
    this.workflowManagerSUT.transition(RandomStringUtils.randomAlphabetic(10), createWorkflowTransitionMock(),
            createWorkflowParameters());
}

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testTransitionInvalidTransition() throws Exception {
    this.workflowManagerSUT.transition(RandomStringUtils.randomAlphabetic(10), createWorkflowTransitionMock(),
            createWorkflowParameters());
}

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testTransitionIllegalTransition() throws Exception {
    this.workflowManagerSUT.transition(RandomStringUtils.randomAlphabetic(10), createWorkflowTransitionMock(),
            createWorkflowParameters());
}

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testCancel() throws Exception {
    this.workflowManagerSUT.cancel(RandomStringUtils.randomAlphabetic(10));
}

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testCancelPackageDoesNotExist() throws Exception {
    this.workflowManagerSUT.cancel(RandomStringUtils.randomAlphabetic(10));
}

From source file:org.craftercms.studio.impl.workflow.WorkflowManagerImplTest.java

@Test(expected = StudioException.class)
public void testCancelInvalidPackageId() throws Exception {
    this.workflowManagerSUT.cancel(RandomStringUtils.randomAlphabetic(10));
}

From source file:org.deephacks.confit.serialization.ValueSerializationTest.java

public Collection<String> randomStrings() {
    Collection<String> values = new ArrayList<>();
    for (int i = 0; i < random(randomFieldsNum); i++) {
        values.add(RandomStringUtils.randomAlphabetic(random(255)));
    }//w  w w .  j  av a 2 s.c  o m
    return values;
}

From source file:org.eclipse.smarthome.core.extension.sample.internal.SampleExtensionService.java

protected void activate() {
    types.add(new ExtensionType("binding", "Bindings"));
    types.add(new ExtensionType("ui", "User Interfaces"));
    types.add(new ExtensionType("persistence", "Persistence Services"));

    for (ExtensionType type : types) {
        for (int i = 0; i < 10; i++) {
            String id = type.getId() + Integer.toString(i);
            boolean installed = Math.random() > 0.5;
            String name = RandomStringUtils.randomAlphabetic(5);
            String label = name + " " + StringUtils.capitalize(type.getId());
            String typeId = type.getId();
            String version = "1.0";
            String link = (Math.random() < 0.5) ? null : "http://lmgtfy.com/?q=" + name;
            String description = createDescription();
            String imageLink = null;
            String backgroundColor = createRandomColor();
            Extension extension = new Extension(id, typeId, label, version, link, installed, description,
                    backgroundColor, imageLink);
            extensions.put(extension.getId(), extension);
        }/*from   w  ww  .  j  a  v  a 2  s  .com*/
    }
}

From source file:org.efaps.ui.wicket.components.gridx.filter.FormFilterPanel.java

/**
 * Instantiates a new form filter panel.
 *
 * @param _wicketId the wicket id/*from   ww  w  .  jav  a  2  s .c  o  m*/
 * @param _model the model
 * @param _uiGrid the ui grid
 */
public FormFilterPanel(final String _wicketId, final IModel<IMapFilter> _model, final UIGrid _uiGrid) {
    super(_wicketId);
    final String id = RandomStringUtils.randomAlphabetic(8);
    final LazyIframe frame = new LazyIframe("content", new IFrameProvider() {

        private static final long serialVersionUID = 1L;

        @Override
        public Page getPage() {
            Page error = null;
            WebPage page = null;
            try {
                page = new FormFilterPage(_model, _uiGrid);
            } catch (final EFapsException e) {
                error = new ErrorPage(e);
            }
            return error == null ? page : error;
        }
    }, id);
    frame.setMarkupId(id);
    frame.setOutputMarkupId(true);
    frame.add(new ContentPaneBehavior(null, false));
    this.add(frame);
}

From source file:org.egov.infra.security.utils.SecureCodeUtils.java

public static File generateSecureCode(String content, BarcodeFormat format, int imgWidth, int imgHeight) {
    try {/*w  ww  .j a v a 2  s  . c o m*/
        Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
        hints.put(CHARACTER_SET, encoding());
        hints.put(MARGIN, 1);
        BitMatrix secureCodeMatrix = new MultiFormatWriter().encode(content, format, imgWidth, imgHeight,
                hints);
        Path secureCodePath = Files.createTempFile(RandomStringUtils.randomAlphabetic(5), PNG_EXTN);
        MatrixToImageWriter.writeToPath(secureCodeMatrix, PNG_FORMAT_NAME, secureCodePath);
        return secureCodePath.toFile();
    } catch (WriterException | IOException e) {
        throw new ApplicationRuntimeException("Error occurred while generating Secure Code", e);
    }
}