Example usage for java.util UUID randomUUID

List of usage examples for java.util UUID randomUUID

Introduction

In this page you can find the example usage for java.util UUID randomUUID.

Prototype

public static UUID randomUUID() 

Source Link

Document

Static factory to retrieve a type 4 (pseudo randomly generated) UUID.

Usage

From source file:com.netflix.genie.web.data.entities.FileEntityTest.java

/**
 * Make sure we can create a file.//from   w ww  .j ava  2s.  c o  m
 */
@Test
public void canCreateFileEntity() {
    final FileEntity fileEntity = new FileEntity();
    final String file = UUID.randomUUID().toString();
    fileEntity.setFile(file);
    Assert.assertThat(fileEntity.getFile(), Matchers.is(file));
}

From source file:com.github.horrorho.inflatabledonkey.cloudkitty.CloudKitty.java

public static CloudKitty backupd(CKInit ckInit, String cloudKitToken) {

    String container = "com.apple.backup.ios";
    String bundle = "com.apple.backupd";

    String cloudKitUserId = ckInit.cloudKitUserId();
    String baseUrl = ckInit.production().url();

    String deviceID = UUID.randomUUID().toString();
    String deviceHardwareID = new BigInteger(256, ThreadLocalRandom.current()).toString(16)
            .toUpperCase(Locale.US);

    RequestOperationFactory factory = new RequestOperationFactory(cloudKitUserId, container, bundle,
            deviceHardwareID, deviceID);

    InputStreamResponseHandler<List<CloudKit.ResponseOperation>> responseHandler = new InputStreamResponseHandler<>(
            new RawProtoDecoderLogger(null));

    return new CloudKitty(factory, container, bundle, cloudKitUserId, cloudKitToken, baseUrl, responseHandler);
}

From source file:com.cubeia.backoffice.wallet.manager.ExternalAccountManagerMockImpl.java

@Override
public String withdraw(BigDecimal amount, String externalUserId, long licenseeId) {
    String xid = UUID.randomUUID().toString();
    log.debug("withdraw external, amount = " + amount + ", xUId = " + externalUserId + ", licenseeId = "
            + licenseeId + ", xTId = " + xid);
    return xid;//from   w w  w .java2  s  .  co  m
}

From source file:org.pikax.log.generator.process.v1.LogGeneratorV1.java

/**
 * {@inheritDoc}// w  ww.  j  a  va  2  s .c om
 * 
 * @see org.pikax.log.generator.PikaxLogGenerator#simulateProcess()
 */
@Override
protected void simulateProcess() {
    final Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("id", UUID.randomUUID().toString());

    runtimeService.startProcessInstanceByKey(PROCESS_KEY, variableMap);

}

From source file:com.allogy.couch.importers.command.BufferedCouchImporterTest.java

@Before
public void setUp() {
    targetCouchDbConnector = mock(CouchDbConnector.class);

    id = UUID.randomUUID().toString();
    dataInputStream = IOUtils.toInputStream(UUID.randomUUID().toString());

    importCommand = mock(ImportCommand.class);
    stub(importCommand.getTargetCouchDbConnector()).toReturn(targetCouchDbConnector);
    stub(importCommand.getId()).toReturn(id);
    stub(importCommand.getDataStream()).toReturn(dataInputStream);

    bufferSize = 1000;//ww w.j  a  v a 2 s . c  om
}

From source file:com.mirth.connect.client.ui.reference.Reference.java

public Reference(Type type, CodeTemplateContextSet contextSet, String category, String name, String description,
        String replacementCode) {
    this.id = UUID.randomUUID().toString();
    this.type = type;
    this.contextSet = contextSet;
    this.category = category;
    this.name = name;
    this.description = description;
    this.replacementCode = replacementCode;
}

From source file:com.vsct.dt.strowgr.admin.nsq.payload.fragment.Header.java

@JsonCreator
public Header(@JsonProperty("correlationId") String correlationId,
        @JsonProperty("application") String application, @JsonProperty("platform") String platform,
        @JsonProperty("timestamp") Long timestamp, @JsonProperty("source") String source) {
    this.correlationId = Optional.ofNullable(correlationId).orElseGet(() -> UUID.randomUUID().toString());
    this.application = checkNotNull(application);
    this.platform = checkNotNull(platform);
    this.timestamp = Optional.ofNullable(timestamp).orElseGet(() -> System.currentTimeMillis());
    this.source = Optional.ofNullable(source).orElseGet(() -> UNKNOWN_SOURCE);
}

From source file:it.reply.orchestrator.service.TemplateServiceTest.java

@Test
public void getTemplate() {
    Deployment createDeployment = ControllerTestUtils.createDeployment();
    String id = UUID.randomUUID().toString();
    Mockito.when(deploymentRepository.findOne(id)).thenReturn(createDeployment);

    Assert.assertEquals(templateServiceImpl.getTemplate(id), createDeployment.getTemplate());
}

From source file:com.esofthead.mycollab.vaadin.ui.UserLink.java

public UserLink(String username, String userAvatarId, String displayName) {
    if (StringUtils.isBlank(username)) {
        return;//  www  .  j  a  v  a 2  s .com
    }
    this.setContentMode(ContentMode.HTML);
    String uid = UUID.randomUUID().toString();
    DivLessFormatter div = new DivLessFormatter();
    Img userAvatar = new Img("", StorageManager.getAvatarLink(userAvatarId, 16));
    A userLink = new A().setId("tag" + uid)
            .setHref(AccountLinkGenerator.generatePreviewFullUserLink(AppContext.getSiteUrl(), username))
            .appendText(displayName);
    userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsDunction(uid, username));
    userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));
    div.appendChild(userAvatar, DivLessFormatter.EMPTY_SPACE(), userLink, DivLessFormatter.EMPTY_SPACE(),
            TooltipHelper.buildDivTooltipEnable(uid));
    this.setValue(div.write());
}

From source file:edu.harvard.i2b2.fhir.intake.basex.XQueryUtil.java

public static ArrayList<String> getStringSequence(String query, String input) throws XQueryUtilException {

    synchronized (context) {
        ArrayList<String> resList = new ArrayList<String>();
        // Database context.
        context = new Context();

        // Create a database from a remote XML document
        // System.out.println("\n* Create a database from a file via
        // http.");

        // Use internal parser to skip DTD parsing
        try {//ww  w .jav a 2 s. c om
            new Set("intparse", true).execute(context);
            String dbName = UUID.randomUUID().toString();
            new org.basex.core.cmd.CreateDB(dbName, input).execute(context);

            try (QueryProcessor proc = new QueryProcessor(query, context)) {
                // Store the pointer to the result in an iterator:
                Iter iter = proc.iter();

                // Iterate through all items and serialize
                int count = 0;
                for (Item item; (item = iter.next()) != null;) {
                    String r = item.serialize().toString();
                    resList.add(r);
                }
            } catch (QueryException | QueryIOException e) {
                // e.printStackTrace();
                logger.error(e.getMessage(), e);
                throw new XQueryUtilException(e);
            }

            // System.out.println("\n* Drop the database.");

            new DropIndex("text").execute(context);
            new DropIndex("attribute").execute(context);
            new DropIndex("fulltext").execute(context);

            new DropDB(dbName).execute(context);
        } catch (BaseXException e1) {
            // e1.printStackTrace();
            logger.error("", e1);
            throw new XQueryUtilException(e1);
        }
        context.close();
        return resList;
    }
}