Package org.glassfish.jersey.message.internal

Examples of org.glassfish.jersey.message.internal.ParameterizedHeader


     */
    public ParameterizedHeadersMap(final MultivaluedMap<String, String> headers) throws ParseException {
        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
            List<ParameterizedHeader> list = new ArrayList<ParameterizedHeader>(entry.getValue().size());
            for (String value : entry.getValue()) {
                list.add(new ParameterizedHeader(value));
            }
            this.put(entry.getKey(), list);
        }
    }
View Full Code Here


     * Test of put method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testPut() throws Exception {
        List<ParameterizedHeader> fooValues1 = new ArrayList<ParameterizedHeader>();
        fooValues1.add(new ParameterizedHeader("foo1"));
        fooValues1.add(new ParameterizedHeader("foo2"));

        assertNull(map.get("foo"));

        map.put("foo", fooValues1);

        assertTrue(map.containsKey("foo"));
        assertTrue(map.containsValue(fooValues1));
        assertTrue(map.get("foo") == fooValues1);

        List<ParameterizedHeader> fooValues2 = new ArrayList<ParameterizedHeader>();
        fooValues2.add(new ParameterizedHeader("foo3"));
        fooValues2.add(new ParameterizedHeader("foo4"));

        map.put("foo", fooValues2);

        assertEquals(1, map.size());
        assertTrue(map.containsKey("foo"));
View Full Code Here

    @Test
    public void testPutAll() throws Exception {
        Map<String, List<ParameterizedHeader>> all = new HashMap<String, List<ParameterizedHeader>>();

        List<ParameterizedHeader> fooValues = new ArrayList<ParameterizedHeader>();
        fooValues.add(new ParameterizedHeader("foo1"));
        fooValues.add(new ParameterizedHeader("foo2"));

        all.put("foo", fooValues);

        List<ParameterizedHeader> barValues = new ArrayList<ParameterizedHeader>();
        barValues.add(new ParameterizedHeader("bar1"));
        barValues.add(new ParameterizedHeader("bar2"));

        all.put("bar", barValues);

        assertTrue(map.isEmpty());
View Full Code Here

     * Test of putSingle method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testPutSingle() throws Exception {
        List<ParameterizedHeader> values = new ArrayList<ParameterizedHeader>();
        values.add(new ParameterizedHeader("bar"));
        values.add(new ParameterizedHeader("baz"));

        map.put("foo", values);

        assertEquals(1, map.size());
        assertEquals(2, map.get("foo").size());

        map.putSingle("foo", new ParameterizedHeader("bop"));

        assertEquals(1, map.size());
        assertEquals(1, map.get("foo").size());
        assertEquals("bop", map.get("foo").get(0).getValue());
    }
View Full Code Here

    /**
     * Test of remove method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testRemove() throws Exception {
        map.add("foo", new ParameterizedHeader("bar"));
        map.add("baz", new ParameterizedHeader("bop"));

        assertEquals(2, map.size());
        assertTrue(map.containsKey("foo"));
        assertTrue(map.containsKey("baz"));

View Full Code Here

     */
    @Test
    public void testSize() throws Exception {
        assertEquals(0, map.size());

        map.add("foo", new ParameterizedHeader("bar"));
        assertEquals(1, map.size());

        map.add("foo", new ParameterizedHeader("arg"));
        assertEquals(1, map.size());

        map.add("baz", new ParameterizedHeader("bop"));
        assertEquals(2, map.size());

        map.remove("baz");
        assertEquals(1, map.size());

View Full Code Here

    @Test
    public void testValues() throws Exception {
        Map<String,List<ParameterizedHeader>> all = new HashMap<String,List<ParameterizedHeader>>();

        List<ParameterizedHeader> fooValues = new ArrayList<ParameterizedHeader>();
        fooValues.add(new ParameterizedHeader("foo1"));
        fooValues.add(new ParameterizedHeader("foo2"));

        all.put("foo", fooValues);

        List<ParameterizedHeader> barValues = new ArrayList<ParameterizedHeader>();
        barValues.add(new ParameterizedHeader("bar1"));
        barValues.add(new ParameterizedHeader("bar2"));

        all.put("bar", barValues);

        map.putAll(all);
View Full Code Here

    /**
     * Test of add method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testAdd() throws Exception {
        map.add("foo", new ParameterizedHeader("bar"));
        List<ParameterizedHeader> values = map.get("foo");

        assertNotNull(values);
        assertEquals(1,values.size());
        assertEquals("bar", values.get(0).getValue());

        map.add("foo", new ParameterizedHeader("baz"));

        assertEquals(1, map.size());

        values = map.get("foo");

        assertEquals(2, values.size());
        assertEquals("bar", values.get(0).getValue());
        assertEquals("baz", values.get(1).getValue());

        map.add("bop", new ParameterizedHeader("boo"));
        assertEquals(2, map.size());
    }
View Full Code Here

    /**
     * Test of clear method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testClear() throws Exception {
        map.add("foo", new ParameterizedHeader("bar"));
        map.add("baz", new ParameterizedHeader("bop"));

        assertTrue(!map.isEmpty());
        assertEquals(2, map.size());

        map.clear();
View Full Code Here

    /**
     * Test of containsKey method, of class ParametrizedHeadersMap.
     */
    @Test
    public void testContainsKey() throws Exception {
        map.add("foo", new ParameterizedHeader("bar"));

        assertTrue(map.containsKey("foo"));
        assertTrue(map.containsKey("FOO"));
        assertTrue(map.containsKey("Foo"));
        assertTrue(map.containsKey("fOo"));
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.message.internal.ParameterizedHeader

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.