List of usage examples for java.lang Long toString
public String toString()
From source file:net.nelz.simplesm.test.dao.TestDAOImpl.java
@ReadThroughMultiCache(namespace = "Delta", expiration = 1000) public List<String> getRandomStrings(@ParameterValueKeyProvider final List<Long> keys) { try {//from w ww. j a v a 2 s .co m Thread.sleep(500); } catch (InterruptedException ex) { } final String series = RandomStringUtils.randomAlphabetic(6); final List<String> results = new ArrayList<String>(keys.size()); for (final Long key : keys) { results.add(series + "-" + key.toString() + "-" + RandomStringUtils.randomAlphanumeric(25 + RandomUtils.nextInt(30))); } return results; }
From source file:org.flite.cach3.test.ReadThroughSingleCacheTest.java
@Test public void testVelocity() { final TestSvc test = (TestSvc) context.getBean("testSvc"); final StubReadThroughSingleCacheListenerImpl listener = (StubReadThroughSingleCacheListenerImpl) context .getBean("stubRTS"); final String v1 = "pass-through1" + System.currentTimeMillis(); final Long keyB = System.currentTimeMillis(); final Long key1a = 123L; final Long key2a = 1234L; final String expectedKey = key1a.toString() + "&&" + keyB.toString(); final int previous = listener.getTriggers().size(); final String r1 = test.getCompoundString(key1a, v1, keyB); assertEquals(v1, r1);/*from ww w. j a v a 2 s. c om*/ // Testing that the listener got invoked as required. assertTrue("Doesn't look like the listener got called.", listener.getTriggers().size() == previous + 1); final String expected = StubReadThroughSingleCacheListenerImpl.formatTriggers( TestDAOImpl.COMPOUND_NAMESPACE, TestDAOImpl.COMPOUND_PREFIX, expectedKey, v1, null, new Object[] { key1a, v1, keyB }); assertEquals(expected, listener.getTriggers().get(listener.getTriggers().size() - 1)); // This time through, we'd better get the CACHED value, not the one being sent in. final String v2 = "pt2-" + RandomStringUtils.randomAlphanumeric(4); final String r2 = test.getCompoundString(key1a, v2, keyB); assertFalse(v2.equals(r2)); assertEquals(v1, r2); // Try a new set of keys, should pass through fine. final String v3 = "pt3--" + RandomStringUtils.randomAlphanumeric(5); final String r3 = test.getCompoundString(key2a, v3, keyB); assertEquals(v3, r3); // Now, even with this 'new' set of keys, we should get the last returned value. final String v4 = "pt4xx" + RandomStringUtils.randomAlphanumeric(6); final String r4 = test.getCompoundString(key2a, v4, keyB); assertFalse(v4.equals(r4)); assertEquals(v3, r4); }
From source file:org.keycloak.testsuite.util.Timer.java
private void saveData(String op) { try {/*from w w w.j av a 2 s .com*/ File f = new File(DATA_DIR, op.replace(" ", "_") + ".txt"); if (!f.createNewFile()) { throw new IOException("Couldn't create file: " + f); } OutputStream stream = new BufferedOutputStream(new FileOutputStream(f)); for (Long duration : stats.get(op)) { IOUtils.write(duration.toString(), stream, "UTF-8"); IOUtils.write("\n", stream, "UTF-8"); } stream.flush(); IOUtils.closeQuietly(stream); } catch (IOException ex) { log.error("Unable to save data for operation '" + op + "'", ex); } }
From source file:net.nelz.simplesm.test.dao.TestDAOImpl.java
@UpdateSingleCache(namespace = "Bravo", expiration = 300) @ReturnDataUpdateContent/*from w w w . j a v a2 s. c om*/ public String updateTimestampValue(@ParameterValueKeyProvider final Long key) { try { Thread.sleep(100); } catch (InterruptedException ex) { } final Long now = new Date().getTime(); final String result = now.toString() + "-U-" + key.toString(); return result; }
From source file:org.lareferencia.backend.tasks.SnapshotManager.java
@ManagedAttribute public List<String> getActiveSnapshots() { List<String> result = new ArrayList<String>(); for (Long snapshotID : workersBySnapshotID.keySet()) { result.add(snapshotID.toString() + " :: " + workersBySnapshotID.get(snapshotID).getStatus()); }//from w ww . j ava2s. c om return result; }
From source file:org.telegram.telegrambots.api.methods.games.GetGameHighScores.java
public GetGameHighScores setChatId(Long chatId) { Objects.requireNonNull(chatId); this.chatId = chatId.toString(); return this; }
From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java
@Before @Override//w w w. j av a 2s . com public void setUp() throws Exception { super.setUp(); tappedStuff = new HashMap<String, ResponseMessage>(); URI uri = new URI(CouchbaseUtils.CONNECT_STRING); String user = CouchbaseUtils.COUCHBASE_USER_NAME; String pass = CouchbaseUtils.COUCHBASE_USER_PASS; try { cb = new CouchbaseClient(Arrays.asList(uri), user, pass); } catch (IOException e) { LOG.error("Couldn't connect to server" + e.getMessage()); fail(e.toString()); } this.client = new TapClient(Arrays.asList(uri), user, pass); cb.flush(); Thread.sleep(500); // set up the items we're going to deserialize Integer anint = new Integer(Integer.MIN_VALUE); cb.set(anint.toString(), 0x300, anint).get(); Long along = new Long(Long.MAX_VALUE); cb.set(along.toString(), 0, along).get(); Float afloat = new Float(Float.MAX_VALUE); cb.set(afloat.toString(), 0, afloat).get(); Double doubleBase = new Double(Double.NEGATIVE_INFINITY); cb.set(doubleBase.toString(), 0, doubleBase).get(); Boolean booleanBase = true; cb.set(booleanBase.toString(), 0, booleanBase).get(); rightnow = new Date(); // instance, needed later dateText = rightnow.toString().replaceAll(" ", "_"); cb.set(dateText, 0, rightnow).get(); Byte byteMeSix = new Byte("6"); cb.set(byteMeSix.toString(), 0, byteMeSix).get(); String ourString = "hi,there"; cb.set(ourString.toString(), 0, ourString).get(); client.tapDump("tester"); while (client.hasMoreMessages()) { ResponseMessage m = client.getNextMessage(); if (m == null) { continue; } tappedStuff.put(m.getKey(), m); } }
From source file:edu.upc.dama.sparksee.RemoteGraph.java
public String begin(long timestamp) { Long transactionId = ((RemoteTransaction) this.tx()).begin(timestamp); return "{\"id\":" + transactionId.toString() + "}"; }
From source file:org.telegram.telegrambots.api.methods.send.SendGame.java
public SendGame setChatId(Long chatId) { Objects.requireNonNull(chatId); this.chatId = chatId.toString(); return this; }
From source file:jp.primecloud.auto.sdk.client.component.StopComponent.java
public void execute(Long componentNo, List<Long> instanceNos, Boolean isStopInstance) { Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("ComponentNo", componentNo.toString()); parameters.put("InstanceNos", StringUtils.join(instanceNos, ",")); if (isStopInstance != null) { parameters.put("IsStopInstance", isStopInstance.toString()); }/*ww w .j av a2 s. c o m*/ requester.execute("/StopComponent", parameters); }