diff --git a/src/test/java/javax/usb/tck/InterruptShortPacketIOTests.java b/src/test/java/javax/usb/tck/InterruptShortPacketIOTests.java new file mode 100755 index 0000000..405f872 --- /dev/null +++ b/src/test/java/javax/usb/tck/InterruptShortPacketIOTests.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) 2004, International Business Machines Corporation. + * All Rights Reserved. + * + * This software is provided and licensed under the terms and conditions + * of the Common Public License: + * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html + */ + +package javax.usb.tck; + +import java.util.*; + +import javax.usb.*; + +import org.junit.runner.RunWith; + +import de.ailis.usb4java.TCKRunner; + + + +import junit.framework.*; + +/** + * Bulk IO Short Packet Test -- Synchronous and asynchronous byte[], IRP, and IRP List submissions + *

+ * The goal of the Bulk, Interrupt, and Isochronous IO test is to + * verify that IN and OUT pipes can be opened and closed, and verify + * that bulk, interrupt, and isochronous transfer operations work successfully, proper + * events are generated, and proper exceptions are thrown in the operation. + * + * This test verifies that UsbShortPacketException is received when expected. + * + * @author Leslie Blair + */ + + +@SuppressWarnings("all") +@RunWith(TCKRunner.class) +public class InterruptShortPacketIOTests extends TestCase +{ + public void setUp() throws Exception + { + endpointType = UsbConst.ENDPOINT_TYPE_INTERRUPT; + usbDevice = FindProgrammableDevice.getInstance().getProgrammableDevice(); + Assert.assertNotNull("Device required for test not found",usbDevice); + IOMethods.createListofAllAvailablePipesOfSpecifiedEndpointType(usbDevice, endpointType, usbPipeListGlobal); + assertFalse("No pipes of specified endpoint were found.", (0 == usbPipeListGlobal.size())); + super.setUp(); + } + public void tearDown() throws Exception + { + IOMethods.releaseListOfPipes(usbPipeListGlobal); + super.tearDown(); + } + + + public void testShortPacketException() + { + //repeat the test for the number of iteration specified + for ( int iterations=0; (iterations < IOShortPacketTest.totalIterations); iterations++ ) + { + //first, do all transfers sync and then do async + for ( int syncOrAsync=0; syncOrAsync