def test_does_not_emit_warning_when_jvm_mv_8_or_less(self, version):
     version_string = ('Java version: %s, vendor: Oracle Corporation' % version).encode()
     self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string)]
     validator = MavenValidator(os_utils=self.mock_os_utils, log=self.mock_log)
     self.assertTrue(validator.validate(maven_path=self.maven_path))
     self.assertEqual(validator.validated_binary_path, self.maven_path)
     self.mock_log.warning.assert_not_called()
 def test_emits_warning_when_jvm_mv_greater_than_8(self):
     version_string = 'Java version: 10.0.1, vendor: Oracle Corporation'.encode()
     self.mock_os_utils.popen.side_effect = [FakePopen(stdout=version_string)]
     validator = MavenValidator(os_utils=self.mock_os_utils, log=self.mock_log)
     self.assertTrue(validator.validate(maven_path=self.maven_path))
     self.assertEqual(validator.validated_binary_path, self.maven_path)
     self.mock_log.warning.assert_called_with(MavenValidator.MAJOR_VERSION_WARNING, self.maven_path, '10')
 def test_accepts_any_jvm_mv(self, version):
     version_string = ('Java version: %s, vendor: Oracle Corporation' %
                       version).encode()
     self.mock_os_utils.popen.side_effect = [
         FakePopen(stdout=version_string)
     ]
     validator = MavenValidator(os_utils=self.mock_os_utils)
     self.assertTrue(validator.validate(maven_path=self.maven_path))
     self.assertEqual(validator.validated_binary_path, self.maven_path)
 def test_emits_warning_when_version_string_not_found(self):
     version_string = 'Blah:          9.0.0'.encode()
     self.mock_os_utils.popen.side_effect = [
         FakePopen(stdout=version_string, returncode=0)
     ]
     validator = MavenValidator(os_utils=self.mock_os_utils,
                                log=self.mock_log)
     validator.validate(maven_path=self.maven_path)
     self.mock_log.warning.assert_called_with(
         MavenValidator.VERSION_STRING_WARNING, self.maven_path)
 def test_emits_warning_when_maven_excutable_fails(self):
     version_string = 'Java version: %s, vendor: Oracle Corporation'.encode(
     )
     self.mock_os_utils.popen.side_effect = [
         FakePopen(stdout=version_string, returncode=1)
     ]
     validator = MavenValidator(os_utils=self.mock_os_utils,
                                log=self.mock_log)
     validator.validate(maven_path=self.maven_path)
     self.mock_log.warning.assert_called_with(
         MavenValidator.VERSION_STRING_WARNING, self.maven_path)
Esempio n. 6
0
 def test_accepts_major_version_only_jvm_mv(self, version):
     version_string = ("Java version: %s, vendor: Oracle Corporation" %
                       version).encode()
     self.mock_os_utils.popen.side_effect = [
         FakePopen(stdout=version_string)
     ]
     validator = MavenValidator(self.runtime,
                                self.architecture,
                                os_utils=self.mock_os_utils)
     self.assertTrue(validator.validate(runtime_path=self.runtime_path))
     self.assertEqual(validator.validated_binary_path, self.runtime_path)
Esempio n. 7
0
 def test_runtime_validate_unsupported_language_fail_open(self):
     validator = MavenValidator(runtime="java2.0", architecture="arm64")
     with self.assertRaises(UnsupportedRuntimeError):
         validator.validate(runtime_path="/usr/bin/java2.0")