Package org.springframework.xd.shell

Examples of org.springframework.xd.shell.Configuration


      assertThat(simulatedInputStream.hasUnreadData(), is(true));
      CommandResult commandResult = shell.executeCommand("admin config server --uri http://localhost:" + adminPort + " --username admin --password");
      assertThat(simulatedInputStream.isReadPerformed(), is(true));
      assertThat(simulatedInputStream.hasUnreadData(), is(false));
      assertThat(commandResult.isSuccess(), is(true));
      Configuration configuration = bootstrap.getApplicationContext().getBean(Configuration.class);
      assertThat(configuration.getTarget().getTargetException(), instanceOf(HttpClientErrorException.class));
      assertThat(((HttpClientErrorException) configuration.getTarget().getTargetException()).getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));
      commandResult = shell.executeCommand("module list");
      assertThat(commandResult.isSuccess(), is(false));
    }
    finally {
      // restore the system input stream
View Full Code Here


      assertThat(simulatedInputStream.hasUnreadData(), is(true));
      CommandResult commandResult = shell.executeCommand("admin config server --uri http://localhost:" + adminPort + " --username admin");
      assertThat(simulatedInputStream.isReadPerformed(), is(false)); // without the --password flag, the shell doesn't prompt and doesn't read from input
      assertThat(simulatedInputStream.hasUnreadData(), is(true));
      assertThat(commandResult.isSuccess(), is(true));
      Configuration configuration = bootstrap.getApplicationContext().getBean(Configuration.class);
      assertThat(configuration.getTarget().getTargetException(), instanceOf(HttpClientErrorException.class));
      assertThat(((HttpClientErrorException) configuration.getTarget().getTargetException()).getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));
      commandResult = shell.executeCommand("module list");
      assertThat(commandResult.isSuccess(), is(false));
    }
    finally {
      // restore the system input stream
View Full Code Here

  public void testShellWithWrongCredentials() throws Exception {
    Bootstrap bootstrap = new Bootstrap();
    JLineShellComponent shell = bootstrap.getJLineShellComponent();
    CommandResult commandResult = shell.executeCommand("admin config server --uri http://localhost:" + adminPort + " --username admin --password whosThere2");
    assertThat(commandResult.isSuccess(), is(true));
    Configuration configuration = bootstrap.getApplicationContext().getBean(Configuration.class);
    assertThat(configuration.getTarget().getTargetException(), instanceOf(HttpClientErrorException.class));
    assertThat(((HttpClientErrorException) configuration.getTarget().getTargetException()).getStatusCode(), equalTo(HttpStatus.UNAUTHORIZED));
    commandResult = shell.executeCommand("module list");
    assertThat(commandResult.isSuccess(), is(false));
  }
View Full Code Here

  public void testShellWithMissingUsername() throws Exception {
    Bootstrap bootstrap = new Bootstrap();
    JLineShellComponent shell = bootstrap.getJLineShellComponent();
    CommandResult commandResult = shell.executeCommand("admin config server --uri http://localhost:" + adminPort + " --password whosThere");
    assertThat(commandResult.isSuccess(), is(true));
    Configuration configuration = bootstrap.getApplicationContext().getBean(Configuration.class);
    assertThat(configuration.getTarget().getTargetException(), instanceOf(IllegalArgumentException.class));
    assertThat(configuration.getTarget().getTargetException().getMessage(), equalTo("A password may be specified only together with a user name"));
    commandResult = shell.executeCommand("module list");
    assertThat(commandResult.isSuccess(), is(false));
  }
View Full Code Here

TOP

Related Classes of org.springframework.xd.shell.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.