use of org.apache.cxf.jaxrs.model.OperationResourceInfoStack in project cxf by apache.
the class UriInfoImplTest method testGetMatchedURIsSubResourceLocatorSubPath.
@Test
public void testGetMatchedURIsSubResourceLocatorSubPath() throws Exception {
System.out.println("testGetMatchedURIsSubResourceLocatorSubPath");
Message m = mockMessage("http://localhost:8080/app", "/foo/sub/subSub");
OperationResourceInfoStack oriStack = new OperationResourceInfoStack();
ClassResourceInfo rootCri = getCri(RootResource.class, true);
OperationResourceInfo rootOri = getOri(rootCri, "getSubResourceLocator");
MethodInvocationInfo miInfo = new MethodInvocationInfo(rootOri, RootResource.class, new ArrayList<String>());
oriStack.push(miInfo);
ClassResourceInfo subCri = getCri(SubResource.class, false);
OperationResourceInfo subOri = getOri(subCri, "getFromSubSub");
miInfo = new MethodInvocationInfo(subOri, SubResource.class, new ArrayList<String>());
oriStack.push(miInfo);
m.put(OperationResourceInfoStack.class, oriStack);
UriInfoImpl u = new UriInfoImpl(m);
List<String> matchedUris = getMatchedURIs(u);
assertEquals(3, matchedUris.size());
assertEquals("foo/sub/subSub", matchedUris.get(0));
assertEquals("foo/sub", matchedUris.get(1));
assertEquals("foo", matchedUris.get(2));
}
use of org.apache.cxf.jaxrs.model.OperationResourceInfoStack in project cxf by apache.
the class UriInfoImplTest method testGetMatchedURIsRoot.
@Test
public void testGetMatchedURIsRoot() throws Exception {
System.out.println("testGetMatchedURIsRoot");
Message m = mockMessage("http://localhost:8080/app", "/foo");
OperationResourceInfoStack oriStack = new OperationResourceInfoStack();
ClassResourceInfo cri = getCri(RootResource.class, true);
OperationResourceInfo ori = getOri(cri, "get");
MethodInvocationInfo miInfo = new MethodInvocationInfo(ori, RootResource.class, new ArrayList<String>());
oriStack.push(miInfo);
m.put(OperationResourceInfoStack.class, oriStack);
UriInfoImpl u = new UriInfoImpl(m);
List<String> matchedUris = getMatchedURIs(u);
assertEquals(1, matchedUris.size());
assertTrue(matchedUris.contains("foo"));
}
Aggregations