@PreAuthorize("hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{projectId}/application/{applicationId}/create/resource", method = RequestMethod.GET) public ModelAndView defaultPage(@PathVariable final String projectId, @PathVariable final String applicationId) { final RestResource restResource = new RestResource(); restResource.setUri(SLASH); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(REST_PROJECT_ID, projectId); model.addObject(REST_APPLICATION_ID, applicationId); model.addObject(REST_RESOURCE, restResource); return model; }
public static RestResource generateRestResource(){ final RestResource restResource = new RestResource(); restResource.setId("REST Resource"); restResource.setName("Rest resource name"); restResource.setMethods(new ArrayList<RestMethod>()); restResource.setUri("URI"); return restResource; }
RestResource createRestResource(String applicationId, String uri) { RestResource restResource = new RestResource(); restResource.setApplicationId(applicationId); restResource.setUri(uri); return restResource; } }
for(Element resourceElement : resourceElements){ final String resourceName = resourceElement.getAttribute("path"); final RestResource restResource = new RestResource(); restResource.setName(resourceName); restResource.setUri(baseUri.orElse("") + resourceName);
RestResource restResource = new RestResource(); restResource.setName(uri); restResource.setUri(uri);
RestResource restResource = new RestResource(); restResource.setName(resource.displayName().value()); restResource.setUri(uri);
final String resourceName = pathEntry.getKey(); final Path resourcePath = pathEntry.getValue(); final RestResource restResource = new RestResource();
@Test public void projectFunctionalityDelete() throws Exception { final String projectId = "projectId"; final String applicationId = "applicationId"; final String[] restResourceIds = {"restApplication1", "restApplication2"}; final RestResource restResource1 = new RestResource(); restResource1.setName("restResource1"); final RestResource restResource2 = new RestResource(); restResource2.setName("restResource2"); final List<RestResource> restResources = Arrays.asList(restResource1, restResource2); Mockito.when(serviceProcessor.process(Mockito.any(ReadRestResourceInput.class))) .thenReturn(ReadRestResourceOutput.builder().restResource(restResource1).build()) .thenReturn(ReadRestResourceOutput.builder().restResource(restResource2).build()); final RestResourceModifierCommand command = new RestResourceModifierCommand(); command.setRestResourceIds(restResourceIds); final MockHttpServletRequestBuilder message = MockMvcRequestBuilders.post(SERVICE_URL + PROJECT + SLASH + projectId + SLASH + APPLICATION + SLASH + applicationId) .param("action", "delete").flashAttr("command", command); mockMvc.perform(message) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.model().size(4 + GLOBAL_VIEW_MODEL_COUNT)) .andExpect(MockMvcResultMatchers.forwardedUrl(INDEX)) .andExpect(MockMvcResultMatchers.model().attribute(PARTIAL, DELETE_REST_RESOURCES_PAGE)) .andExpect(MockMvcResultMatchers.model().attribute(REST_PROJECT_ID, projectId)) .andExpect(MockMvcResultMatchers.model().attribute(REST_APPLICATION_ID, applicationId)) .andExpect(MockMvcResultMatchers.model().attribute(REST_RESOURCES, restResources)) .andExpect(MockMvcResultMatchers.model().attributeExists(DELETE_REST_RESOURCES_COMMAND)); Mockito.verify(serviceProcessor, Mockito.times(2)).process(Mockito.any(ReadRestResourceInput.class)); }
final String[] restResourceIds = {"restApplication1", "restApplication2"}; final RestResource restResource1 = new RestResource(); restResource1.setName("restResource1"); final RestResource restResource2 = new RestResource(); restResource2.setName("restResource2");
RestResource resource = new RestResource(); resource.setUri(restResourceV1.getUri()); resource.setName(restResourceV1.getName());