VirtualAssetCreateCommand extends Command { @Override public void execute() throws CommandException { consoleWriter.newLine().a("Create a virtual asset: ").fg(Ansi.Color.CYAN).a(pathParam). reset().a(" in repository: ").fg(Ansi.Color.CYAN).a(repositoryParam).println(2); Repository repository = commandHelper.findRepositoryByName(repositoryParam); VirtualAsset virtualAsset = new VirtualAsset(); virtualAsset.setPath(pathParam); virtualAsset.setRepositoryId(repository.getId()); virtualAsset.setDeleted(Boolean.FALSE); try { consoleWriter.a(" - Create virtual asset: ").fg(Ansi.Color.CYAN).a(pathParam).println(); virtualAsset = virtualAssetClient.createOrUpdate(virtualAsset); consoleWriter.a(" --> asset id: ").fg(Ansi.Color.MAGENTA).a(virtualAsset.getId()).println(); consoleWriter.fg(Ansi.Color.GREEN).newLine().a("Finished").println(2); } catch (HttpClientErrorException hcee) { HttpClientErrorJson toHttpClientErrorJson = httpClientErrorExceptionHelper.toHttpClientErrorJson(hcee); consoleWriter.println().fg(Ansi.Color.RED).a(toHttpClientErrorJson.getMessage()).println(2); } }  @Override void execute();  }
@Test public void execute() throws Exception { Repository repository = createTestRepoUsingRepoService(); getL10nJCommander().run("virtual-asset-create", "-r", repository.getName(), "-p", "asset1"); getL10nJCommander().run("virtual-asset-create", "-r", repository.getName(), "-p", "asset2"); }