ConfigSchemaV1 extends BaseSchema implements ConvertableSchema<ConfigSchema> { public static String getUniqueId(Set<UUID> ids, String name) { UUID id = UUID.nameUUIDFromBytes(name == null ? EMPTY_NAME.getBytes(StandardCharsets.UTF_8) : name.getBytes(StandardCharsets.UTF_8)); while (ids.contains(id)) { id = new UUID(id.getMostSignificantBits(), id.getLeastSignificantBits() + 1); } ids.add(id); return id.toString(); } ConfigSchemaV1(Map map); @Override ConfigSchema convert(); static String getUniqueId(Set<UUID> ids, String name); @Override int getVersion(); static final String REMOTE_PROCESS_GROUPS_KEY_V1; static final String FOUND_THE_FOLLOWING_DUPLICATE_PROCESSOR_NAMES; static final String FOUND_THE_FOLLOWING_DUPLICATE_CONNECTION_NAMES; static final String FOUND_THE_FOLLOWING_DUPLICATE_REMOTE_PROCESSING_GROUP_NAMES; static final String CANNOT_LOOK_UP_PROCESSOR_ID_FROM_PROCESSOR_NAME_DUE_TO_DUPLICATE_PROCESSOR_NAMES; static final int CONFIG_VERSION; static final String CONNECTION_WITH_NAME; static final String HAS_INVALID_DESTINATION_NAME; static final String HAS_INVALID_SOURCE_NAME; }
@Test public void testGetUniqueIdConflicts() { Set<UUID> ids = new HashSet<>(); assertEquals("56e7ae5d-aae1-351e-bca9-cdc4446c6386", ConfigSchemaV1.getUniqueId(ids, "test/id")); assertEquals("348c4f93-cd15-3d91-82f2-bfe5d43834d8", ConfigSchemaV1.getUniqueId(ids, "test$id")); assertEquals("348c4f93-cd15-3d91-82f2-bfe5d43834d9", ConfigSchemaV1.getUniqueId(ids, "test$id")); assertEquals("348c4f93-cd15-3d91-82f2-bfe5d43834da", ConfigSchemaV1.getUniqueId(ids, "test$id")); assertEquals("348c4f93-cd15-3d91-82f2-bfe5d43834db", ConfigSchemaV1.getUniqueId(ids, "test$id")); assertEquals("697487ff-979c-342d-9aab-5c710ae43a28", ConfigSchemaV1.getUniqueId(ids, "test_id_2")); }
@Test public void testGetUniqueIdEmptySet() { String testId = "testId"; assertEquals("17841b04-ce22-34a3-9603-d95ec31d02dc", ConfigSchemaV1.getUniqueId(new HashSet<>(), testId + "/ $")); }