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:edu.depaul.armada.util.TestUtil.java

public static Container newContainer() {
    Container container = new Container();
    container.setCAdvisorURL("http://localhost:8080/cAdvisor");
    container.setContainerUniqueId(UUID.randomUUID().toString());
    container.setName("test-name");
    container.setTimestamp(new Timestamp(System.currentTimeMillis()));
    return container;
}

From source file:de.zib.gndms.GORFX.service.TaskFlowServiceAux.java

public static <T extends Order> HttpStatus setAndValidateOrder(Order order, TaskFlow<T> taskFlow,
        TaskFlowFactory<T, ?> factory) {

    DelegatingOrder<T> delegate = setOrderAsDelegate(order, taskFlow, factory);
    delegate.setActId(UUID.randomUUID().toString());

    return validateOrder(factory, delegate);
}

From source file:com.scf.utils.UUIDUtilies.java

/**
 * 22?
 * @author wubin
 * @return
 */
public static String base58Uuid() {
    UUID uuid = UUID.randomUUID();
    return base58Uuid(uuid);
}

From source file:com.enonic.cms.core.boot.HomeResolverTest.java

@Before
public void setUp() throws Exception {
    this.tmpDir = new File(SystemUtils.getJavaIoTmpDir(), "tmp-" + UUID.randomUUID().toString());
    this.defaultHomeDir = new File(this.tmpDir, "cms.home").getCanonicalFile();
    this.invalidHomeDir = new File(this.tmpDir, "invalid.home").getCanonicalFile();
    this.validHomeDir = new File(this.tmpDir, "valid.home").getCanonicalFile();
    this.notCreatedHomeDir = new File(this.tmpDir, "not.created.home").getCanonicalFile();

    this.defaultHomeDir.mkdirs();
    this.validHomeDir.mkdirs();
    FileUtils.touch(this.invalidHomeDir);
}

From source file:com.enonic.cms.core.boot.ConfigBuilderTest.java

@Before
public void setUp() throws Exception {
    this.homeDir = new File(SystemUtils.getJavaIoTmpDir(), "tmp-" + UUID.randomUUID().toString());

    this.classLoader = Mockito.mock(ClassLoader.class);

    this.builder = new ConfigBuilder(this.homeDir);
    this.builder.setSystemProperties(new Properties());
    this.builder.setClassLoader(this.classLoader);
}

From source file:io.github.howiefh.jeews.modules.oauth2.service.ClientService.java

public int save(Client client) {
    client.setClientId(UUID.randomUUID().toString());
    client.setClientSecret(UUID.randomUUID().toString());
    return clientDao.save(client);
}

From source file:com.apptentive.android.sdk.model.ConversationItem.java

protected ConversationItem() {
    super();// www. j  ava2s  .  c  o m
    setNonce(UUID.randomUUID().toString());

    double seconds = Util.currentTimeSeconds();
    int utcOffset = Util.getUtcOffset();

    setClientCreatedAt(seconds);
    setClientCreatedAtUtcOffset(utcOffset);

}

From source file:demo.util.MockedTransactionManager.java

@Override
protected Object doGetTransaction() throws TransactionException {
    return UUID.randomUUID().toString();
}

From source file:alluxio.AlluxioTestDirectory.java

/**
 * Creates a directory with the given prefix inside the Alluxio temporary directory.
 *
 * @param prefix a prefix to use in naming the temporary directory
 * @return the created directory/*www. ja  v a2s  .c om*/
 */
public static File createTemporaryDirectory(String prefix) {
    final File file = new File(ALLUXIO_TEST_DIRECTORY, prefix + "-" + UUID.randomUUID());
    if (!file.mkdir()) {
        throw new RuntimeException("Failed to create directory " + file.getAbsolutePath());
    }

    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        public void run() {
            try {
                alluxio.util.io.FileUtils.deletePathRecursively(file.getAbsolutePath());
            } catch (IOException e) {
                LOG.warn("Failed to clean up Alluxio test directory {} : {}", file.getAbsolutePath(),
                        e.getMessage());
            }
        }
    }));
    return file;
}

From source file:ai.grakn.engine.util.EngineID.java

public static EngineID me() {
    String hostName = "";
    try {/* ww w .j  ava 2 s.  c o  m*/
        hostName = InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
        LOG.error("Could not get system hostname: ", e);
    }

    String value = hostName + "-" + UUID.randomUUID().toString();

    return EngineID.of(value);
}