Esempio n. 1
0
  public Object[] retrieveServiceStatus(Location location) {
    if (location == null || location.getServices() == null) {
      return ArrayUtils.EMPTY_OBJECT_ARRAY;
    }
    try {
      return getSipxProcessContext().getStatus(location, true);

    } catch (UserException e) {
      IValidationDelegate validator = getValidator(this);
      validator.record(new ValidatorException(e.getMessage()));

      Collection<ServiceStatus> serviceStatusList = new ArrayList<ServiceStatus>();
      for (LocationSpecificService lss : location.getServices()) {
        SipxService service = lss.getSipxService();
        String serviceName = service.getProcessName();
        if (serviceName != null) {
          serviceStatusList.add(new ServiceStatus(service.getBeanId(), Undefined));
        }
      }
      return serviceStatusList.toArray();
    }
  }
  public void testAcdBridgePublishSaveDelete() throws Exception {
    loadDataSetXml("admin/commserver/clearLocations.xml");
    Location[] emptyLocations = m_out.getLocations();
    assertEquals(0, emptyLocations.length);
    assertEquals(0, m_acdContext.getServers().size());

    Location location = new Location();
    location.setName("test location");
    location.setAddress("192.168.1.2");
    location.setFqdn("location1");
    location.setInstalledBundles(asList("callCenterBundle"));
    m_out.storeLocation(location);
    assertEquals(1, m_acdContext.getServers().size());
    assertEquals(0, m_conferenceBridgeContext.getBridges().size());

    SipxService freeswitchService = new SipxFreeswitchService();
    freeswitchService.setBeanId(SipxFreeswitchService.BEAN_ID);
    LocationSpecificService service = new LocationSpecificService();
    service.setSipxService(freeswitchService);
    service.setLocation(location);
    location.addService(freeswitchService);
    location.setInstalledBundles(asList("callCenterBundle", "conferenceBundle"));
    m_out.storeLocation(location);
    assertEquals(1, m_acdContext.getServers().size());
    assertEquals(1, m_conferenceBridgeContext.getBridges().size());

    location.setInstalledBundles(asList("callCenterBundle"));
    m_out.storeLocation(location);
    assertEquals(1, m_acdContext.getServers().size());
    assertEquals(0, m_conferenceBridgeContext.getBridges().size());

    location.setInstalledBundles(Collections.<String>emptyList());
    m_out.storeLocation(location);
    assertEquals(0, m_acdContext.getServers().size());
    assertEquals(0, m_conferenceBridgeContext.getBridges().size());
  }