Example usage for java.lang Long longValue

List of usage examples for java.lang Long longValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public long longValue() 

Source Link

Document

Returns the value of this Long as a long value.

Usage

From source file:be.solidx.hot.test.TestScriptExecutors.java

@Test
public void testPythonExecutor1() throws Exception {
    Script<CompiledScript> script = new Script<CompiledScript>(
            IOUtils.toByteArray(getClass().getResourceAsStream("/python-script.py")),
            "test_" + Thread.currentThread().getName());
    Collection<Long> results = multiThreadedTest(script, 100000, pythonScriptExecutor);
    results = multiThreadedTest(script, 100000, pythonScriptExecutor);
    results = multiThreadedTest(script, 100000, pythonScriptExecutor);
    for (Object result : results) {
        Long r = (Long) result;
        Assert.assertEquals(100000, r.longValue());
    }//from   w w  w  .j a  v  a  2s  .co  m
}

From source file:com.redhat.rhn.taskomatic.task.ErrataMailer.java

private void sendEmails(Long errataId, Long orgId, Long channelId) {
    Errata errata = (Errata) HibernateFactory.getSession().load(PublishedErrata.class,
            new Long(errataId.longValue()));
    List orgServers = getOrgRelevantServers(errataId, orgId, channelId);

    if (orgServers == null || orgServers.size() == 0) {
        log.debug("No relevant servers found for erratum " + errata.getId() + " in channel " + channelId
                + " for org " + orgId + " ... skipping.");
        return;//from   w ww.ja v  a 2  s.co  m
    }

    Map<Long, List> userMap = createUserEmailMap(orgServers);

    log.info("Found " + userMap.keySet().size() + " user(s) to notify about erratum " + errata.getId()
            + " in channel " + channelId + " for org " + orgId + ".");

    for (Long userId : userMap.keySet()) {
        Map userInfo = getUserInfo(userId);
        String email = (String) userInfo.get("email");
        String login = (String) userInfo.get("login");
        List servers = userMap.get(userId);
        log.info("Notification for user " + login + "(" + userId + ") about " + servers.size()
                + " relevant server(s).");
        String emailBody = formatEmail(login, email, errata, servers);
        Mail mail = new SmtpMail();
        mail.setRecipient(email);
        mail.setHeader("X-RHN-Info", "Autogenerated mail for " + login);
        mail.setHeader("Precedence", "first-class");
        mail.setHeader("Errors-To", "rhn-bounce" + login + "-" + orgId.toString() + "@rhn.redhat.com");
        mail.setBody(emailBody);
        StringBuilder subject = new StringBuilder();
        subject.append(Config.get().getString("web.product_name") + " Errata Alert: ");
        subject.append(errata.getAdvisory()).append(" - ");
        subject.append(errata.getSynopsis());
        mail.setSubject(subject.toString());
        TaskHelper.sendMail(mail, log);
    }
}

From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java

/**
 * Lookup KickstartableTree by tree id and org id
 * @param treeId desired tree/*from  w  w  w  .  jav a2  s  .c  om*/
 * @param org owning org
 * @return KickstartableTree if found, otherwise null
 */
public static KickstartableTree lookupKickstartTreeByIdAndOrg(Long treeId, Org org) {
    Session session = null;
    KickstartableTree retval = null;
    String queryName = "KickstartableTree.findByIdAndOrg";
    if (treeId != null && org != null) {
        session = HibernateFactory.getSession();
        Query query = session.getNamedQuery(queryName);
        query.setLong("org_id", org.getId().longValue());
        query.setLong("tree_id", treeId.longValue());
        //Retrieve from cache if there
        retval = (KickstartableTree) query.setCacheable(true).uniqueResult();
    }
    return retval;
}

From source file:be.solidx.hot.test.TestScriptExecutors.java

@Test
public void testGroovyExecutor2() throws Exception {
    Script<CompiledScript> script = new Script<CompiledScript>(
            IOUtils.toByteArray(getClass().getResourceAsStream("/groovy-script2.groovy")),
            "test_" + Thread.currentThread().getName());
    //groovyScriptExecutor.compile(script);
    Collection<Long> results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    results = multiThreadedTest(script, 1000, groovyScriptExecutor);
    for (Object result : results) {
        Long r = (Long) result;
        Assert.assertEquals(1000, r.longValue());
    }/*w w w  .  ja v a2  s  .c om*/
}

From source file:be.solidx.hot.test.TestScriptExecutors.java

