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:info.archinnov.achilles.it.TestEntityWithSASIIndices.java
@Test public void should_search_using_like_non_tokenizer() throws Exception { //Given// ww w. j av a 2s .c o m Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); scriptExecutor.executeScriptTemplate("EntityWithSASIIndices/insertRows.cql", ImmutableMap.of("id", id)); //When final List<EntityWithSASIIndices> actual = manager.indexed().select().allColumns_FromBaseTable().where() .prefixNonTokenizer().Like("speedster").sparse().Gte(13).sparse().Lte(15).getList(); //Then assertThat(actual).hasSize(1); assertThat(actual.get(0).getPrefixNonTokenizer()).isEqualTo("speedster"); }
From source file:uk.codingbadgers.bootstrap.download.EtagDownload.java
public void download() { CloseableHttpClient client = HttpClients.createDefault(); HttpGet assetRequest = new HttpGet(remote); assetRequest.setHeader(new BasicHeader("Accept", BootstrapConstants.ASSET_MIME_TYPE)); if (local.exists()) { assetRequest// www.j a v a 2s . c o m .setHeader(new BasicHeader("If-None-Match", "\"" + ChecksumGenerator.createMD5(local) + "\"")); } try { HttpResponse response = client.execute(assetRequest); StatusLine status = response.getStatusLine(); if (status.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) { // No need to download, its already latest System.out.println("File " + local.getName() + " is up to date with remote, no need to download"); } else if (status.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY || status.getStatusCode() == HttpStatus.SC_OK) { // Update local version System.err.println("Downloading " + local.getName()); HttpEntity entity = response.getEntity(); ReadableByteChannel rbc = Channels.newChannel(entity.getContent()); FileOutputStream fos = new FileOutputStream(local); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); EntityUtils.consume(entity); String hash = "\"" + ChecksumGenerator.createMD5(local) + "\""; if (!hash.equalsIgnoreCase(response.getFirstHeader("Etag").getValue())) { throw new BootstrapException( "Error downloading file (" + local.getName() + ")\n[expected hash: " + response.getFirstHeader("Etag").getValue() + " but got " + hash + "]"); } System.out.println("Downloaded " + local.getName()); } else { throw new BootstrapException("Error getting update from github. Error: " + status.getStatusCode() + status.getReasonPhrase()); } } catch (IOException ex) { throw new BootstrapException(ex); } finally { close(client); } }
From source file:com.luna.common.repository.RepositoryHelperIT.java
@Test public void testFindAllWithCondition() { String ql = "select o from User o where id>=? and id<=?"; List<User> before = repositoryHelper.findAll(ql, 0L, Long.MAX_VALUE); User user1 = createUser();/*from w w w. j a va 2 s . com*/ User user2 = createUser(); User user3 = createUser(); User user4 = createUser(); repositoryHelper.getEntityManager().persist(user1); repositoryHelper.getEntityManager().persist(user2); repositoryHelper.getEntityManager().persist(user3); repositoryHelper.getEntityManager().persist(user4); List<User> after = repositoryHelper.findAll(ql, 0L, user2.getId()); Assert.assertEquals(before.size() + 2, after.size()); Assert.assertTrue(after.contains(user1)); Assert.assertTrue(after.contains(user2)); Assert.assertFalse(after.contains(user3)); Assert.assertFalse(after.contains(user4)); }
From source file:de.undercouch.bson4jackson.BsonGeneratorTest.java
@Test public void generatePrimitives() throws Exception { Map<String, Object> data = new LinkedHashMap<String, Object>(); data.put("Int32", 5); data.put("Boolean1", true); data.put("Boolean2", false); data.put("String", "Hello"); data.put("Long", 1234L); data.put("Null", null); data.put("Float", 1234.1234f); data.put("Double", 5678.5678); //BigInteger that can be serialized as an Integer data.put("BigInt1", BigInteger.valueOf(Integer.MAX_VALUE)); //BigInteger that can be serialized as a Long BigInteger bi2 = BigInteger.valueOf(Integer.MAX_VALUE).multiply(BigInteger.valueOf(2)); data.put("BigInt2", bi2); //BigInteger that will be serialized as a String BigInteger bi3 = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(Long.MAX_VALUE)); data.put("BigInt3", bi3); BSONObject obj = generateAndParse(data); assertEquals(5, obj.get("Int32")); assertEquals(true, obj.get("Boolean1")); assertEquals(false, obj.get("Boolean2")); assertEquals("Hello", obj.get("String")); assertEquals(1234L, obj.get("Long")); assertEquals(null, obj.get("Null")); assertEquals(1234.1234f, (Double) obj.get("Float"), 0.00001); assertEquals(5678.5678, (Double) obj.get("Double"), 0.00001); assertEquals(Integer.MAX_VALUE, obj.get("BigInt1")); assertEquals(Long.valueOf(Integer.MAX_VALUE) * 2L, obj.get("BigInt2")); assertEquals(bi3.toString(), obj.get("BigInt3")); }
From source file:info.archinnov.achilles.it.TestEntityWithStaticAnnotations.java
@Test public void should_insert_using_static_strategy_an_consistency_level() throws Exception { //Given/*from w w w.ja v a 2s. c o m*/ final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE); scriptExecutor.executeScriptTemplate("EntityWithStaticAnnotations/insert_single_row.cql", ImmutableMap.of("id", id)); final EntityWithStaticAnnotations entity = new EntityWithStaticAnnotations(id, "new_val", null); final CassandraLogAsserter logAsserter = new CassandraLogAsserter(); logAsserter.prepareLogLevelForDriverConnection(); //When manager.crud().insert(entity).usingTimeToLive(1000).execute(); //Then Row actual = session.execute("SELECT * FROM entity_static_annotations WHERE partition_key = " + id).one(); assertThat(actual).isNotNull(); assertThat(actual.getString("value")).isEqualTo("new_val"); assertThat(actual.getString("\"overRiden\"")).isEqualTo("overriden_val"); logAsserter.assertConsistencyLevels(LOCAL_ONE); }
From source file:com.twitter.hraven.etl.JobFileModifiedRangePathFilter.java
/** * Constructs a filter that accepts only JobFiles with lastModification time * as least the specified minumum.//from ww w . j a v a2s.co m * * @param myConf * used to be able to go from a path to a FileStatus. * @param minModificationTimeMillis * The minimum modification time of a file to be accepted in * milliseconds since January 1, 1970 UTC (excluding). */ public JobFileModifiedRangePathFilter(Configuration myConf, long minModificationTimeMillis) { this(myConf, minModificationTimeMillis, Long.MAX_VALUE); }
From source file:com.redhat.lightblue.ResponseTest.java
@Test public void testWithMatchCount() { node = JsonNodeFactory.withExactBigDecimals(true).numberNode(Long.MAX_VALUE); builder.withMatchCount(node);//from w w w.j a v a 2 s . co m assertTrue(new Long(Long.MAX_VALUE).equals(builder.buildResponse().getMatchCount())); }
From source file:org.openspaces.maven.plugin.RunHSQLDBViewMojo.java
/** Executes the Mojo **/ public void executeMojo() throws MojoExecutionException, MojoFailureException { if (help != null) { printUsage();//from ww w . j a va2 s . c o m } else { ArrayList argList = new ArrayList(); // handles the case when the user specifies an empty string for driver // in that case driver gets the value 'true' if (StringUtils.hasText(driver) && !driver.equals("true")) { argList.add("-driver"); argList.add(driver); } // handles the case when the user specifies an empty string for driver // in that case url gets the value 'true' if (StringUtils.hasText(url) && !url.equals("true")) { argList.add("-url"); argList.add(url); } if (StringUtils.hasText(user)) { argList.add("-user"); argList.add(user); } if (StringUtils.hasText(password)) { argList.add("-password"); argList.add(password); } // create the arguments array String[] args = new String[argList.size()]; argList.toArray(args); PluginLog.getLog().info("Starting HSQLDB viewer with arguments: " + argList); // start the viewer and sleep forever DatabaseManagerSwing.main(args); try { Thread.currentThread().sleep(Long.MAX_VALUE); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:edu.cornell.med.icb.goby.compression.FastBufferedMessageChunksReader.java
/** * Support for splitting the entries on the file system. * Seek the input to start and start looking for the beginning of a new collection. * When found, return all entries in the collection through hasNext, next(). * Will possibly return additional collection of entries, but will stop * returning new entries if the position in the input stream is past end. * * @param start The start index for the split * @param end The end index for the split * @param input The input stream containing the data * @throws IOException if there is a problem reading from the stream */// w w w. j a v a 2 s . co m public FastBufferedMessageChunksReader(final long start, long end, final FastBufferedInputStream input) throws IOException { super(); if (start < 0L) { throw new IllegalArgumentException("Start position (" + start + ") must not be less than zero"); } if (end != Long.MAX_VALUE && end < 0L) { throw new IllegalArgumentException("End position (" + end + ") must not be less than zero"); } if (start > end) { throw new IllegalArgumentException( "Start position (" + start + ") must not be greater than the end position (" + end + ")"); } if (end != Long.MAX_VALUE && start != end) { end += MessageChunksWriter.DELIMITER_LENGTH + 4; } startOffset = start; endOffset = end; this.input = input; this.in = new DataInputStream(input); supportedCodecRegistrationCodes = ChunkCodecHelper.registrationCodes(); reposition(start, end); }
From source file:com.metamx.emitter.core.EmitterTest.java
private HttpPostEmitter sizeBasedEmitter(int size) { HttpPostEmitter emitter = new HttpPostEmitter(new HttpEmitterConfig(Long.MAX_VALUE, size, TARGET_URL), httpClient, jsonMapper);//from www . jav a 2s .c om emitter.start(); return emitter; }