private void assertCodecConfigurationForModel(CodecGroupType codecGroup, String phoneModelId)
      throws Exception {

    // Initialize the phone.
    m_phone = new PolycomPhone();
    m_phone.setModel(phoneModelBuilder(phoneModelId, getClass()));
    PhoneTestDriver.supplyTestData(m_phone, new LinkedList<User>());

    // Each model belongs to exactly one codec group.
    Collection<Setting> codecPref = m_phone.getSettings().getSetting("voice/codecPref").getValues();
    assertTrue(
        String.format("The '%s' model does not have a codec group.", phoneModelId),
        0 != codecPref.size());
    String str_groups = "";
    for (Setting s : codecPref) {
      str_groups += "-" + s.getName();
    }
    assertEquals(
        String.format(
            "The '%s' model has more than one codec group ('%s'):", phoneModelId, str_groups),
        1,
        codecPref.size());

    // Make sure it's the correct codec group.
    Setting codec_adaptor = codecPref.iterator().next();
    assertEquals(
        String.format("The '%s' model has the wrong codec group:", phoneModelId),
        codecGroup.toString(),
        codec_adaptor.getName());

    // Collect the major types of the supported codec options.  (Remove the minor bit/sample rates.)
    HashSet<String> major_supported_codecs = new HashSet<String>();
    Collection<String> options = ((MultiEnumSetting) codec_adaptor.getType()).getEnums().values();
    for (String option : options) {
      int i = option.indexOf('.');
      if (-1 != i) {
        option = option.substring(0, i);
      }
      major_supported_codecs.add(StringUtils.remove(option, "_"));
    }

    // Loop though the audioProfiles for the model.  There should be one for major supported codec
    // type.
    Collection<Setting> audioProfile =
        m_phone.getSettings().getSetting("voice/audioProfile").getValues();
    for (Setting s : audioProfile) {
      assertTrue(
          String.format(
              "The '%s' model has an audioProfile for unsupported codec type '%s'.",
              phoneModelId, s.getName()),
          major_supported_codecs.remove(s.getName()));
    }
    assertEquals(
        String.format(
            "The '%s' model is missing an audioProfile for the following supported code type(s): %s.",
            phoneModelId, major_supported_codecs),
        0,
        major_supported_codecs.size());
  }
Пример #2
0
  public void testGetSetting() {
    Setting setting = m_permission.getSetting();
    assertEquals(m_permission.getName(), setting.getName());
    assertTrue(setting.getType() instanceof BooleanSetting);

    Permission permission = new Permission();
    permission.setDefaultValue(true);
    assertEquals("ENABLE", permission.getSetting().getDefaultValue());
    assertTrue(permission.getSetting().getName().startsWith("perm"));
  }
Пример #3
0
 @Override
 public void visitSetting(Setting setting) {
   if ((setting.getType() instanceof EnumSetting)
       | (setting.getType() instanceof MultiEnumSetting)) {
     if (setting.getPath().matches(getPattern())) {
       if (setting.getType().getName().equals("enum")) {
         addEnums(setting.getName(), setting.getIndex(), (EnumSetting) setting.getType());
       } else if (setting.getType().getName().equals("multiEnum")) {
         addMultiEnums(
             setting.getName(), setting.getIndex(), (MultiEnumSetting) setting.getType());
       }
     }
   }
 }