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.bugs.TestEntityWithCaseSensitivePKIT.java

@Test
public void should_insert_and_find() throws Exception {
    //Given/*  w  w w.  j  a  v  a  2  s .  c  o  m*/
    Long id = RandomUtils.nextLong(0, Long.MAX_VALUE);
    Long clust = RandomUtils.nextLong(0, Long.MAX_VALUE);
    final EntityWithCaseSensitivePK entity = new EntityWithCaseSensitivePK(id, clust);
    entity.setList(Arrays.asList("1", "2"));
    entity.setSet(Sets.newHashSet("1", "2"));
    entity.setMap(ImmutableMap.of(1, "1", 2, "2"));
    entity.setUdt(new UDTWithNoKeyspace(id, "test"));

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

    //Then
    final EntityWithCaseSensitivePK found = manager.crud().findById(id, clust).get();
    assertThat(found).isNotNull();
    assertThat(found.getList()).containsExactly("1", "2");
    assertThat(found.getSet()).containsExactly("1", "2");
    assertThat(found.getMap()).containsEntry(1, "1");
    assertThat(found.getMap()).containsEntry(2, "2");
    assertThat(found.getUdt().getId()).isEqualTo(id);
    assertThat(found.getUdt().getValue()).isEqualTo("test");

}

From source file:com.offbynull.portmapper.upnpigd.UpnpIgdPortMapper.java

@Override
public MappedPort mapPort(PortType portType, int internalPort, long lifetime) throws InterruptedException {
    Validate.validState(!closed);/*from w  w w.j ava2  s.co m*/
    Validate.notNull(portType);
    Validate.inclusiveBetween(1, 65535, internalPort);
    Validate.inclusiveBetween(1L, Long.MAX_VALUE, lifetime);

    int externalPort = random.nextInt(55535) + 10000; // 10000 - 65535
    PortMappingInfo info;
    InetAddress externalAddress;
    try {
        info = controller.addPortMapping(externalPort, internalPort, portType, lifetime);
        externalAddress = controller.getExternalIp();
    } catch (IllegalArgumentException | ResponseException re) {
        throw new IllegalStateException(re);
    }

    return new MappedPort(info.getInternalPort(), info.getExternalPort(), externalAddress, info.getPortType(),
            info.getRemainingDuration());
}

From source file:de.dal33t.powerfolder.test.transfer.BandwidthLimitText.java

public void testLimiter() {
    System.out.println("BandwidthLimitTest.testLimiter");
    BandwidthLimiter bl = BandwidthLimiter.LAN_INPUT_BANDWIDTH_LIMITER;
    try {/*from   w ww .j a v a  2s. c om*/
        assertEquals(bl.requestBandwidth(Long.MAX_VALUE), Long.MAX_VALUE);
    } catch (InterruptedException e) {
        fail(e.toString());
    }
    bl.setAvailable(2500);
    long amount = 700;
    while (amount > 0) {
        long rem = 0;
        try {
            rem = bl.requestBandwidth(amount);
        } catch (InterruptedException e) {
            fail(e.toString());
        }
        amount -= rem;
        assertTrue("Short on amount", rem > 0);
    }
    assertTrue("Exceeded amount", amount == 0);
}

From source file:com.jxt.web.dao.hbase.HbaseAgentLifeCycleDao.java

@Override
public AgentStatus getAgentStatus(String agentId, long timestamp) {
    if (agentId == null) {
        throw new NullPointerException("agentId must not be null");
    }/*from  w  ww. jav a2s  .c  o m*/
    if (timestamp < 0) {
        throw new IllegalArgumentException("timestamp must not be less than 0");
    }

    long startRowTimestamp = TimeUtils.reverseTimeMillis(timestamp);
    long endRowTimestamp = Long.MAX_VALUE;

    Scan scan = createScan(agentId, startRowTimestamp, endRowTimestamp);

    AgentLifeCycleBo agentLifeCycleBo = this.hbaseOperations2.find(HBaseTables.AGENT_LIFECYCLE, scan,
            new AgentLifeCycleResultsExtractor(this.agentLifeCycleMapper, timestamp));
    return createAgentStatus(agentId, agentLifeCycleBo);
}

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

@Test
public void should_query_using_simple_index_fromJSON() throws Exception {
    //Given//from   ww  w  .j  av a2 s. c  o m
    final Long id = RandomUtils.nextLong(0L, Long.MAX_VALUE);
    scriptExecutor.executeScriptTemplate("EntityWithIndicesForJSON/insertRows.cql", ImmutableMap.of("id", id));

    //When
    final List<EntityWithIndicesForJSON> actual = manager.indexed().select().allColumns_FromBaseTable().where()
            .simpleIndex().Eq_FromJson("\"313\"").getList();

    //Then
    assertThat(actual).hasSize(1);
    final EntityWithIndicesForJSON entity = actual.get(0);
    assertThat(entity.getFullIndexOnCollection()).containsExactly("313");
}

