CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
-
Upload
telestax -
Category
Technology
-
view
2.866 -
download
2
Transcript of CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011
![Page 1: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/1.jpg)
CDI Telco Framework and Aquillianto the Sip Servlets platform
Annual Mobicents Community Summit
Sochi-Russia, December 4-9, 2011 George VagenasCDI Telco Framework project lead
![Page 2: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/2.jpg)
Agenda
● CDI Telco Framework○ Few words about CDI JSR-299
○ CTF Introduction
○ Examples
○ Sip Servlets 2.0
● Sip Servlets Arquillian Container○ Introduction to Arquillian
○ MSS Arquillian container
○ Examples
![Page 3: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/3.jpg)
CDI Telco FrameworkCDI JSR299, is the Java standard for dependency injection and contextual lifecycle management. The CDI services provide: ● an improved lifecycle for stateful objects, bound to well-
defined contexts● a typesafe approach to dependency injection● object interaction via an event notification facility
![Page 4: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/4.jpg)
CDI Telco FrameworkCTF brings the power and productivity benefits of CDI into the Mobicents Sip Servlets platform providing dependency injection and contextual lifecycle management for converged HTTP/SIP applications.Mission Statement
● Simplify SipServlets development by introducing a clean programming model
● Extensibility is a major concern● The framework will stand as an extension to the CDI core, thus
making integration with other Java EE 6 technologies a breeze Project's home: CDI Telco Framework
![Page 6: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/6.jpg)
CDI Telco Framework
Benefits ● Loose coupling with strong typing● Portable extensions● Reusable components● Enhanced event notifications mechanism● Out of the box integration with the rest of the
Java EE ecosystem
![Page 7: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/7.jpg)
CDI Telco Framework
CTF Bean public class SimpleSipServlet {
@Injectprivate SipFactory sipFactory; protected void doInvite(@Observes @Invite SipServletRequest req){ ... } protected void doSuccessResponse(@Observes @SuccessResponse SipServletResponse resp){ ... }
}
![Page 8: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/8.jpg)
CDI Telco Frameworkpublic class SimpleSipServlet {
@InjectSipRegistarComponent sipRegistar;@Injectjavax.enterprise.event.Event<String> event;
protected void doRegister(@Observes @Register SipServletRequest req) {
sipRegistar.doRegister(req);event.fire("Received Register event");
}}
![Page 9: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/9.jpg)
CDI Telco Framework
Current State and future plans Currenlty CTF Core in Alpha version providing● Injection of Sip Servlet tools● Sip Event notification mechanism Whats coming next● Provide extensions with high level abstraction
components● Integration with Media Server
![Page 10: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/10.jpg)
CDI Telco FrameworkResources
● CDI-Telco-Framework web site - http://www.mobicents.org/mss/ctf/mss-ctf.html
● CDI-Telco-Framework introduction & Click2Call Example- http://blog.devrealm.org/2011/04/19/cdi-telco-framework/
● CDI-Telco-Framework documentation - http://docs.jboss.org/mobicents/frameworks/ctf/1.0.0.ALPHA1/user_guide/en-US/html_single/
![Page 11: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/11.jpg)
CDI Telco Framework
Sip Servlets 2.0 The new JSR proposal for Sip Servlets 2.0 aims for enhancements and simplifications over the existing API. CDI Telco Framework could be a candidate technology to be adopted in the new specification since the simplified programming model and the extensibility of the framework will foster innovation and bring new ideas to the technology.
![Page 12: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/12.jpg)
MSS Arquillian container
Arquillian testing framework, seeks to minimize the burden on the developer to author integration tests by handling all aspects of test execution, including:● managing the lifecycle of the container (start/stop),● bundling the test class with dependent classes and
resources into a deployable archive,● enhancing the test class (e.g., resolving @Inject, @EJB
and @Resource injections),● deploying the archive to test (deploy/undeploy) and
capturing results and failures.
![Page 13: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/13.jpg)
MSS Arquillian container
Mobicents brings the Sip Servlets Arquillian container for testing converged applications. ● Container is based on Tomcat 6.x● Using SipUnit as SIP client
○ We are collaborating with CafeSip developers on the SipUnit project in order to provide new features, fix bugs etc.
![Page 14: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/14.jpg)
MSS Arquillian container
Extras● Annotations
○ @ContextParam○ @ContextParamMap○ @ConcurrencyControlMode
● Helper classes○ ContextParamTool○ SipStackTool
● Lifecycle extension to provide finer grained control over container's and test's lifecycle
![Page 15: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/15.jpg)
MSS Arquillian container
● Finer grained control over the test's lifecycle and the container's lifecycle
● Override container configuration as needed● The integration is completely transparent,
which means you can launch the tests and get the test results using existing IDE, Ant and Maven test plugins without any add-ons.
![Page 16: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/16.jpg)
MSS Arquillian container
● CTF can be optionally enabled in order to enrich the test or the test archive.
● On the same test we can have○ Multiple test archives○ Multiple container configuration
![Page 17: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/17.jpg)
MSS Arquillian container
<container qualifier="mss-tomcat-embedded-6" default="true" mode="manual">
<configuration><property name="tomcatHome">target/mss-tomcat-embedded-
6</property><property name="workDir">work</property><property name="bindHttpPort">8888</property><property name="unpackArchive">true</property><property name="sipConnectors">:5070,:5070/TCP</property><property name="bindAddress">127.0.0.1</property><property name="sipApplicationRouterProviderClassName">org.
mobicents.servlet.sip.router.DefaultApplicationRouterProvider</property></configuration>
</container>
![Page 18: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/18.jpg)
MSS Arquillian container@RunWith(Arquillian.class)public class ShootistSipServletTest extends SipTestCase {@Deployment(name="simpleArchive", managed=false)
public static WebArchive createTestArchive(){WebArchive webArchive = ShrinkWrap.create(WebArchive.class,"shootistsipservlet.war");webArchive.addClasses(ShootistSipServlet.class);webArchive.addAsWebInfResource("in-container-sip.xml", "sip.xml");return webArchive;}
![Page 19: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/19.jpg)
MSS Arquillian container@Test @ContextParam(name="cancel", value="true")public void testShootist() throws Exception {
SipStackTool sipStackTool = new SipStackTool();receiver = sipStackTool.initializeSipStack(SipStack.PROTOCOL_UDP,
"127.0.0.1", "5080", "127.0.0.1:5070");sipPhone = receiver.createSipPhone("127.0.0.1", SipStack.
PROTOCOL_UDP, 5070, "sip:[email protected]");sipCall = sipPhone.createSipCall();sipCall.listenForIncomingCall();deployer.deploy("simpleArchive");assertTrue(sipCall.waitForIncomingCall(timeout));assertTrue(sipCall.sendIncomingCallResponse(Response.TRYING,"
Trying", timeout));
![Page 20: CDI Telco Framework & Arquillian presentation at Mobicents Summit, Sochi 2011](https://reader030.fdocuments.in/reader030/viewer/2022020217/555e5759d8b42a8e4c8b50b6/html5/thumbnails/20.jpg)
MSS Arquillian container
What comes next:● Will be released soon in order to get community
feedback for missing features or bugs● Work on a Tomcat 7.x based container● Mobicents Sip Servlets testsuite will migrate to
the new container