コード例 #1
0
  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
  @Override
  protected void setUp() throws Exception {
    XMLUnit.setIgnoreWhitespace(true);
    phone = new PolycomPhone();
    PolycomModel model = new PolycomModel();
    model.setMaxLineCount(6);
    phone.setModel(model);
    PhoneTestDriver.supplyTestData(phone);

    m_location = new MemoryProfileLocation();

    VelocityProfileGenerator pg = new VelocityProfileGenerator();
    pg.setVelocityEngine(TestHelper.getVelocityEngine());
    m_pg = pg;
  }