org.apache.log4j.Logger.info()

Here are the examples of the java api org.apache.log4j.Logger.info() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5227 Examples 7

19 Source : Log.java
with Apache License 2.0
from zhengshuheng

public void info(String message) {
    logger.info(message);
}

19 Source : LogTest.java
with Apache License 2.0
from ZHENFENG13

public static void main(String... arg0) {
    long start = System.currentTimeMillis();
    for (int i = 0; i < 10; i++) {
        log.info("log输出info:" + i);
        log.debug("log输出debug:" + i);
    }
    long time = System.currentTimeMillis() - start;
    log.info("所用时间" + time);
}

19 Source : Task.java
with Apache License 2.0
from zhangyingwei

public Task addDeep(int deep) {
    if (deep > 0) {
        this.deep += deep;
    } else {
        logger.info("deep is not valid: " + deep);
    }
    return this;
}

19 Source : CockroachConfig.java
with Apache License 2.0
from zhangyingwei

public void print() {
    logger.info("---------------------------config--------------------------");
    logger.info("AppName: " + this.getAppName());
    logger.info("Proxys: " + this.getProxys());
    logger.info("Threads: " + this.getThread());
    logger.info("ThreadSleep: " + this.getThreadSleep());
    logger.info("IHttpClient: " + this.getHttpClient());
    logger.info("HttpClientProgress: " + this.getShowHttpClientProgress());
    logger.info("Store: " + this.getStore());
    logger.info("Cookie: " + this.getCookie());
    logger.info("CookieGenerator: " + this.getCookieGenerator());
    logger.info("HttpHeaders: " + this.getHttpHeader());
    logger.info("HttpHeadersGenerator: " + this.getHeaderGenerator());
    logger.info("AutoClose: " + this.autoClose);
    logger.info("TaskErrorHandler: " + this.getTaskErrorHandler());
    logger.info("ResponseFilters: " + this.getResponseFilters());
    logger.info("-------------------------------------------------------------");
}

19 Source : FileUtils.java
with Apache License 2.0
from zhangyingwei

/**
 * delete file
 * @param file
 */
public static boolean delete(File file) {
    boolean result = false;
    if (file.exists()) {
        result = file.delete();
        if (!result) {
            logger.info("delete " + file.getName() + " error");
        }
    }
    return result;
}

19 Source : LoggerUtil.java
with Apache License 2.0
from zhangliangming

public void i(String str) {
    String name = getFunctionName();
    if (logFlag) {
        if (name != null) {
            // Log.i(tag, name + " - " + str);
            logger.info(name + " - " + str);
        } else {
            // Log.i(tag, str);
            logger.info(str.toString());
        }
    }
}

19 Source : QuartzTask.java
with MIT License
from zhangjikai

public void run() {
    log.info("QuartzTask开始");
}

19 Source : MyLogger.java
with MIT License
from zazaluMonster

public static void log(String log) {
    logger.info(log);
}

19 Source : TutorialPage.java
with Apache License 2.0
from zaproxy

/**
 * Called when a POST request has been made. By default handles the task completion
 *
 * @param msg the HTTP message
 */
public void handlePostRequest(HttpMessage msg, Map<String, String> params) {
    // Check to see if they've solved the task
    String body = msg.getRequestBody().toString();
    if (this.key == null || body.length() == 0) {
        // Key not set yet or no data submitted
        return;
    }
    boolean csrfOk = false;
    boolean taskOk = false;
    for (Map.Entry<String, String> entry : params.entrySet()) {
        if (entry.getKey().equals("key")) {
            log.debug("Expecting key=" + key + " got " + entry.getValue());
            if (entry.getValue().equals(key)) {
                if (this.tutorialProxyServer.isTutorialTestMode()) {
                    log.info("Preplaceded the task with key " + key);
                }
                taskOk = true;
                taskPreplaceded();
            } else if (this.tutorialProxyServer.isTutorialTestMode()) {
                log.info("Unexpected key value: " + entry.getValue());
            }
        } else if (entry.getKey().equals("anticsrf")) {
            if (entry.getValue().equals(this.antiCsrfToken)) {
                if (this.tutorialProxyServer.isTutorialTestMode()) {
                    log.info("Anticsrf token ok");
                }
                csrfOk = true;
            } else if (this.tutorialProxyServer.isTutorialTestMode()) {
                log.info("Anticsrf token bad " + entry.getValue());
            }
        }
    }
    if (csrfOk && taskOk) {
        this.setTaskCompleted(true);
        this.setTaskJustCompleted(true);
    }
    if (this.tutorialProxyServer.isTutorialTestMode() && !this.taskJustCompleted) {
        log.info("Did not preplaced the task for key " + key);
    }
}

