Package org.jetbrains.osgi.jps.util

Examples of org.jetbrains.osgi.jps.util.OrderedProperties


   * @return the additional properties as a Map for convenience.
   */
  @NotNull
  public Map<String, String> getAdditionalPropertiesAsMap() {
    try {
      OrderedProperties p = new OrderedProperties();
      p.load(new StringReader(getAdditionalProperties()));
      return p.toMap();
    }
    catch (IOException e) {
      LOG.warn(e);
      return Collections.emptyMap();
    }
View Full Code Here


* Test of {@link OrderedProperties}
*/
public class OrderedPropertiesTest {
  @Test
  public void testRead() throws IOException {
    OrderedProperties props = new OrderedProperties();
    props.load(new StringReader("Foo: Bar,\\\nnaf\nBar: naf\nBaz=naf\n"));

    Enumeration<Object> keys = props.keys();
    assertThat((String)keys.nextElement(), equalTo("Foo"));
    assertThat((String)keys.nextElement(), equalTo("Bar"));
    assertThat((String)keys.nextElement(), equalTo("Baz"));

    Enumeration<?> propertyNames = props.propertyNames();
    assertThat((String)propertyNames.nextElement(), equalTo("Foo"));
    assertThat((String)propertyNames.nextElement(), equalTo("Bar"));
    assertThat((String)propertyNames.nextElement(), equalTo("Baz"));

    Iterator<String> iterator = props.stringPropertyNames().iterator();
    assertThat(iterator.next(), equalTo("Foo"));
    assertThat(iterator.next(), equalTo("Bar"));
    assertThat(iterator.next(), equalTo("Baz"));
  }
View Full Code Here

    assertThat(iterator.next(), equalTo("Baz"));
  }

  @Test
  public void testPopulate() throws Exception {
    OrderedProperties props = new OrderedProperties();
    props.setProperty("key1", "value1");
    props.setProperty("key3", "value3");
    props.setProperty("key2", "value2");

    Iterator<String> iterator = props.stringPropertyNames().iterator();
    assertThat(iterator.next(), equalTo("key1"));
    assertThat(iterator.next(), equalTo("key3"));
    assertThat(iterator.next(), equalTo("key2"));
  }
View Full Code Here

TOP

Related Classes of org.jetbrains.osgi.jps.util.OrderedProperties

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.