Example usage for java.lang Long MAX_VALUE

List of usage examples for java.lang Long MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Long MAX_VALUE.

Prototype

long MAX_VALUE

To view the source code for java.lang Long MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value a long can have, 263-1.

Usage

From source file:edu.cornell.med.icb.goby.modes.TestReformatCompactReadsMode.java

/**
 * Validates that the reformat compact reads mode is capable of reformatting when
 * given positions at the extreme minimum and maximum values.
 *
 * @throws IOException if there is a problem reading or writing to the files
 *//* w w  w . j ava 2 s.c  om*/
@Test
public void startAndEndAtExtremes() throws IOException {
    final ReformatCompactReadsMode reformat = new ReformatCompactReadsMode();

    final String inputFilename = "test-data/compact-reads/s_1_sequence_short.compact-reads";
    reformat.setInputFilenames(inputFilename);
    reformat.setStartPosition(0L);
    reformat.setEndPosition(Long.MAX_VALUE);
    final String outputFilename = "test-results/reformat-test-extremes.compact-reads";
    reformat.setOutputFile(outputFilename);
    reformat.execute();

    assertTrue(FileUtils.contentEquals(new File(inputFilename), new File(outputFilename)));
}

From source file:info.archinnov.achilles.it.TestAsyncCRUDSimpleEntity.java

@Test
public void should_insert_async() throws Exception {
    //Given//from   w ww.j a  va  2  s  .c  om
    final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final Date date = new Date();
    final SimpleEntity entity = new SimpleEntity(id, date, "value");
    final CountDownLatch latch = new CountDownLatch(1);
    final CassandraLogAsserter logAsserter = new CassandraLogAsserter();
    logAsserter.prepareLogLevel(ASYNC_LOGGER_STRING, "%msg - [%thread]%n");

    //When
    manager.crud().insert(entity).withResultSetAsyncListener(rs -> {
        LOGGER.info(CALLED);
        latch.countDown();
        return rs;
    }).executeAsync();

    //Then
    latch.await();
    logAsserter.assertContains("Called - [achilles-default-executor");

    final List<Row> rows = session.execute("SELECT * FROM simple WHERE id = " + id).all();
    assertThat(rows).hasSize(1);

    final Row row = rows.get(0);
    assertThat(row.getLong("id")).isEqualTo(id);
    assertThat(row.getTimestamp("date")).isEqualTo(date);
    assertThat(row.getString("value")).isEqualTo("value");
}

From source file:de.rwhq.hdfs.index.LineRecordReader.java

public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException {
    FileSplit split = (FileSplit) genericSplit;
    Configuration job = context.getConfiguration();
    this.maxLineLength = job.getInt("mapred.linerecordreader.maxlength", Integer.MAX_VALUE);
    start = split.getStart();/*from  w  w  w. j a  v  a  2s .co  m*/
    end = start + split.getLength();
    final Path file = split.getPath();
    compressionCodecs = new CompressionCodecFactory(job);
    final CompressionCodec codec = compressionCodecs.getCodec(file);

    // open the file and seek to the start of the split
    FileSystem fs = file.getFileSystem(job);
    fileIn = fs.open(split.getPath());
    boolean skipFirstLine = false;
    if (codec != null) {
        in = new LineReader(codec.createInputStream(fileIn), job);
        end = Long.MAX_VALUE;
    } else {
        if (start != 0) {
            skipFirstLine = true;
            --start;
            fileIn.seek(start);
        }
        in = new LineReader(fileIn, job);
    }
    if (skipFirstLine) { // skip first line and re-establish "start".
        start += in.readLine(new Text(), 0, (int) Math.min((long) Integer.MAX_VALUE, end - start));
    }
    this.pos = start;
}

From source file:org.esupportail.portlet.filemanager.services.ResourceUtils.java

/**
 * @param filename//from  w w  w.j ava  2 s.co m
 * @return size limit in bytes
 */
public Long getSizeLimit(String filename) {
    Long limit = sizeLimitMap.get(getFileExtension(filename));
    if (limit == null) {
        return Long.MAX_VALUE;
    }

    limit *= (1024 * 1024);

    //overflow
    if (limit < 0) {
        return Long.MAX_VALUE;
    }

    return limit;
}

From source file:info.archinnov.achilles.it.TestEntityWithComplexIndices.java

@Test
public void should_query_using_collection_index() throws Exception {
    //Given//  ww  w.j  av  a  2 s.  com
    final Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    scriptExecutor.executeScriptTemplate("EntityWithIndicesForJSON/insertRows.cql", ImmutableMap.of("id", id));

    //When
    final List<EntityWithComplexIndices> actual = manager.indexed().select().allColumns_FromBaseTable().where()
            .collectionIndex().Contains("4").getList();

    //Then
    assertThat(actual).hasSize(1);
    final EntityWithComplexIndices entity = actual.get(0);
    assertThat(entity.getSimpleIndex()).isEqualTo("411");
}

From source file:com.hpcloud.util.Duration.java

/** Infinite constructor. */
private Duration() {
    finite = false;
    this.length = Long.MAX_VALUE;
    this.timeUnit = TimeUnit.DAYS;
}

From source file:info.archinnov.achilles.test.integration.tests.InsertStrategyIT.java

@Test
public void should_insert_not_null_field_overriding_global_config() throws Exception {
    //Given/*from  w w w. j a  va  2 s.com*/
    Long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    EntityWithNotNullInsertStrategy entity = new EntityWithNotNullInsertStrategy();
    entity.setId(id);
    entity.setName("Helen");
    entity.setLabel("label");

    //When
    manager1.insert(entity);
    entity.setLabel(null);

    manager1.insert(entity);

    //Then
    final EntityWithNotNullInsertStrategy found = manager1.find(EntityWithNotNullInsertStrategy.class, id);

    assertThat(found.getName()).isEqualTo("Helen");
    assertThat(found.getLabel()).isEqualTo("label");
}

From source file:io.cloudslang.engine.partitions.services.PartitionTemplateWithEmfTest.java

@Test
@DirtiesContext//from w  w  w. j av  a2  s . c o m
public void startSecondTime() { // the partition group is already exist
    service.createPartitionGroup(tableName, Integer.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE);
    PartitionGroup partitionGroupOrig = service.readPartitionGroup(tableName);

    applicationContext.getBean(tableName, PartitionTemplate.class);
    PartitionGroup partitionGroup = service.readPartitionGroup(tableName);
    assertThat(partitionGroup).isEqualTo(partitionGroupOrig);
}

From source file:net.dfs.server.filespace.accessor.impl.WriteSpaceAccessorImpl.java

/**
 * writeToSPace will write a File object to the newly created local Space. It
 * makes sure the Space is not null before the File objects are been written to the 
 * Space.//  w  w  w . j a v  a  2  s . c  o  m
 * <p>
 * It returns no value and throws RemoteException or TransactionException on a failure.
 * 
 * @param file is an object of the type {@link FileStorageModel}
 */

public void writeToSpace(FileToken token) {

    if (space == null) {
        try {
            if (space == null) {
                space = spaceCreator.getSpace(InetAddress.getByName(serverIP), InetAddress.getLocalHost());
            }

        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

    try {
        space.write((FileToken) token, null, Long.MAX_VALUE);
        log.info("Chunk " + token.fileName + " with Chunk No " + token.CHUNK_NO + " Written to the Space");

    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (TransactionException e) {
        e.printStackTrace();
    }
}