public Builder() { this(UUID.randomUUID().toString()); }
public TestEventLogSpout(long totalCount) { this.uid = UUID.randomUUID().toString(); synchronized (acked) { acked.put(uid, 0); } synchronized (failed) { failed.put(uid, 0); } this.totalCount = totalCount; }
private Map<String, Object> contextWithSqlId(Map<String, Object> queryContext) { Map<String, Object> newContext = new HashMap<>(); if (queryContext != null) { newContext.putAll(queryContext); } if (!newContext.containsKey(PlannerContext.CTX_SQL_QUERY_ID)) { newContext.put(PlannerContext.CTX_SQL_QUERY_ID, UUID.randomUUID().toString()); } return newContext; }
@Test public void testValidateFileInputNotExist() { String fileName = UUID.randomUUID().toString(); File file = new File(testData, fileName); String absolutePath = file.getAbsolutePath(); String error = ZKUtil.validateFileInput(absolutePath); assertNotNull(error); String expectedMessage = "File '" + absolutePath + "' does not exist."; assertEquals(expectedMessage, error); }
private void init(XmlSuite suite, int index) { m_suite = suite; m_suite.getTests().add(this); m_index = index; //no two tests in the same suite should have the same name. //so, make the default test name unique m_name = TestNG.DEFAULT_COMMAND_LINE_TEST_NAME + " " + UUID.randomUUID().toString(); }
@Test public void testFindNotificationsByTopicId() throws Exception { String topicId = UUID.randomUUID().toString(); List<NotificationDto> expectedList = new ArrayList<>(); expectedList.addAll(generateNotifications(topicId, null, null, 2, NotificationTypeDto.USER)); expectedList.addAll(generateNotifications(topicId, null, null, 1, NotificationTypeDto.SYSTEM)); List<CassandraNotification> found = notificationDao.findNotificationsByTopicId(topicId); Assert.assertEquals(expectedList.size(), found.size()); }
public void nextTuple() { if (_serveTuples.size() > 0) { FixedTuple ft = _serveTuples.remove(0); String id = UUID.randomUUID().toString(); _pending.put(id, ft); _collector.emit(ft.stream, ft.values, id); } else { Utils.sleep(100); } }
public FixedTupleSpout(List tuples, Fields fields) { _id = UUID.randomUUID().toString(); synchronized (acked) { acked.put(_id, 0); } synchronized (failed) { failed.put(_id, 0); } _tuples = new ArrayList<FixedTuple>(); for (Object o : tuples) { FixedTuple ft; if (o instanceof FixedTuple) { ft = (FixedTuple) o; } else { ft = new FixedTuple((List) o); } _tuples.add(ft); } _fields = fields; }
public SnapshotPacket(int windowId, DistributedMember sender, List<SnapshotRecord> recs) { this.windowId = windowId; this.packetId = UUID.randomUUID().toString(); this.sender = sender; records = recs.toArray(new SnapshotRecord[recs.size()]); }
@Test(groups = "slow") public void testNoEntries() { final UUID subscriptionId = UUID.randomUUID(); final String unitType = "foo"; final LocalDate startDate = new LocalDate(2013, 1, 1); final LocalDate endDate = new LocalDate(2013, 2, 1); RolledUpUsageModelDao usage1 = new RolledUpUsageModelDao(subscriptionId, unitType, endDate, 9L, UUID.randomUUID().toString()); List<RolledUpUsageModelDao> usages = new ArrayList<RolledUpUsageModelDao>(); usages.add(usage1); rolledUpUsageDao.record(usages, internalCallContext); final List<RolledUpUsageModelDao> result = rolledUpUsageDao.getUsageForSubscription(subscriptionId, startDate, endDate, unitType, internalCallContext); assertEquals(result.size(), 0); }
@Test public void testSetProperty() { String key = "System2Test.testSetProperty"; String value = randomUUID().toString(); System2.INSTANCE.setProperty(key, value); assertThat(System2.INSTANCE.property(key)).isEqualTo(value); }
@Test public void onNewSessionMulti() { String sessionId = UUID.randomUUID().toString(); this.resolver.setSessionId(this.request, this.response, sessionId); this.resolver.setSessionId(this.request, this.response, sessionId); assertThat(this.response.getHeaders(HEADER_X_AUTH_TOKEN).size()).isEqualTo(1); assertThat(this.response.getHeaders(HEADER_X_AUTH_TOKEN)).containsOnly(sessionId); }
@Test public void subclassWithCustomIdAndNoTimestamp() { final AtomicLong id = new AtomicLong(); @SuppressWarnings("serial") class MyMH extends MessageHeaders { public MyMH() { super(null, new UUID(0, id.incrementAndGet()), -1L); } } MessageHeaders headers = new MyMH(); assertEquals("00000000-0000-0000-0000-000000000001", headers.getId().toString()); assertEquals(1, headers.size()); }
public void testCheckedThrowableSync(CacheableService<?> service) throws Exception { String arg = UUID.randomUUID().toString(); try { service.throwCheckedSync(arg); fail("Excepted exception"); } catch (Exception ex) { ex.printStackTrace(); assertEquals("Wrong exception type", IOException.class, ex.getClass()); assertEquals(arg, ex.getMessage()); } }
@Test public void testEvict() throws Exception { kylinConfig.setProperty("kylin.snapshot.ext.local.cache.max-size-gb", "0.005"); int snapshotNum = 10; int snapshotRowCnt = 100000; for (int i = 0; i < snapshotNum; i++) { buildSnapshotCache(RandomUtil.randomUUID().toString(), snapshotRowCnt); } assertTrue(RocksDBLookupTableCache.getInstance(kylinConfig).getTotalCacheSize() < 0.006 * 1024 * 1024 * 1024); }
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(StringUtils.removeChar(uuid.toString(), '-'), uuidString); }
@Test public void testRandomUUID() { Assert.assertEquals(RandomUtil.randomUUID().toString().length(), UUID.randomUUID().toString().length()); Assert.assertNotEquals(RandomUtil.randomUUID().toString(), RandomUtil.randomUUID().toString()); } }
public TupleCaptureBolt() { _name = UUID.randomUUID().toString(); emitted_tuples.put(_name, new HashMap<String, List<FixedTuple>>()); }