Example #1
0
    def test_should_use_config_file_from_cli_for_java(self):
        extensions = 'yml', 'yaml'
        for ext in extensions:
            config_file = '/tmp/monasca-persister-abc.%s' % ext
            cmdline = _mock_java_persister(config_file)

            FakeProcesses.cmdLine = cmdline

            helper = mon._MonPersisterJavaHelper(cmdline=cmdline)
            helper._read_config_file = rcf = mock.Mock()

            self._mon_p._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)
Example #2
0
    def test_should_use_config_file_from_cli_for_java(self):
        extensions = 'yml', 'yaml'
        for ext in extensions:
            config_file = '/tmp/monasca-persister-abc.%s' % ext
            cmdline = _mock_java_persister(config_file)

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

            helper = mon._MonPersisterJavaHelper(cmdline=cmdline)
            helper._read_config_file = rcf = mock.Mock()

            self._mon_p._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)