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:dk.netarkivet.harvester.harvesting.metadata.MetadataFileWriterWarc.java
/** * Create a <code>MetadataFileWriter</code> for WARC output. * * @param metadataWarcFile The WARC output file * @return <code>MetadataFileWriter</code> for writing metadata files in WARC *///from w ww .j ava2 s . c o m public static MetadataFileWriter createWriter(File metadataWarcFile) { MetadataFileWriterWarc mtfw = new MetadataFileWriterWarc(); WarcFileNaming naming = new WarcFileNamingSingleFile(metadataWarcFile); WarcFileWriterConfig config = new WarcFileWriterConfig(metadataWarcFile.getParentFile(), false, Long.MAX_VALUE, true); mtfw.writer = WarcFileWriter.getWarcWriterInstance(naming, config); mtfw.open(); return mtfw; }
From source file:edu.umass.cs.reconfiguration.reconfigurationpackets.DemandReport.java
/** * @param initiator//from w w w. j a v a2 s . c om * @param name * @param epochNumber * @param demand */ public DemandReport(NodeIDType initiator, String name, int epochNumber, AbstractDemandProfile demand) { super(initiator, ReconfigurationPacket.PacketType.DEMAND_REPORT, name, epochNumber); this.stats = demand.getStats(); this.requestID = (long) (Math.random() * Long.MAX_VALUE); }
From source file:info.archinnov.achilles.test.integration.tests.bugs.JSONSerializationForCollectionAndMapIT.java
@Test public void should_encode() throws Exception { //Given/*ww w .j a v a 2 s .c om*/ Long id = RandomUtils.nextLong(0, Long.MAX_VALUE); final EntityWithJSONOnCollectionAndMap entity = new EntityWithJSONOnCollectionAndMap(id, Arrays.asList(1, 2), Sets.newHashSet(3), ImmutableMap.of(1, 100), ImmutableMap.of(2, 200), ImmutableMap.of(3, 300)); manager.insert(entity); //When final TypedMap found = manager .nativeQuery(select().from(EntityWithJSONOnCollectionAndMap.TABLE_NAME).where(eq("id", id))) .getFirst(); //Then assertThat(found.<List<String>>getTyped("mylist")).containsExactly("1", "2"); assertThat(found.<Set<String>>getTyped("myset")).containsExactly("3"); assertThat(found.<Map<String, Integer>>getTyped("keymap")).contains(MapEntry.entry("1", 100)); assertThat(found.<Map<String, Integer>>getTyped("valuemap")).contains(MapEntry.entry(2, "200")); assertThat(found.<Map<String, Integer>>getTyped("keyvaluemap")).contains(MapEntry.entry("3", "300")); }
From source file:fr.inria.lille.repair.nopol.NoPolLauncher.java
public static List<Patch> launch(File[] sourceFile, URL[] classpath, StatementType type, String[] args) { System.out.println("Source files: " + Arrays.toString(sourceFile)); System.out.println("Classpath: " + Arrays.toString(classpath)); System.out.println("Statement type: " + type); System.out.println("Args: " + Arrays.toString(args)); System.out.println("Config: " + Config.INSTANCE); System.out.println("Available processors (cores): " + Runtime.getRuntime().availableProcessors()); /* Total amount of free memory available to the JVM */ System.out.println("Free memory: " + FileUtils.byteCountToDisplaySize(Runtime.getRuntime().freeMemory())); /* This will return Long.MAX_VALUE if there is no preset limit */ long maxMemory = Runtime.getRuntime().maxMemory(); /* Maximum amount of memory the JVM will attempt to use */ System.out.println("Maximum memory: " + (maxMemory == Long.MAX_VALUE ? "no limit" : FileUtils.byteCountToDisplaySize(maxMemory))); /* Total memory currently available to the JVM */ System.out.println("Total memory available to JVM: " + FileUtils.byteCountToDisplaySize(Runtime.getRuntime().totalMemory())); System.out.println("Java version: " + Runtime.class.getPackage().getImplementationVersion()); System.out.println("JAVA_HOME: " + System.getenv("JAVA_HOME")); System.out.println("PATH: " + System.getenv("PATH")); long executionTime = System.currentTimeMillis(); NoPol nopol = new NoPol(sourceFile, classpath, type); List<Patch> patches = null; try {/*from w w w. j ava2s. c o m*/ if (args.length > 0) { patches = nopol.build(args); } else { patches = nopol.build(); } } catch (Exception e) { e.printStackTrace(); } finally { executionTime = System.currentTimeMillis() - executionTime; displayResult(nopol, patches, executionTime); } return patches; }
From source file:com.destroystokyo.paperclip.Paperclip.java
static void run(final String[] args) { try {//from w w w . j ava2 s . c o m digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { System.err.println("Could not create hashing instance"); e.printStackTrace(); System.exit(1); } final PatchData patchInfo; try (final InputStream is = getConfig()) { patchInfo = PatchData.parse(is); } catch (final IllegalArgumentException e) { System.err.println("Invalid patch file"); e.printStackTrace(); System.exit(1); return; } catch (final IOException e) { System.err.println("Error reading patch file"); e.printStackTrace(); System.exit(1); return; } final File vanillaJar = new File(cache, "mojang_" + patchInfo.getVersion() + ".jar"); paperJar = new File(cache, "patched_" + patchInfo.getVersion() + ".jar"); final boolean vanillaValid; final boolean paperValid; try { vanillaValid = checkJar(vanillaJar, patchInfo.getOriginalHash()); paperValid = checkJar(paperJar, patchInfo.getPatchedHash()); } catch (final IOException e) { System.err.println("Error reading jar"); e.printStackTrace(); System.exit(1); return; } if (!paperValid) { if (!vanillaValid) { System.out.println("Downloading original jar..."); //noinspection ResultOfMethodCallIgnored cache.mkdirs(); //noinspection ResultOfMethodCallIgnored vanillaJar.delete(); try (final InputStream stream = patchInfo.getOriginalUrl().openStream()) { final ReadableByteChannel rbc = Channels.newChannel(stream); try (final FileOutputStream fos = new FileOutputStream(vanillaJar)) { fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } } catch (final IOException e) { System.err.println("Error downloading original jar"); e.printStackTrace(); System.exit(1); } // Only continue from here if the downloaded jar is correct try { if (!checkJar(vanillaJar, patchInfo.getOriginalHash())) { System.err.println("Invalid original jar, quitting."); System.exit(1); } } catch (final IOException e) { System.err.println("Error reading jar"); e.printStackTrace(); System.exit(1); } } if (paperJar.exists()) { if (!paperJar.delete()) { System.err.println("Error deleting invalid jar"); System.exit(1); } } System.out.println("Patching original jar..."); final byte[] vanillaJarBytes; final byte[] patch; try { vanillaJarBytes = getBytes(vanillaJar); patch = Utils.readFully(patchInfo.getPatchFile().openStream()); } catch (final IOException e) { System.err.println("Error patching original jar"); e.printStackTrace(); System.exit(1); return; } // Patch the jar to create the final jar to run try (final FileOutputStream jarOutput = new FileOutputStream(paperJar)) { Patch.patch(vanillaJarBytes, patch, jarOutput); } catch (final CompressorException | InvalidHeaderException | IOException e) { System.err.println("Error patching origin jar"); e.printStackTrace(); System.exit(1); } } // Exit if user has set `paperclip.patchonly` system property to `true` if (Boolean.getBoolean("paperclip.patchonly")) { System.exit(0); } // Get main class info from jar final String main; try (final FileInputStream fs = new FileInputStream(paperJar); final JarInputStream js = new JarInputStream(fs)) { main = js.getManifest().getMainAttributes().getValue("Main-Class"); } catch (final IOException e) { System.err.println("Error reading from patched jar"); e.printStackTrace(); System.exit(1); return; } // Run the jar Utils.invoke(main, args); }
From source file:com.gsma.mobileconnect.cache.DiscoveryCacheValueTest.java
@Test public void create_withoutValue_shouldThrowException() { // THEN/* ww w .j a va 2s .com*/ thrown.expect(IllegalArgumentException.class); thrown.expectMessage(containsString("value")); new DiscoveryCacheValue(new Date(Long.MAX_VALUE), null); }
From source file:com.joyent.manta.client.crypto.AesCbcCipherDetails.java
@Override public long plaintextSize(final long ciphertextSize) { Validate.inclusiveBetween(0L, Long.MAX_VALUE, ciphertextSize); if (ciphertextSize == getBlockSizeInBytes() + getAuthenticationTagOrHmacLengthInBytes()) { return 0L; }/*from w ww .j a va 2s. c om*/ return ciphertextSize - getBlockSizeInBytes() - getAuthenticationTagOrHmacLengthInBytes(); }
From source file:com.parivero.swagger.demo.controller.PaisController.java
@RequestMapping(method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED)//from w ww . ja v a2 s . c om public @ResponseBody Pais alta(@RequestBody Pais pais) { if (pais.getId() != null) { throw new IllegalArgumentException(); } pais.setId(Long.MAX_VALUE); pais.setNombre(pais.getNombre() + "- Creado"); return pais; }
From source file:info.archinnov.achilles.test.integration.tests.SchemaUpdateIT.java
@Test public void should_allow_dynamic_schema_update() throws Exception { //Given/*from ww w .j a v a2s. c om*/ Long id = RandomUtils.nextLong(0, Long.MAX_VALUE); final Session session = CassandraEmbeddedServerBuilder.noEntityPackages() .withKeyspaceName("schema_dynamic_update").cleanDataFilesAtStartup(true).buildNativeSessionOnly(); session.execute("DROP TABLE IF EXISTS new_simple_field"); session.execute("DROP INDEX IF EXISTS field_index"); session.execute("CREATE TABLE new_simple_field(id bigint PRIMARY KEY, existing_field text)"); session.execute("CREATE INDEX field_index ON schema_dynamic_update.new_simple_field(existing_field)"); //When final PersistenceManagerFactory pmf = PersistenceManagerFactoryBuilder.builder(session.getCluster()) .withNativeSession(session).withEntities(Arrays.<Class<?>>asList(EntityWithNewSimpleField.class)) .enableSchemaUpdate(false) .enableSchemaUpdateForTables(ImmutableMap.of("schema_dynamic_update.new_simple_field", true)) .relaxIndexValidation(true).build(); final PersistenceManager pm = pmf.createPersistenceManager(); pm.insert(new EntityWithNewSimpleField(id, "existing", "new")); //Then final EntityWithNewSimpleField found = pm.find(EntityWithNewSimpleField.class, id); assertThat(found).isNotNull(); assertThat(found.getUnmappedField()).isEqualTo("UNMAPPED"); assertThat(pm.find(EntityWithNewSimpleField.class, id).getUnmappedField()).isEqualTo("UNMAPPED"); session.close(); }
From source file:jp.primecloud.auto.api.ApiValidate.java
public static void validateComponentTypeNo(String componentTypeNo) { ValidateUtil.required(componentTypeNo, "EAPI-000001", new Object[] { PARAM_NAME_COMPONENT_TYPE_NO }); ValidateUtil.longInRange(componentTypeNo, 1, Long.MAX_VALUE, "EAPI-000002", new Object[] { PARAM_NAME_COMPONENT_TYPE_NO, 1, Long.MAX_VALUE }); }