def buildLayout(tomcatDir, tomcatVersion, jira_home, instance_name, ondemand): pom_parser = PomParser('pom.xml') version_ = pom_parser.get_property( WorkspaceBuilder.VERSIONS[tomcatVersion]) return WorkspaceLayout(tomcatVersion, version_, tomcatDir, jira_home, instance_name, ondemand)
def set_remote(self, log: Logger, pom_parser=None): if pom_parser is None: try: pom_parser = PomParser(os.sep.join([".", "pom.xml"])) except ParseError as e: log.error("Parse error in main project pom: " + str(e)) return Callable.do_not_proceed except OSError as e: log.error("Could not read main project pom: " + str(e)) return Callable.do_not_proceed developerConnection = pom_parser.get_developer_connection() git_scm_type = "scm:git:" if not developerConnection.startswith(git_scm_type): # worried that it's not? raise Exception("I can't believe this is happening.") self.git.set_remote("origin", developerConnection[len(git_scm_type) :])
def set_remote(self, log: Logger, pom_parser=None): if pom_parser is None: try: pom_parser = PomParser(os.sep.join(['.', 'pom.xml'])) except ParseError as e: log.error('Parse error in main project pom: ' + str(e)) return Callable.do_not_proceed except OSError as e: log.error('Could not read main project pom: ' + str(e)) return Callable.do_not_proceed developerConnection = pom_parser.get_developer_connection() git_scm_type = 'scm:git:' if not developerConnection.startswith(git_scm_type): # worried that it's not? raise Exception('I can\'t believe this is happening.') self.git.set_remote('origin', developerConnection[len(git_scm_type):])
class TestPomParser(TestCase): parser = PomParser('jmake_src/testdata/pomparser.xml') def test_get_version(self): version = self.parser.get_version() self.assertEqual(version, '10.0.0') def test_get_artifact_id(self): artifact_id = self.parser.get_artifact_id() self.assertEqual(artifact_id, 'jira-project') def test_get_properties_return_property_value(self): value = self.parser.get_property('test.property') self.assertEqual(value, 'value1', 'Expected value to be defined') def test_get_properties_when_no_property_defined_returns_none(self): value = self.parser.get_property('test.property.new') self.assertIsNone(value, 'Expected value to be undefined')
def buildLayout(tomcatDir, tomcatVersion, jira_home, instance_name, ondemand): pom_parser = PomParser('pom.xml') version_ = pom_parser.get_property(WorkspaceBuilder.VERSIONS[tomcatVersion]) return WorkspaceLayout(tomcatVersion, version_, tomcatDir, jira_home, instance_name, ondemand)