Package plugins.Freetalk.ui.NNTP

Examples of plugins.Freetalk.ui.NNTP.ArticleParser$ContentType


    }

    @Test
    public void equals_with_parameters()
    {
        ContentType master = new ContentType("text/html;charset=utf-8");

        assertFalse(master.equals(new ContentType("text/html")));
        assertTrue(master.equals(new ContentType("text/html;charset=utf-8")));
        assertFalse(master.equals(new ContentType("text/html;charset=utf-8;foo=bar")));

        // Check that keys are case insensitive

        assertTrue(master.equals(new ContentType("text/html;Charset=utf-8")));

        master = new ContentType("text/html;foo=bar;biff=bazz");

        assertTrue(master.equals(new ContentType("text/html;foo=bar;biff=bazz")));
        assertTrue(master.equals(new ContentType("text/html;Foo=bar;Biff=bazz")));
        assertTrue(master.equals(new ContentType("text/html;biff=bazz;foo=bar")));
    }
View Full Code Here


    }

    @Test
    public void parse_with_parameters() throws Exception
    {
        ContentType contentType = new ContentType("text/html;charset=utf-8");

        assertEquals(contentType.getBaseType(), "text");

        assertEquals(contentType.getSubType(), "html");

        assertEquals(contentType.getMimeType(), "text/html");

        List<String> parameterNames = contentType.getParameterNames();
        assertEquals(parameterNames.size(), 1);

        assertEquals(parameterNames.get(0), "charset");

        assertEquals(contentType.getCharset(), "utf-8");

        assertTrue(contentType.hasParameters());

        String nonexistant = contentType.getParameter("nonexistant");

        assertTrue(nonexistant == null);
    }
View Full Code Here

    @Test(dataProvider = "invalid_content_type_strings_data")
    public void invalid_content_type_strings(String input)
    {
        try
        {
            new ContentType(input);

            unreachable();
        } catch (IllegalArgumentException ex)
        {
View Full Code Here

    }

    @Test
    public void parse_without_parameters() throws Exception
    {
        ContentType contentType = new ContentType("text/html");

        assertEquals(contentType.getBaseType(), "text");

        assertEquals(contentType.getSubType(), "html");

        assertEquals(contentType.getMimeType(), "text/html");

        assertTrue(contentType.getParameterNames().isEmpty());

        assertFalse(contentType.hasParameters());
    }
View Full Code Here

    }

    @Test
    public void unparse_with_parameters() throws Exception
    {
        ContentType contentType = new ContentType("text/html").withCharset("utf-8");

        assertEquals(contentType.toString(), "text/html;charset=utf-8");
    }
View Full Code Here

    }

    @Test
    public void unparse_no_parameters() throws Exception
    {
        ContentType contentType = new ContentType("text/html");

        assertEquals(contentType.toString(), "text/html");
    }
View Full Code Here

    }

    @Test
    public void add_charset() throws Exception
    {
        ContentType base = new ContentType("text/html");

        ContentType charset = base.withCharset("utf-8");

        assertTrue(charset.hasParameters());

        assertNotSame(base, charset);
        assertNotEquals(base, charset);

        assertEquals(base.toString(), "text/html");
        assertEquals(charset.toString(), "text/html;charset=utf-8");
    }
View Full Code Here

            }
        };

        resources.triggerEvent("providecompletions", new Object[] {input}, callback);

        ContentType contentType = responseRenderer.findContentType(this);

        MarkupWriter writer = factory.newMarkupWriter(contentType);

        generateResponseMarkup(writer, matchesHolder.get());

        return new TextStreamResponse(contentType.toString(), writer.toString());
    }
View Full Code Here

        // If we end up doing a partial render, the page render queue service needs to know the
        // page that will be rendered (for logging purposes, if nothing else).

        queue.setRenderingPage(activePage);

        ContentType contentType = pageContentTypeAnalyzer.findContentType(activePage);

        request.setAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME, contentType);

        Page containerPage = cache.get(parameters.getContainingPageName());
View Full Code Here

            }
        };

        resources.triggerEvent(EventConstants.PROVIDE_COMPLETIONS, new Object[] { input }, callback);

        ContentType contentType = responseRenderer.findContentType(this);

        MarkupWriter writer = factory.newPartialMarkupWriter(contentType);

        generateResponseMarkup(writer, model);

        return new TextStreamResponse(contentType.toString(), writer.toString());
    }
View Full Code Here

TOP

Related Classes of plugins.Freetalk.ui.NNTP.ArticleParser$ContentType

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.