Package org.gridgain.grid.kernal.ggfs.common

Examples of org.gridgain.grid.kernal.ggfs.common.GridGgfsLogger


     * Ensure correct static loggers creation/removal as well as file creation.
     *
     * @throws Exception If failed.
     */
    public void testCreateDelete() throws Exception {
        GridGgfsLogger log = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        GridGgfsLogger sameLog0 = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        // Loggers for the same endpoint must be the same object.
        assert log == sameLog0;

        GridGgfsLogger otherLog = GridGgfsLogger.logger("other" + ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        // Logger for another endpoint must be different.
        assert log != otherLog;

        otherLog.close();

        log.logDelete(PATH, PRIMARY, false);

        log.close();

        File logFile = new File(LOG_FILE);

        // When there are multiple loggers, closing one must not force flushing.
        assert !logFile.exists();

        GridGgfsLogger sameLog1 = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        assert sameLog0 == sameLog1;

        sameLog0.close();

        assert !logFile.exists();

        sameLog1.close();

        // When we cloe the last logger, it must flush data to disk.
        assert logFile.exists();

        logFile.delete();

        GridGgfsLogger sameLog2 = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        // This time we expect new logger instance to be created.
        assert sameLog0 != sameLog2;

        sameLog2.close();

        // As we do not add any records to the logger, we do not expect flushing.
        assert !logFile.exists();
    }
View Full Code Here


     * Test read operations logging.
     *
     * @throws Exception If failed.
     */
    public void testLogRead() throws Exception {
        GridGgfsLogger log = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        log.logOpen(1, PATH, PRIMARY, 2, 3L);
        log.logRandomRead(1, 4L, 5);
        log.logSeek(1, 6L);
        log.logSkip(1, 7L);
        log.logMark(1, 8L);
        log.logReset(1);
        log.logCloseIn(1, 9L, 10L, 11);

        log.close();

        checkLog(
            new SB().a(U.jvmPid() + d() + TYPE_OPEN_IN + d() + PATH_STR_ESCAPED + d() + PRIMARY + d() + 1 + d() + 2 +
                d() + 3 + d(14)).toString(),
            new SB().a(U.jvmPid() + d() + TYPE_RANDOM_READ + d(3) + 1 + d(7) + 4 + d() + 5 + d(8)).toString(),
View Full Code Here

     * Test write operations logging.
     *
     * @throws Exception If failed.
     */
    public void testLogWrite() throws Exception {
        GridGgfsLogger log = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        log.logCreate(1, PATH, PRIMARY, true, 2, new Integer(3).shortValue(), 4L);
        log.logAppend(2, PATH, PRIMARY, 8);
        log.logCloseOut(2, 9L, 10L, 11);

        log.close();

        checkLog(
            new SB().a(U.jvmPid() + d() + TYPE_OPEN_OUT + d() + PATH_STR_ESCAPED + d() + PRIMARY + d() + 1 + d() +
                2 + d(2) + 0 + d() + 1 + d() + 3 + d() + 4 + d(10)).toString(),
            new SB().a(U.jvmPid() + d() + TYPE_OPEN_OUT + d() + PATH_STR_ESCAPED + d() + PRIMARY + d() + 2 + d() +
View Full Code Here

     *
     * @throws Exception If failed.
     */
    @SuppressWarnings("TooBroadScope")
    public void testLogMisc() throws Exception {
        GridGgfsLogger log = GridGgfsLogger.logger(ENDPOINT, GGFS_NAME, LOG_DIR, 10);

        String newFile = "/dir3/file.test";
        String file1 = "/dir3/file1.test";
        String file2 = "/dir3/file1.test";

        log.logMakeDirectory(PATH, PRIMARY);
        log.logRename(PATH, PRIMARY, new GridGgfsPath(newFile));
        log.logListDirectory(PATH, PRIMARY, new String[] { file1, file2 });
        log.logDelete(PATH, PRIMARY, false);

        log.close();

        checkLog(
            new SB().a(U.jvmPid() + d() + TYPE_DIR_MAKE + d() + PATH_STR_ESCAPED + d() + PRIMARY + d(17)).toString(),
            new SB().a(U.jvmPid() + d() + TYPE_RENAME + d() + PATH_STR_ESCAPED + d() + PRIMARY + d(15) + newFile +
                d(2)).toString(),
View Full Code Here

TOP

Related Classes of org.gridgain.grid.kernal.ggfs.common.GridGgfsLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.