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.it.TestEntityWithStaticCounterColumn.java

@Test
public void should_find() throws Exception {
    //Given//w  w w  . jav  a 2s . c o  m
    final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final UUID uuid = UUIDs.timeBased();
    final long count = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final long staticCount = RandomUtils.nextLong(0L, Long.MAX_VALUE);

    scriptExecutor.executeScriptTemplate("EntityWithStaticCounterColumn/insert_single_row.cql",
            ImmutableMap.of("id", id, "uuid", uuid, "count", count, "staticCount", staticCount));

    //When
    final EntityWithStaticCounterColumn actual = manager.crud().findById(id, uuid).get();

    //Then
    assertThat(actual).isNotNull();
    assertThat(actual.getCount()).isEqualTo(count);
    assertThat(actual.getStaticCount()).isEqualTo(staticCount);
}

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

@Test
public void should_insert() throws Exception {
    //Given//from   w w  w. j a v  a 2s. co  m
    final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final UUID uuid = new UUID(1L, 1L);
    final EntityWithCompositePartitionKey entity = new EntityWithCompositePartitionKey(id, uuid, "val");

    //When
    manager.crud().insert(entity).execute();

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

    final Row row = rows.get(0);
    assertThat(row.getLong("id")).isEqualTo(id);
    assertThat(row.getUUID("uuid")).isEqualTo(uuid);
    assertThat(row.getString("value")).isEqualTo("val");
}

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

@Test
public void should_update_with_IN_clause_on_all_clusterings() throws Exception {
    //Given/*from ww w . ja v  a  2 s. c o  m*/
    final long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    scriptExecutor.executeScriptTemplate("MultiClusteringEntity/insertRows.cql", ImmutableMap.of("id", id));

    //When
    manager.dsl().update().fromBaseTable().value().Set("new val").where().id().Eq(id).c1().IN(1, 3).c2()
            .IN(1, 2).execute();

    //Then
    final List<Row> all = session
            .execute("SELECT value FROM achilles_embedded.multi_clustering_entity WHERE id = " + id
                    + " AND c1 IN(1,3) AND c2 IN (1,2)")
            .all();

    assertThat(all).hasSize(4);
    assertThat(all.stream().map(x -> x.getString("value")).collect(Collectors.toList()))
            .containsExactly("new val", "new val", "new val", "new val");
}

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

@Test
public void should_slice_query_with_transformed_types() throws Exception {
    //Given/*from w  w  w  .j av  a 2s  . co m*/
    Long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    MyCount myCount1 = new MyCount(1);
    MyCount myCount2 = new MyCount(2);
    MyCount myCount3 = new MyCount(3);

    final ClusteredEntityWithTypeTransformer entity1 = new ClusteredEntityWithTypeTransformer(id, myCount1,
            "val1");
    final ClusteredEntityWithTypeTransformer entity2 = new ClusteredEntityWithTypeTransformer(id, myCount2,
            "val2");
    final ClusteredEntityWithTypeTransformer entity3 = new ClusteredEntityWithTypeTransformer(id, myCount3,
            "val3");

    manager.insert(entity1);
    manager.insert(entity2);
    manager.insert(entity3);

    //When
    final List<ClusteredEntityWithTypeTransformer> found = manager
            .sliceQuery(ClusteredEntityWithTypeTransformer.class).forSelect().withPartitionComponents(id)
            .fromClusterings(myCount1).get(2);

    //Then
    assertThat(found).hasSize(2);
    assertThat(found.get(0).getId().getCount()).isEqualTo(myCount1);
    assertThat(found.get(1).getId().getCount()).isEqualTo(myCount2);
}

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

@Test
public void should_insert() throws Exception {
    //Given/*www . j av  a2  s  .com*/
    final long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    final EntityAsChild entity = new EntityAsChild(id, "val", "child_val");

    //When
    manager.crud().insert(entity).execute();

    //Then
    final Row row = session.execute("SELECT * FROM entity_child").one();
    assertThat(row.getLong("id")).isEqualTo(id);
    assertThat(row.getString("value")).isEqualTo("val");
    assertThat(row.getString("child_value")).isEqualTo("child_val");
}

From source file:cn.wanghaomiao.seimi.core.SeimiContext.java

protected void waitToEnd() {
    workersPool.shutdown();/*from  w ww  . j ava2  s  . co  m*/
    try {
        workersPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:com.weib.spittr.web.SpittleControllerTest.java

@Test
public void postSpittleTest() throws Exception {
    //??/*  w  w w.  j  a  v  a2s  . co m*/
    List<Spittle> spittleList = createSpittleList(20); //?20??
    SpittleRepository mockRepository = mock(SpittleRepository.class); //??Mock
    when(mockRepository.findSpittles(Long.MAX_VALUE, 20)) //??
            .thenReturn(spittleList);

    //controller
    SpittleController controller = new SpittleController(mockRepository); //controller
    MockMvc mockMvc = standaloneSetup(controller)
            .setSingleView(new InternalResourceView("/WEB-INF/views/spittle_list.jsp") //????setSingleView
            ).build();

    //?GET/spittles
    mockMvc.perform(get("/spittle_list")).andExpect(view().name("spittle_list"))
            .andExpect(model().attributeExists("spittleList"))
            .andExpect(model().attribute("spittleList", hasItems(spittleList.toArray())));

}

From source file:com.gsma.mobileconnect.impl.ParseIDTokenTest.java

@Test
public void parseIDToken_withMissingIdToken_shouldThrowException()
        throws OIDCException, DiscoveryResponseExpiredException {
    // GIVEN//ww  w  .  ja  va 2s.  c o  m
    IOIDC oidc = Factory.getOIDC(null);
    CaptureParsedIdToken captureParsedIdToken = new CaptureParsedIdToken();
    DiscoveryResponse discoveryResponse = new DiscoveryResponse(true, new Date(Long.MAX_VALUE), 0, null,
            buildJsonNode());

    // THEN
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage(containsString("id_token"));

    // WHEN
    oidc.parseIDToken(discoveryResponse, null, null, captureParsedIdToken);
}

From source file:com.redhat.lightblue.metadata.types.IntegerTypeTest.java

@Test
public void testCastLong() {
    assertTrue(integerType.cast(Long.MAX_VALUE) instanceof Long);
}

From source file:com.redhat.lightblue.metadata.types.BooleanTypeTest.java

@Test
public void testCastLong() {
    Long laung = Long.MAX_VALUE;
    assertTrue(booleanType.cast(laung) instanceof Boolean);
}