test_class.file: lang-python/src/test/java/org/eclipse/steady/python/pip/PipWrapperTest.java
test_class.identifier: PipWrapperTest
test_case.body: @Test
    @Category(Slow.class)
    public void testGetFreezePackages() throws ProcessWrapperException, FileAnalysisException {
      VulasConfiguration.getGlobal().setProperty(ThreadUtil.NO_OF_THREADS, "AUTO");
      final PipWrapper pip = new PipWrapper();
      Set<PipInstalledPackage> packs = null;
      try {
        packs = pip.getFreezePackages();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      assertTrue(packs.size() > 0);
  
      // Compute the digests
      for (PipInstalledPackage p : packs) {
        System.out.println(p);
        /*if(p.getName().equals("setuptools")) {
        	final String sha1 = p.getSha1();
        	assertTrue(sha1!=null && sha1.length()>0);
        	assertTrue(p.getConstructs().size()>0);
        }*/
      }
    }
test_case.class_method_signature: PipWrapperTest.testGetFreezePackages()
test_case.full_signature: @Test @Category(Slow.class) public void testGetFreezePackages()
test_case.identifier: testGetFreezePackages
test_case.invocations: setProperty getGlobal getFreezePackages printStackTrace printStackTrace assertTrue size println
test_case.modifiers: @Test @Category(Slow.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetFreezePackages()
focal_class.declarator: log = org.apache.logging.log4j.LogManager.getLogger()
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = org.apache.logging.log4j.LogManager.getLogger();
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: DOWNLOAD_PATTERN = Pattern.compile("^\\s*Downloading\\s*(http\\S*).*$")
focal_class.modifier: static final
focal_class.original_string: static final Pattern DOWNLOAD_PATTERN = Pattern.compile("^\\s*Downloading\\s*(http\\S*).*$");
focal_class.type: Pattern
focal_class.var_name: DOWNLOAD_PATTERN
focal_class.declarator: SAVED_PATTERN_1 =
        Pattern.compile("^\\s*File was already downloaded\\s*(.*)$")
focal_class.modifier: static final
focal_class.original_string: static final Pattern SAVED_PATTERN_1 =
        Pattern.compile("^\\s*File was already downloaded\\s*(.*)$");
focal_class.type: Pattern
focal_class.var_name: SAVED_PATTERN_1
focal_class.declarator: SAVED_PATTERN_2 = Pattern.compile("^\\s*Saved\\s*(.*)$")
focal_class.modifier: static final
focal_class.original_string: static final Pattern SAVED_PATTERN_2 = Pattern.compile("^\\s*Saved\\s*(.*)$");
focal_class.type: Pattern
focal_class.var_name: SAVED_PATTERN_2
focal_class.declarator: PACK_PATTERN_REGEX = ".*<pack>-<version>.*"
focal_class.modifier: static final
focal_class.original_string: static final String PACK_PATTERN_REGEX = ".*<pack>-<version>.*";
focal_class.type: String
focal_class.var_name: PACK_PATTERN_REGEX
focal_class.declarator: pathToPip = null
focal_class.modifier: private
focal_class.original_string: private Path pathToPip = null;
focal_class.type: Path
focal_class.var_name: pathToPip
focal_class.declarator: logDir = null
focal_class.modifier: private
focal_class.original_string: private Path logDir = null;
focal_class.type: Path
focal_class.var_name: logDir
focal_class.declarator: ignorePacks = new StringList()
focal_class.modifier: private
focal_class.original_string: private StringList ignorePacks = new StringList();
focal_class.type: StringList
focal_class.var_name: ignorePacks
focal_class.file: lang-python/src/main/java/org/eclipse/steady/python/pip/PipWrapper.java
focal_class.identifier: PipWrapper
focal_class.class_method_signature: PipWrapper.PipWrapper()
focal_class.full_signature: public  PipWrapper()
focal_class.identifier: PipWrapper
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  PipWrapper()
focal_class.class_method_signature: PipWrapper.PipWrapper(Path _path_to_pip, Path _log_dir)
focal_class.full_signature: public  PipWrapper(Path _path_to_pip, Path _log_dir)
focal_class.identifier: PipWrapper
focal_class.modifiers: public
focal_class.parameters: (Path _path_to_pip, Path _log_dir)
focal_class.signature:  PipWrapper(Path _path_to_pip, Path _log_dir)
focal_class.class_method_signature: PipWrapper.ignorePackage(String _p)
focal_class.full_signature: private boolean ignorePackage(String _p)
focal_class.identifier: ignorePackage
focal_class.modifiers: private
focal_class.parameters: (String _p)
focal_class.return: boolean
focal_class.signature: boolean ignorePackage(String _p)
focal_class.class_method_signature: PipWrapper.isAvailable()
focal_class.full_signature: public boolean isAvailable()
focal_class.identifier: isAvailable
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isAvailable()
focal_class.class_method_signature: PipWrapper.installPackages(Path _project)
focal_class.full_signature: public Set<PipInstalledPackage> installPackages(Path _project)
focal_class.identifier: installPackages
focal_class.modifiers: public
focal_class.parameters: (Path _project)
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> installPackages(Path _project)
focal_class.class_method_signature: PipWrapper.getFreezePackages()
focal_class.full_signature: public Set<PipInstalledPackage> getFreezePackages()
focal_class.identifier: getFreezePackages
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> getFreezePackages()
focal_class.class_method_signature: PipWrapper.parsePipFreezeOutput(Path _file)
focal_class.full_signature: private Set<PipInstalledPackage> parsePipFreezeOutput(Path _file)
focal_class.identifier: parsePipFreezeOutput
focal_class.modifiers: private
focal_class.parameters: (Path _file)
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> parsePipFreezeOutput(Path _file)
focal_class.class_method_signature: PipWrapper.getListPackages()
focal_class.full_signature: public Set<PipInstalledPackage> getListPackages()
focal_class.identifier: getListPackages
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> getListPackages()
focal_class.class_method_signature: PipWrapper.parsePipListOutput(Path _file)
focal_class.full_signature: private Set<PipInstalledPackage> parsePipListOutput(Path _file)
focal_class.identifier: parsePipListOutput
focal_class.modifiers: private
focal_class.parameters: (Path _file)
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> parsePipListOutput(Path _file)
focal_class.class_method_signature: PipWrapper.deserializePipListOutput(Path _file)
focal_class.full_signature: private Set<PipInstalledPackage> deserializePipListOutput(Path _file)
focal_class.identifier: deserializePipListOutput
focal_class.modifiers: private
focal_class.parameters: (Path _file)
focal_class.return: Set<PipInstalledPackage>
focal_class.signature: Set<PipInstalledPackage> deserializePipListOutput(Path _file)
focal_class.class_method_signature: PipWrapper.parsePipShowOutput(Path _file)
focal_class.full_signature: private Map<String, String> parsePipShowOutput(Path _file)
focal_class.identifier: parsePipShowOutput
focal_class.modifiers: private
focal_class.parameters: (Path _file)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> parsePipShowOutput(Path _file)
focal_class.class_method_signature: PipWrapper.searchDownloadInfo(Set<PipInstalledPackage> _packs, String _out)
focal_class.full_signature:  void searchDownloadInfo(Set<PipInstalledPackage> _packs, String _out)
focal_class.identifier: searchDownloadInfo
focal_class.parameters: (Set<PipInstalledPackage> _packs, String _out)
focal_class.return: void
focal_class.signature: void searchDownloadInfo(Set<PipInstalledPackage> _packs, String _out)
focal_class.class_method_signature: PipWrapper.searchDownloadInfo(PipInstalledPackage _p, String _out)
focal_class.full_signature: private void searchDownloadInfo(PipInstalledPackage _p, String _out)
focal_class.identifier: searchDownloadInfo
focal_class.modifiers: private
focal_class.parameters: (PipInstalledPackage _p, String _out)
focal_class.return: void
focal_class.signature: void searchDownloadInfo(PipInstalledPackage _p, String _out)
focal_method.body: public Set<PipInstalledPackage> getFreezePackages()
        throws ProcessWrapperException, IOException, InterruptedException {
      final StopWatch sw = new StopWatch("pip freeze").start();
      Set<PipInstalledPackage> packages = null;
      ProcessWrapper pw = new ProcessWrapper().setCommand(this.pathToPip, "freeze").setPath(logDir);
      final Thread t = new Thread(pw, "pip");
      t.start();
      t.join();
      if (pw.terminatedWithSuccess()) {
        // Create packages
        packages = this.parsePipFreezeOutput(pw.getOutFile());
  
        // Log
        log.info("Found [" + packages.size() + "] pip packages:");
        for (PipInstalledPackage pack : packages) log.info("    " + pack);
  
        // Call pip show and pip download in separate threads
        final ExecutorService pool =
            Executors.newFixedThreadPool(ThreadUtil.getNoThreads(2)); // newSingleThreadExecutor();
        final Set<Future<PipInstalledPackage>> futures = new HashSet<Future<PipInstalledPackage>>();
        for (PipInstalledPackage pack : packages) {
          futures.add(pool.submit(new PipShow(pack)));
          futures.add(pool.submit(new PipDownload(pack)));
        }
        pool.shutdown();
        try {
          while (!pool.awaitTermination(10, TimeUnit.SECONDS)) {
            int done = 0;
            for (Future<PipInstalledPackage> f : futures) {
              if (f.isDone()) done++;
            }
            sw.lap("[" + done + "/" + futures.size() + "] pip jobs are done");
          }
        } catch (InterruptedException e) {
          PipWrapper.log.error("Interrupt exception");
        }
      }
      sw.stop();
      return packages;
    }
focal_method.class_method_signature: PipWrapper.getFreezePackages()
focal_method.full_signature: public Set<PipInstalledPackage> getFreezePackages()
focal_method.identifier: getFreezePackages
focal_method.invocations: start setPath setCommand start join terminatedWithSuccess parsePipFreezeOutput getOutFile info size info newFixedThreadPool getNoThreads add submit add submit shutdown awaitTermination isDone lap size error stop
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Set<PipInstalledPackage>
focal_method.signature: Set<PipInstalledPackage> getFreezePackages()