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.AbstractManagerTest.java

protected DeploymentChannel createDeploymentChannelMock() {
    DeploymentChannel channel = new DeploymentChannel();
    channel.setVersionUrl(RandomStringUtils.randomAlphabetic(150));
    channel.setType(RandomStringUtils.randomAlphabetic(10));
    channel.setTarget(RandomStringUtils.randomAlphanumeric(20));
    channel.setStatusUrl(RandomStringUtils.randomAlphabetic(150));
    channel.setDisabled(false);/* w  w w .  j a  v  a2s  . c om*/
    channel.setId(UUID.randomUUID().toString());
    channel.setName(RandomStringUtils.randomAlphabetic(15));
    channel.setExcludePatterns(createStringListMock());
    channel.setIncludePatterns(createStringListMock());
    channel.setHost(RandomStringUtils.randomAlphabetic(10));
    channel.setPort(RandomStringUtils.randomNumeric(4));
    channel.setPublishingUrl(RandomStringUtils.randomAlphabetic(150));
    channel.setPublishMetadata(false);
    return channel;
}

From source file:org.craftercms.studio.impl.AbstractManagerTest.java

protected Activity createActivityMock() {
    Activity activity = new Activity();
    activity.setId(UUID.randomUUID().toString());
    activity.setCreator(RandomStringUtils.randomAlphabetic(10));
    activity.setDate(new Date());
    activity.setSiteId(RandomStringUtils.randomAlphabetic(10));
    activity.setSiteName(RandomStringUtils.randomAlphabetic(20));
    activity.setTarget(RandomStringUtils.randomAlphanumeric(20));
    Map<String, Object> props = new HashMap<String, Object>();
    props.put("param1", "param1");
    props.put("param2", "param2");
    activity.setTargetProperties(props);
    activity.setType(RandomStringUtils.randomAlphabetic(10));
    return activity;
}

From source file:org.craftercms.studio.impl.AbstractManagerTest.java

protected FormDefinition createFormDefinitionMock() {
    FormDefinition form = new FormDefinition();
    form.setId(UUID.randomUUID().toString());
    form.setName(RandomStringUtils.randomAlphabetic(20));
    form.setSiteName(RandomStringUtils.randomAlphabetic(10));
    form.setSiteId(RandomStringUtils.randomAlphabetic(10));
    Map<String, Object> schema = new HashMap<String, Object>();
    schema.put("param1", "param1");
    schema.put("param2", "param2");
    form.setSchema(schema);/*from w w  w.j a v  a 2s .com*/
    return form;
}

From source file:org.craftercms.studio.impl.AbstractManagerTest.java

protected Map<String, Object> createMapMock() {
    Map<String, Object> map = new HashMap<String, Object>();
    for (int i = 0; i < 5 + (int) (Math.random() * ((10 - 5) + 1)); i++) {
        map.put(RandomStringUtils.randomAlphabetic(10), RandomStringUtils.randomAlphanumeric(20));
    }//  w  w  w.  j a  va  2s  . c  o m
    return map;
}

From source file:org.craftercms.studio.impl.AbstractServiceTest.java

protected Item createItemMock() {
    Item item = new Item();
    item.setContentType(RandomStringUtils.randomAlphabetic(10));
    item.setDisabled(false);//from  w w w.  j  a v  a2s  .c  o m
    item.setFileName(RandomStringUtils.randomAlphanumeric(10));
    item.setId(new ItemId(UUID.randomUUID().toString()));
    item.setLastModifiedDate(new Date());
    item.setLockOwner(RandomStringUtils.randomAlphabetic(10));
    item.setMimeType(RandomStringUtils.randomAlphabetic(10));
    item.setPackages(new ArrayList<String>());
    item.setPath(RandomStringUtils.randomAlphabetic(100));
    item.setPlaceInNav(true);
    item.setPreviewUrl(RandomStringUtils.randomAlphabetic(100));
    item.setProperties(new HashMap<String, Object>());
    item.setRenderingTemplates(new ArrayList<String>());
    item.setRepoId(RandomStringUtils.randomAlphabetic(10));
    item.setScheduledDate(new Date());
    item.setState(RandomStringUtils.randomAlphabetic(10));
    item.setLabel(RandomStringUtils.randomAlphabetic(10));
    InputStream sampleContent = this.getClass().getResourceAsStream("/content/sample.xml");
    item.setInputStream(sampleContent);
    return item;
}

From source file:org.craftercms.studio.impl.AbstractServiceTest.java

protected Activity createActivityMock() {
    Activity activity = new Activity();
    activity.setId(UUID.randomUUID().toString());
    activity.setCreator(RandomStringUtils.randomAlphabetic(10));
    activity.setDate(new Date());
    activity.setSiteId(RandomStringUtils.randomAlphabetic(10));
    activity.setSiteName(RandomStringUtils.randomAlphabetic(20));
    activity.setTarget(RandomStringUtils.randomAlphanumeric(20));
    Map<String, String> props = new HashMap<String, String>();
    props.put("param1", "param1");
    props.put("param2", "param2");
    activity.setTargetProperties(props);
    activity.setType(RandomStringUtils.randomAlphabetic(10));
    return activity;
}

From source file:org.craftercms.studio.impl.AbstractServiceTest.java

protected Form createFormDefinitionMock() {
    Form form = new Form();
    form.setId(UUID.randomUUID().toString());
    form.setName(RandomStringUtils.randomAlphabetic(20));
    form.setSiteName(RandomStringUtils.randomAlphabetic(10));
    form.setSiteId(RandomStringUtils.randomAlphabetic(10));
    Map<String, Object> schema = new HashMap<String, Object>();
    schema.put("param1", "param1");
    schema.put("param2", "param2");
    form.setSchema(schema);/*from ww  w . j av a 2  s. c o  m*/
    return form;
}

From source file:org.craftercms.studio.impl.audit.AuditManagerImplTest.java

@Test(expected = StudioException.class)
public void testGetActivities() throws Exception {
    this.auditManagerSUT.getActivities(null, RandomStringUtils.randomAlphabetic(10), createStringListMock());
}

From source file:org.craftercms.studio.impl.audit.AuditManagerImplTest.java

@Test(expected = StudioException.class)
public void testGetActivitiesInvalidSite() throws Exception {
    this.auditManagerSUT.getActivities(null, RandomStringUtils.randomAlphabetic(10), createStringListMock());
}

From source file:org.craftercms.studio.impl.audit.AuditManagerImplTest.java

@Test(expected = StudioException.class)
public void testLogActivity() throws Exception {
    this.auditManagerSUT.logActivity(null, RandomStringUtils.randomAlphabetic(10), createActivityMock());
}