コード例 #1
0
  public void testStore() throws Exception {
    loadDataSetXml("admin/commserver/clearLocations.xml");
    Location location = new Location();
    location.setName("test location");
    location.setAddress("192.168.1.2");
    location.setFqdn("localhost");

    m_out.storeLocation(location);

    Location[] dbLocations = m_out.getLocations();
    assertEquals(1, dbLocations.length);
    assertEquals("test location", dbLocations[0].getName());
    assertEquals("192.168.1.2", dbLocations[0].getAddress());
    assertEquals("localhost", dbLocations[0].getFqdn());
  }
コード例 #2
0
  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());
  }