Package com.volantis.synergetics.testtools.servletunit

Examples of com.volantis.synergetics.testtools.servletunit.ServletRunner$WebXmlEntityResolver


     * Resolve the PC device which has a valid secondary ID header mapping to
     * the Wibble device. The Wibble device should be returned.
     */
    public void testSecondaryIDMapping() throws Exception {

        ServletRunner servletRunner = new ServletRunner(webXMLInputStream);
        servletRunner.registerServlet("MyServlet",
                "com.volantis.mcs.devices.ResolveDeviceServlet");

        final ServletUnitClient servletClient = servletRunner.newClient();

        final WebRequest request = new PostMethodWebRequest(
                "http://test.colantis.com/MyServlet");
        request.setHeaderField("User-Agent", "Mozilla/5.0 blah blah blah");
        request.setHeaderField("host", "www.volantis.com:8080");
        request.setHeaderField("Accept", "text/html");
        request.setHeaderField("HeaderName", "HeaderValue");

        ConfigValue cv = new ConfigValue();
        AppConfigurator ac = new MyAppConfigurator();
        ac.setUp(cv);
        try {
            ConfigFileBuilder configFileBuilder = new ConfigFileBuilder();
            configFileBuilder.buildConfigDocument(cv);
            servletRunner.setRealPath(configFileBuilder.getConfigFileDir());

            hypersonicManager.useCleanupWith(new Executor() {
                public void execute() throws Exception {
                    createRepository();

View Full Code Here


     * Resolve the PC device which has a valid secondary ID header mapping to
     * the Wibble device. The Wibble device should be returned.
     */
    public void testCachedSecondaryIDMapping() throws Exception {

        ServletRunner servletRunner = new ServletRunner(webXMLInputStream);
        servletRunner.registerServlet("MyServlet",
                "com.volantis.mcs.devices.ResolveDeviceServlet");

        final ServletUnitClient servletClient = servletRunner.newClient();

        final WebRequest request = new PostMethodWebRequest(
                "http://test.colantis.com/MyServlet");
        request.setHeaderField("User-Agent", "Mozilla/5.0 blah blah blah");
        request.setHeaderField("host", "www.volantis.com:8080");
        request.setHeaderField("Accept", "text/html");
        request.setHeaderField("HeaderName", "HeaderValue");

        ConfigValue cv = new ConfigValue();
        AppConfigurator ac = new MyAppConfigurator();
        ac.setUp(cv);
        try {
            ConfigFileBuilder configFileBuilder = new ConfigFileBuilder();
            configFileBuilder.buildConfigDocument(cv);
            servletRunner.setRealPath(configFileBuilder.getConfigFileDir());

            hypersonicManager.useCleanupWith(new Executor() {
                public void execute() throws Exception {
                    createRepository();

View Full Code Here

     * Resolve the Test device. This is a valid device with no secondary ID header
     * defined so this should resolve as normal from the user agent alone.
     */
    public void testNoSecondaryIDMapping() throws Exception {

        ServletRunner servletRunner = new ServletRunner(webXMLInputStream);
        servletRunner.registerServlet( "MyServlet",
                                       "com.volantis.mcs.devices.ResolveDeviceServlet" );

        final ServletUnitClient servletClient = servletRunner.newClient();

        final WebRequest request = new PostMethodWebRequest(
                            "http://test.colantis.com/MyServlet" );
        request.setHeaderField( "User-Agent", "Mozilla/6.0 blah blah blah" );
        request.setHeaderField( "host", "www.volantis.com:8080" );
        request.setHeaderField( "Accept", "text/html");
        request.setHeaderField( "HeaderName", "HeaderValue");

        // todo: this should be using AppManager instead of the code below
        ConfigValue cv = new ConfigValue();
        AppConfigurator ac = new MyAppConfigurator();
        ac.setUp( cv );
        try {
            ConfigFileBuilder configFileBuilder = new ConfigFileBuilder();
            configFileBuilder.buildConfigDocument(cv);
            servletRunner.setRealPath(configFileBuilder.getConfigFileDir());

            hypersonicManager.useCleanupWith(new Executor() {
                public void execute() throws Exception {
                    createRepository();

View Full Code Here

     * the header does not exist in the request so the device mapped from the user
     * agent should be returned.
     */
    public void testInvalidSecondaryIDMapping() throws Exception {

        ServletRunner servletRunner = new ServletRunner(webXMLInputStream);
        servletRunner.registerServlet( "MyServlet",
                                       "com.volantis.mcs.devices.ResolveDeviceServlet" );

        final ServletUnitClient servletClient = servletRunner.newClient();

        final WebRequest request = new PostMethodWebRequest(
                            "http://test.colantis.com/MyServlet" );
        request.setHeaderField( "User-Agent", "Mozilla/7.0 blah blah blah" );
        request.setHeaderField( "host", "www.volantis.com:8080" );
        request.setHeaderField( "Accept", "text/html");
        request.setHeaderField( "HeaderName", "HeaderValue");

        // todo: this should be using AppManager instead of the code below
        ConfigValue cv = new ConfigValue();
        AppConfigurator ac = new MyAppConfigurator();
        ac.setUp( cv );
        try {
            ConfigFileBuilder configFileBuilder = new ConfigFileBuilder();
            configFileBuilder.buildConfigDocument(cv);
            servletRunner.setRealPath(configFileBuilder.getConfigFileDir());
            hypersonicManager.useCleanupWith(new Executor() {
                public void execute() throws Exception {
                    createRepository();

                    WebResponse response = servletClient.getResponse(request);
View Full Code Here

TOP

Related Classes of com.volantis.synergetics.testtools.servletunit.ServletRunner$WebXmlEntityResolver

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.