private void startServer(String[] originalArgs) { InjectorUtil.create(new BootstrapModule()).injectMembers(this); if (isNull(pluginClassNames) || 0 == pluginClassNames.length) { LOGGER.debug("No plugins specified - attempting to load defaults"); // check for list of comma-separated plugin classes to load if none specified pluginClassNames = ofNullable(MetaUtil.readMetaProperties().getProperty("plugins")) .map(plugin -> plugin.split(",")) .orElse(new String[0]); } final Map<String, String> splitArgs = Arrays.stream(ofNullable(pluginArgs).orElse(new String[0])) .map(arg -> arg.split("=")) .collect(Collectors.toMap(splitArg -> splitArg[0], splitArg -> splitArg[1])); imposterConfig.setConfigDirs(configDirs); imposterConfig.setPluginClassNames(pluginClassNames); imposterConfig.setListenPort(listenPort); imposterConfig.setHost(host); imposterConfig.setServerUrl(serverUrl); imposterConfig.setTlsEnabled(tlsEnabled); imposterConfig.setKeystorePath(keystorePath); imposterConfig.setKeystorePassword(keystorePassword); imposterConfig.setPluginArgs(splitArgs); final List<String> args = Lists.newArrayList(originalArgs); args.add(0, "run"); args.add(1, ImposterVerticle.class.getCanonicalName()); super.dispatch(args.toArray(new String[args.size()])); }
@Before public void setUp(TestContext testContext) throws Exception { final Async async = testContext.async(); listenPort = findFreePort(); // simulate ImposterLauncher injector bootstrap final ImposterConfig imposterConfig = InjectorUtil.create(new BootstrapModule()).getInstance(ImposterConfig.class); configure(imposterConfig); rule.vertx().deployVerticle(ImposterVerticle.class.getCanonicalName(), completion -> { if (completion.succeeded()) { async.complete(); } else { testContext.fail(completion.cause()); } }); }