test_class.declarator: task
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private RenameDataSetsWithFolderPath task;
test_class.type: RenameDataSetsWithFolderPath
test_class.var_name: task
test_class.declarator: repository
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private DataSetMetadataRepository repository;
test_class.type: DataSetMetadataRepository
test_class.var_name: repository
test_class.file: dataprep-upgrade/src/test/java/org/talend/dataprep/upgrade/to_1_2_0_PE/RenameDataSetsWithFolderPathTest.java
test_class.identifier: RenameDataSetsWithFolderPathTest
test_class.superclass: extends Base_1_2_0_PE_Test
test_case.body: @Test
      public void shouldRenameDataSets() throws Exception {
  
          // given
          List<String> expected = new ArrayList<>();
          expected.add("cars");
          expected.add("us_states - my lookup");
          expected.add("communes_france - personnal/confidential");
          expected.add("Emails Reference - Quick Examples and Tutorials/Lookup");
          expected.add("Customer Contact Data - Quick Examples and Tutorials");
          expected.add("Business Unit Regions With States - Quick Examples and Tutorials/Lookup");
          expected.add("HRMS Export - Quick Examples and Tutorials");
          expected.add("nba_franchises");
          expected.add("Marketing Leads - Quick Examples and Tutorials");
          expected.add("CRM Export - Quick Examples and Tutorials");
          expected.add("Customer Marketing Leads - Quick Examples and Tutorials");
  
          // when
          task.run();
  
          // then
          final Stream<DataSetMetadata> list = repository.list();
          final List<String> names = list.map(DataSetMetadata::getName).collect(toList());
          assertTrue(names.containsAll(expected));
      }
test_case.class_method_signature: RenameDataSetsWithFolderPathTest.shouldRenameDataSets()
test_case.full_signature: @Test public void shouldRenameDataSets()
test_case.identifier: shouldRenameDataSets
test_case.invocations: add add add add add add add add add add add run list collect map toList assertTrue containsAll
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldRenameDataSets()
focal_class.declarator: LOG = getLogger(RenameDataSetsWithFolderPath.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = getLogger(RenameDataSetsWithFolderPath.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: dataSetMetadataRepository
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private DataSetMetadataRepository dataSetMetadataRepository;
focal_class.type: DataSetMetadataRepository
focal_class.var_name: dataSetMetadataRepository
focal_class.declarator: folderRepository
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private FolderRepository folderRepository;
focal_class.type: FolderRepository
focal_class.var_name: folderRepository
focal_class.file: dataprep-upgrade/src/main/java/org/talend/dataprep/upgrade/to_1_2_0_PE/RenameDataSetsWithFolderPath.java
focal_class.identifier: RenameDataSetsWithFolderPath
focal_class.interfaces: implements BaseUpgradeTaskTo_1_2_0_PE
focal_class.class_method_signature: RenameDataSetsWithFolderPath.getOrder()
focal_class.full_signature: @Override public int getOrder()
focal_class.identifier: getOrder
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getOrder()
focal_class.class_method_signature: RenameDataSetsWithFolderPath.getTarget()
focal_class.full_signature: @Override public target getTarget()
focal_class.identifier: getTarget
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: target
focal_class.signature: target getTarget()
focal_class.class_method_signature: RenameDataSetsWithFolderPath.run()
focal_class.full_signature: @Override public void run()
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_method.body: @Override
      public void run() {
  
          final Stream<DataSetMetadata> datasets = dataSetMetadataRepository.list();
          datasets.forEach(dataset -> {
              final Folder folder = folderRepository.locateEntry(dataset.getId(), FolderContentType.DATASET);
              // skip home folder
              if (folder != null && !StringUtils.equals("/", folder.getPath())) {
                  String newName = dataset.getName() + " - " + StringUtils.strip(folder.getPath(), "/");
                  dataset.setName(newName);
                  dataSetMetadataRepository.save(dataset);
                  LOG.debug("dataset #{} renamed to {}", dataset.getId(), newName);
              } else {
                  LOG.debug("dataset #{} not renamed since it's in the user home folder", dataset.getId());
              }
          });
      }
focal_method.class_method_signature: RenameDataSetsWithFolderPath.run()
focal_method.full_signature: @Override public void run()
focal_method.identifier: run
focal_method.invocations: list forEach locateEntry getId equals getPath getName strip getPath setName save debug getId debug getId
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void run()