@Test
public void testPythonExecutor2() throws Exception {
    Script<CompiledScript> script = new Script<CompiledScript>(
            IOUtils.toByteArray(getClass().getResourceAsStream("/python-script2.py")),
            "test_" + Thread.currentThread().getName());
    // Python interpreter is 3X faster when compiling scripts
    Collection<Long> results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    results = multiThreadedTest(script, 1000, pythonScriptExecutor);
    for (Object result : results) {
        Long r = (Long) result;
        Assert.assertEquals(1000, r.longValue());
    }/*from  w  w  w  . j  a  va2s . c om*/
}

From source file:be.solidx.hot.test.TestScriptExecutors.java

@Test
public void testJSExecutor2() throws Exception {
    Script<org.mozilla.javascript.Script> script = new Script<org.mozilla.javascript.Script>(
            IOUtils.toByteArray(getClass().getResourceAsStream("/js-script2.js")),
            "test_" + Thread.currentThread().getName());
    // Python interpreter is 3X faster when compiling scripts
    Collection<Long> results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    results = multiThreadedTest(script, 1000, jsScriptExecutor);
    for (Object result : results) {
        Long r = (Long) result;
        Assert.assertEquals(1000, r.longValue());
    }/*from w  w w .j av a 2s  .c om*/
}

From source file:be.solidx.hot.test.TestScriptExecutors.java

@Test
public void testJS223Executor2() throws Exception {
    Script<CompiledScript> script = new Script<CompiledScript>(
            IOUtils.toByteArray(getClass().getResourceAsStream("/js-script2.js")),
            "test_" + Thread.currentThread().getName());
    // Python interpreter is 3X faster when compiling scripts
    Collection<Long> results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    results = multiThreadedTest(script, 1000, js223ScriptExecutor);
    for (Object result : results) {
        Long r = (Long) result;
        Assert.assertEquals(1000, r.longValue());
    }//from   w w w  .  j  a va 2s  .  c  o  m
}

From source file:com.netpace.aims.controller.application.WapApplicationHelper.java

public static boolean checkEditAccess(String currUserType, Long aimsLifecyclePhaseId) {
    if (currUserType.equals(AimsConstants.ALLIANCE_USERTYPE)) {
        if ((aimsLifecyclePhaseId.longValue() == AimsConstants.PHASE_SUBMITTED_DCR_ID.longValue())
                || (aimsLifecyclePhaseId.longValue() == AimsConstants.PHASE_TESTING_PASSED_ID.longValue())
                || (aimsLifecyclePhaseId.longValue() == AimsConstants.PHASE_TESTING_FAILED_ID.longValue())
                || (aimsLifecyclePhaseId.longValue() == AimsConstants.PHASE_PUBLICATION_READY_ID.longValue())
                || (aimsLifecyclePhaseId.longValue() == AimsConstants.PHASE_COMPLETED_IN_PRODUCTION_ID
                        .longValue())//from   w ww.  ja v  a 2  s  . c  o  m
                || (aimsLifecyclePhaseId.longValue() == AimsConstants.SUNSET_ID.longValue()))
            return false;
        else
            return true;
    } else
        return true;
}

From source file:com.netpace.aims.controller.application.WapApplicationHelper.java

public static boolean isStatusSubmittedDCRAndAbove(Long lifecyclePhaseId) {
    boolean returnValue = false;

    if (lifecyclePhaseId != null)
        if ((lifecyclePhaseId.longValue() == AimsConstants.PHASE_TESTING_PASSED_ID.longValue())
                || (lifecyclePhaseId.longValue() == AimsConstants.PHASE_TESTING_FAILED_ID.longValue())
                || (lifecyclePhaseId.longValue() == AimsConstants.PHASE_PUBLICATION_READY_ID.longValue())
                || (lifecyclePhaseId.longValue() == AimsConstants.PHASE_COMPLETED_IN_PRODUCTION_ID.longValue())
                || (lifecyclePhaseId.longValue() == AimsConstants.SUNSET_ID.longValue()))
            returnValue = true;/*from  w  w w  .j av a2 s .c  om*/

    return returnValue;
}

From source file:PDFDemo.java

/** Write all the xrefs, using the format above */
protected void writeXrefs() {
    xrefStart = offset;/* w  ww  . ja  va 2  s.c om*/
    println("xref");
    print(0);
    print(" ");
    print(xrefs.size() + 1);
    println();
    // "fake" entry at 0, always 0, -1, f(free).
    printXref(0, 65535, 'f');
    // Remaining xref entries are for real objects.
    for (int i = 0; i < xrefs.size(); i++) {
        Long lo = (Long) xrefs.get(i);
        long l = lo.longValue();
        printXref(l, 0, 'n');
    }

}