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(); }
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; }
@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()); }
@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); }
@Override public CompletableFuture<?> appendPage(Page page) { for (int position = 0; position < page.getPositionCount(); position++) { List<Object> values = new ArrayList<>(columnTypes.size() + 1); if (generateUUID) { values.add(UUID.randomUUID()); } for (int channel = 0; channel < page.getChannelCount(); channel++) { appendColumn(values, page, position, channel); } cassandraSession.execute(insert.bind(values.toArray())); } return NOT_BLOCKED; }
public HashJoinComparisonStructure(List<List<Map.Entry<Field, Field>>> t1ToT2FieldsComparisons) { comparisonIDtoComparisonFields = new HashMap<>(); comparisonIDtoComparisonHash = new HashMap<>(); if(t1ToT2FieldsComparisons == null || t1ToT2FieldsComparisons.size() == 0){ String comparisonId = UUID.randomUUID().toString(); this.comparisonIDtoComparisonFields.put(comparisonId,new ArrayList<Map.Entry<Field,Field>>()); this.comparisonIDtoComparisonHash.put(comparisonId,new HashMap<String, SearchHitsResult>()); } for (List<Map.Entry<Field,Field>> comparisonFields : t1ToT2FieldsComparisons){ String comparisonId = UUID.randomUUID().toString(); //maby from field to List<IDS> ? this.comparisonIDtoComparisonFields.put(comparisonId,comparisonFields); this.comparisonIDtoComparisonHash.put(comparisonId, new HashMap<String, SearchHitsResult>()); } }
/** * @throws Exception If failed. */ @Test public void testSingleNode() throws Exception { AlwaysFailoverSpi spi = getSpi(); List<ClusterNode> nodes = new ArrayList<>(); ClusterNode node = new GridTestNode(UUID.randomUUID()); nodes.add(node); node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes); assert node == null; }
private static String createBaseDir() { String baseDir = System.getProperty("user.home") + SEP + "unitteststore-" + UUID.randomUUID(); final File file = new File(baseDir); if (file.exists()) { logger.info(String.format("[%s] has already existed, please back up and remove it for integration tests", baseDir)); System.exit(1); } TMPE_FILES.add(file); return baseDir; }
@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 testUuidToStringAndStringToUuid() { UUID uuid = UUID.randomUUID(); String convertToString = conversionService.convert(uuid, String.class); UUID convertToUUID = conversionService.convert(convertToString, UUID.class); assertEquals(uuid, convertToUUID); }
@Test(expected = IllegalArgumentException.class) public void testIdHeaderValueReadOnly() { UUID id = UUID.randomUUID(); MessageBuilder.withPayload("test").setHeader(MessageHeaders.ID, id); }
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 testErrorMessageIsMeaningfulWhenUnableToCreateTemporaryDirectory() { String propertyName = "java.io.tmpdir"; String originalValue = System.getProperty(propertyName); try { String nonExistedDirectory = "/tmp/" + UUID.randomUUID(); System.setProperty(propertyName, nonExistedDirectory); RealtimeTuningConfig.makeDefaultTuningConfig(null); } catch (IllegalStateException e) { Assert.assertTrue(e.getMessage().startsWith("Failed to create temporary directory in")); } finally { System.setProperty(propertyName, originalValue); } }
@Test public void testFromFile() throws Exception { File tmp = File.createTempFile("aleph" + UUID.randomUUID().toString(), ".tmp"); tmp.deleteOnExit(); try (BufferedWriter bw = new BufferedWriter(new FileWriter(tmp))) { bw.write("${p.name}/${p.text}/${p.age}"); bw.flush(); } Person person = new Person("A", "B", 20); String result = fromFile(tmp.getPath(), "p", person).fmt(); assertTrue("A/B/20".equals(result)); }