1 /* 2 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8049021 27 * @summary Test different constructors for CommandAPDU and check CLA,INS,NC,NE, 28 * P1,and P2 29 * @compile --add-modules=java.smartcardio CommandAPDUTest.java 30 * @run testng/othervm --add-modules=java.smartcardio CommandAPDUTest 31 */ 32 import java.nio.ByteBuffer; 33 import javax.smartcardio.CommandAPDU; 34 import static org.testng.Assert.*; 35 import org.testng.annotations.BeforeClass; 36 import org.testng.annotations.DataProvider; 37 import org.testng.annotations.Test; 38 39 public class CommandAPDUTest { 40 41 static final byte[] C1 = {(byte) 0x00, (byte) 0xA4, (byte) 0x04, 42 (byte) 0x00, (byte) 0x07, (byte) 0xA0, (byte) 0x00, (byte) 0x00, 43 (byte) 0x00, (byte) 0x62, (byte) 0x81, (byte) 0x01, (byte) 0x00}; 44 static int cla, ins, nc, ne, p1, p2; 45 static byte[] apdu, data; 46 static CommandAPDU cm1, cm2, cm3, cm4, cm5, cm6, cm7, cm8, cm9; 47 48 @BeforeClass 49 public static void setUpClass() throws Exception { 50 //expected values of apdu, data, headers, nc, ne | 1 /* 2 * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8049021 27 * @summary Test different constructors for CommandAPDU and check CLA,INS,NC,NE, 28 * P1,and P2 29 * @run testng CommandAPDUTest 30 */ 31 import java.nio.ByteBuffer; 32 import javax.smartcardio.CommandAPDU; 33 import static org.testng.Assert.*; 34 import org.testng.annotations.BeforeClass; 35 import org.testng.annotations.DataProvider; 36 import org.testng.annotations.Test; 37 38 public class CommandAPDUTest { 39 40 static final byte[] C1 = {(byte) 0x00, (byte) 0xA4, (byte) 0x04, 41 (byte) 0x00, (byte) 0x07, (byte) 0xA0, (byte) 0x00, (byte) 0x00, 42 (byte) 0x00, (byte) 0x62, (byte) 0x81, (byte) 0x01, (byte) 0x00}; 43 static int cla, ins, nc, ne, p1, p2; 44 static byte[] apdu, data; 45 static CommandAPDU cm1, cm2, cm3, cm4, cm5, cm6, cm7, cm8, cm9; 46 47 @BeforeClass 48 public static void setUpClass() throws Exception { 49 //expected values of apdu, data, headers, nc, ne |