test_class.file: rest-backend/src/test/java/org/eclipse/steady/backend/component/ApplicationExporterTest.java
test_class.identifier: ApplicationExporterTest
test_case.body: @Test
    public void testPartition() {
      // 1x10
      Set<List<Integer>> parts = ApplicationExporter.partition(this.createList(10), 1);
      int num = 0;
      assertEquals(1, parts.size());
      assertEquals(10, parts.iterator().next().size());
  
      // 0
      parts = ApplicationExporter.partition(null, 10);
      num = 0;
      assertEquals(0, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(false);
      }
      assertEquals(0, num);
  
      // 1x0
      parts = ApplicationExporter.partition(this.createList(0), 10);
      num = 0;
      assertEquals(1, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 0);
        num += part.size();
      }
      assertEquals(0, num);
  
      // 1x1
      parts = ApplicationExporter.partition(this.createList(1), 10);
      num = 0;
      assertEquals(1, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 1);
        num += part.size();
      }
      assertEquals(1, num);
  
      // 1x2
      parts = ApplicationExporter.partition(this.createList(2), 10);
      num = 0;
      assertEquals(1, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 2);
        num += part.size();
      }
      assertEquals(2, num);
  
      // 10x1
      parts = ApplicationExporter.partition(this.createList(10), 10);
      num = 0;
      assertEquals(10, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 1);
        num += part.size();
      }
      assertEquals(10, num);
  
      // 5x2
      parts = ApplicationExporter.partition(this.createList(10), 5);
      num = 0;
      assertEquals(5, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 2);
        num += part.size();
      }
      assertEquals(10, num);
  
      // 4x2 + 1x3 = 11
      parts = ApplicationExporter.partition(this.createList(11), 5);
      num = 0;
      assertEquals(5, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 2 || part.size() == 3);
        num += part.size();
      }
      assertEquals(11, num);
  
      // 4x2 + 1x4
      parts = ApplicationExporter.partition(this.createList(12), 5);
      num = 0;
      assertEquals(5, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 2 || part.size() == 4);
        num += part.size();
      }
      assertEquals(12, num);
  
      // 39x28 + 1x38 = 1030
      parts = ApplicationExporter.partition(this.createList(1130), 40);
      num = 0;
      assertEquals(40, parts.size());
      for (List<Integer> part : parts) {
        assertTrue(part.size() == 28 || part.size() == 38);
        num += part.size();
      }
      assertEquals(1130, num);
    }