From source file:com.livhuwani.rambuda.test.service.PolicyServiceTest.java

@Test(dependsOnMethods = "CreatePerson")
public void CreateQuote() {
    policyService = ctx.getBean(PolicyCrudService.class);
    quoteService = ctx.getBean(PolicyQuoteCrudService.class);

    //Create a Policy type
    BusinessInterest business = new BusinessInterest();
    business.setId(Long.MAX_VALUE + 1);
    business.setBusniessType("Private Company");
    business.setRegisteredName("MD Corperations SA (PTY) LtD");

    //Create a Policy and add the type
    policy = policyService.createBusinessPolicy(business);
    Assert.notNull(policy);/* ww  w  . j  a v a 2s.c  om*/

    //Create a Quote and add a policy to the quote
    PolicyQuote quote = quoteService.createPolicyQuotes(customer, policy);
    Assert.notNull(quote);
}

From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java

@Before
@Override//from  w  w w  .  j a v  a 2s .  c o  m
public void setUp() throws Exception {
    super.setUp();

    tappedStuff = new HashMap<String, ResponseMessage>();

    URI uri = new URI(CouchbaseUtils.CONNECT_STRING);
    String user = CouchbaseUtils.COUCHBASE_USER_NAME;
    String pass = CouchbaseUtils.COUCHBASE_USER_PASS;

    try {
        cb = new CouchbaseClient(Arrays.asList(uri), user, pass);
    } catch (IOException e) {
        LOG.error("Couldn't connect to server" + e.getMessage());
        fail(e.toString());
    }
    this.client = new TapClient(Arrays.asList(uri), user, pass);

    cb.flush();
    Thread.sleep(500);

    // set up the items we're going to deserialize
    Integer anint = new Integer(Integer.MIN_VALUE);
    cb.set(anint.toString(), 0x300, anint).get();

    Long along = new Long(Long.MAX_VALUE);
    cb.set(along.toString(), 0, along).get();

    Float afloat = new Float(Float.MAX_VALUE);
    cb.set(afloat.toString(), 0, afloat).get();

    Double doubleBase = new Double(Double.NEGATIVE_INFINITY);
    cb.set(doubleBase.toString(), 0, doubleBase).get();

    Boolean booleanBase = true;
    cb.set(booleanBase.toString(), 0, booleanBase).get();

    rightnow = new Date(); // instance, needed later
    dateText = rightnow.toString().replaceAll(" ", "_");
    cb.set(dateText, 0, rightnow).get();

    Byte byteMeSix = new Byte("6");
    cb.set(byteMeSix.toString(), 0, byteMeSix).get();

    String ourString = "hi,there";
    cb.set(ourString.toString(), 0, ourString).get();

    client.tapDump("tester");
    while (client.hasMoreMessages()) {
        ResponseMessage m = client.getNextMessage();
        if (m == null) {
            continue;
        }
        tappedStuff.put(m.getKey(), m);
    }
}

From source file:com.thinkberg.webdav.data.DavCollection.java

protected boolean addQuotaAvailableBytesProperty(Element root, boolean ignoreValue) {
    // TODO add correct handling of available quota
    root.addElement(PROP_QUOTA_AVAILABLE_BYTES).addText(Long.toString(Long.MAX_VALUE));
    return true;/*from  w  w  w .jav a  2 s  .c  o m*/
}

From source file:com.adito.activedirectory.GroupContainer.java

synchronized String storeGroup(ActiveDirectoryGroup group, String[] parents) {
    String principalName = storePrincipal(group);
    final String dn = group.getOriginalDn().toLowerCase();
    dnToRoleCache.store(dn, group, Long.MAX_VALUE, null, GROUPS_CACHE_PREFIX);
    if (group.getRID() != null) { // Only NT Authority groups will be used
        groupsByRidCache.store(group.getRID(), group, Long.MAX_VALUE, null, GROUPS_CACHE_PREFIX);
    }/*from w  w  w .j a  va  2 s. c o m*/
    parentGroupsByDnCache.store(dn, parents, Long.MAX_VALUE, null, GROUPS_CACHE_PREFIX);
    return principalName;
}

From source file:com.taobao.tddl.common.util.CountPunisher.java

/**
 * @return truefalse// w ww .j  a  va2s  .  co  m
 */
public boolean punish() {
    if (punishBeginTime == Long.MAX_VALUE || timeWindow == 0) {
        //
        return false;
    }
    if (System.currentTimeMillis() - punishBeginTime > resetTime) {
        //
        punishBeginTime = Long.MAX_VALUE;
        resetTimeWindow();
        smoothValve.setAvailable();
        return false;
    }
    return !smoothValve.smoothThroughOnInitial();
}