Package org.jnode.test.support

Examples of org.jnode.test.support.MockInitializer


public class MockIDEDeviceFactory extends AbstractMockDeviceFactory implements
    IDEDeviceFactory {
    public IDEDevice createIDEDevice(IDEBus bus, boolean primary,
                                     boolean master, String name, IDEDriveDescriptor descriptor,
                                     DefaultIDEControllerDriver controller) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockIDEDevice) {
                // Boolean diskChanged = Boolean.FALSE;
                // mockFDC.expects(testCase.atLeastOnce()).method("diskChanged").withAnyArguments().
                // will(new ReturnStub(diskChanged));
            }
View Full Code Here


        return MockUtils.createMockObject(IDEDevice.class,
            initializer);
    }

    public IDEBus createIDEBus(Device parent, boolean primary) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockIDEBus) {
                mockIDEBus.expects(testCase.atLeastOnce()).method(
                    "executeAndWait").withAnyArguments();
            }
        };
View Full Code Here

        return (IDEBus) MockUtils.createMockObject(IDEBus.class, initializer,
            argCls, args);
    }

    public IDEIO createIDEIO(Device parent, boolean primary) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockIDEIO) {
                Integer irq = new Integer(13);
                mockIDEIO.expects(testCase.atLeastOnce()).method("getIrq")
                    .withNoArguments().will(new ReturnStub(irq));
View Full Code Here

        return MockUtils.createMockObject(IDEIO.class, initializer);
    }

    private IBMPartitionTableEntry createEntry(int partNum,
                                               final boolean extended, final long startLba, final long nbSectors) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockEntry) {
                Boolean valid = Boolean.TRUE;
                mockEntry.expects(testCase.atLeastOnce()).method("isValid")
                    .withNoArguments().will(new ReturnStub(valid));
View Full Code Here

            return entry;
        }
    }

    public IBMPartitionTable createIBMPartitionTable(byte[] bs, Device dev) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockTable) {
                final BlockDeviceAPIContext context = (BlockDeviceAPIContext) ContextManager
                    .getInstance().getContext();
                final Partition[] parts = context.getPartitions();
                log.debug("with " + parts.length + " partitions");
View Full Code Here

    ////////////////////////////////////////////////////
    //   FloppyDeviceFactory interface implementation //
    ////////////////////////////////////////////////////

    public FloppyDevice createDevice(FloppyControllerBus bus, int drive, FloppyDriveParameters dp) {
        @SuppressWarnings("unused")
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockFloppyDevice) {
//                mockFloppyDevice.expects(testCase.atLeastOnce()).method("setDriver").withAnyArguments().will(
//                        new SetDriverStub());

                //mockFloppyDevice.expects(testCase.atLeastOnce()).method("setDriver").withAnyArguments();
View Full Code Here

//        return (FloppyDevice) MockUtils.createMockObject(FloppyDevice.class, initializer, argCls, args);
        return new FloppyDevice(bus, drive, dp);
    }

    public FDC createFDC(Device device) throws DriverException, ResourceNotFreeException {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockFDC) {
                Integer nbStubFloppy = new Integer(1);
                mockFDC.expects(testCase.once()).method("getDriveCount").withNoArguments().
                    will(new ReturnStub(nbStubFloppy));
View Full Code Here

    public FloppyDriveParametersCommand createFloppyDriveParametersCommand(int drive, FloppyDriveParameters dp,
                                                                           FloppyParameters fp) {
        Class<?>[] argCls = new Class[]{int.class, FloppyDriveParameters.class, FloppyParameters.class};
        Object[] args = new Object[]{new Integer(drive), dp, fp};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));
            }
        };
View Full Code Here

    }

    public FloppySeekCommand createFloppySeekCommand(int drive, int cylinder) {
        Class<?>[] argCls = new Class[]{int.class, int.class};
        Object[] args = new Object[]{new Integer(drive), new Integer(cylinder)};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockFloppyDevice) {
//                FloppyDriver driver = new FloppyDriver();       
//                mockFloppyDevice.expects(testCase.atLeastOnce()).method("getDriver").withNoArguments().
//                        will(new ReturnStub(driver));
            }
View Full Code Here

                                                                 byte[] dest, int destOffset) {
        Class<?>[] argCls = new Class[]{int.class, Geometry.class, CHS.class, int.class, boolean.class, int.class,
            byte[].class, int.class};
        Object[] args = new Object[]{new Integer(drive), geometry, chs, new Integer(currentSectorSize),
            Boolean.valueOf(b), new Integer(gap1Size), dest, new Integer(destOffset)};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));
            }
        };
View Full Code Here

TOP

Related Classes of org.jnode.test.support.MockInitializer

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.