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:com.devicehive.handler.notification.NotificationSearchHandlerTest.java

@Test
public void shouldNotFindSingleNotificationByIdAndGuid() throws Exception {
    NotificationSearchRequest searchRequest = new NotificationSearchRequest();
    searchRequest.setId(Long.MAX_VALUE); // nonexistent id
    searchRequest.setGuid(UUID.randomUUID().toString()); // random guid

    Request request = Request.newBuilder().withPartitionKey(searchRequest.getGuid()).withBody(searchRequest)
            .build();/*  w  w w .  j a v a 2  s  . co  m*/
    CompletableFuture<Response> future = new CompletableFuture<>();
    client.call(request, future::complete);

    Response response = future.get(10, TimeUnit.SECONDS);
    NotificationSearchResponse responseBody = (NotificationSearchResponse) response.getBody();
    assertTrue(responseBody.getNotifications().isEmpty());
}

From source file:com.twitter.hraven.HdfsStatsKey.java

/**
 * returns the run id based on the encoded run id
 *///from w w w .j  a v  a 2s.  co m
public static long getRunId(long encodedRunId) {
    return Long.MAX_VALUE - encodedRunId;
}

From source file:com.brienwheeler.lib.concurrent.StoppableThread.java

public void shutdown() throws InterruptedException {
    shutdown(Long.MAX_VALUE);
}

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

@Test
public void should_search_using_prefix_non_tokenizer() throws Exception {
    //Given//from w w w  .  j  a  va  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().StartWith("speed").numeric().Gte(10).numeric().Lte(15).getList();

    //Then
    assertThat(actual).hasSize(2);
    assertThat(actual.get(0).getPrefixNonTokenizer()).isEqualTo("speed runner");
    assertThat(actual.get(1).getPrefixNonTokenizer()).isEqualTo("speedster");
}

From source file:info.archinnov.achilles.it.bugs.ClassLevelTracing.java

@Test
public void should_activate_tracing_programmatically() throws Exception {
    //Given//from   w  ww.  java2 s  .  co m
    Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);

    CassandraLogAsserter logAsserter = new CassandraLogAsserter();
    logAsserter.prepareLogLevel(SimpleEntity.class.getCanonicalName());

    //When
    manager.crud().insert(new SimpleEntity(id, new Date(), "value")).withTracing().execute();

    //Then
    logAsserter.assertContains("Tracing for Query ID");
}

From source file:info.magnolia.cms.util.QueryUtil.java

/**
* @deprecated Since 4.5.4 use search methods.
*///from   w ww  .j  a v  a  2  s .  c  om
public static Collection<Content> exceptionThrowingQuery(String repository, String statement, String language,
        String returnItemType) throws RepositoryException {
    return exceptionThrowingQuery(repository, statement, language, returnItemType, Long.MAX_VALUE);
}

From source file:samza.samza_test.SamzaCountWindow.java

@Override
public void init(Config config, TaskContext context) {
    this.totalFlows = 0;
    this.packets = 0;
    this.startLast = 0;
    this.startLastFlows = 0;
    this.filtered = 0;
    this.timeStart = Long.MAX_VALUE;
    this.timeEnd = 0;
    this.mapper = new ObjectMapper();
    this.conf = config;
    this.top = new HashMap<>();
    this.windowLimit = config.getInt("securitycloud.test.windowLimit");
}

From source file:com.gsma.mobileconnect.cache.DiscoveryCacheHashMapImplTest.java

@Test
public void add_withSubscriberId_shouldRemoveSubscriberId() {
    // GIVEN//from  w  ww  .  j a  v a 2s .  c  o m
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode root = mapper.createObjectNode();

    String field = "field";
    String expectedFieldValue = "field_value";
    root.put(field, expectedFieldValue);

    String subscriberId = "subscriber_id";
    String expectedSubscriberIdValue = "subscriber_id_value";
    root.put(subscriberId, expectedSubscriberIdValue);
    DiscoveryCacheValue value = new DiscoveryCacheValue(new Date(Long.MAX_VALUE), root);

    DiscoveryCacheKey key = DiscoveryCacheKey.newWithDetails("a", "a");
    IDiscoveryCache cache = Factory.getDefaultDiscoveryCache();

    // WHEN
    cache.add(key, value);
    DiscoveryCacheValue cachedValue = cache.get(key);

    // THEN
    assertNotNull(cachedValue);
    assertNotEquals(value, cachedValue);
    assertNull(cachedValue.getValue().get(subscriberId));
    assertEquals(expectedFieldValue, cachedValue.getValue().get(field).textValue());

    // Original object should not be changed.
    assertEquals(expectedSubscriberIdValue, value.getValue().get(subscriberId).textValue());
}

