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.nesscomputing.hbase.spill.TestBinaryConverter.java

@Test
public void testSimple() {
    final Put put = new Put(UUID.randomUUID().toString().getBytes(Charsets.UTF_8));

    put.add("family1".getBytes(Charsets.UTF_8), "qualifier1".getBytes(Charsets.UTF_8),
            System.currentTimeMillis(), "data1".getBytes(Charsets.UTF_8));
    put.add("family2".getBytes(Charsets.UTF_8), "qualifier2".getBytes(Charsets.UTF_8),
            System.currentTimeMillis(), "data2".getBytes(Charsets.UTF_8));
    put.add("family3".getBytes(Charsets.UTF_8), "qualifier3".getBytes(Charsets.UTF_8),
            System.currentTimeMillis(), "data3".getBytes(Charsets.UTF_8));

    final byte[] data = new BinaryConverter.PutToBinary().apply(put);

    final Put put2 = new BinaryConverter.StreamToPut().apply(new ByteArrayInputStream(data));

    Assert.assertNotNull(put2);/*from   ww  w .  ja va2s . c om*/
    Assert.assertArrayEquals(put.getRow(), put2.getRow());

    for (final List<KeyValue> entries : put.getFamilyMap().values()) {
        for (final KeyValue kv : entries) {
            Assert.assertTrue(put2.has(kv.getFamily(), kv.getQualifier(), kv.getTimestamp(), kv.getValue()));
        }
    }

    for (final byte[] family : put.getFamilyMap().keySet()) {
        Assert.assertTrue(put2.getFamilyMap().containsKey(family));
    }

    Assert.assertEquals(put.getFamilyMap().size(), put2.getFamilyMap().size());
}

From source file:com.vehicles.domain.entities.Bicycle.java

private void init(BicycleType bicycleType, Color color) {
    this.id = UUID.randomUUID().toString();
    this.bicycleType = bicycleType;
    this.color = color;
}

From source file:lydichris.smashbracket.persistence.TournamentPersistence.java

public Tournament createTournament(Tournament tournament) {
    UUID uuid = UUID.randomUUID();
    String SQL = "insert into tournaments (uuid, name, start_time, size_limit, location, game, host, format, description, is_bracket_visible) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

    jdbcTemplateObject.update(SQL, uuid.toString(), tournament.getName(), tournament.getStartTime(),
            tournament.getMaxEntrants(), null, tournament.getGame(), tournament.getHostId(),
            tournament.getTournamentType().getValue(), tournament.getDescription(),
            tournament.isMatchesRevealed());

    tournament.setId(uuid.toString());/* w  w  w.  j a  va2 s . com*/
    return tournament;
}

From source file:org.stem.streaming.AbstractSession.java

protected AbstractSession() {
    sessionId = UUID.randomUUID();
    completed = new AtomicLong(-1);
    total = new AtomicLong(-1);
}

From source file:de.kaiserpfalzEdv.office.ui.web.widgets.content.ReplaceMainTabEvent.java

public ReplaceMainTabEvent(final UUID id, final Component component) {
    super(UUID.randomUUID(), id);
    this.component = component;
}

From source file:com.streamsets.datacollector.execution.runner.TestSlaveStandaloneRunner.java

@BeforeClass
public static void beforeClass() throws IOException {
    File testDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(testDir.mkdirs());
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR, testDir.getAbsolutePath());
    TestUtil.captureStagesForProductionRun();
}

From source file:com.vehicles.domain.entities.Motorcycle.java

private void init(Color color, RiderGender riderGender) {
    this.id = UUID.randomUUID().toString();
    this.color = color;
    this.riderGender = riderGender;
}

From source file:edu.sjsu.cohort6.esp.common.BaseModel.java

public UUID randomUUID() {
    return UUID.randomUUID();
}

From source file:org.ulyssis.ipp.control.commands.Command.java

public static String generateCommandId() {
    return UUID.randomUUID().toString();
}

From source file:com.foundationdb.server.types.aksql.aktypes.AkGUIDTest.java

@Test
public void UUIDtoUUID() {
    UUID randomUUID = UUID.randomUUID();
    byte[] byteArray = AkGUID.uuidToBytes(randomUUID);
    UUID outputUUID = AkGUID.bytesToUUID(byteArray, 0);
    assertEquals(randomUUID, outputUUID);
}