2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2016-02-11 21:20:16 +00:00
|
|
|
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-25 22:58:33 +00:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
2016-09-21 14:09:41 +00:00
|
|
|
/*
|
2007-12-01 00:00:00 +00:00
|
|
|
* @test
|
2016-10-27 18:50:23 +00:00
|
|
|
* @bug 6327047 8168851
|
2007-12-01 00:00:00 +00:00
|
|
|
* @summary verify that TerminalFactory.getDefault() works
|
|
|
|
* @author Andreas Sterbenz
|
2016-09-21 14:09:41 +00:00
|
|
|
* @modules java.smartcardio/javax.smartcardio
|
2007-12-01 00:00:00 +00:00
|
|
|
* @run main/manual TestDefault
|
2016-10-27 18:50:23 +00:00
|
|
|
* @run main/othervm/manual/java.security.policy==test.policy TestDefault
|
2007-12-01 00:00:00 +00:00
|
|
|
*/
|
|
|
|
|
2014-03-18 22:04:59 +00:00
|
|
|
// This test requires special hardware.
|
|
|
|
|
2014-07-18 13:04:10 +00:00
|
|
|
import java.util.List;
|
|
|
|
import javax.smartcardio.CardTerminal;
|
|
|
|
import javax.smartcardio.TerminalFactory;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
public class TestDefault {
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
TerminalFactory factory = TerminalFactory.getDefault();
|
|
|
|
System.out.println("Type: " + factory.getType());
|
|
|
|
List<CardTerminal> terminals = factory.terminals().list();
|
|
|
|
if (terminals.isEmpty()) {
|
2016-02-11 21:20:16 +00:00
|
|
|
System.out.println("Skipping the test: " +
|
|
|
|
"no card terminals available");
|
|
|
|
return;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2016-02-11 21:20:16 +00:00
|
|
|
System.out.println("Terminals: " + terminals);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
System.out.println("OK.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|