コード例 #1
0
  @BeforeClass
  public static void startUp() throws InterruptedException, IOException {
    if (applicationContext == null) {
      if (System.getProperty(SHUTDOWN_AFTER_RUN) != null) {
        shutdownAfterRun = Boolean.getBoolean(SHUTDOWN_AFTER_RUN);
      }

      SpringApplication application =
          new SpringApplicationBuilder(
                  AdminApplication.class, AdminConfiguration.class, TestConfig.class)
              .build();
      applicationContext =
          application.run(
              String.format("--server.port=%s", adminPort),
              "--security.basic.enabled=false",
              "--spring.main.show_banner=false",
              "--spring.cloud.config.enabled=false");
    }
    JLineShellComponent shell =
        new Bootstrap(new String[] {"--port", String.valueOf(adminPort)}).getJLineShellComponent();
    if (!shell.isRunning()) {
      shell.start();
    }
    dataFlowShell = new DataFlowShell(shell);
  }
コード例 #2
0
 @Override
 public void run(String... args) throws Exception {
   shell.start();
   shell.promptLoop();
   shell.waitForComplete();
   SpringApplication.exit(ctx);
 }
コード例 #3
0
  @Test
  public void testSimple() {
    Bootstrap bootstrap = new Bootstrap();

    JLineShellComponent shell = bootstrap.getJLineShellComponent();

    CommandResult cr = shell.executeCommand("hw simple --message hello");
    assertEquals(true, cr.isSuccess());
    assertEquals("Message = [hello] Location = [null]", cr.getResult());
  }