test_class.file: rest-backend/src/test/java/org/eclipse/steady/backend/util/PyPiVerifierTest.java
test_class.identifier: PyPiVerifierTest
test_case.body: @Test
    public void testVerify() throws IOException {
      final String json = FileUtil.readFile("./src/test/resources/pypi_flask.json");
  
      PyPiVerifier ppv = new PyPiVerifier();
      assertTrue(ppv.containsMD5(json, "c1d30f51cff4a38f9454b23328a15c5a")); // Flask 0.11
      final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
      c.setTimeInMillis(1482351732000L);
      assertEquals(c, ppv.getReleaseTimestamp());
  
      ppv = new PyPiVerifier();
      assertFalse(ppv.containsMD5(json, "c1d30f51cff4a38f9454b23328a15c5azzzzz")); // Does not exist
      assertEquals(null, ppv.getReleaseTimestamp());
    }
test_case.class_method_signature: PyPiVerifierTest.testVerify()
test_case.full_signature: @Test public void testVerify()
test_case.identifier: testVerify
test_case.invocations: readFile assertTrue containsMD5 getInstance getTimeZone setTimeInMillis assertEquals getReleaseTimestamp assertFalse containsMD5 assertEquals getReleaseTimestamp
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testVerify()
focal_class.declarator: log = LoggerFactory.getLogger(PyPiVerifier.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger log = LoggerFactory.getLogger(PyPiVerifier.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: SUPP_LANG = new HashSet<ProgrammingLanguage>()
focal_class.modifier: private static
focal_class.original_string: private static Set<ProgrammingLanguage> SUPP_LANG = new HashSet<ProgrammingLanguage>();
focal_class.type: Set<ProgrammingLanguage>
focal_class.var_name: SUPP_LANG
focal_class.declarator: SUPP_ALG = new HashSet<DigestAlgorithm>()
focal_class.modifier: private static
focal_class.original_string: private static Set<DigestAlgorithm> SUPP_ALG = new HashSet<DigestAlgorithm>();
focal_class.type: Set<DigestAlgorithm>
focal_class.var_name: SUPP_ALG
focal_class.declarator: url = null
focal_class.modifier: private
focal_class.original_string: private String url = null;
focal_class.type: String
focal_class.var_name: url
focal_class.declarator: timestamp
focal_class.modifier: private
focal_class.original_string: private java.util.Calendar timestamp;
focal_class.type: java.util.Calendar
focal_class.var_name: timestamp
focal_class.declarator: dateFormat = null
focal_class.modifier: private
focal_class.original_string: private SimpleDateFormat dateFormat = null;
focal_class.type: SimpleDateFormat
focal_class.var_name: dateFormat
focal_class.file: rest-backend/src/main/java/org/eclipse/steady/backend/util/PyPiVerifier.java
focal_class.identifier: PyPiVerifier
focal_class.interfaces: implements DigestVerifier
focal_class.class_method_signature: PyPiVerifier.PyPiVerifier()
focal_class.full_signature: public  PyPiVerifier()
focal_class.identifier: PyPiVerifier
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  PyPiVerifier()
focal_class.class_method_signature: PyPiVerifier.getSupportedLanguages()
focal_class.full_signature: @Override public Set<ProgrammingLanguage> getSupportedLanguages()
focal_class.identifier: getSupportedLanguages
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Set<ProgrammingLanguage>
focal_class.signature: Set<ProgrammingLanguage> getSupportedLanguages()
focal_class.class_method_signature: PyPiVerifier.getSupportedDigestAlgorithms()
focal_class.full_signature: @Override public Set<DigestAlgorithm> getSupportedDigestAlgorithms()
focal_class.identifier: getSupportedDigestAlgorithms
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Set<DigestAlgorithm>
focal_class.signature: Set<DigestAlgorithm> getSupportedDigestAlgorithms()
focal_class.class_method_signature: PyPiVerifier.getVerificationUrl()
focal_class.full_signature: @Override public String getVerificationUrl()
focal_class.identifier: getVerificationUrl
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getVerificationUrl()
focal_class.class_method_signature: PyPiVerifier.getReleaseTimestamp()
focal_class.full_signature: @Override public java.util.Calendar getReleaseTimestamp()
focal_class.identifier: getReleaseTimestamp
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: java.util.Calendar
focal_class.signature: java.util.Calendar getReleaseTimestamp()
focal_class.class_method_signature: PyPiVerifier.verify(final Library _lib)
focal_class.full_signature: @Override public List<LibraryId> verify(final Library _lib)
focal_class.identifier: verify
focal_class.modifiers: @Override public
focal_class.parameters: (final Library _lib)
focal_class.return: List<LibraryId>
focal_class.signature: List<LibraryId> verify(final Library _lib)
focal_class.class_method_signature: PyPiVerifier.containsMD5(String _json, final String _md5)
focal_class.full_signature:  boolean containsMD5(String _json, final String _md5)
focal_class.identifier: containsMD5
focal_class.parameters: (String _json, final String _md5)
focal_class.return: boolean
focal_class.signature: boolean containsMD5(String _json, final String _md5)
focal_method.body: @Override
    public List<LibraryId> verify(final Library _lib) throws VerificationException {
      if (_lib == null || _lib.getDigest() == null)
        throw new IllegalArgumentException("No library or digest provided: [" + _lib + "]");
  
      if (_lib.getLibraryId() == null
          || _lib.getLibraryId().getMvnGroup() == null
          || _lib.getLibraryId().getVersion() == null) return null;
  
      this.url =
          "https://pypi.python.org/pypi/<name>/<version>/json"
              .replaceAll("<name>", _lib.getLibraryId().getMvnGroup())
              .replaceAll("<version>", _lib.getLibraryId().getVersion());
  
      String response_body = null;
      List<LibraryId> verified_lids = null;
      int sc = -1;
      try {
        final CloseableHttpClient httpclient = HttpClients.createDefault();
        final HttpGet method = new HttpGet(this.url);
        if (ConnectionUtil.getProxyConfig() != null)
          method.setConfig(ConnectionUtil.getProxyConfig());
        final CloseableHttpResponse response = httpclient.execute(method);
        try {
          sc = response.getStatusLine().getStatusCode();
          HttpEntity entity = response.getEntity();
          if (sc == HttpStatus.SC_OK && entity != null) {
            response_body = ConnectionUtil.readInputStream(entity.getContent());
            verified_lids = new ArrayList<LibraryId>();
            if (this.containsMD5(response_body, _lib.getDigest()))
              verified_lids.add(_lib.getLibraryId());
          }
        } finally {
          response.close();
        }
      } catch (Exception e) {
        throw new VerificationException(_lib, this.url, e);
      }
      return verified_lids;
    }
focal_method.class_method_signature: PyPiVerifier.verify(final Library _lib)
focal_method.full_signature: @Override public List<LibraryId> verify(final Library _lib)
focal_method.identifier: verify
focal_method.invocations: getDigest getLibraryId getMvnGroup getLibraryId getVersion getLibraryId replaceAll replaceAll getMvnGroup getLibraryId getVersion getLibraryId createDefault getProxyConfig setConfig getProxyConfig execute getStatusCode getStatusLine getEntity readInputStream getContent containsMD5 getDigest add getLibraryId close
focal_method.modifiers: @Override public
focal_method.parameters: (final Library _lib)
focal_method.return: List<LibraryId>
focal_method.signature: List<LibraryId> verify(final Library _lib)