Package javax.ws.rs.core

Examples of javax.ws.rs.core.Link$JaxbLink


        return new ResourceConfig(Resource.class, LinkTestResource.class);
    }

    @Test
    public void testEquals() {
        Link link = Link.fromMethod(Resource.class, "producesXml").build();
        String string = link.toString();
        Link fromValueOf = Link.valueOf(string);
        assertEquals(link, fromValueOf);
    }
View Full Code Here


        assertEquals(link, fromValueOf);
    }

    @Test
    public void testFromResourceMethod() {
        Link link = Link.fromMethod(Resource.class, "producesXml").build();
        assertEquals("producesxml", link.getUri().toString());
    }
View Full Code Here

    @Test
    public void testDelimiters() {
        Link.Builder builder = Link.fromUri("http://localhost:80");
        final String value = "param1value1    param1value2";
        builder = builder.param("param1", value);
        Link link = builder.build();
        final Map<String, String> params = link.getParams();
        assertEquals(value, params.get("param1"));
    }
View Full Code Here

    }

    @Test
    public void testGetUri() {
        URI u = URI.create("http://example.org/app/link1");
        Link l1 = Link.fromUri("http://example.org/app/link1").param("foo1", "bar1").param("foo2", "bar2").build();
        assertEquals(l1.getUri(), u);
        assertEquals(l1.getUriBuilder().build(), u);
    }
View Full Code Here

        assertEquals(l1.getUriBuilder().build(), u);
    }

    @Test
    public void testToString() {
        Link link = Link.fromUri("http://example.org/app/link1").rel("self").build();
        assertEquals("<http://example.org/app/link1>; rel=\"self\"", link.toString());
    }
View Full Code Here

        assertEquals("<http://example.org/app/link1>; rel=\"self\"", link.toString());
    }

    @Test
    public void testGetters() {
        Link link = Link.fromUri("http://example.org/app/link1").rel("self").type("text/plain").build();
        assertEquals(URI.create("http://example.org/app/link1"), link.getUri());
        assertEquals("self", link.getRel());
        assertEquals(null, link.getTitle());
        assertEquals("text/plain", link.getType());
        assertEquals(2, link.getParams().size());
    }
View Full Code Here

        RuntimeDelegate.setInstance(null);
    }

    @Test
    public void testValueOf() {
        Link l1 = Link.fromUri("http://example.org/app/link1").build();
        Link l2 = Link.valueOf("<http://example.org/app/link1>");
        assertEquals(l1, l2);
        l2 = Link.valueOf(" <http://example.org/app/link1>");
        assertEquals(l1, l2);
        l2 = Link.valueOf(" <http://example.org/app/link1> ");
        assertEquals(l1, l2);
View Full Code Here

        assertEquals(nOfExceptions, 3);
    }

    @Test
    public void testValueOfParams() {
        Link l1 = Link.fromUri("http://example.org/app/link1").param("foo1", "bar1").param("foo2", "bar2").build();
        Link l2 = Link.valueOf("<http://example.org/app/link1>; foo1=\"bar1\"; foo2 = \"bar2\"");
        assertEquals(l1, l2);
        l2 = Link.valueOf("<http://example.org/app/link1>; foo2=\"bar2\"; foo1= \"bar1\"");
        assertEquals(l1, l2);
        l2 = Link.valueOf("<http://example.org/app/link1>;      foo1=\"bar1\";     foo2=\"bar2\"");
        assertEquals(l1, l2);
View Full Code Here

        assertEquals(l1, l2);
    }

    @Test
    public void testRoundTrip() {
        Link l1 = Link.fromUri("http://example.org/app/link1").param("foo1", "bar1").param("foo2", "bar2").build();
        assertEquals(l1, Link.valueOf(l1.toString()));
        Link l2 = Link.valueOf("<http://example.org/app/link1>; foo1=\"bar1\"; foo2 = \"bar2\"");
        assertEquals(l1, l2);
    }
View Full Code Here

    }

    @Test
    public void testGetLinks() {
        InboundMessageContext r = createInboundMessageContext();
        Link link1 = Link.fromUri("http://example.org/app/link1").param("produces", "application/json").param("method",
                "GET").rel("self").build();
        Link link2 = Link.fromUri("http://example.org/app/link2").param("produces", "application/xml").param("method",
                "PUT").rel("self").build();
        r.header("Link", link1.toString());
        r.header("Link", link2.toString());
        assertEquals(2, r.getLinks().size());
        assertTrue(r.getLinks().contains(link1));
        assertTrue(r.getLinks().contains(link2));
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.Link$JaxbLink

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.