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:info.archinnov.achilles.test.integration.tests.StaticColumnIT.java

@Test
public void should_query_static_column() throws Exception {
    Long partitionKey = RandomUtils.nextLong(0, Long.MAX_VALUE);
    ClusteredEntityWithStaticColumn parisStreet1 = new ClusteredEntityWithStaticColumn(
            new ClusteredKey(partitionKey, "street1"), "Paris", "rue de la paix");
    ClusteredEntityWithStaticColumn parisStreet2 = new ClusteredEntityWithStaticColumn(
            new ClusteredKey(partitionKey, "street2"), "Paris", "avenue des Champs Elysees");

    manager.insert(parisStreet1);/*from  w ww . ja  v a  2 s .  c o m*/
    manager.insert(parisStreet2);

    List<ClusteredEntityWithStaticColumn> found = manager.sliceQuery(ClusteredEntityWithStaticColumn.class)
            .forSelect().withPartitionComponents(partitionKey).get(100);

    assertThat(found).hasSize(2);
    final ClusteredEntityWithStaticColumn foundParisStreet1 = found.get(0);
    final ClusteredEntityWithStaticColumn foundParisStreet2 = found.get(1);

    assertThat(foundParisStreet1.getStreet()).isEqualTo("rue de la paix");
    assertThat(foundParisStreet2.getStreet()).isEqualTo("avenue des Champs Elysees");

    ClusteredEntityWithStaticColumn lyonStreet3 = new ClusteredEntityWithStaticColumn(
            new ClusteredKey(partitionKey, "street3"), "Lyon", "rue Lamartine");
    manager.insert(lyonStreet3);

    found = manager.sliceQuery(ClusteredEntityWithStaticColumn.class).forSelect()
            .withPartitionComponents(partitionKey).get(100);

    assertThat(found).hasSize(3);
    final ClusteredEntityWithStaticColumn foundLyonStreet1 = found.get(0);
    final ClusteredEntityWithStaticColumn foundLyonStreet2 = found.get(1);
    final ClusteredEntityWithStaticColumn foundLyonStreet3 = found.get(2);

    assertThat(foundLyonStreet1.getStreet()).isEqualTo("rue de la paix");
    assertThat(foundLyonStreet1.getCity()).isEqualTo("Lyon");
    assertThat(foundLyonStreet2.getStreet()).isEqualTo("avenue des Champs Elysees");
    assertThat(foundLyonStreet3.getCity()).isEqualTo("Lyon");
    assertThat(foundLyonStreet3.getStreet()).isEqualTo("rue Lamartine");
    assertThat(foundLyonStreet3.getCity()).isEqualTo("Lyon");
}

From source file:com.jd.bdp.hydra.hbase.service.impl.QueryServiceImpl.java

