Skip to content

Commit

Permalink
Removed old QA code (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergkh authored Aug 21, 2024
1 parent 2b1ecc6 commit e2bdd1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
5 changes: 2 additions & 3 deletions tool/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ abstract class CommandLineInterface {

final static protected OptionSpec<String> OPT_APP_ID = parser.accepts("app-id", "Application identifier")
.availableIf(OPT_STORE_DATA, OPT_SECURE_APDU, OPT_UNINSTALL, OPT_INSTALL, OPT_UPLOAD, OPT_CLEANUP, OPT_LIST_APPLETS, OPT_FLUSH_APPLETS, OPT_DELETE)
.withRequiredArg().describedAs("appId");
final static protected OptionSpec<Integer> OPT_QA = parser.accepts("qa", "Run a QA support session").withOptionalArg().ofType(Integer.class).describedAs("QA number");
.withRequiredArg().describedAs("appId");

final static protected OptionSpec<Integer> OPT_TIMEOUT = parser.accepts("timeout", "Timeout for services").withRequiredArg().ofType(Integer.class).describedAs("minutes");
final static protected OptionSpec<Void> OPT_IGNORE_IMPLICIT_BATCHING = parser.accepts("ignore-implicit-batching", "Require explicit batching if not a Fidesmo device");
Expand Down Expand Up @@ -152,7 +151,7 @@ protected static OptionSet parseArguments(String[] argv) throws IOException {

public static boolean requiresCard() {
OptionSpec<?>[] commands = new OptionSpec<?>[]{
OPT_INSTALL, OPT_UNINSTALL, OPT_STORE_DATA, OPT_SECURE_APDU, OPT_RUN, OPT_CARD_APPS, OPT_CARD_INFO, OPT_QA
OPT_INSTALL, OPT_UNINSTALL, OPT_STORE_DATA, OPT_SECURE_APDU, OPT_RUN, OPT_CARD_APPS, OPT_CARD_INFO
};
return Arrays.stream(commands).anyMatch(args::has);
}
Expand Down
24 changes: 0 additions & 24 deletions tool/src/main/java/com/fidesmo/fdsm/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
import java.util.stream.StreamSupport;

public class Main extends CommandLineInterface {
static final String FDSM_SP = "8e5cdaae";

public static void main(String[] argv) {
System.setProperty("org.slf4j.simpleLogger.showThreadName", "true");
System.setProperty("org.slf4j.simpleLogger.levelInBrackets", "true");
Expand Down Expand Up @@ -292,28 +290,6 @@ public static void main(String[] argv) {
APDUBIBO bibo = new APDUBIBO(CardBIBO.wrap(card));
Optional<FidesmoCard> fidesmoMetadata = (args.has(OPT_OFFLINE) || args.has(OPT_IGNORE_IMPLICIT_BATCHING)) ? FidesmoCard.detectOffline(bibo) : FidesmoCard.detectOnline(bibo, client);

// Allows to run with any card
if (args.has(OPT_QA)) {
String number = Integer.toString(ThreadLocalRandom.current().nextInt(900000) + 100000).substring(0, 6);
if (args.valueOf(OPT_QA) != null) {
number = args.valueOf(OPT_QA).toString();
} else {
System.out.printf("Your QA number is %s-%s%n", number.substring(0, 3), number.substring(3, 6));
}
FormHandler formHandler = getCommandLineFormHandler();

ServiceDeliverySession cardSession = ServiceDeliverySession.getInstance(() -> bibo, fidesmoMetadata.orElseGet(FidesmoCard::dummy), client, FDSM_SP, number, formHandler);

if (args.has(OPT_TIMEOUT))
cardSession.setTimeoutMinutes(args.valueOf(OPT_TIMEOUT));
CancellationWaitingFuture<ServiceDeliverySession.DeliveryResult> deliveryTask = new CancellationWaitingFuture<>(cardSession);

if (!ServiceDeliverySession.deliverService(deliveryTask).isSuccess()) {
fail("Failed to run service");
} else {
success();
}
}
System.out.println("Using card in " + terminal.getName());

// Can be used always
Expand Down

0 comments on commit e2bdd1a

Please sign in to comment.