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:AdminAssetCreateTest.java

public static String TEST_FILE_ASSET_NAME() {
    if (assetFileName == null)
        assetFileName = TEST_FILE_ASSET_NAME_ + UUID.randomUUID();
    return assetFileName;
}

From source file:com.streamsets.datacollector.el.TestRuntimeEL.java

@BeforeClass
public static void beforeClass() throws IOException {
    File configDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(configDir.mkdirs());
    resourcesDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(resourcesDir.mkdirs());
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.CONFIG_DIR, configDir.getPath());
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.RESOURCES_DIR, resourcesDir.getPath());
}

From source file:in.rishikeshdarandale.rest.model.cart.Cart.java

public Cart() {
    super();
    this.setId(UUID.randomUUID().toString());
}

From source file:com.tollefoto.tetravex.Highscore.java

public Highscore(int boardSize, int moves, String timer) {
    //generate unique id
    mId = UUID.randomUUID();
    setBoardSize(boardSize);/*from www  .j  a va2s . c  om*/
    setMoves(moves);
    setTimer(timer);
}

From source file:ch.cyberduck.core.local.FinderLocalTest.java

@Test
public void testEqual() throws Exception {
    final String name = UUID.randomUUID().toString();
    FinderLocal l = new FinderLocal(System.getProperty("java.io.tmpdir"), name);
    assertEquals(new FinderLocal(System.getProperty("java.io.tmpdir"), name), l);
    new DefaultLocalTouchFeature().touch(l);
    assertEquals(new FinderLocal(System.getProperty("java.io.tmpdir"), name), l);
    final FinderLocal other = new FinderLocal(System.getProperty("java.io.tmpdir"), name + "-");
    assertNotSame(other, l);//from   w  w w . j a v  a2s  .  c om
    new DefaultLocalTouchFeature().touch(other);
    assertNotSame(other, l);
    l.delete();
    other.delete();
}

From source file:ezbake.data.elastic.test.TestUtils.java

public static Document generateDocument(String type, String jsonObject, Visibility vis) {
    final Document doc = new Document();
    doc.set_id(UUID.randomUUID().toString());
    doc.set_type(type);//  w  w  w. j a  v a2s .  c  o  m
    doc.set_jsonObject(jsonObject);
    doc.setVisibility(vis);
    return doc;
}

From source file:io.helixservice.feature.restservice.error.jsonapi.ErrorData.java

/**
 * Create an empty ErrorData
 */
public ErrorData() {
    this.id = UUID.randomUUID().toString();
}

From source file:com.chinalbs.service.impl.FileServiceImpl.java

@Override
public String saveImage(MultipartFile[] multipartFile) {
    String webPath = null;//from w w w .j a  va 2 s  .c  om
    if (multipartFile == null || multipartFile.length == 0) {
        return null;
    }
    try {
        for (MultipartFile multiFile : multipartFile) {
            if (multiFile.getSize() > ImageMaxSize) {
                continue;
            }
            String uuid = UUID.randomUUID().toString();
            String sourcePath = uploadPath + File.separator + "src_" + uuid + "."
                    + FilenameUtils.getExtension(multiFile.getOriginalFilename());
            //            webPath = uuid + "." + DEST_EXTENSION;
            webPath = File.separator + "src_" + uuid + "."
                    + FilenameUtils.getExtension(multiFile.getOriginalFilename());
            String storePath = uploadPath + File.separator + uuid + "." + DEST_EXTENSION;
            ;

            File tempFile = new File(System.getProperty("java.io.tmpdir") + File.separator + "upload_"
                    + UUID.randomUUID() + ".tmp");
            if (!tempFile.getParentFile().exists()) {
                tempFile.getParentFile().mkdirs();
            }

            multiFile.transferTo(tempFile);
            proccessImage(tempFile, sourcePath, storePath, licenseImageWidth, licenseImageHeight, true);
        }
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return webPath;
}

From source file:com.autonomy.nonaci.indexing.impl.IndexingServiceImplTest.java

@Test
@SuppressWarnings("unchecked")
public void testExecuteCommand() throws IndexingException {
    final Map<String, String> parameters = new HashMap<String, String>(1);
    parameters.put(IndexCommand.PARAM_DRE_DBNAME, UUID.randomUUID().toString());

    //        final IndexCommandImpl command = new IndexCommandImpl(IndexCommand.CMD_DREINITIAL);
    final IndexCommandImpl command = new IndexCommandImpl(IndexCommand.CMD_DRECREATEDBASE);
    command.setParameters(parameters);//  ww  w. ja  va2  s  .c o  m

    final int queueId = 1; // indexingService.executeCommand(command);

    assertThat("Should have got a queue id", queueId, is(not(0)));
}

From source file:edu.kit.scc.test.redis.RedisClientTest.java

@Test
public void createUserTest() {
    String uuid = UUID.randomUUID().toString();

    String uidNumber = redisClient.createUser(uuid);

    assertNotNull(uidNumber);/*from  ww w  .  j ava 2 s.  c om*/

    uidNumber = redisClient.createUser(uuid);

    assertNull(uidNumber);
}