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.gsma.mobileconnect.impl.ParseIDTokenTest.java
@Test public void parseIDToken_withMissingCallback_shouldThrowException() throws OIDCException, DiscoveryResponseExpiredException { // GIVEN//from w w w . j a v a2s. c o m IOIDC oidc = Factory.getOIDC(null); DiscoveryResponse discoveryResponse = new DiscoveryResponse(true, new Date(Long.MAX_VALUE), 0, null, buildJsonNode()); // THEN thrown.expect(IllegalArgumentException.class); thrown.expectMessage(containsString("callback")); // WHEN oidc.parseIDToken(discoveryResponse, "", null, null); }
From source file:internal.product.ProductImportResource.java
@GET @Produces(MediaType.TEXT_PLAIN)//from w w w .j a v a2s . c om @Path("/file") public Response file(@HeaderParam("path") String path, @HeaderParam("skip") long skip, @HeaderParam("max") long max) { System.out.println("Product Load! path:" + path + " skip:" + skip + " max:" + max); Summary summary = new Summary(); if (max == 0) max = Long.MAX_VALUE; try (BufferedReader reader = Files.newBufferedReader(Paths.get(path))) { for (int i = 0; i < skip; i++) { reader.readLine(); } long bufferSize = 0; Transaction tx = db.beginTx(); try { for (int i = 0; i < max; i++) { if (bufferSize >= BATCH_SIZE) { tx.success(); tx.close(); tx = db.beginTx(); summary.batches++; bufferSize = 0; } String line = reader.readLine(); if (line == null) { summary.eof = true; break; } if (!processLine(line.toString(), summary, accountLRU, merchantLRU, brandLRU)) { StringBuilder extendedLine = new StringBuilder(line); boolean success = false; for (int retry = 0; retry < 20; retry++) { summary.failed++; if (i == max) { break; } line = reader.readLine(); i++; if (line == null) { summary.eof = true; break; } if (processLine(line, summary, accountLRU, merchantLRU, brandLRU)) { summary.processed++; bufferSize++; break; } extendedLine.append(line); if (processLine(extendedLine.toString(), summary, accountLRU, merchantLRU, brandLRU)) { summary.processed++; bufferSize++; summary.failed -= retry + 1; summary.multi_lines++; // System.out.println("Combined lines:"+(retry+1)); success = true; break; } } if (!success) { //System.out.println("Failed on:"+extendedLine.toString()); } } else { summary.processed++; bufferSize++; } if (i % 10000 == 0) { System.out.println(summary); } } } catch (Exception ex) { summary.batches++; tx.success(); tx.close(); ex.printStackTrace(); System.out.println("Failed:" + summary); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(UTF8.encode("{\"error\":\"" + ex.getMessage() + "\"}")).build(); } finally { tx.success(); summary.batches++; tx.close(); } } catch (IOException e) { e.printStackTrace(); System.out.println("Failed:" + summary); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(UTF8.encode("{\"error\":\"" + e.getMessage() + "\"}")).build(); } System.out.println("Done:" + summary); return Response .status(Status.OK).entity(UTF8.encode("{\"" + path + "\":\"OK\" , \"processed\":" + summary.processed + ", \"failed\":" + summary.failed + ", \"eof\":" + summary.eof + " }")) .build(); }
From source file:info.archinnov.achilles.it.TestALLEntityAsChild.java
@Test public void should_insert_generate_query_and_bound_values() throws Exception { //Given/* ww w . j av a2 s. c om*/ final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); final EntityAsChild entity = new EntityAsChild(id, "val", "child_val"); //When final InsertWithOptions<EntityAsChild> insert = manager.crud().insert(entity).usingTimeToLive(123) .usingTimestamp(100L); //Then String expectedQuery = "INSERT INTO " + DEFAULT_CASSANDRA_EMBEDDED_KEYSPACE_NAME + ".entity_child (id,child_value,value) " + "VALUES (:id,:child_value,:value) " + "USING TTL :ttl;"; assertThat(insert.getStatementAsString()).isEqualTo(expectedQuery); assertThat(insert.getBoundValues()).containsExactly(id, "child_val", "val", 123); assertThat(insert.getEncodedBoundValues()).containsExactly(id, "child_val", "val", 123); assertThat(insert.generateAndGetBoundStatement().preparedStatement().getQueryString()) .isEqualTo(expectedQuery); }
From source file:com.redhat.lightblue.ResponseTest.java
@Test public void testWithMatchCountNull() { builder.withMatchCount(null); assertFalse(new Long(Long.MAX_VALUE).equals(builder.buildResponse().getMatchCount())); }
From source file:com.redhat.lightblue.metadata.types.BigDecimalTypeTest.java
@Test public void testCastLong() { assertTrue(bigDecimalType.cast(Long.MAX_VALUE) instanceof BigDecimal); }
From source file:ac.elements.parser.SimpleDBConverter.java
/** * Encodes real long value into a string by offsetting and zero-padding * number up to the specified number of digits. Use this encoding method if * the data range set includes both positive and negative values. * /* w w w.ja v a 2 s . c o m*/ * com.xerox.amazonws.sdb.DataUtils * * @param number * long to be encoded * @return string representation of the long */ private static String encodeLong(long number) { int maxNumDigits = BigInteger.valueOf(Long.MAX_VALUE).subtract(BigInteger.valueOf(Long.MIN_VALUE)) .toString(RADIX).length(); long offsetValue = Long.MIN_VALUE; BigInteger offsetNumber = BigInteger.valueOf(number).subtract(BigInteger.valueOf(offsetValue)); String longString = offsetNumber.toString(RADIX); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(longString); return strBuffer.toString(); }
From source file:JobScheduler.java
private synchronized long runJobs() { long minDiff = Long.MAX_VALUE; long now = System.currentTimeMillis(); for (int i = 0; i < jobs.size();) { JobNode jn = (JobNode) jobs.elementAt(i); if (jn.executeAt.getTime() <= now) { if (tp != null) { tp.addRequest(jn.job);/* w w w . j a v a 2s . c o m*/ } else { Thread jt = new Thread(jn.job); jt.setDaemon(false); jt.start(); } if (updateJobNode(jn) == null) { jobs.removeElementAt(i); dlock.release(); } } else { long diff = jn.executeAt.getTime() - now; minDiff = Math.min(diff, minDiff); i++; } } return minDiff; }
From source file:info.archinnov.achilles.it.TestCastFunctionCallIT.java
@Test public void should_dsl_with_cast_nested_into_udf_call() throws Exception { //Given//w w w. j a va 2 s .c o m final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); Date now = new Date(); Thread.sleep(2); scriptExecutor.executeScriptTemplate("EntityForCastFunctionCall/insertRow.cql", ImmutableMap.of("id", id)); //When final TypedMap typedMap = manager.dsl().select().id() .function( FunctionsRegistry.convertStringToLong( castAsText(writetime(EntityForCastFunctionCall_AchillesMeta.COLUMNS.VALUE))), "casted") .fromBaseTable().where().id().Eq(id).getTypedMap(); //Then assertThat(typedMap).isNotNull(); assertThat(typedMap).isNotEmpty(); assertThat(typedMap.<Long>getTyped("casted")).isGreaterThan(now.getTime()); }
From source file:lirmm.inria.fr.math.BigSparseRealMatrix.java
/** * Build a sparse matrix with the supplied i and column dimensions. * * @param rowDimension Number of rows of the matrix. * @param columnDimension Number of columns of the matrix. * @throws NotStrictlyPositiveException if i or column dimension is not * positive./*from w w w .ja v a 2s . c o m*/ * @throws NumberIsTooLargeException if the total number of entries of the * matrix is larger than {@code Integer.MAX_VALUE}. */ public BigSparseRealMatrix(int rowDimension, int columnDimension) throws NotStrictlyPositiveException, NumberIsTooLargeException { super(rowDimension, columnDimension); long lRow = rowDimension; long lCol = columnDimension; if (lRow * lCol >= Long.MAX_VALUE) { throw new NumberIsTooLargeException(lRow * lCol, Long.MAX_VALUE, false); } this.rows = rowDimension; this.columns = columnDimension; this.entries = new OpenLongToDoubleHashMap(0.0); }
From source file:co.cask.cdap.internal.app.runtime.distributed.AbstractDistributedProgramRunner.java
protected EventHandler createEventHandler(CConfiguration cConf) { return new AbortOnTimeoutEventHandler( cConf.getLong(Constants.CFG_TWILL_NO_CONTAINER_TIMEOUT, Long.MAX_VALUE)); }