diff --git a/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java b/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java index b86f332..d97183e 100644 --- a/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java +++ b/src/main/java/com/fidesmo/fdsm/CommandLineInterface.java @@ -61,6 +61,7 @@ abstract class CommandLineInterface { final static String OPT_VERSION = "version"; final static String OPT_QA = "qa"; + final static String OPT_FAKE = "fake"; final static String OPT_TIMEOUT = "timeout"; protected static String appId = null; @@ -145,6 +146,7 @@ protected static OptionSet parseArguments(String[] argv) throws IOException { parser.accepts(OPT_VERBOSE, "Be verbose"); parser.accepts(OPT_QA, "Run a QA support session").withOptionalArg().ofType(Integer.class).describedAs("QA number"); + parser.accepts(OPT_FAKE, "Fake Fidesmo metadata"); parser.accepts(OPT_TIMEOUT, "Timeout for services").withRequiredArg().ofType(Integer.class).describedAs("minutes"); parser.acceptsAll(Arrays.asList("V", OPT_VERSION), "Show version and check for updates"); diff --git a/src/main/java/com/fidesmo/fdsm/Main.java b/src/main/java/com/fidesmo/fdsm/Main.java index 516eab4..a6841eb 100644 --- a/src/main/java/com/fidesmo/fdsm/Main.java +++ b/src/main/java/com/fidesmo/fdsm/Main.java @@ -224,6 +224,12 @@ public static void main(String[] argv) { terminal = LoggingCardTerminal.getInstance(terminal); } Card card = terminal.connect("*"); + + if (args.has(OPT_FAKE) || args.has(OPT_QA)) { + fidesmoCard = FidesmoCard.fakeInstance(card.getBasicChannel()); + } else { + fidesmoCard = FidesmoCard.getInstance(card.getBasicChannel()); + } // Allows to run with any card if (args.has(OPT_QA)) { String number = Integer.toString(new Random().nextInt(900000) + 100000).substring(0, 6); @@ -232,8 +238,6 @@ public static void main(String[] argv) { } else { System.out.printf("Your QA number is %s-%s%n", number.substring(0, 3), number.substring(3, 6)); } - fidesmoCard = FidesmoCard.fakeInstance(card.getBasicChannel()); - FormHandler formHandler = getCommandLineFormHandler(); ServiceDeliverySession cardSession = ServiceDeliverySession.getInstance(fidesmoCard, client, formHandler); @@ -245,7 +249,6 @@ public static void main(String[] argv) { success(); } } - fidesmoCard = FidesmoCard.getInstance(card.getBasicChannel()); System.out.println("Using card in " + terminal.getName()); // Can be used always