Search in sources :

Example 96 with UUID

use of java.util.UUID in project crate by crate.

the class KillJobsRequest method readFrom.

@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int numJobs = in.readVInt();
    toKill = new ArrayList<>(numJobs);
    for (int i = 0; i < numJobs; i++) {
        UUID job = new UUID(in.readLong(), in.readLong());
        toKill.add(job);
    }
}
Also used : UUID(java.util.UUID)

Example 97 with UUID

use of java.util.UUID in project crate by crate.

the class NestedLoopPhaseTest method testSerialization.

@Test
public void testSerialization() throws Exception {
    TopNProjection topNProjection = new TopNProjection(10, 0, Collections.emptyList());
    UUID jobId = UUID.randomUUID();
    MergePhase mp1 = new MergePhase(jobId, 2, "merge", 1, Collections.emptyList(), ImmutableList.<DataType>of(DataTypes.STRING), ImmutableList.of(), DistributionInfo.DEFAULT_BROADCAST, null);
    MergePhase mp2 = new MergePhase(jobId, 3, "merge", 1, Collections.emptyList(), ImmutableList.<DataType>of(DataTypes.STRING), ImmutableList.of(), DistributionInfo.DEFAULT_BROADCAST, null);
    SqlExpressions sqlExpressions = new SqlExpressions(T3.SOURCES, T3.TR_1);
    Symbol joinCondition = sqlExpressions.normalize(sqlExpressions.asSymbol("t1.x = t1.i"));
    NestedLoopPhase node = new NestedLoopPhase(jobId, 1, "nestedLoop", ImmutableList.of(topNProjection), mp1, mp2, Sets.newHashSet("node1", "node2"), JoinType.INNER, joinCondition, 1, 1);
    BytesStreamOutput output = new BytesStreamOutput();
    node.writeTo(output);
    StreamInput input = StreamInput.wrap(output.bytes());
    NestedLoopPhase node2 = new NestedLoopPhase();
    node2.readFrom(input);
    assertThat(node.nodeIds(), Is.is(node2.nodeIds()));
    assertThat(node.jobId(), Is.is(node2.jobId()));
    assertThat(node.name(), is(node2.name()));
    assertThat(node.outputTypes(), is(node2.outputTypes()));
    assertThat(node.joinType(), is(node2.joinType()));
    assertThat(node.numLeftOutputs(), is(node2.numLeftOutputs()));
    assertThat(node.numRightOutputs(), is(node2.numRightOutputs()));
}
Also used : Symbol(io.crate.analyze.symbol.Symbol) StreamInput(org.elasticsearch.common.io.stream.StreamInput) TopNProjection(io.crate.planner.projection.TopNProjection) UUID(java.util.UUID) SqlExpressions(io.crate.testing.SqlExpressions) NestedLoopPhase(io.crate.planner.node.dql.join.NestedLoopPhase) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 98 with UUID

use of java.util.UUID in project cryptomator by cryptomator.

the class WindowsProtectedKeychainAccess method generateSalt.

private byte[] generateSalt() {
    byte[] result = new byte[2 * Long.BYTES];
    UUID uuid = UUID.randomUUID();
    ByteBuffer buf = ByteBuffer.wrap(result);
    buf.putLong(uuid.getMostSignificantBits());
    buf.putLong(uuid.getLeastSignificantBits());
    return result;
}
Also used : UUID(java.util.UUID) ByteBuffer(java.nio.ByteBuffer)

Example 99 with UUID

use of java.util.UUID in project druid by druid-io.

the class UUIDUtilsTest method validateIsStandardUUID.

public static void validateIsStandardUUID(String uuidString) {
    // Since we strip the "-" from the string, we need to break them back out
    final ArrayList<String> strings = new ArrayList<>();
    strings.add(uuidString.substring(0, 8));
    strings.add(uuidString.substring(8, 12));
    strings.add(uuidString.substring(12, 16));
    strings.add(uuidString.substring(16, 20));
    strings.add(uuidString.substring(20, 32));
    UUID uuid = UUID.fromString(Joiner.on('-').join(strings));
    Assert.assertEquals(uuid.toString().replace("-", ""), uuidString);
}
Also used : ArrayList(java.util.ArrayList) UUID(java.util.UUID)

Example 100 with UUID

use of java.util.UUID in project crate by crate.

the class DistributedResultRequestTest method testStreaming.

@Test
public void testStreaming() throws Exception {
    Streamer<?>[] streamers = new Streamer[] { DataTypes.STRING.streamer() };
    Object[][] rows = new Object[][] { { new BytesRef("ab") }, { null }, { new BytesRef("cd") } };
    UUID uuid = UUID.randomUUID();
    DistributedResultRequest r1 = new DistributedResultRequest(uuid, 1, (byte) 3, 1, streamers, new ArrayBucket(rows), false);
    BytesStreamOutput out = new BytesStreamOutput();
    r1.writeTo(out);
    StreamInput in = StreamInput.wrap(out.bytes());
    DistributedResultRequest r2 = new DistributedResultRequest();
    r2.readFrom(in);
    r2.streamers(streamers);
    assertTrue(r2.rowsCanBeRead());
    assertEquals(r1.rows().size(), r2.rows().size());
    assertThat(r1.isLast(), is(r2.isLast()));
    assertThat(r1.executionPhaseInputId(), is(r2.executionPhaseInputId()));
    assertThat(r2.rows(), contains(isRow("ab"), isNullRow(), isRow("cd")));
}
Also used : ArrayBucket(io.crate.data.ArrayBucket) Streamer(io.crate.Streamer) DistributedResultRequest(io.crate.executor.transport.distributed.DistributedResultRequest) StreamInput(org.elasticsearch.common.io.stream.StreamInput) UUID(java.util.UUID) BytesRef(org.apache.lucene.util.BytesRef) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

UUID (java.util.UUID)8697 Test (org.junit.Test)3030 ArrayList (java.util.ArrayList)1077 HashMap (java.util.HashMap)934 List (java.util.List)738 Map (java.util.Map)652 Test (org.testng.annotations.Test)630 HashSet (java.util.HashSet)436 IOException (java.io.IOException)397 LocalDate (org.joda.time.LocalDate)328 Set (java.util.Set)315 BigDecimal (java.math.BigDecimal)284 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)283 UUID.randomUUID (java.util.UUID.randomUUID)281 Collectors (java.util.stream.Collectors)276 ClusterNode (org.apache.ignite.cluster.ClusterNode)265 Test (org.junit.jupiter.api.Test)248 Account (org.killbill.billing.account.api.Account)225 Collection (java.util.Collection)222 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)218