use of javax.ws.rs.core.PathSegment in project scheduling by ow2-proactive.
the class WorkflowVariablesTransformerTest method testEmptyMap.
@Test
public void testEmptyMap() {
PathSegment pathSegment = mock(PathSegment.class);
MultivaluedMap<String, String> multivalueMap = new MultivaluedHashMap();
when(pathSegment.getMatrixParameters()).thenReturn(multivalueMap);
Map<String, String> variables = workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment);
assertThat(variables, is(nullValue()));
}
use of javax.ws.rs.core.PathSegment in project scheduling by ow2-proactive.
the class WorkflowVariablesTransformerTest method testTwoVariablesNullMap.
@Test
public void testTwoVariablesNullMap() {
Map<String, String> expectedVariables = Maps.newHashMap();
expectedVariables.put("KEY1", "");
expectedVariables.put("KEY2", "");
PathSegment pathSegment = mock(PathSegment.class);
MultivaluedMap<String, String> multivalueMap = new MultivaluedHashMap();
multivalueMap.put("KEY1", null);
multivalueMap.put("KEY2", null);
when(pathSegment.getMatrixParameters()).thenReturn(multivalueMap);
Map<String, String> variables = workflowVariablesTransformer.getWorkflowVariablesFromPathSegment(pathSegment);
assertThat(variables, is(expectedVariables));
}
use of javax.ws.rs.core.PathSegment in project Payara by payara.
the class CompositeResource method getParentUri.
private URI getParentUri(boolean isCollectionChild) throws Exception {
List<PathSegment> pathSegments = this.uriInfo.getPathSegments();
// go up a level to get to the parent
int count = pathSegments.size() - 1;
if (isCollectionChild) {
// collection children have the url pattern .../foos/id/myfoo. need to go up another level
count--;
}
// [0] = 'javaservice', which is a resource
if (count <= 0) {
// top level resource
return null;
}
UriBuilder bldr = this.uriInfo.getBaseUriBuilder();
for (int i = 0; i < count; i++) {
bldr.path(pathSegments.get(i).getPath());
}
return bldr.build();
}
Aggregations