19 Source : TutorialPage.java
with Apache License 2.0
from zaproxy

/**
 * Returns an 8 digit random number that can be used for a tutorial task
 *
 * @return an 8 digit random number
 */
public String setTaskToken() {
    this.key = Integer.toString(10000000 + rnd.nextInt(90000000));
    if (this.tutorialProxyServer.isTutorialTestMode()) {
        log.info("Generated key " + key);
    }
    return this.key;
}

19 Source : ExtensionHUD.java
with Apache License 2.0
from zaproxy

@Override
public void optionsChanged(OptionsParam arg0) {
    if (!this.getHudParam().getBaseDirectory().equals(this.baseDirectory)) {
        log.info("Reloading HUD scripts");
        this.removeHudScripts();
        this.addHudScripts();
    }
    this.hudEnabledForDesktop = getHudParam().isEnabledForDesktop();
    if (View.isInitialised()) {
        this.getHudButton().setSelected(hudEnabledForDesktop);
        this.setHudButton();
        setZapCanGetFocus(!this.hudEnabledForDesktop);
    }
    this.hudEnabledForDaemon = getHudParam().isEnabledForDaemon();
}

19 Source : RedisHashLoadGenerator.java
with Apache License 2.0
from yugabyte

private boolean selectRandomly() {
    if (!selectRandomly) {
        selectRandomly = !loadGenerator.stillLoading();
        if (selectRandomly) {
            LOG.info("Loaded all the data. Will now start choosing subkeys at random");
        }
    }
    return selectRandomly;
}

19 Source : AppBase.java
with Apache License 2.0
from yugabyte

/**
 * Report exception.
 *
 * @param e  the exception
 */
public void reportException(Exception e) {
    LOG.info("Caught Exception: ", e);
    if (e instanceof NoHostAvailableException) {
        NoHostAvailableException ne = (NoHostAvailableException) e;
        for (Map.Entry<EndPoint, Throwable> entry : ne.getErrors().entrySet()) {
            LOG.info("Exception encountered at host " + entry.getKey() + ": ", entry.getValue());
        }
    }
}

19 Source : AppBase.java
with Apache License 2.0
from yugabyte

public void dropCreplacedandraTable(String tableName) {
    String drop_stmt = String.format("DROP TABLE IF EXISTS %s;", tableName);
    getCreplacedandraClient().execute(new SimpleStatement(drop_stmt).setReadTimeoutMillis(60000));
    LOG.info("Dropped Creplacedandra table " + tableName + " using query: [" + drop_stmt + "]");
}

19 Source : User.java
with GNU General Public License v3.0
from yogeshsd

public void logoutUser() {
    this.authToken = "";
    logger.info("For user " + this.username + " logging out and setting authToken to null");
}

19 Source : DevopsUtil.java
with Apache License 2.0
from yaoguangluo

/**
 * windows�����»�ȡJVM��PID
 */
public void getJvmPIDOnWindows() {
    RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
    pid = runtime.getName().split("@")[0];
    log.info("PID of JVM:" + pid);
}

19 Source : NewsAction.java
with MIT License
from xujie01