test_case.class_method_signature: ApplicationExporterTest.testPartition()
test_case.full_signature: @Test public void testPartition()
test_case.identifier: testPartition
test_case.invocations: partition createList assertEquals size assertEquals size next iterator partition assertEquals size assertTrue assertEquals partition createList assertEquals size assertTrue size size assertEquals partition createList assertEquals size assertTrue size size assertEquals partition createList assertEquals size assertTrue size size assertEquals partition createList assertEquals size assertTrue size size assertEquals partition createList assertEquals size assertTrue size size assertEquals partition createList assertEquals size assertTrue size size size assertEquals partition createList assertEquals size assertTrue size size size assertEquals partition createList assertEquals size assertTrue size size size assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPartition()
focal_class.declarator: log = LoggerFactory.getLogger(ApplicationExporter.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger log = LoggerFactory.getLogger(ApplicationExporter.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: EXPORT_FILE_PREFIX = "vulas_all_apps-"
focal_class.modifier: private static final
focal_class.original_string: private static final String EXPORT_FILE_PREFIX = "vulas_all_apps-";
focal_class.type: String
focal_class.var_name: EXPORT_FILE_PREFIX
focal_class.declarator: DATE_FORMAT = new SimpleDateFormat("yyyyMMdd")
focal_class.modifier: private static final
focal_class.original_string: private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
focal_class.type: DateFormat
focal_class.var_name: DATE_FORMAT
focal_class.declarator: no_threads = ThreadUtil.getNoThreads()
focal_class.modifier: final
focal_class.original_string: final int no_threads = ThreadUtil.getNoThreads();
focal_class.type: int
focal_class.var_name: no_threads
focal_class.declarator: applicationContext
focal_class.modifier: @Autowired private
focal_class.original_string: @Autowired private ApplicationContext applicationContext;
focal_class.type: ApplicationContext
focal_class.var_name: applicationContext
focal_class.declarator: appRepository
focal_class.modifier: @Autowired private
focal_class.original_string: @Autowired private ApplicationRepository appRepository;
focal_class.type: ApplicationRepository
focal_class.var_name: appRepository
focal_class.file: rest-backend/src/main/java/org/eclipse/steady/backend/component/ApplicationExporter.java
focal_class.identifier: ApplicationExporter
focal_class.class_method_signature: ApplicationExporter.produceExportAsync(
        final Tenant _tenant,
        final Space _space,
        final String separator,
        final String[] includeSpaceProperties,
        final String[] includeGoalConfiguration,
        final String[] includeGoalSystemInfo,
        final String[] _selected_bugs,
        final boolean _incl_all_bugs,
        final boolean _incl_exemptions,
        final ExportFormat _format,
        final Message _msg)
focal_class.full_signature: public synchronized void produceExportAsync(
        final Tenant _tenant,
        final Space _space,
        final String separator,
        final String[] includeSpaceProperties,
        final String[] includeGoalConfiguration,
        final String[] includeGoalSystemInfo,
        final String[] _selected_bugs,
        final boolean _incl_all_bugs,
        final boolean _incl_exemptions,
        final ExportFormat _format,
        final Message _msg)
focal_class.identifier: produceExportAsync
focal_class.modifiers: public synchronized
focal_class.parameters: (
        final Tenant _tenant,
        final Space _space,
        final String separator,
        final String[] includeSpaceProperties,
        final String[] includeGoalConfiguration,
        final String[] includeGoalSystemInfo,
        final String[] _selected_bugs,
        final boolean _incl_all_bugs,
        final boolean _incl_exemptions,
        final ExportFormat _format,
        final Message _msg)
focal_class.return: void
focal_class.signature: void produceExportAsync(
        final Tenant _tenant,
        final Space _space,
        final String separator,
        final String[] includeSpaceProperties,
        final String[] includeGoalConfiguration,
        final String[] includeGoalSystemInfo,
        final String[] _selected_bugs,
        final boolean _incl_all_bugs,
        final boolean _incl_exemptions,
        final ExportFormat _format,
        final Message _msg)
focal_class.class_method_signature: ApplicationExporter.produceExport(
        Tenant _tenant,
        Space _space,
        String separator,
        String[] includeSpaceProperties,
        String[] includeGoalConfiguration,
        String[] includeGoalSystemInfo,
        String[] _selected_bugs,
        boolean _incl_all_bugs,
        boolean _incl_exemptions,
        ExportFormat _format)
focal_class.full_signature: @Transactional public synchronized Path produceExport(
        Tenant _tenant,
        Space _space,
        String separator,
        String[] includeSpaceProperties,
        String[] includeGoalConfiguration,
        String[] includeGoalSystemInfo,
        String[] _selected_bugs,
        boolean _incl_all_bugs,
        boolean _incl_exemptions,
        ExportFormat _format)
focal_class.identifier: produceExport
focal_class.modifiers: @Transactional public synchronized
focal_class.parameters: (
        Tenant _tenant,
        Space _space,
        String separator,
        String[] includeSpaceProperties,
        String[] includeGoalConfiguration,
        String[] includeGoalSystemInfo,
        String[] _selected_bugs,
        boolean _incl_all_bugs,
        boolean _incl_exemptions,
        ExportFormat _format)
focal_class.return: Path
focal_class.signature: Path produceExport(
        Tenant _tenant,
        Space _space,
        String separator,
        String[] includeSpaceProperties,
        String[] includeGoalConfiguration,
        String[] includeGoalSystemInfo,
        String[] _selected_bugs,
        boolean _incl_all_bugs,
        boolean _incl_exemptions,
        ExportFormat _format)
focal_class.class_method_signature: ApplicationExporter.partition(List<T> _list, int _num)
focal_class.full_signature: public static Set<List<T>> partition(List<T> _list, int _num)
focal_class.identifier: partition
focal_class.modifiers: public static
focal_class.parameters: (List<T> _list, int _num)
focal_class.return: Set<List<T>>
focal_class.signature: Set<List<T>> partition(List<T> _list, int _num)
focal_method.body: public static <T> Set<List<T>> partition(List<T> _list, int _num)
        throws IllegalArgumentException {
      final Set<List<T>> parts = new HashSet<List<T>>();
  
      // Number of parts must be > 0
      if (_num < 1)
        throw new IllegalArgumentException(
            "Number of partitions must be greater than 0 but is [" + _num + "]");
  
      // No list
      else if (_list == null)
        ;
  
      // Return 1 part only
      else if (_list.size() < _num) parts.add(_list);
  
      // Create sublists
      else {
        final int size = (int) Math.floor((double) _list.size() / (double) _num);
        int i, min, max;
  
        // Create _partition_no -1 parts
        for (i = 0; i < _num - 1; i++) {
          min = i * size;
          max = Math.min((i + 1) * size, _list.size());
          if (max >= min) {
            parts.add(_list.subList(min, max));
          }
        }
  
        // Create last part with remaining elements
        min = i * size;
        max = Math.min((_num + 1) * size, _list.size());
        if (max >= min) {
          parts.add(_list.subList(min, max));
        }
      }
      return parts;
    }
focal_method.class_method_signature: ApplicationExporter.partition(List<T> _list, int _num)
focal_method.full_signature: public static Set<List<T>> partition(List<T> _list, int _num)
focal_method.identifier: partition
focal_method.invocations: size add floor size min size add subList min size add subList
focal_method.modifiers: public static
focal_method.parameters: (List<T> _list, int _num)
focal_method.return: Set<List<T>>
focal_method.signature: Set<List<T>> partition(List<T> _list, int _num)