Package org.jnode.apps.vmware.disk

Examples of org.jnode.apps.vmware.disk.VMWareDisk


    /**
     * Do read test.
     */
    @Test
    public void read() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);

        ByteBuffer data = IOUtils.allocate(IOHandler.SECTOR_SIZE * 100);
        disk.read(0, data);

        Assert.assertEquals(toString() + ": buffer should be filled", 0, data.remaining());
    }
View Full Code Here


     * Do a write test.
     */
    @Test
    @Ignore
    public void write() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);

        ByteBuffer data = IOUtils.allocate(IOHandler.SECTOR_SIZE * 100);
        disk.write(0, data);

        Assert.assertEquals(toString() + ": buffer should be fully copied", 0, data.remaining());
    }
View Full Code Here

    @Ignore
    public void writeAndRead() throws Exception {
        Utils.DO_CLEAR = false;

        LOG.info("BEGIN writeAndRead");
        VMWareDisk disk = new VMWareDisk(diskFile);

        // write
        LOG.info("writeAndRead: writing...");
        int size = IOHandler.SECTOR_SIZE * 100;
        ByteBuffer expectedData = IOUtils.allocate(size);
        for (int i = 0; i < (size / 4); i++) {
            expectedData.putInt(i);
        }
        expectedData.rewind();
        disk.write(0, expectedData);
        disk.flush();

        // read
        LOG.info("writeAndRead: reading...");
        VMWareDisk disk2 = new VMWareDisk(diskFile);
        Assert.assertEquals("disk has different size", disk.getLength(), disk2.getLength());
        Assert.assertEquals("disk has different descriptor", disk.getDescriptor(), disk2
                .getDescriptor());

        expectedData.rewind();
        ByteBuffer actualData = IOUtils.allocate(size);
        disk2.read(0, actualData);
        long nbErrors = 0;
        long nbInts = (size / 4);
        for (int i = 0; i < nbInts; i++) {
            int actual = actualData.getInt(i);
            int expected = expectedData.getInt();
View Full Code Here

    /**
     * Do a read test on VMware disk headers.
     */
    @Test
    public void read() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);
        disk.flush();
    }
View Full Code Here

    /**
     * Do a write test on VMware disk headers.
     */
    @Test
    public void write() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);
        disk.flush();
    }
View Full Code Here

    @Test
    public void writeAndRead() throws Exception {
        Utils.DO_CLEAR = false;

        LOG.info("BEGIN writeAndRead");
        VMWareDisk disk = new VMWareDisk(diskFile);

        // write
        LOG.info("writeAndRead: writing...");
        disk.flush();

        // read
        LOG.info("writeAndRead: reading...");
        VMWareDisk disk2 = new VMWareDisk(diskFile);
        Assert.assertEquals("disk has different size", disk.getLength(), disk2.getLength());
        Assert.assertEquals("disk has different descriptor", disk.getDescriptor(), disk2
                .getDescriptor());
        disk2.flush();
        LOG.info("END   writeAndRead");
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    @Ignore
    public void read() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);

        ByteBuffer data = IOUtils.allocate(IOHandler.SECTOR_SIZE * 100);
        disk.read(0, data);

        Assert.assertEquals(toString() + ": buffer should be filled", 0, data.remaining());
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    @Ignore
    public void write() throws Exception {
        VMWareDisk disk = new VMWareDisk(diskFile);

        ByteBuffer data = IOUtils.allocate(IOHandler.SECTOR_SIZE * 100);
        disk.write(0, data);

        Assert.assertEquals(toString() + ": buffer should be fully copied", 0, data.remaining());
    }
View Full Code Here

    @Test
    public void writeAndRead() throws Exception {
        Utils.DO_CLEAR = false;

        LOG.info("BEGIN writeAndRead");
        VMWareDisk disk = new VMWareDisk(diskFile);

        // write
        LOG.info("writeAndRead: writing...");
        int size = IOHandler.SECTOR_SIZE * 100;
        ByteBuffer expectedData = IOUtils.allocate(size);
        for (int i = 0; i < (size / 4); i++) {
            expectedData.putInt(i);
        }
        expectedData.rewind();
        disk.write(0, expectedData);
        disk.flush();

        // read
        LOG.info("writeAndRead: reading...");
        VMWareDisk disk2 = new VMWareDisk(diskFile);
        Assert.assertEquals("disk has different size", disk.getLength(), disk2.getLength());
        Assert.assertEquals("disk has different descriptor", disk.getDescriptor(), disk2
                .getDescriptor());

        expectedData.rewind();
        ByteBuffer actualData = IOUtils.allocate(size);
        disk2.read(0, actualData);
        for (int i = 0; i < (size / 4); i++) {
            int actual = actualData.getInt(i);
            int expected = expectedData.getInt();
            Assert.assertEquals("bad data at index " + (i * 4), expected, actual);
        }
View Full Code Here

        File tmpFile = File.createTempFile("disk", "");
        File directory = tmpFile.getParentFile();
        String name = tmpFile.getName();

        File mainFile = DiskFactory.createSparseDisk(directory, name, DEFAULT_FILE_SIZE);
        VMWareDisk vmwareDisk = new VMWareDisk(mainFile);

        AbstractIDEDevice dev = new VMWareIDEDevice(name, true, true, vmwareDisk);
        return dev;
    }
View Full Code Here

TOP

Related Classes of org.jnode.apps.vmware.disk.VMWareDisk

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.