test_class.declarator: home
test_class.modifier: private
test_class.original_string: private Folder home;
test_class.type: Folder
test_class.var_name: home
test_class.file: dataprep-api/src/test/java/org/talend/dataprep/api/service/FolderAPITest.java
test_class.identifier: FolderAPITest
test_class.superclass: extends ApiServiceTestBase
test_case.body: @Test
      public void shouldListPreparationsInFolder() throws Exception {
          // given
          folderRepository.addFolder(home.getId(), "/one");
          folderRepository.addFolder(home.getId(), "/two");
          testClient.createPreparationFromFile("dataset/dataset.csv", "yet another preparation", home.getId());
          testClient.createPreparationFromFile("dataset/dataset.csv", "prep 2", home.getId());
          testClient.createPreparationFromFile("dataset/dataset.csv", "preparation 3 !", home.getId());
  
          // when
          final Response response = given() //
                  .when()//
                  .expect()
                  .statusCode(200)
                  .log()
                  .ifError() //
                  .get("/api/folders/{id}/preparations", home.getId());
  
          // then
          assertThat(response.getStatusCode(), is(200));
          final JsonNode rootNode = mapper.readTree(response.asInputStream());
  
          final JsonNode folders = rootNode.get("folders");
          assertNotNull(folders);
          assertEquals(2, folders.size());
  
          final JsonNode preparations = rootNode.get("preparations");
          assertNotNull(preparations);
          assertEquals(3, preparations.size());
          for (JsonNode preparation : preparations) {
              final JsonNode dataset = preparation.get("dataset");
              // check for dataset
              assertNotNull(dataset);
              assertTrue(dataset.has("dataSetName"));
          }
      }
