@Override public UUID readObject(ObjectInput input) throws IOException, ClassNotFoundException { return MarshallUtil.unmarshallUUID(input, true); } };
@Override public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException { commandType = MarshallUtil.unmarshallEnum(input, CQCommandType::valueOf); queryDefinition = (QueryDefinition) input.readObject(); queryId = MarshallUtil.unmarshallUUID(input, true); docIndex = input.readInt(); }
@Override public void readFrom(ObjectInput input) throws IOException, ClassNotFoundException { commandType = MarshallUtil.unmarshallEnum(input, ClusteredQueryCommandType::valueOf); query = (HSQuery) input.readObject(); lazyQueryId = MarshallUtil.unmarshallUUID(input, true); docIndex = input.readInt(); }
@Test public void testUUID() throws IOException { ObjectInputOutput io = new ObjectInputOutput(); MarshallUtil.marshallUUID(null, io, true); Assert.assertNull(MarshallUtil.unmarshallUUID(io, true)); Assert.assertEquals(0, io.buffer.size()); for (int i = 0; i < NR_RANDOM; ++i) { io.reset(); UUID uuid = UUID.randomUUID(); MarshallUtil.marshallUUID(uuid, io, false); Assert.assertEquals(uuid, MarshallUtil.unmarshallUUID(io, false)); Assert.assertEquals(0, io.buffer.size()); } for (int i = 0; i < NR_RANDOM; ++i) { io.reset(); UUID uuid = UUID.randomUUID(); MarshallUtil.marshallUUID(uuid, io, true); Assert.assertEquals(uuid, MarshallUtil.unmarshallUUID(io, true)); Assert.assertEquals(0, io.buffer.size()); } }
@Override public AuthenticatedClientSessionEntity readObject(ObjectInput input) throws IOException, ClassNotFoundException { AuthenticatedClientSessionEntity sessionEntity = new AuthenticatedClientSessionEntity(MarshallUtil.unmarshallUUID(input, false)); sessionEntity.setRealmId(MarshallUtil.unmarshallString(input)); sessionEntity.setAuthMethod(MarshallUtil.unmarshallString(input)); sessionEntity.setRedirectUri(MarshallUtil.unmarshallString(input)); sessionEntity.setTimestamp(KeycloakMarshallUtil.unmarshallInteger(input)); sessionEntity.setAction(MarshallUtil.unmarshallString(input)); Map<String, String> notes = KeycloakMarshallUtil.readMap(input, KeycloakMarshallUtil.STRING_EXT, KeycloakMarshallUtil.STRING_EXT, new KeycloakMarshallUtil.ConcurrentHashMapBuilder<>()); sessionEntity.setNotes(notes); sessionEntity.setCurrentRefreshToken(MarshallUtil.unmarshallString(input)); sessionEntity.setCurrentRefreshTokenUseCount(KeycloakMarshallUtil.unmarshallInteger(input)); return sessionEntity; }