From source file:com.liferay.alloy.util.DefaultValueUtil.java

public static String getDefaultValue(String className, String value) {
    String defaultValue = StringPool.BLANK;

    if (className.equals(ArrayList.class.getName()) || className.equals(HashMap.class.getName())
            || className.equals(Object.class.getName()) || className.equals(String.class.getName())) {

        if (!isValidStringValue(value)) {
            return defaultValue;
        }/* www . j a  va2 s.c  om*/

        if (_EMPTY_STRINGS.contains(value)) {
            value = StringPool.BLANK;
        } else if (className.equals(ArrayList.class.getName())
                && !StringUtil.startsWith(value.trim(), StringPool.OPEN_BRACKET)) {

            value = "[]";
        } else if (className.equals(HashMap.class.getName())
                && !StringUtil.startsWith(value.trim(), StringPool.OPEN_CURLY_BRACE)) {

            value = "{}";
        }

        defaultValue = StringUtil.unquote(value);
    } else if (className.equals(boolean.class.getName()) || className.equals(Boolean.class.getName())) {

        defaultValue = String.valueOf(GetterUtil.getBoolean(value));
    } else if (className.equals(int.class.getName()) || className.equals(Integer.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Integer.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getInteger(value));
    } else if (className.equals(double.class.getName()) || className.equals(Double.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Double.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getDouble(value));
    } else if (className.equals(float.class.getName()) || className.equals(Float.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Float.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getFloat(value));
    } else if (className.equals(long.class.getName()) || className.equals(Long.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Long.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getLong(value));
    } else if (className.equals(short.class.getName()) || className.equals(Short.class.getName())) {

        if (_INFINITY.contains(value)) {
            value = String.valueOf(Short.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getShort(value));
    } else if (className.equals(Number.class.getName())) {
        if (_INFINITY.contains(value)) {
            value = String.valueOf(Integer.MAX_VALUE);
        }

        defaultValue = String.valueOf(GetterUtil.getNumber(value));
    }

    return defaultValue;
}

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

@Test
public void should_query_with_default_params() throws Exception {
    long partitionKey = RandomUtils.nextLong(0, Long.MAX_VALUE);
    List<ClusteredEntity> entities = manager.sliceQuery(ClusteredEntity.class).forSelect()
            .withPartitionComponents(partitionKey).fromClusterings(2, "name2").toClusterings(4, "name4").get();

    assertThat(entities).isEmpty();/* w w w .j a  v a  2s  .c  o  m*/

    insertClusteredValues(partitionKey, 1, "name1", 3);
    insertClusteredValues(partitionKey, 2, "name2", 2);
    insertClusteredValues(partitionKey, 3, "name3", 2);
    insertClusteredValues(partitionKey, 4, "name4", 4);

    entities = manager.sliceQuery(ClusteredEntity.class).forSelect().withPartitionComponents(partitionKey)
            .fromClusterings(2, "name21").toClusterings(4, "name41").get();

    assertThat(entities).hasSize(5);

    assertThat(entities.get(0).getValue()).isEqualTo("value21");
    assertThat(entities.get(0).getId().getCount()).isEqualTo(2);
    assertThat(entities.get(0).getId().getName()).isEqualTo("name21");

    assertThat(entities.get(1).getValue()).isEqualTo("value22");
    assertThat(entities.get(1).getId().getCount()).isEqualTo(2);
    assertThat(entities.get(1).getId().getName()).isEqualTo("name22");

    assertThat(entities.get(2).getValue()).isEqualTo("value31");
    assertThat(entities.get(2).getId().getCount()).isEqualTo(3);
    assertThat(entities.get(2).getId().getName()).isEqualTo("name31");

    assertThat(entities.get(3).getValue()).isEqualTo("value32");
    assertThat(entities.get(3).getId().getCount()).isEqualTo(3);
    assertThat(entities.get(3).getId().getName()).isEqualTo("name32");

    assertThat(entities.get(4).getValue()).isEqualTo("value41");
    assertThat(entities.get(4).getId().getCount()).isEqualTo(4);
    assertThat(entities.get(4).getId().getName()).isEqualTo("name41");
}