Examples of PathAnnotation


Examples of org.exquery.restxq.annotation.PathAnnotation

                }
                builder.endElement();
            }
           
            if(resourceFn.getPathAnnotation() != null) {
                final PathAnnotation pathAnnotation = resourceFn.getPathAnnotation();
                attrs = new AttributesImpl();
                attrs.addAttribute(null, SPECIFICITY_METRIC, "", "string", Long.toString(pathAnnotation.getPathSpecificityMetric()));
                builder.startElement(QName.fromJavaQName(pathAnnotation.getName()), attrs);
                final String[] segments = pathAnnotation.getLiterals()[0].getValue().split("/");
                for(final String segment : segments) {
                    if(!segment.isEmpty()) {
                        builder.startElement(SEGMENT, null);
                        builder.characters(segment);
                        builder.endElement();
View Full Code Here

Examples of org.exquery.restxq.annotation.PathAnnotation

public class RestXqServiceTest {
   
    @Test
    public void compareTo_resourceFunctions_path_before_no_path() {
       
        final PathAnnotation mockPathAnnotation = mock(PathAnnotation.class);
        final ResourceFunction mockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock restXqService = new RestXqServiceMock(mockResourceFunction);
       
        final ResourceFunction otherMockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock otherRestXqService = new RestXqServiceMock(otherMockResourceFunction);
       
        when(mockResourceFunction.getPathAnnotation()).thenReturn(mockPathAnnotation);
        when(mockPathAnnotation.getPathSpecificityMetric()).thenReturn(Long.valueOf(3));
       
        when(otherMockResourceFunction.getPathAnnotation()).thenReturn(null);
       
        final int result = restXqService.compareTo(otherRestXqService);
       
View Full Code Here

Examples of org.exquery.restxq.annotation.PathAnnotation

    public void compareTo_resourceFunctions_no_path_after_path() {
       
        final ResourceFunction mockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock restXqService = new RestXqServiceMock(mockResourceFunction);
       
        final PathAnnotation otherMockPathAnnotation = mock(PathAnnotation.class);
        final ResourceFunction otherMockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock otherRestXqService = new RestXqServiceMock(otherMockResourceFunction);
       
        when(mockResourceFunction.getPathAnnotation()).thenReturn(null);
       
        when(otherMockResourceFunction.getPathAnnotation()).thenReturn(otherMockPathAnnotation);
        when(otherMockPathAnnotation.getPathSpecificityMetric()).thenReturn(Long.valueOf(3));
       
        final int result = restXqService.compareTo(otherRestXqService);
       
        assertEquals(1, result);
    }
View Full Code Here

Examples of org.exquery.restxq.annotation.PathAnnotation

    }
   
    @Test
    public void compareTo_resourceFunctions_most_specific_path_first() {
       
        final PathAnnotation mockPathAnnotation = mock(PathAnnotation.class);
        final ResourceFunction mockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock restXqService = new RestXqServiceMock(mockResourceFunction);
       
        final PathAnnotation otherMockPathAnnotation = mock(PathAnnotation.class);
        final ResourceFunction otherMockResourceFunction = mock(ResourceFunction.class);
        final RestXqServiceMock otherRestXqService = new RestXqServiceMock(otherMockResourceFunction);
       
        when(mockResourceFunction.getPathAnnotation()).thenReturn(mockPathAnnotation);
        when(mockPathAnnotation.getPathSpecificityMetric()).thenReturn(Long.valueOf(3));
       
        when(otherMockResourceFunction.getPathAnnotation()).thenReturn(otherMockPathAnnotation);
        when(otherMockPathAnnotation.getPathSpecificityMetric()).thenReturn(Long.valueOf(2));
       
        final int result = restXqService.compareTo(otherRestXqService);
       
        assertEquals(-1, result);
    }
View Full Code Here

Examples of org.exquery.restxq.annotation.PathAnnotation

   
    @Test
    public void create_succeedsForRESTXQAnnotations_With_PathAnnotation() throws URISyntaxException, ExQueryException {
       
        final QName qnPathAnnotation = new QName(Namespace.ANNOTATION_NS, "path");
        final PathAnnotation mckPathAnnotation = mock(PathAnnotation.class);
       
        final Set<Annotation> annotations = new HashSet<Annotation>();
        annotations.add(mckPathAnnotation);
       
        when(mckPathAnnotation.getName()).thenReturn(qnPathAnnotation);
       
        final ResourceFunction resourceFunction = ResourceFunctionFactory.create(new URI("/some.xquery"), annotations);
        assertNotNull(resourceFunction);
        assertEquals(mckPathAnnotation, resourceFunction.getPathAnnotation());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.