Beispiel #1
0
    def test_should_use_config_file_from_cli_for_java(self):
        extensions = 'yml', 'yaml'
        for ext in extensions:
            config_file = '/tmp/monasca-api-foo-bar.%s' % ext
            cmdline = _mock_java_cmd_api(config_file)

            FakeProcesses.cmdLine = cmdline

            helper = mon._MonAPIJavaHelper(cmdline=cmdline)
            helper._read_config_file = rcf = mock.Mock()
            helper.get_bound_port = mock.Mock(return_value=123)

            self._mon_api._init_impl_helper = iih = mock.Mock(
                return_value=helper)
            self._detect()

            iih.assert_called_once_with(cmdline, 'java')
            rcf.assert_called_once_with(config_file)
            self.assertTrue(iih.get_bound_port.called_once)
Beispiel #2
0
    def test_should_use_config_file_from_cli_for_java(self):
        extensions = 'yml', 'yaml'
        for ext in extensions:
            config_file = '/tmp/monasca-api-foo-bar.%s' % ext
            cmdline = _mock_java_cmd_api(config_file)

            fake_processes = FakeProcesses(name=TestMonAPIDetectionPlugin.fake_processes_name,
                                           cmd_line=cmdline)

            helper = mon._MonAPIJavaHelper(cmdline=cmdline)
            helper._read_config_file = rcf = mock.Mock()
            helper.get_bound_port = mock.Mock(return_value=123)

            self._mon_api._init_impl_helper = iih = mock.Mock(
                    return_value=helper
            )
            self._detect(retval=[fake_processes])

            iih.assert_called_once_with(cmdline, 'java')
            rcf.assert_called_once_with(config_file)
            self.assertTrue(iih.get_bound_port.called_once)