List of usage examples for java.lang Long MAX_VALUE
long MAX_VALUE
To view the source code for java.lang Long MAX_VALUE.
Click Source Link
From source file:com.alibaba.ims.platform.util.DateUtil.java
/** * /* ww w . j a v a2s . com*/ * * @param date1 * @param date2 * @return */ public static long minus(Date date1, Date date2) { if (date1 == null || date2 == null) { return Long.MAX_VALUE; } return ((date1.getTime() - date2.getTime() - 1) / DateUtils.MILLIS_PER_DAY) + 1; }
From source file:com.mongodb.hadoop.input.MongoInputSplit.java
/** * This is supposed to return the size of the split in bytes, but for now, for sanity sake we return the # of docs * in the split instead./*from w w w . j a v a 2 s. c om*/ * * @return */ @Override public long getLength() { return Long.MAX_VALUE; }
From source file:com.twitter.hraven.TestJobKey.java
/** * Confirm that we can properly serialize and deserialize a JobKey. *//*from w ww.ja v a 2 s . c o m*/ @Test public void testKeySerialization() { JobKeyConverter conv = new JobKeyConverter(); JobKey key = new JobKey("cluster1@identifier1", "user1", "app1", 13, "job_20120101235959_0001"); byte[] keyBytes = conv.toBytes(key); JobKey key2 = conv.fromBytes(keyBytes); assertEquals(key.getCluster(), key2.getCluster()); assertEquals(key.getUserName(), key2.getUserName()); assertEquals(key.getAppId(), key2.getAppId()); assertEquals(key.getRunId(), key2.getRunId()); assertEquals(key.getJobId(), key2.getJobId()); // also verify that the runId gets inverted in the serialized byte // representation byte[][] keyParts = ByteUtil.split(keyBytes, Constants.SEP_BYTES); assertEquals(5, keyParts.length); long encodedRunId = Bytes.toLong(keyParts[3]); assertEquals(key.getRunId(), Long.MAX_VALUE - encodedRunId); // test partial keys key = new JobKey("c1@local", "user1", "app1", 15, (String) null); keyBytes = conv.toBytes(key); key2 = conv.fromBytes(keyBytes); assertEquals(key.getCluster(), key2.getCluster()); assertEquals(key.getUserName(), key2.getUserName()); assertEquals(key.getAppId(), key2.getAppId()); assertEquals(key.getRunId(), key2.getRunId()); assertEquals(key.getJobId(), key2.getJobId()); // key with no trailing job Id keyBytes = ByteUtil.join(Constants.SEP_BYTES, Bytes.toBytes("c1@local"), Bytes.toBytes("user1"), Bytes.toBytes("app1"), Bytes.toBytes(Long.MAX_VALUE - 15L)); key2 = conv.fromBytes(keyBytes); assertEquals("c1@local", key2.getCluster()); assertEquals("user1", key2.getUserName()); assertEquals("app1", key2.getAppId()); assertEquals(15L, key2.getRunId()); assertEquals(0L, key2.getJobId().getJobEpoch()); assertEquals(0L, key2.getJobId().getJobSequence()); // key with empty appId key = new JobKey("c1@local", "user1", "", 1234L, "job_201206201718_1941"); keyBytes = conv.toBytes(key); key2 = conv.fromBytes(keyBytes); assertKey(key, key2); }
From source file:info.archinnov.achilles.test.integration.tests.SliceQueryIterateIT.java
@Test public void should_iterate_with_default_params() throws Exception { long partitionKey = RandomUtils.nextLong(0, Long.MAX_VALUE); insertClusteredValues(partitionKey, 1, "name1", 5); Iterator<ClusteredEntity> iter = manager.sliceQuery(ClusteredEntity.class).forIteration() .withPartitionComponents(partitionKey).iterator(); assertThat(iter.hasNext()).isTrue(); ClusteredEntity next = iter.next();//from ww w .j av a 2s. c om assertThat(next.getId().getCount()).isEqualTo(1); assertThat(next.getId().getName()).isEqualTo("name11"); assertThat(next.getValue()).isEqualTo("value11"); assertThat(iter.hasNext()).isTrue(); next = iter.next(); assertThat(next.getId().getCount()).isEqualTo(1); assertThat(next.getId().getName()).isEqualTo("name12"); assertThat(next.getValue()).isEqualTo("value12"); assertThat(iter.hasNext()).isTrue(); next = iter.next(); assertThat(next.getId().getCount()).isEqualTo(1); assertThat(next.getId().getName()).isEqualTo("name13"); assertThat(next.getValue()).isEqualTo("value13"); assertThat(iter.hasNext()).isTrue(); next = iter.next(); assertThat(next.getId().getCount()).isEqualTo(1); assertThat(next.getId().getName()).isEqualTo("name14"); assertThat(next.getValue()).isEqualTo("value14"); assertThat(iter.hasNext()).isTrue(); next = iter.next(); assertThat(next.getId().getCount()).isEqualTo(1); assertThat(next.getId().getName()).isEqualTo("name15"); assertThat(next.getValue()).isEqualTo("value15"); assertThat(iter.hasNext()).isFalse(); }
From source file:io.macgyver.neorx.rest.NeoRxClientTest.java
@Test public void testLongParam() { NeoRxClient c = new NeoRxClient(); Assert.assertEquals(JsonNodeType.NUMBER, c.createParameters("abc", Long.MAX_VALUE).get("abc").getNodeType()); }
From source file:de.tor.tribes.types.TargetInformation.java
public void updateAttackInfo() { snobs = 0;/*from w w w . j ava2 s .co m*/ fakes = 0; first = Long.MAX_VALUE; last = Long.MIN_VALUE; for (TimedAttack a : getAttacks()) { if (a.isPossibleFake()) { fakes++; } else if (a.isPossibleSnob()) { snobs++; } if (a.getlArriveTime() < first) { first = a.getlArriveTime(); } if (a.getlArriveTime() > last) { last = a.getlArriveTime(); } } logger.debug(target.getCoordAsString() + " found " + snobs + " snobs and " + fakes + " fakes"); }
From source file:info.archinnov.achilles.it.TestEntityWithClusteringIT.java
@Test public void should_select_with_allow_per_partition_limit() throws Exception { //Given//from w w w . j a v a 2s . c om Long id1 = RandomUtils.nextLong(0L, Long.MAX_VALUE); Long id2 = RandomUtils.nextLong(0L, Long.MAX_VALUE); Long id3 = RandomUtils.nextLong(0L, Long.MAX_VALUE); scriptExecutor.executeScriptTemplate("EntityWithClustering/insertRows.cql", ImmutableMap.of("id1", id1, "id2", id2, "id3", id3)); //When final List<EntityWithClustering> list = manager.dsl().select().allColumns_FromBaseTable() .without_WHERE_Clause().perPartitionLimit(2).getList(); //Then assertThat(list).hasSize(6); assertThat(list.stream().map(x -> x.getClust()).collect(Collectors.toList())).containsExactly(1L, 2L, 1L, 2L, 1L, 2L); }
From source file:com.proofpoint.units.DataSize.java
public long roundTo(Unit unit) { double rounded = Math.floor(getValue(unit) + 0.5d); Preconditions.checkArgument(rounded <= Long.MAX_VALUE, "size is too large to be represented in requested unit as a long"); return (long) rounded; }
From source file:com.jxt.web.filter.FilterDescriptor.java
public Long getResponseTo() { if (toResponseTime == null) { return null; } else if ("max".equals(toResponseTime)) { return Long.MAX_VALUE; } else {/* ww w .j av a 2 s. c om*/ return Long.valueOf(toResponseTime); } }
From source file:com.zimbra.common.util.BufferStreamRequestEntity.java
public BufferStreamRequestEntity(InputStream is, String contentType, long sizeHint, int maxBuffer) { this(is, contentType, sizeHint, maxBuffer, Long.MAX_VALUE); }