Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:org.drizzly.MySQLConnectionTest.java

@Test
public void testGetEmployeeById() {
    Long empId = new Long(1);
    EmployeeManager emp = new EmployeeManager();
    System.out.println(emp.getEmployeeDetails(Long.valueOf("1")));
    Assert.notNull(emp);/*from   w w w  . j a va2 s.  c om*/
}

From source file:org.homiefund.test.dao.UserDAOTest.java

@Test
public void getById() {
    Assert.assertEquals(Long.valueOf(1L), userDAO.getById(1L).getId());
}

From source file:com.epam.dlab.auth.rest.UserSessionDurationAuthorizer.java

@Override
public boolean authorize(UserInfo principal, String role) {
    if (SHORT_USER_SESSION_DURATION.equalsIgnoreCase(role)) {
        try {/*from w  w w . ja  v  a 2s .c  om*/
            String refreshToken = principal.getKeys().get("refresh_token");
            String createdDateOfRefreshToken = principal.getKeys().get("created_date_of_refresh_token");

            if (StringUtils.isEmpty(refreshToken)) {
                log.info("Refresh token is empty for user {}", principal.getName());
                return false;
            }

            if (StringUtils.isEmpty(createdDateOfRefreshToken)) {
                log.info("Created date for refresh token is empty for user {}", principal.getName());
                return false;
            }

            log.debug("refresh token requested {} and current date is {}",
                    new Date(Long.valueOf(createdDateOfRefreshToken)), new Date());

            long passedTime = System.currentTimeMillis() - Long.valueOf(createdDateOfRefreshToken);

            log.info("Passed time of session for user {} is {} milliseconds", principal.getName(), passedTime);
            if (passedTime > maxSessionDurabilityMilliseconds) {

                silentCallbackExecution(principal);

                log.info("Re-login required for user {}", principal.getName());
                return false;
            }

            return true;
        } catch (RuntimeException e) {
            log.error("Cannot verify durability of session for user {}", principal.getName(), e);
            return false;
        }

    }

    return true;
}

From source file:com.alibaba.rocketmq.tools.command.message.PrintMessageSubCommand.java

public static long timestampFormat(final String value) {
    long timestamp = 0;
    try {//from   w  w  w . ja  v a  2s .c  o m
        //  long  timestamp
        timestamp = Long.valueOf(value);
    } catch (NumberFormatException e) {
        // ?
        timestamp = UtilAll.parseDate(value, UtilAll.yyyy_MM_dd_HH_mm_ss_SSS).getTime();
    }

    return timestamp;
}

From source file:com.springsource.insight.plugin.apache.http.hc3.HttpPlaceholderMethodTest.java

@Test
public void testResolveHttpMethodOnNoMethod() {
    assertSame(HttpPlaceholderMethod.PLACEHOLDER,
            HttpPlaceholderMethod.resolveHttpMethod("1234", Long.valueOf(System.currentTimeMillis())));
}