test_case.class_method_signature: FolderAPITest.shouldListPreparationsInFolder()
test_case.full_signature: @Test public void shouldListPreparationsInFolder()
test_case.identifier: shouldListPreparationsInFolder
test_case.invocations: addFolder getId addFolder getId createPreparationFromFile getId createPreparationFromFile getId createPreparationFromFile getId get ifError log statusCode expect when given getId assertThat getStatusCode is readTree asInputStream get assertNotNull assertEquals size get assertNotNull assertEquals size get assertNotNull assertTrue has
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldListPreparationsInFolder()
focal_class.file: dataprep-api/src/main/java/org/talend/dataprep/api/service/FolderAPI.java
focal_class.identifier: FolderAPI
focal_class.class_method_signature: FolderAPI.listFolders(@RequestParam(required = false) String parentId)
focal_class.full_signature: @RequestMapping(value = "/api/folders", method = GET) @ApiOperation(value = "List folders. Optional filter on parent ID may be supplied.", produces = APPLICATION_JSON_VALUE) @Timed public ResponseEntity<StreamingResponseBody> listFolders(@RequestParam(required = false) String parentId)
focal_class.identifier: listFolders
focal_class.modifiers: @RequestMapping(value = "/api/folders", method = GET) @ApiOperation(value = "List folders. Optional filter on parent ID may be supplied.", produces = APPLICATION_JSON_VALUE) @Timed public
focal_class.parameters: (@RequestParam(required = false) String parentId)
focal_class.return: ResponseEntity<StreamingResponseBody>
focal_class.signature: ResponseEntity<StreamingResponseBody> listFolders(@RequestParam(required = false) String parentId)
focal_class.class_method_signature: FolderAPI.getTree()
focal_class.full_signature: @RequestMapping(value = "/api/folders/tree", method = GET) @ApiOperation(value = "List all folders", produces = APPLICATION_JSON_VALUE) @Timed public StreamingResponseBody getTree()
focal_class.identifier: getTree
focal_class.modifiers: @RequestMapping(value = "/api/folders/tree", method = GET) @ApiOperation(value = "List all folders", produces = APPLICATION_JSON_VALUE) @Timed public
focal_class.parameters: ()
focal_class.return: StreamingResponseBody
focal_class.signature: StreamingResponseBody getTree()
focal_class.class_method_signature: FolderAPI.getFolderAndHierarchyById(@PathVariable(value = "id") final String id)
focal_class.full_signature: @RequestMapping(value = "/api/folders/{id}", method = GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Get folder by id", produces = APPLICATION_JSON_VALUE, notes = "Get a folder by id") @Timed public ResponseEntity<StreamingResponseBody> getFolderAndHierarchyById(@PathVariable(value = "id") final String id)
focal_class.identifier: getFolderAndHierarchyById
focal_class.modifiers: @RequestMapping(value = "/api/folders/{id}", method = GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Get folder by id", produces = APPLICATION_JSON_VALUE, notes = "Get a folder by id") @Timed public
focal_class.parameters: (@PathVariable(value = "id") final String id)
focal_class.return: ResponseEntity<StreamingResponseBody>
focal_class.signature: ResponseEntity<StreamingResponseBody> getFolderAndHierarchyById(@PathVariable(value = "id") final String id)
focal_class.class_method_signature: FolderAPI.addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_class.full_signature: @RequestMapping(value = "/api/folders", method = PUT) @ApiOperation(value = "Add a folder.", produces = APPLICATION_JSON_VALUE) @Timed public StreamingResponseBody addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_class.identifier: addFolder
focal_class.modifiers: @RequestMapping(value = "/api/folders", method = PUT) @ApiOperation(value = "Add a folder.", produces = APPLICATION_JSON_VALUE) @Timed public
focal_class.parameters: (@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_class.return: StreamingResponseBody
focal_class.signature: StreamingResponseBody addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_class.class_method_signature: FolderAPI.removeFolder(@PathVariable final String id, final OutputStream output)
focal_class.full_signature: @RequestMapping(value = "/api/folders/{id}", method = DELETE) @ApiOperation(value = "Remove a Folder") @Timed public ResponseEntity<String> removeFolder(@PathVariable final String id, final OutputStream output)
focal_class.identifier: removeFolder
focal_class.modifiers: @RequestMapping(value = "/api/folders/{id}", method = DELETE) @ApiOperation(value = "Remove a Folder") @Timed public
focal_class.parameters: (@PathVariable final String id, final OutputStream output)
focal_class.return: ResponseEntity<String>
focal_class.signature: ResponseEntity<String> removeFolder(@PathVariable final String id, final OutputStream output)
focal_class.class_method_signature: FolderAPI.renameFolder(@PathVariable final String id, @RequestBody final String newName)
focal_class.full_signature: @RequestMapping(value = "/api/folders/{id}/name", method = PUT) @ApiOperation(value = "Rename a Folder") @Timed public void renameFolder(@PathVariable final String id, @RequestBody final String newName)
focal_class.identifier: renameFolder
focal_class.modifiers: @RequestMapping(value = "/api/folders/{id}/name", method = PUT) @ApiOperation(value = "Rename a Folder") @Timed public
focal_class.parameters: (@PathVariable final String id, @RequestBody final String newName)
focal_class.return: void
focal_class.signature: void renameFolder(@PathVariable final String id, @RequestBody final String newName)
focal_class.class_method_signature: FolderAPI.search(@RequestParam(required = false) final String name,
              @RequestParam(required = false) final Boolean strict, @RequestParam(required = false) final String path)
focal_class.full_signature: @RequestMapping(value = "/api/folders/search", method = GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Search Folders with parameter as part of the name", produces = APPLICATION_JSON_VALUE) @Timed public ResponseEntity<StreamingResponseBody> search(@RequestParam(required = false) final String name,
              @RequestParam(required = false) final Boolean strict, @RequestParam(required = false) final String path)
focal_class.identifier: search
focal_class.modifiers: @RequestMapping(value = "/api/folders/search", method = GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Search Folders with parameter as part of the name", produces = APPLICATION_JSON_VALUE) @Timed public
focal_class.parameters: (@RequestParam(required = false) final String name,
              @RequestParam(required = false) final Boolean strict, @RequestParam(required = false) final String path)
focal_class.return: ResponseEntity<StreamingResponseBody>
focal_class.signature: ResponseEntity<StreamingResponseBody> search(@RequestParam(required = false) final String name,
              @RequestParam(required = false) final Boolean strict, @RequestParam(required = false) final String path)
focal_class.class_method_signature: FolderAPI.listPreparationsByFolder(
              @PathVariable @ApiParam(name = "id", value = "The destination to search preparations from.") final String id, //
              @ApiParam(value = "Sort key (by name or date), defaults to 'date'.") @RequestParam(defaultValue = "creationDate") final Sort sort, //
              @ApiParam(value = "Order for sort key (desc or asc), defaults to 'desc'.") @RequestParam(defaultValue = "desc") final Order order)
focal_class.full_signature: @RequestMapping(value = "/api/folders/{id}/preparations", method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Get all preparations for a given id.", notes = "Returns the list of preparations for the given id the current user is allowed to see.") @Timed public PreparationsByFolder listPreparationsByFolder(
              @PathVariable @ApiParam(name = "id", value = "The destination to search preparations from.") final String id, //
              @ApiParam(value = "Sort key (by name or date), defaults to 'date'.") @RequestParam(defaultValue = "creationDate") final Sort sort, //
              @ApiParam(value = "Order for sort key (desc or asc), defaults to 'desc'.") @RequestParam(defaultValue = "desc") final Order order)
focal_class.identifier: listPreparationsByFolder
focal_class.modifiers: @RequestMapping(value = "/api/folders/{id}/preparations", method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Get all preparations for a given id.", notes = "Returns the list of preparations for the given id the current user is allowed to see.") @Timed public
focal_class.parameters: (
              @PathVariable @ApiParam(name = "id", value = "The destination to search preparations from.") final String id, //
              @ApiParam(value = "Sort key (by name or date), defaults to 'date'.") @RequestParam(defaultValue = "creationDate") final Sort sort, //
              @ApiParam(value = "Order for sort key (desc or asc), defaults to 'desc'.") @RequestParam(defaultValue = "desc") final Order order)
focal_class.return: PreparationsByFolder
focal_class.signature: PreparationsByFolder listPreparationsByFolder(
              @PathVariable @ApiParam(name = "id", value = "The destination to search preparations from.") final String id, //
              @ApiParam(value = "Sort key (by name or date), defaults to 'date'.") @RequestParam(defaultValue = "creationDate") final Sort sort, //
              @ApiParam(value = "Order for sort key (desc or asc), defaults to 'desc'.") @RequestParam(defaultValue = "desc") final Order order)
focal_class.superclass: extends APIService
focal_method.body: @RequestMapping(value = "/api/folders", method = PUT)
      @ApiOperation(value = "Add a folder.", produces = APPLICATION_JSON_VALUE)
      @Timed
      public StreamingResponseBody addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path) {
          try {
              final HystrixCommand<InputStream> createChildFolder = getCommand(CreateChildFolder.class, parentId, path);
              return CommandHelper.toStreaming(createChildFolder);
          } catch (Exception e) {
              throw new TDPException(APIErrorCodes.UNABLE_TO_CREATE_FOLDER, e);
          }
      }
focal_method.class_method_signature: FolderAPI.addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_method.full_signature: @RequestMapping(value = "/api/folders", method = PUT) @ApiOperation(value = "Add a folder.", produces = APPLICATION_JSON_VALUE) @Timed public StreamingResponseBody addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_method.identifier: addFolder
focal_method.invocations: getCommand toStreaming
focal_method.modifiers: @RequestMapping(value = "/api/folders", method = PUT) @ApiOperation(value = "Add a folder.", produces = APPLICATION_JSON_VALUE) @Timed public
focal_method.parameters: (@RequestParam(required = false) final String parentId,
              @RequestParam final String path)
focal_method.return: StreamingResponseBody
focal_method.signature: StreamingResponseBody addFolder(@RequestParam(required = false) final String parentId,
              @RequestParam final String path)