Ejemplo n.º 1
0
  protected void setUp() throws Exception {
    IntegerSetting type = new IntegerSetting();
    type.setRequired(true);

    SettingImpl s1 = new SettingImpl();
    s1.setType(type);
    s1.setName("integerSetting");
    s1.setValue("4");

    SettingImpl s2 = new SettingImpl();
    s2.setName("stringSetting");
    s2.setValue("bongo");

    m_setting = new SettingSet();
    m_setting.setName("testGroup");
    m_setting.addSetting(s1);
    m_setting.addSetting(s2);

    m_result = new Hashtable();
    m_result.put("result-code", new Integer(1));
  }
Ejemplo n.º 2
0
  public void testGet() {
    Hashtable result = new Hashtable();
    result.put("result-code", new Integer(1));
    result.put("integerSetting", new Integer(17));
    result.put("stringSetting", "kuku");

    Hashtable params = new Hashtable();
    params.put("object-class", "testGroup");
    params.put("integerSetting", new Integer(4));
    params.put("stringSetting", "bongo");

    IMocksControl control = EasyMock.createControl();
    Provisioning prov = control.createMock(Provisioning.class);
    prov.get(params);
    control.andReturn(result);
    control.replay();

    XmlRpcSettings xmlRpc = new XmlRpcSettings(prov);
    assertTrue(xmlRpc.get(m_setting));
    assertEquals("kuku", m_setting.getSetting("stringSetting").getValue());
    assertEquals("17", m_setting.getSetting("integerSetting").getValue());

    control.verify();
  }