/** * Convert the input to a UUID using the convenience method * {@link #getUUID(Object)}. * * @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object) */ public UUID convert(Object source) { return getUUID(source); }
byte[] bytes = serialize(input); return UUID.nameUUIDFromBytes(bytes);
/** * Helper method that converts the channel id to a UUID using * {@link UUIDConverter#getUUID(Object)}. * @param input Parameter may be null * @return Returns null when the input is null otherwise the UUID as String. */ private String getKey(Object input) { return input == null ? null : UUIDConverter.getUUID(input).toString(); }
byte[] bytes = serialize(input); return UUID.nameUUIDFromBytes(bytes);
private String pathFor(String input) { return input == null ? null : UUIDConverter.getUUID(input).toString(); }
private String getKey(Object input) { return input == null ? null : UUIDConverter.getUUID(input).toString(); }
private void updateMessageGroup(JdbcTemplate template, final String groupId, final long timeout) { template.update("UPDATE INT_MESSAGE_GROUP set UPDATED_DATE=? where GROUP_KEY=? and REGION=?", (PreparedStatementSetter) ps -> { ps.setTimestamp(1, new Timestamp(System.currentTimeMillis() - timeout)); ps.setString(2, UUIDConverter.getUUID(groupId).toString()); ps.setString(3, "DEFAULT"); }); }
private void removeEmptyGroupAfterTimeout(MessageGroup messageGroup, long timeout) { Object groupId = messageGroup.getGroupId(); UUID groupUuid = UUIDConverter.getUUID(groupId); ScheduledFuture<?> scheduledFuture = getTaskScheduler() .schedule(() -> {
@Test public void testConvertUUIDString() throws Exception { UUID uuid = UUID.randomUUID(); assertEquals(uuid, UUIDConverter.getUUID(uuid.toString())); }
@Test public void testConvertUUID() throws Exception { UUID uuid = UUID.randomUUID(); assertEquals(uuid, UUIDConverter.getUUID(uuid)); }
@Test(expected = IllegalArgumentException.class) public void testConvertNonSerializable() throws Exception { assertNotNull(UUIDConverter.getUUID(new Object())); }
@Test public void testConvertSerializable() throws Exception { assertNotNull(UUIDConverter.getUUID(new Date())); }
this.logger.debug("Schedule MessageGroup [ " + messageGroup + "] to 'forceComplete'."); this.expireGroupScheduledFutures.put(UUIDConverter.getUUID(groupId), scheduledFuture);
@Test public void testConvertPrimitive() throws Exception { assertNotNull(UUIDConverter.getUUID(1L)); }
private void checkLock(AbstractCorrelatingMessageHandler handler, String group, boolean expectedHeld) { ReentrantLock lock = (ReentrantLock) TestUtils.getPropertyValue(handler, "lockRegistry", LockRegistry.class) .obtain(UUIDConverter.getUUID(group).toString()); assertEquals(expectedHeld, lock.isHeldByCurrentThread()); }
@Test public void testConvertNull() throws Exception { assertNull(UUIDConverter.getUUID(null)); }
@Test public void testConvertAlmostUUIDString() throws Exception { String name = "1-2-3-4"; try { UUID.fromString(name); fail(); } catch (IllegalArgumentException e) { String message = e.getMessage(); assertTrue("Wrong message: " + message, message.contains("Invalid UUID string")); } assertNotNull(UUIDConverter.getUUID(name)); }
UUID groupIdUuid = UUIDConverter.getUUID(correlationKey); Lock lock = this.lockRegistry.obtain(groupIdUuid.toString());