@Override
public JSONArray getTracesByDuration(String serviceId, Long startTime, int sum, int durationMin,
        int durationMax) {
    JSONArray array = new JSONArray();
    Scan scan = new Scan();
    scan.setStartRow(new String(serviceId + ":" + startTime).getBytes());
    scan.setStopRow(new String(serviceId + ":" + Long.MAX_VALUE).getBytes());
    Filter filter = new PageFilter(sum);
    scan.setFilter(filter);//  w  w  w  .  j  av  a2  s .  c o m
    try {
        scan.setTimeRange(durationMin, durationMax);
    } catch (IOException e) {
        e.printStackTrace();
    }
    HTableInterface table = null;
    ResultScanner rs = null;
    try {
        table = POOL.getTable(duration_index);
        rs = table.getScanner(scan);
        int resultSum = 0;
        for (Result res : rs) {
            List<KeyValue> list = res.list();
            for (KeyValue kv : list) {
                if (resultSum == sum) {//??????
                    break;
                }
                JSONObject obj = new JSONObject();
                String[] key = new String(kv.getRow()).split(":");
                obj.put("serviceId", key[0]);
                obj.put("timestamp", Long.parseLong(key[1]));
                obj.put("duration", kv.getTimestamp());
                obj.put("traceId", byteArray2Long(kv.getQualifier()));
                array.add(obj);
                resultSum++;
            }
        }
        return array;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    } finally {
        try {
            table.close();
            rs.close();
        } catch (IOException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
    }
}

From source file:com.linkedin.pinot.core.segment.index.creator.SegmentGenerationWithTimeColumnTest.java

@BeforeMethod
public void reset() {
    minTime = Long.MAX_VALUE;
    maxTime = Long.MIN_VALUE;
    FileUtils.deleteQuietly(new File(SEGMENT_DIR_NAME));
}

From source file:com.glaf.jbpm.assignment.ProcessStarterAssignment.java

public void assign(Assignable assignable, ExecutionContext ctx) {
    logger.debug("-------------------------------------------------------");
    logger.debug("----------------ProcessStarterAssignment---------------");
    logger.debug("-------------------------------------------------------");

    ContextInstance contextInstance = ctx.getContextInstance();

    String actorId = (String) contextInstance.getVariable(Constant.PROCESS_STARTERID);
    if (StringUtils.isEmpty(actorId)) {
        long taskInstanceId = Long.MAX_VALUE;
        TaskMgmtInstance tmi = ctx.getProcessInstance().getTaskMgmtInstance();
        Collection<TaskInstance> taskInstances = tmi.getTaskInstances();
        Iterator<TaskInstance> iterator = taskInstances.iterator();
        while (iterator.hasNext()) {
            TaskInstance taskInstance = iterator.next();
            if (taskInstance.hasEnded() && StringUtils.isNotEmpty(taskInstance.getActorId())) {
                if (taskInstance.getId() < taskInstanceId) {
                    taskInstanceId = taskInstance.getId();
                }//from  w  w  w  .  ja  va 2s .  c o  m
            }
        }
        if (taskInstanceId < Long.MAX_VALUE) {
            TaskInstance taskInstance = ctx.getJbpmContext().getTaskInstance(taskInstanceId);
            actorId = taskInstance.getActorId();
        }
    }

    if (StringUtils.isNotEmpty(actorId)) {
        assignable.setActorId(actorId);
        if (StringUtils.isNotEmpty(sendMail) && StringUtils.equals(sendMail, "true")) {
            Set<String> actorIds = new HashSet<String>();
            actorIds.add(actorId);
            MailBean mailBean = new MailBean();
            mailBean.setContent(content);
            mailBean.setSubject(subject);
            mailBean.setTaskContent(taskContent);
            mailBean.setTemplateId(templateId);
            mailBean.execute(ctx, actorIds);
        }
        return;
    }

}

From source file:com.github.ukase.service.BulkRenderer.java

public BulkStatus checkStatus(String id) {
    Long rendered = renderedPDFs.get(id);
    if (rendered == null) {
        return BulkStatus.ERROR;
    } else if (rendered.equals(Long.MAX_VALUE)) {
        return BulkStatus.ORDERED;
    }/*www . j a  v  a 2s .co m*/
    return BulkStatus.PROCESSED;
}

From source file:cz.jirutka.spring.http.client.cache.DefaultCachingPolicy.java

/**
 * Creates a new instance of {@code DefaultCachingPolicy} without the
 * size limit./*ww w.  j a v  a  2  s .  c  o m*/
 *
 * @param sharedCache Whether to behave as a shared cache (true) or a
 *                    non-shared/private cache (false).
 * @see #DefaultCachingPolicy(boolean, long)
 */
public DefaultCachingPolicy(boolean sharedCache) {
    this(sharedCache, Long.MAX_VALUE);
}

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

@Test
public void should_update_udt_fields() throws Exception {
    //Given//from   ww w .j  a v  a 2s  .  c o  m
    Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    scriptExecutor.executeScriptTemplate("EntityWithNonFrozenUDT/insertRow.cql", ImmutableMap.of("id", id));

    //When
    manager.dsl().update().fromBaseTable().nonFrozen().val().Set("new_value").nonFrozen().li()
            .Set(Arrays.asList("3")).nonFrozen().se().Set_FromJSON("[\"3\"]").nonFrozen().ma()
            .Set(ImmutableMap.of(3, "3")).nonFrozen().address()
            .Set_FromJSON("{\"street\": \"new_street\", \"number\": 100}").where().id().Eq(id).execute();

    //Then
    final Row actual = session.execute("SELECT * FROM it_3_6.non_frozen_udt WHERE id = " + id).one();

    assertThat(actual).isNotNull();

    final UDTValue nonFrozen = actual.getUDTValue("nonFrozen");

    assertThat(nonFrozen).isNotNull();
    assertThat(nonFrozen.getList("li", String.class)).containsExactly("3");
    assertThat(nonFrozen.getSet("se", String.class)).containsExactly("3");
    assertThat(nonFrozen.getMap("ma", Integer.class, String.class)).hasSize(1);
    assertThat(nonFrozen.getMap("ma", Integer.class, String.class)).containsEntry(3, "3");

    final UDTValue address = nonFrozen.getUDTValue("address");

    assertThat(address).isNotNull();
    assertThat(address.getString("street")).isEqualTo("new_street");
    assertThat(address.getInt("number")).isEqualTo(100);
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeUInt64EncodeMaxLong() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.UINT64_SAFE.writeValue(Long.MAX_VALUE, g);
    g.flush();/*from   ww w  .j a  v  a2  s .  c o m*/
    assertEquals("\"9223372036854775807\"", out.toString());
}

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

@Test
public void should_find() throws Exception {
    //Given//from w ww .j  a  v a2  s .c om
    final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final long incr = RandomUtils.nextLong(0L, Long.MAX_VALUE);

    scriptExecutor.executeScriptTemplate("EntityWithCounterColumn/insert_single_row.cql",
            ImmutableMap.of("id", id, "incr", incr));

    //When
    final EntityWithCounterColumn actual = manager.crud().findById(id).get();

    //Then
    assertThat(actual).isNotNull();
    assertThat(actual.getCount()).isEqualTo(incr);
}

From source file:com.amazonaws.services.dynamodbv2.streamsadapter.model.RecordAdapterTest.java

@Before
public void setUpTest() {
    testRecord = new Record();
    testRecord.setAwsRegion("us-east-1");
    testRecord.setEventID(UUID.randomUUID().toString());
    testRecord.setEventSource("aws:dynamodb");
    testRecord.setEventVersion("1.0");
    testRecord.setEventName(OperationType.MODIFY);
    StreamRecord testStreamRecord = new StreamRecord();
    testRecord.setDynamodb(testStreamRecord);
    Map<String, AttributeValue> key = new HashMap<String, AttributeValue>();
    key.put("hashKey", new AttributeValue("hashKeyValue"));
    Map<String, AttributeValue> oldImage = new HashMap<String, AttributeValue>(key);
    Map<String, AttributeValue> newImage = new HashMap<String, AttributeValue>(key);
    newImage.put("newAttributeKey", new AttributeValue("someValue"));
    testStreamRecord.setKeys(key);//w  w  w  . j av  a 2 s  .  co  m
    testStreamRecord.setOldImage(oldImage);
    testStreamRecord.setNewImage(newImage);
    testStreamRecord.setSizeBytes(Long.MAX_VALUE);
    testStreamRecord.setSequenceNumber(UUID.randomUUID().toString());
    testStreamRecord.setStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES);
    testStreamRecord.setSequenceNumber(TEST_STRING);
    try {
        adapter = new RecordAdapter(testRecord);
    } catch (IOException e) {
        fail(e.getMessage());
    }
}