All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.boot.test.FileCacheStoreTest Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*
 * @(#) $Id: FileCacheStoreTest.java 2084 2007-11-27 14:53:31Z s3460 $
 */
package at.spardat.xma.boot.test;

import java.io.File;
import java.io.IOException;
import java.util.Random;

import at.spardat.xma.boot.cache.VersionNumber;
import at.spardat.xma.boot.transform.HashChecksum;

import junit.framework.TestCase;

/**
 * @author s2877
 * @since version_number
 */
public class FileCacheStoreTest extends TestCase {
    Random random = new Random();
    { random.setSeed(System.currentTimeMillis()); }

    private String randomHash() {
        byte[] content = new byte[8];
        random.nextBytes(content);
        return HashChecksum.calcCheckSum(content);
    }

    /**
     * @param arg0
     */
    public FileCacheStoreTest(String arg0) {
        super(arg0);
    }

    public static void main(String[] args) {
        junit.awtui.TestRunner.main(new String[] { VersionNumberTest.class.getName(), "-noloading" });
    }

    public void testFileCacheStore() {
    }

    public void testGetBaseDir() {
    }

    public void testGetResource() {
    }

    /*
     * Class under test for FCResource storeResource(File, Result, URL, IFileCacheResource, boolean, boolean)
     */
    public void testStoreResourceFileResultURLIFileCacheResourcebooleanboolean() {
    }

    /*
     * Class under test for FCResource storeResource(File, Result, byte[], URL, boolean)
     */
    public void testStoreResourceFileResultbyteArrayURLboolean() {
    }

    public void testLock() {
    }

    public void testUnlock() {
    }

    public void testSaveToDisk() {
    }

    public void testSaveContent() {
    }

    public void testCreatePropertyFile() {
    }

    public void testRemoveResource() {
    }

    public void testFindPreviousVersion() throws IOException {
        File dir = new File("tmp/junit/cache");
        dir.mkdirs();
        File toFind = new File(dir,VersionNumber.insertHash("test_1.0.13.jar",randomHash()));

        File file1 = new File(dir,VersionNumber.insertHash("test_1.0.1.jar",randomHash()));
        file1.createNewFile();
        File file2 = new File(dir,VersionNumber.insertHash("test_1.0.10.jar",randomHash()));
        file2.createNewFile();
        File file3 = new File(dir,VersionNumber.insertHash("test_1.0.5.jar",randomHash()));
        file3.createNewFile();
        File file4 = new File(dir,VersionNumber.insertHash("test_1.1.1.jar",randomHash()));
        file4.createNewFile();
        File file5 = new File(dir,VersionNumber.insertHash("tesd_1.0.12.jar",randomHash()));
        file5.createNewFile();

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy