コード例 #1
0
  /** Test setting and getting a configuration item */
  @Test
  public void itemTest() {
    IConfigurationService cs = getConfigurationService();

    String value = "xyz";

    TestItem item1 = new TestItem();
    item1.setValue(value);

    cs.set(item1);

    TestItem item2 = cs.get(TestItem.class);

    Assert.assertEquals(item1, item2);

    // remove key
    item1 = new TestItem();
    item1.setValue(null);

    cs.set(item1);

    item2 = cs.get(TestItem.class);

    Assert.assertEquals(item1, item2);
  }
コード例 #2
0
  /**
   * Simple test for {@link IConfigurationService#set(String, String)} and {@link
   * IConfigurationService#get(String)}
   */
  @Test
  public void simpleTest() {
    IConfigurationService cs = getConfigurationService();

    String key = "test/x.y.z";
    String value = "testval";
    cs.set(key, value);

    Assert.assertEquals(value, cs.get(key));

    cs.set(key, null);

    Assert.assertEquals(null, cs.get(key));
  }