Package com.openshift.client.fakes

Examples of com.openshift.client.fakes.UserConfigurationFake


    assertFalse(version.contains("pom"));
  }

  @Test
  public void canReadUsername() throws OpenShiftException, IOException {
    UserConfigurationFake userConfiguration = new UserConfigurationFake() {

      protected void initFile(Writer writer) throws IOException {
        writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
      }

    };
    assertEquals(USERNAME, userConfiguration.getRhlogin());
  }
View Full Code Here


  }

  @Test
  public void canStoreUsername() throws OpenShiftException, IOException {
    // pre-condition
    UserConfigurationFake userConfiguration = new UserConfigurationFake() {

      protected void initFile(Writer writer) throws IOException {
        writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
      }

    };

    // operation
    userConfiguration.setRhlogin(ANOTHER_USERNAME);
    userConfiguration.save();

    // verification
    File userConfigurationFile = userConfiguration.getFile();
    assertNotNull(userConfigurationFile);
    String fileContent = StreamUtils.readToString(new FileReader(userConfigurationFile));
    Pattern pattern = Pattern.compile(USERNAME_REGEX);
    Matcher matcher = pattern.matcher(fileContent);
    assertTrue(matcher.find());
View Full Code Here

  }

  @Test
  public void canStoreAndReadUsername() throws OpenShiftException, IOException {
    // pre-condition
    UserConfigurationFake userConfiguration = new UserConfigurationFake() {

      protected void initFile(Writer writer) throws IOException {
        writer.append(KEY_RHLOGIN).append('=').append(USERNAME).append('\n');
      }
    };
    assertEquals(USERNAME, userConfiguration.getRhlogin());

    // operation
    userConfiguration.setRhlogin(ANOTHER_USERNAME);
    userConfiguration.save();
    final File userConfigurationFile = userConfiguration.getFile();
    assertNotNull(userConfigurationFile);
    UserConfigurationFake userConfiguration2 = new UserConfigurationFake() {

      protected File createFile() {
        return userConfigurationFile;
      }

      protected void initFile(File file) {
      }
    };

    // verification
    assertEquals(ANOTHER_USERNAME, userConfiguration2.getRhlogin());
  }
View Full Code Here

      protected void init(Properties properties) {
        properties.put(KEY_RHLOGIN, USERNAME);
      }

    };
    UserConfigurationFake userConfiguration = new UserConfigurationFake(systemConfiguration);
    assertEquals(USERNAME, userConfiguration.getRhlogin());
  }
View Full Code Here

TOP

Related Classes of com.openshift.client.fakes.UserConfigurationFake

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.