From 5f227250b8661cb46967f40673374953c8e495e9 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Wed, 09 May 2012 07:59:43 -0400 Subject: [PATCH] Merge pull request #16 from jcrygier/custom_properties --- tests/com/gitblit/tests/RepositoryModelTest.java | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/com/gitblit/tests/RepositoryModelTest.java b/tests/com/gitblit/tests/RepositoryModelTest.java index f741815..3596c33 100644 --- a/tests/com/gitblit/tests/RepositoryModelTest.java +++ b/tests/com/gitblit/tests/RepositoryModelTest.java @@ -25,11 +25,11 @@ public static void startGitBlit() throws Exception { wasStarted = GitBlitSuite.startGitblit() == false; - oldSection = Constants.CUSTOM_DEFINED_PROP_SECTION; - oldSubSection = Constants.CUSTOM_DEFINED_PROP_SUBSECTION; + oldSection = Constants.CUSTOM_FIELDS_PROP_SECTION; + oldSubSection = Constants.CUSTOM_FIELDS_PROP_SUBSECTION; - Constants.CUSTOM_DEFINED_PROP_SECTION = "RepositoryModelTest"; - Constants.CUSTOM_DEFINED_PROP_SUBSECTION = "RepositoryModelTestSubSection"; + Constants.CUSTOM_FIELDS_PROP_SECTION = "RepositoryModelTest"; + Constants.CUSTOM_FIELDS_PROP_SUBSECTION = "RepositoryModelTestSubSection"; } @AfterClass @@ -37,8 +37,8 @@ if (wasStarted == false) GitBlitSuite.stopGitblit(); - Constants.CUSTOM_DEFINED_PROP_SECTION = oldSection; - Constants.CUSTOM_DEFINED_PROP_SUBSECTION = oldSubSection; + Constants.CUSTOM_FIELDS_PROP_SECTION = oldSection; + Constants.CUSTOM_FIELDS_PROP_SUBSECTION = oldSubSection; } @Before @@ -46,9 +46,9 @@ Repository r = GitBlitSuite.getHelloworldRepository(); StoredConfig config = JGitUtils.readConfig(r); - config.unsetSection(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION); - config.setString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, "commitMessageRegEx", "\\d"); - config.setString(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION, "anotherProperty", "Hello"); + config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION); + config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "commitMessageRegEx", "\\d"); + config.setString(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION, "anotherProperty", "Hello"); config.save(); } @@ -58,7 +58,7 @@ Repository r = GitBlitSuite.getHelloworldRepository(); StoredConfig config = JGitUtils.readConfig(r); - config.unsetSection(Constants.CUSTOM_DEFINED_PROP_SECTION, Constants.CUSTOM_DEFINED_PROP_SUBSECTION); + config.unsetSection(Constants.CUSTOM_FIELDS_PROP_SECTION, Constants.CUSTOM_FIELDS_PROP_SUBSECTION); config.save(); } @@ -67,8 +67,8 @@ RepositoryModel model = GitBlit.self().getRepositoryModel( GitBlitSuite.getHelloworldRepository().getDirectory().getName()); - assertEquals("\\d", model.userDefinedProperties.get("commitMessageRegEx")); - assertEquals("Hello", model.userDefinedProperties.get("anotherProperty")); + assertEquals("\\d", model.customFields.get("commitMessageRegEx")); + assertEquals("Hello", model.customFields.get("anotherProperty")); } @Test @@ -76,17 +76,17 @@ RepositoryModel model = GitBlit.self().getRepositoryModel( GitBlitSuite.getHelloworldRepository().getDirectory().getName()); - assertEquals("\\d", model.userDefinedProperties.get("commitMessageRegEx")); - assertEquals("Hello", model.userDefinedProperties.get("anotherProperty")); + assertEquals("\\d", model.customFields.get("commitMessageRegEx")); + assertEquals("Hello", model.customFields.get("anotherProperty")); - assertEquals("Hello", model.userDefinedProperties.put("anotherProperty", "GoodBye")); + assertEquals("Hello", model.customFields.put("anotherProperty", "GoodBye")); GitBlit.self().updateRepositoryModel(model.name, model, false); model = GitBlit.self().getRepositoryModel( GitBlitSuite.getHelloworldRepository().getDirectory().getName()); - assertEquals("\\d", model.userDefinedProperties.get("commitMessageRegEx")); - assertEquals("GoodBye", model.userDefinedProperties.get("anotherProperty")); + assertEquals("\\d", model.customFields.get("commitMessageRegEx")); + assertEquals("GoodBye", model.customFields.get("anotherProperty")); } } -- Gitblit v1.9.1