// �û�����ij������
public String publishComment() {
    user = (User) sessionMap.get("user");
    ipAddress = httpRequest.getRemoteAddr();
    commentService.publishComment(comment, ipAddress, newsId, user);
    logger.info(user.getUsername() + "�������ۣ�" + comment + " ,IP��ַ��" + ipAddress + " ,����ID��" + newsId);
    allComments = commentService.getViewNewsAllComment(newsId);
    try {
        writeJSON(allComments);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

19 Source : AdminAction.java
with MIT License
from xujie01

public String homePage() {
    logger.info("ע������Ա:" + ((Admin) sessionMap.get("admin")).getUsername());
    sessionMap.put("admin", null);
    httpSession.invalidate();
    return "to_NewsAction_getAllPreplacededNews";
}

19 Source : AdminAction.java
with MIT License
from xujie01

/**
 * ����Աע��
 */
public String doneLogout() {
    logger.info("ע������Ա:" + ((Admin) sessionMap.get("admin")).getUsername());
    sessionMap.put("admin", null);
    httpSession.invalidate();
    return "to_indexPage";
}

19 Source : AdminAction.java
with MIT License
from xujie01

/**
 * ɾ������Ա
 */
public String deleteAdmin() {
    model = adminService.getEnreplacedy(model.getId());
    adminService.deleteEnreplacedy(model);
    logger.info("ɾ������Ա:" + model.getUsername());
    return "to_AdminAction_getAllAdmins";
}

19 Source : HomeController.java
with Apache License 2.0
from xiaop1ng

// @GetMapping("/starter")
// String starter(){return helloService.sayHello();}
/**
 * test AuthorizationInterceptor
 */
@RequestMapping(value = "/auth", method = RequestMethod.GET)
@ResponseBody
Rs auth() {
    logger.info("[入参]" + getParamMap().toString());
    logger.info("[当前用户]" + attr("_username").toString());
    return Rs.ok("授权通过!");
}

19 Source : App.java
with Apache License 2.0
from xiaop1ng

public static void main(String[] args) throws Exception {
    // SpringApplication 将引导我们的应用,启动 Spring,相应地启动被自动配置的 Tomcat web 服务器。
    // 我们需要将 App.clreplaced 作为参数传递给 run 方法,以此告诉 SpringApplication 谁是主要的 Spring 组件,并传递 args 数组以暴露所有的命令行参数。
    SpringApplication.run(App.clreplaced, args);
    logger.info("已启动!");
}

19 Source : tar_3.java
with GNU General Public License v2.0
from xgdsmileboy

public static void main(String[] args) {
    FileFlooder.flood(".", "file", "txt", 100, 1000);
    log.info("done");
}

19 Source : ESBJAVA4770VFSPasswordSecurityWithLargekeyTestCase.java
with Apache License 2.0
from wso2

@Test(groups = "wso2.esb", description = "VFS secure preplacedword test")
public void securePreplacedwordTest() throws XMLStreamException, IOException {
    // copy SOAP message  into the SFTP server
    String sentMessageFile = "test.xml";
    File sourceMessage = new File(sampleFileFolder + File.separator + sentMessageFile);
    File destinationMessage = new File(inputFolder + File.separator + sentMessageFile);
    copyFile(sourceMessage, destinationMessage);
    // Below is encrypted value of "SFTPUser:SFTP321" using vfsKeystore.jks which has a key with key strength 2048
    String encryptedPreplaced = "qZnz8nFwQGqI1jp5DcjW8mUurphNc9Mj1DH8cGQBYB0p05geEDMQE3mNp3FTGhAhlohzvzuHdymETTEniprVua4PqPoeB1ZOXpCxE2Xy/auq+JSo77uPmPc9Uf3wgx5fhKqSghENwiCeWqAvbiLwyArwpmq4A5PVAuIzjADFwSkIpRxD9VnDlaDr2ovYVfbrwM7Z3DF4w4GJmyeXdswoCiYBZ+t+SJEU8tihzLsO0B3cbYXbzDEDNUVF6lWnokD01Ywp4VcI3FSHI1XwyKeZj1RAtP4YdhqEnUbSnlG3VsMeSgFpjUrnRomVY6/Pw2rq7s19RGgVO+X6JekON1mH2w==";
    String fileUri = "sftp://{wso2:vault-decrypt('" + encryptedPreplaced + "')}@localhost:" + FTPPort + "/" + inputFolderName + "/?transport.vfs.AvoidPermissionCheck=true";
    String moveAfterProcess = "sftp://{wso2:vault-decrypt('" + encryptedPreplaced + "')}@localhost:" + FTPPort + "/" + outputFolderName + "?transport.vfs.AvoidPermissionCheck=true";
    // create VFS transport listener proxy
    String proxy = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\"\n" + "       name=\"VfsSecurePreplacedwordTest1\"\n" + "       transports=\"vfs http https\"\n" + "       startOnLoad=\"true\"\n" + "       trace=\"disable\">\n" + "   <description/>\n" + "   <target>\n" + "      <inSequence>\n" + "         <property name=\"transport.vfs.ReplyFileName\"\n" + "                   expression=\"get-property('transport', 'FILE_NAME')\"\n" + "                   scope=\"transport\"\n" + "                   type=\"STRING\"/>\n" + "         <log level=\"custom\">\n" + "            <property name=\"File recieved for the proxy service - \"\n" + "                      expression=\"fn:concat(' - File ',get-property('transport','FILE_NAME'),' received')\"/>\n" + "         </log>\n" + "         <drop/>\n" + "      </inSequence>\n" + "   </target>\n" + "   <parameter name=\"transport.PollInterval\">1</parameter>\n" + "   <parameter name=\"transport.vfs.ActionAfterProcess\">MOVE</parameter>\n" + "   <parameter name=\"transport.vfs.ClusterAwareness\">true</parameter>\n" + "   <parameter name=\"transport.vfs.FileURI\">" + fileUri + "</parameter>\n" + "   <parameter name=\"transport.vfs.MoveAfterProcess\">" + moveAfterProcess + "</parameter>\n" + "   <parameter name=\"transport.vfs.FileNamePattern\">test.*\\.xml</parameter>\n" + "   <parameter name=\"transport.vfs.Locking\">enable</parameter>\n" + "   <parameter name=\"transport.vfs.ContentType\">application/octet-stream</parameter>\n" + "   <parameter name=\"transport.vfs.ActionAfterFailure\">DELETE</parameter>\n" + "</proxy>";
    OMElement proxyOM = AXIOMUtil.stringToOM(proxy);
    // add the listener proxy to ESB server
    try {
        Utils.deploySynapseConfiguration(proxyOM, "VfsSecurePreplacedwordTest1", "proxy-services", true);
    } catch (Exception e) {
        LOGGER.error("Error while updating the Synapse config", e);
    }
    LOGGER.info("Synapse config updated");
    // Here we can't know whether the proxy polling happened or not, hence only way is to wait and see. Since poll interval is 1,
    // this waiting period should suffice. But it may include the time it take to deploy ther service as well.
    // check whether file is moved to "out" folder
    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(checkForOutputFile(outputFolder));
}

19 Source : TelemetryEventSource.java
with Apache License 2.0
from wso2

private void stopServer() {
    if (this.server != null && !this.server.isShutdown()) {
        log.info("Shutting down telemetry service");
        this.server.shutdown();
    }
}

19 Source : TransformBaseRunner.java
with GNU General Public License v3.0
from wlhbdp

protected void afterRunJob(Job job, Throwable e) throws IOException {
    try {
        long endTime = System.currentTimeMillis();
        logger.info("Job" + job.getJobName() + "是否执行成功:" + (e == null ? job.isSuccessful() : false) + "; 开始时间:" + startTime + "; 结束时间:" + endTime + "; 用时" + (endTime - startTime) + "ms" + (e == null ? "" : "; 异常信息为:" + e));
    } catch (Throwable e1) {
    // nothing
    }
}

19 Source : LogResultsWriter.java
with Apache License 2.0
from viclovsky

private void logMissedCoverage(Map<OperationKey, Operation> missed) {
    if (!missed.isEmpty()) {
        LOGGER.info("Missed coverage: ");
        missed.keySet().forEach(m -> LOGGER.info(m.getHttpMethod() + " " + m.getPath()));
    }
}

19 Source : GlobalContext.java
with Eclipse Public License 1.0
from viatra

/**
 * Starts a new thread to explore the design space.
 *
 * @param originalThreadContext The context of the thread which starts the new thread.
 * @param model The model to start from.
 * @param cloneModel It should be true in most cases.
 * @param strategy The strategy, the thread will use.
 * @return The {@link ExplorerThread}
 */
private synchronized ExplorerThread tryStartNewThread(ThreadContext originalThreadContext, Notifier model, IStrategy strategy) {
    if (!isAlreadyInited) {
        isAlreadyInited = true;
        init();
    }
    if (state != ExplorationProcessState.COMPLETED && state != ExplorationProcessState.STOPPING && threadPool.canStartNewThread()) {
        ThreadContext newThreadContext = new ThreadContext(this, strategy, model);
        // TODO : clone undo list? slave strategy can't go further back...
        ExplorerThread explorerThread = new ExplorerThread(newThreadContext);
        newThreadContext.setExplorerThread(explorerThread);
        boolean isSuccessful = threadPool.tryStartNewStrategy(explorerThread);
        if (isSuccessful) {
            runningThreads.add(explorerThread);
            state = ExplorationProcessState.RUNNING;
            ++numberOfStartedThreads;
            logger.info("New thread started, active threads: " + runningThreads.size());
            return explorerThread;
        }
    }
    return null;
}

19 Source : GlobalContext.java
with Eclipse Public License 1.0
from viatra

public synchronized void stopAllThreads() {
    if (state == ExplorationProcessState.RUNNING) {
        state = ExplorationProcessState.STOPPING;
        logger.info("Stopping all threads.");
        for (ExplorerThread strategy : runningThreads) {
            strategy.stopRunning();
        }
    }
}

19 Source : DesignSpaceExplorer.java
with Eclipse Public License 1.0
from viatra

/**
 * Stops the exploration asynchronously. It has no effect if the exploration is already terminated or not even
 * started.
 */
public void stopExplorationAsync() {
    if (globalContext.isDone()) {
        logger.info("Cannot stop exploration - design space exploration has already finished.");
    } else if (globalContext.isNotStarted()) {
        logger.info("Cannot stop exploration - design space exploration has not been started.");
    } else {
        globalContext.stopAllThreads();
    }
}

19 Source : DesignSpaceExplorer.java
with Eclipse Public License 1.0
from viatra

/**
 * Stops the exploration and waits for termination. It has no effect if the exploration is already terminated or not
 * even started.
 */
public void stopExploration() {
    if (globalContext.isDone()) {
        logger.info("Cannot stop exploration - design space exploration has already finished.");
    } else if (globalContext.isNotStarted()) {
        logger.info("Cannot stop exploration - design space exploration has not been started.");
    } else {
        globalContext.stopAllThreads();
        waitForTerminaition();
    }
}

19 Source : UserController.java
with MIT License
from veracode

@RequestMapping(value = "/register", method = RequestMethod.GET)
public String showRegister() {
    logger.info("Entering showRegister");
    return "register";
}

19 Source : LoggerGenerator.java
with Apache License 2.0
from ukihsoroy

public static void main(String[] args) {
    int index = 0;
    while (true) {
        try {
            logger.info("value: " + index++);
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

19 Source : HttpSendClientFactory.java
with Apache License 2.0
from ucarGroup

/**
 * 请求会超时
 * <p>
 * 单例
 * <p>
 * 默认连接超时时间:2秒<br>
 * 默认执行超时时间:3秒<br>
 *
 * @return
 */
public static HttpSendClient getInstance() {
    if (instance == null) {
        synchronized (lock) {
            if (instance == null) {
                instance = httpSendClient(SO_TIMEOUT_DEFAULT, CONNECTION_TIMEOUT_DEFAULT);
                logger.info("HttpSendClientFactory New HttpSendClient Instance");
            }
        }
    }
    return instance;
}

19 Source : HttpSendClientFactory.java
with Apache License 2.0
from ucarGroup

/**
 * 请求不超时
 * <p>
 * 单例
 * <p>
 * 默认连接超时时间:2秒<br>
 *
 * @return
 */
public static HttpSendClient getNTOInstance() {
    if (infiniteInstance == null) {
        synchronized (infiniteLock) {
            if (infiniteInstance == null) {
                infiniteInstance = httpSendClient(SO_TIMEOUT_INFINITE, CONNECTION_TIMEOUT_DEFAULT);
                logger.info("HttpSendClientFactory New Not TimeOut HttpSendClient Instance");
            }
        }
    }
    return infiniteInstance;
}

19 Source : MailSenderUtil.java
with Apache License 2.0
from tmobile

/**
 * Send Mail or Slack Alert For HealthCheckVos if a subscription is available.
 *
 * @param stsChgList
 * @throws SQLException
 * @throws Exception
 */
public static void sendMailForHealthCheckVos(List<HealthCheckVO> stsChgList) throws SQLException {
    logger.info("************** STARTED Mail Sending **************");
    if (stsChgList.size() == 0) {
        logger.info("************** END Mail Sending - No Status change**************");
        return;
    }
    Set<Integer> parentAndCompIdSet = getParentAndCompIdSet(stsChgList);
    List<SubscriptionVO> subscriptionVOs = DBQueryUtil.getAllSubscriptions(parentAndCompIdSet);
    PropertyUtil prop = PropertyUtil.getInstance();
    String mailTemplate = prop.getValue(SurveillerConstants.MAIL_MESSAGE_TEMPLATE);
    String mailSubjectTemplate = prop.getValue(SurveillerConstants.MAIL_SUBJECT_TEMPLATE);
    if (!stsChgList.isEmpty()) {
        for (HealthCheckVO hVo : stsChgList) {
            for (SubscriptionVO sVo : subscriptionVOs) {
                if (isSubscriptionForComponent(hVo, sVo)) {
                    String mailMsg = mailTemplate;
                    String mailSub = mailSubjectTemplate;
                    mailSub = mailSub.replace("<EnvironmentName>", hVo.getEnvironmentName());
                    mailSub = mailSub.replace("<RegionName>", hVo.getRegionName());
                    mailSub = mailSub.replace("<Status>", hVo.getStatus().getStatus().getStatusDesc());
                    String serviceName = hVo.getComponent().getParentComponentName() + "/" + hVo.getComponent().getComponentName();
                    mailSub = mailSub.replace("<ServiceName>", serviceName);
                    mailMsg = mailMsg.replace("<parent_component_name>", hVo.getComponent().getParentComponentName());
                    mailMsg = mailMsg.replace("<component_name>", hVo.getComponent().getComponentName());
                    mailMsg = mailMsg.replace("<status>", hVo.getStatus().getStatus().getStatusDesc());
                    mailMsg = mailMsg.replace("<message>", hVo.getFailureStatusMessage());
                    mailMsg = mailMsg.replace("<EnvironmentName>", hVo.getEnvironmentName());
                    mailMsg = mailMsg.replace("<RegionName>", hVo.getRegionName());
                    logger.debug("Subject: " + mailSub + "\nMessage: " + mailMsg);
                    switch(sVo.getSubscriptionType()) {
                        case SurveillerConstants.SUBSCRIPTION_TYPE_EMAIL:
                            MailSenderUtil.sendMail(mailMsg, sVo.getSubscriptionValue(), mailSub);
                            break;
                        case SurveillerConstants.SUBSCRIPTION_TYPE_SLACK_WEB_HOOK:
                            try {
                                MailSenderUtil.sendSlackAlertByWebHook(hVo, sVo.getSubscriptionValue(), mailSub);
                            } catch (IOException e) {
                                logger.error("Error in Senting Slack Message. URL = " + sVo.getSubscriptionValue(), e);
                            }
                            break;
                        case SurveillerConstants.SUBSCRIPTION_TYPE_SLACK_CHANNEL:
                            MailSenderUtil.sendMessageToSlackChannel(hVo, sVo.getSubscriptionValue(), mailSub);
                            break;
                        default:
                            break;
                    }
                }
            }
        }
    }
    logger.info("************** END OF Mail Sending **************");
}

19 Source : K8sAPIDashboardTask.java
with Apache License 2.0
from tmobile

public static void doK8sApiDashboardDataLoad() throws Exception {
    logger.info("************** STARTED doK8sApiDashboardDataLoad **************");
    List<EnvironmentVO> envInfoList = DBQueryUtil.getAllEnvironments();
    for (EnvironmentVO eVo : envInfoList) {
        if (eVo.getK8sUrl() == null || eVo.getK8sCred() == null) {
            logger.info("The Kubernetes URL/Credentials are null for the Environment -" + eVo.getEnvironmentName());
            continue;
        }
        loadKubernetesApiDashboard(eVo);
    }
}

19 Source : ProjectTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * Main junit test application.
 * @param args ignored
 */
public static void main(String[] args) {
    junit.textui.TestRunner.run(suite());
    LOG.info("Finished Project JUnit tests...");
}

19 Source : SqrtInt.java
with GNU General Public License v3.0
from TilmanNeumann

private static void testCorrectness(int nCount) {
    for (int bits = 100; bits <= 130; bits += 1) {
        LOG.info("test correctness of sqrt() implementations for " + bits + "-bit numbers...");
        ArrayList<BigInteger> testSet = createTestSet(nCount, bits);
        for (BigInteger testNum : testSet) {
            testCorrectness(testNum, bits, iSqrt(/*_v01*/
            testNum), "v01");
        }
    }
}

19 Source : SqrtInt.java
with GNU General Public License v3.0
from TilmanNeumann

private static void testPerformance(int nCount) {
    for (int bits = 10; ; bits += 10) /*RNG.nextInt(50)*/
    {
        ArrayList<BigInteger> testSet = createTestSet(nCount, bits);
        LOG.info("test sqrt of " + bits + "-bit numbers:");
        long t0, t1;
        t0 = System.currentTimeMillis();
        for (BigInteger testNum : testSet) {
            iSqrt(/*_v01*/
            testNum);
        }
        t1 = System.currentTimeMillis();
        LOG.info("   v01 sqrt with " + nCount + " numbers took " + (t1 - t0) + " ms");
    }
}

19 Source : MpiPartitionGeneratorTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * prints the number of essentially different factorizations of n, n=0,1,...
 * A001055 (n=1...) = 1, 1, 1, 2, 1, 2, 1, 3, 2, 2, 1, 4, 1, 2, 2, 5, 1, 4, 1, 4, 2, 2, 1, 7, 2, 2, 3, 4, 1, ...
 */
private static void printNumberOfFactorizations() {
    for (int n = 0; n <= 100; n++) {
        BigInteger bigN = BigInteger.valueOf(n);
        long numberOfFactorizations = MpiParreplacedionGenerator.numberOfFactorizationsOf(bigN);
        LOG.info(bigN + " can be factored in " + numberOfFactorizations + " different ways");
    }
}

19 Source : MpiPartitionGeneratorTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * prints the number of essentially different factorizations of n!, n=0,1,...
 * A076716 (n=2...)= 1,2,7,21,98,392,2116,11830,70520,...
 */
private static void printNumberOfFactorialFactorizations() {
    for (int i = 0; i < 14; i++) {
        long start = System.currentTimeMillis();
        BigInteger factorial = Factorial.factorial(i);
        long numberOfFactorizations = MpiParreplacedionGenerator.numberOfFactorizationsOf(factorial);
        LOG.info(i + "! = " + factorial + " can be factored in " + numberOfFactorizations + " different ways (computed in " + (System.currentTimeMillis() - start) + " ms)");
    }
}

19 Source : MpiPartitionGeneratorTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * prints parreplacedions of parreplacedions
 * A001970 = 1, 1, 3, 6, 14, 27, 58, 111, 223, 424, 817, 1527, 2870, 5279, 9710, 17622, 31877, 57100, 101887, 180406, 318106, 557453, 972796, 1688797, 2920123, ...
 */
private static void printHyperParreplacedions() {
    for (int n = 1; n < 25; n++) {
        long start = System.currentTimeMillis();
        int totalNumberOfParreplacedions = 0;
        // run over all additive parreplacedion of n:
        IntegerParreplacedionGenerator partgen = new IntegerParreplacedionGenerator(n);
        while (partgen.hasNext()) {
            int[] flatParreplacedion = partgen.next();
            // parreplacedion is in flat form, i.e. a list of all parts.
            // convert this into the multiset form:
            IntegerParreplacedion expParreplacedion = new IntegerParreplacedion(flatParreplacedion);
            // LOG.debug("expParreplacedion from n=" + n + ": " + expParreplacedion);
            // now we have all the multiplicities
            Mpi mpiFromParreplacedion = new Mpi_IntegerArrayImpl(expParreplacedion.values());
            MpiParreplacedionGenerator mpiPartGen = new MpiParreplacedionGenerator(mpiFromParreplacedion);
            while (mpiPartGen.hasNext()) {
                mpiPartGen.next();
                totalNumberOfParreplacedions++;
            }
        }
        LOG.info(n + " has " + totalNumberOfParreplacedions + " hyper parreplacedions! (computed in " + (System.currentTimeMillis() - start) + " ms)");
    }
}

19 Source : MpiPartitionGeneratorTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * prints record numbers of essentially different factorizations of n, n=0,1,...
 * A033833 = 1, 4, 8, 12, 16, 24, 36, 48, 72, 96, 120, 144, 192, 216, 240, 288, 360, 432, 480, 576, 720, 960, 1080, 1152, 1440, 2160, 2880, 4320, 5040, 5760, 7200, 8640, 10080, 11520, ...
 */
private static void printNumberOfFactorizationsRecords() {
    long record = 0;
    for (BigInteger n = I_1; ; n = n.add(I_1)) {
        long numberOfFactorizations = MpiParreplacedionGenerator.numberOfFactorizationsOf(n);
        if (numberOfFactorizations > record) {
            // same value does not count as new record
            LOG.info(n + " can be factored in " + numberOfFactorizations + " different ways");
            record = numberOfFactorizations;
        }
    }
}

19 Source : MpiPartitionGeneratorTest.java
with GNU General Public License v3.0
from TilmanNeumann

/**
 * prints record numbers of essentially different factorizations of n per bit.
 */
// Note: factorizations per n is too restrictive, small n (like 1) would be unbeatable!
private static void printNumberOfFactorizationsRecordsPerBit() {
    // long recordFactorizations = 0;
    // double recordBitLength;
    double recordRatio = 0;
    for (BigInteger n = I_1; ; n = n.add(I_1)) {
        long numberOfFactorizations = MpiParreplacedionGenerator.numberOfFactorizationsOf(n);
        // ld(n)
        double bits = n.equals(I_1) ? 1.0 : Math.log(n.doubleValue()) / Math.log(2.0);
        double ratio = numberOfFactorizations / bits;
        if (ratio > recordRatio) {
            // same value does not count as new record
            LOG.info(n + " (" + bits + " bit) can be factored in " + numberOfFactorizations + " different ways -> ratio = " + ratio);
            recordRatio = ratio;
        // recordBitLength = bits;
        // recordFactorizations = numberOfFactorizations;
        }
    }
}

19 Source : MpiPartitionGenerator.java
with GNU General Public License v3.0
from TilmanNeumann

private static void printNumberOfMultiparreplacedeParreplacedions(Mpi q) {
    long start = System.currentTimeMillis();
    long count = numberOfParreplacedionsOf(q);
    LOG.info(q + " has " + count + " parreplacedions (computed in " + (System.currentTimeMillis() - start) + "ms)");
}

19 Source : IntegerPartitionGenerator.java
with GNU General Public License v3.0
from TilmanNeumann

private static void printNumberOfParreplacedions(int n) {
    long start = System.currentTimeMillis();
    IntegerParreplacedionGenerator partGen = new IntegerParreplacedionGenerator(n);
    int count = 0;
    while (partGen.hasNext()) {
        partGen.next();
        count++;
    }
    LOG.debug("maxStackSize = " + partGen.maxStackSize);
    LOG.info(n + " has " + count + " parreplacedions (computed in " + (System.currentTimeMillis() - start) + "ms)");
}

19 Source : ModularSqrtTest.java
with GNU General Public License v3.0
from TilmanNeumann

private static void testCorrectness(int NCOUNT) {
    ModularSqrt31 mse31 = new ModularSqrt31();
    LOG.info("Test correctness of " + NCOUNT + " p with p%8==5");
    int[] pArray = createPArray(5, NCOUNT);
    int[] nArray = createNArray(pArray);
    for (int i = 0; i < NCOUNT; i++) {
        int a = nArray[i];
        int p = pArray[i];
        int tonelli = mse31.Tonelli_Shanks(a, p);
        replacedertEquals((tonelli * (long) tonelli) % p, a % p);
        int case5Mod8 = mse31.case5Mod8(a, p);
        replacedertEquals((case5Mod8 * (long) case5Mod8) % p, a % p);
        // both returned the smaller sqrt
        replacedertTrue(tonelli == case5Mod8);
    }
}

19 Source : HarmonicNumbers.java
with GNU General Public License v3.0
from TilmanNeumann

private static void print(BigRational[] arr) {
    StringBuffer bu = new StringBuffer();
    for (int i = 0; i < arr.length; i++) {
        if (i > 0)
            bu.append(" ");
        bu.append(arr[i]);
    }
    LOG.info(bu.toString());
}

19 Source : BParamTest.java
with GNU General Public License v3.0
from TilmanNeumann

void computeNextBParameter() {
    int v = Integer.numberOfTrailingZeros(bIndex << 1);
    LOG.info("v = " + v);
    // bIndex/2^v is a half-integer. Therefore we have ceilTerm = ceil(bIndex/2^v) = bIndex/2^v + 1.
    // If ceilTerm is even, then (-1)^ceilTerm is positive and B_l[v] must be added.
    // Slightly faster is: if ceilTerm-1 = bIndex/2^v is odd then B_l[v] must be added.
    boolean bParameterNeedsAddition = (((bIndex / (1 << v)) & 1) == 1);
    // WARNING: In contrast to the description in [Contini p.10, 2nd paragraph],
    // WARNING: b must not be computed (mod a) !
    b = bParameterNeedsAddition ? b.add(B2Array[v - 1]) : b.subtract(B2Array[v - 1]);
    bIndex++;
}

See More Examples