Package org.cipango.sipapp

Examples of org.cipango.sipapp.SipAppContext$Context


  @SuppressWarnings("unchecked")
  @Test
  public void testNamespace() throws Exception
  {
    SipAppContext context = new SipAppContext();
    SipMetaData metaData = context.getSipMetaData();
    metaData.setSipXml(getResource("/org/cipango/xml/sip-namespace.xml"));
    metaData.addDescriptorProcessor(new StandardDescriptorProcessor());
    metaData.resolve(context);
   
    assertEquals(SipAppContext.VERSION_11, context.getSpecVersion());
   
    Enumeration<String> e = context.getInitParameterNames();
    String name = (String) e.nextElement();
    assertNotNull(name);
    assertEquals("contextConfigLocation", name);
    assertEquals("/WEB-INF/kaleo.xml", context.getInitParameter(name));
    assertFalse(e.hasMoreElements())
   
    // servlets
    SipServletHandler servletHandler = (SipServletHandler) context.getServletHandler();
    SipServletHolder[] holders = servletHandler.getSipServlets();
    assertEquals(1, holders.length);
   
    assertEquals("main", holders[0].getName());
    // TODO assertEquals("PBX Servlet", holders[0].getDisplayName());
    assertEquals("org.cipango.kaleo.PbxServlet", holders[0].getClassName());
    e = holders[0].getInitParameterNames();
    name = (String) e.nextElement();
    assertEquals("value", holders[0].getInitParameter(name));
    assertFalse(e.hasMoreElements());     
   
    // servlet-mapping
    SipServletMapping[] mappings = servletHandler.getSipServletMappings();
    assertNull(mappings);
   
    assertEquals("main", servletHandler.getMainServlet().getName());
   
    assertEquals("org.cipango.kaleo", context.getName())
  }
View Full Code Here


   
    SipDescriptor descriptor = new SipDescriptor(getResource("/org/cipango/xml/sip-validated-1.1.xml"));
    descriptor.setValidating(true);
    descriptor.parse();
     
    processor.process(new SipAppContext(), descriptor);
  }
View Full Code Here

  private SipAppContext _context;
 
  @Before
  public void setUp() throws Exception
  {
    _context = new SipAppContext();
    _context.setSecurityHandler(new ConstraintSecurityHandler());
  }
View Full Code Here

    udp.setPort(port);
    tcp.setPort(port);
   
    server.getConnectorManager().setConnectors(new SipConnector[] { udp, tcp });
   
    SipAppContext sipapp = new SipAppContext();
    sipapp.setContextPath("/");
    sipapp.setWar(args[0]);
   
    SipContextHandlerCollection handler = new SipContextHandlerCollection();
    handler.addHandler(sipapp);
   
    server.setApplicationRouter(new DefaultApplicationRouter());
View Full Code Here

  //TODO init default context
 
  public void handle(DiameterMessage message) throws IOException
  {
    DiameterListener[] listeners = null;
    SipAppContext context = null;
    if (message instanceof DiameterAnswer)
      context = ((DiameterAnswer) message).getRequest().getContext();
   
    if (context == null)
    {
      AppSessionIf appSession = (AppSessionIf) message.getApplicationSession();
      if (appSession != null)
        context = appSession.getAppSession().getContext();
    }
   
    if (context == null)
      context = _defaultContext;
   
    if (context != null)
    {
      DiameterAppContext ctx = _diameterListeners.get(context.getContextPath());
      if (ctx != null)
        listeners = ctx.getDiameterListeners();
    }

    if (listeners != null && listeners.length != 0)
      context.fire(listeners, _handleMsg, message);
    else
      Log.warn("No diameter listeners for context {} to handle message {}",
          context == null ? "" : context.getName(), message)
  }
View Full Code Here

  }
 
  public void fireNoAnswerReceived(DiameterRequest request, long timeout)
  {
    DiameterErrorListener[] listeners = null;
    SipAppContext context = null;
    AppSessionIf appSession = (AppSessionIf) request.getApplicationSession();
    if (appSession != null)
      context = appSession.getAppSession().getContext();
   
    if (context != null)
    {
      DiameterAppContext ctx = _diameterListeners.get(context.getContextPath());
      if (ctx != null)
        listeners = ctx.getErrorListeners();
    }
   
    if (listeners != null && listeners.length != 0)
      context.fire(listeners, _noAnswerReceived, new DiameterErrorEvent(request, timeout));   
  }
View Full Code Here

    _server.setApplicationRouter(new SipClientApplicationRouter());
   
    SipContextHandlerCollection handler = new SipContextHandlerCollection();
    _server.setHandler(handler);
   
    _context = new SipAppContext();
    _context.setConfigurationClasses(new String[0]);
    _context.setContextPath("/");
    _context.setName(SipClient.class.getName());
   
    SipServletHolder holder = new SipServletHolder();
View Full Code Here

  private SipApplicationKeyAnnotationHandler _handler;

  @Before
  public void setUp() throws Exception
  {
    _context = new SipAppContext();
    _parser = new AnnotationParser();
    _handler = new SipApplicationKeyAnnotationHandler(_context);
        _parser.registerAnnotationHandler("javax.servlet.sip.annotation.SipApplicationKey",
            _handler);
  }
View Full Code Here

  private Decorator _decorator;

  @Before
  public void setUp() throws Exception
  {
    _context = new SipAppContext();
    _injections = new InjectionCollection();
     _context.setAttribute(InjectionCollection.INJECTION_COLLECTION, _injections);
    _decorator = new AnnotationDecorator(_context);
  }
View Full Code Here

  private AnnotationParser _parser;

  @Before
  public void setUp() throws Exception
  {
    _sac = new SipAppContext();
    _parser = new AnnotationParser();
        _parser.registerAnnotationHandler("javax.servlet.sip.annotation.SipServlet",
            new SipServletAnnotationHandler(_sac));
  }
View Full Code Here

TOP

Related Classes of org.cipango.sipapp.SipAppContext$Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.