2
* Copyright 2005-2012 Restlet S.A.S.
4
* The contents of this file are subject to the terms of one of the following
5
* open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
6
* 1.0 (the "Licenses"). You can select the license that you prefer but you may
7
* not use this file except in compliance with one of these Licenses.
9
* You can obtain a copy of the Apache 2.0 license at
10
* http://www.opensource.org/licenses/apache-2.0
12
* You can obtain a copy of the LGPL 3.0 license at
13
* http://www.opensource.org/licenses/lgpl-3.0
15
* You can obtain a copy of the LGPL 2.1 license at
16
* http://www.opensource.org/licenses/lgpl-2.1
18
* You can obtain a copy of the CDDL 1.0 license at
19
* http://www.opensource.org/licenses/cddl1
21
* You can obtain a copy of the EPL 1.0 license at
22
* http://www.opensource.org/licenses/eclipse-1.0
24
* See the Licenses for the specific language governing permissions and
25
* limitations under the Licenses.
27
* Alternatively, you can obtain a royalty free commercial license with less
28
* limitations, transferable or non-transferable, directly at
29
* http://www.restlet.com/products/restlet-framework
31
* Restlet is a registered trademark of Restlet S.A.S.
34
package org.restlet.test.jaxrs.services.tests;
36
import java.util.Collections;
39
import javax.ws.rs.core.Application;
41
import org.restlet.Response;
42
import org.restlet.data.Status;
43
import org.restlet.test.jaxrs.services.resources.ContextsTestService;
46
* @author Stephan Koops
47
* @see ContextsTestService
49
public class ContextsTest extends JaxRsTestCase {
52
protected Application getApplication() {
53
return new Application() {
55
@SuppressWarnings({ "unchecked", "rawtypes" })
56
public Set<Class<?>> getClasses() {
57
return (Set) Collections.singleton(ContextsTestService.class);
62
public void testFields() throws Exception {
63
final Response response = get("fields");
64
sysOutEntityIfError(response);
65
assertEquals(Status.SUCCESS_OK, response.getStatus());
66
final String entity = response.getEntity().getText();
67
assertEquals("providers\nuriInfo\n", entity);
70
public void testLastPathSegm() throws Exception {
71
final Response response = get("lastPathSegm;a=b;c=d;c=e");
72
sysOutEntityIfError(response);
73
assertEquals(Status.SUCCESS_OK, response.getStatus());
74
// final String entity = response.getEntity().getText();
75
// LATER assertEquals("a : [b]\nc : [d, e]\n", entity);
78
public void testParams() throws Exception {
79
final Response response = get("params");
80
sysOutEntityIfError(response);
81
assertEquals(Status.SUCCESS_OK, response.getStatus());
82
final String entity = response.getEntity().getText();
83
assertEquals("providers\nuriInfo\n", entity);