summaryrefslogtreecommitdiffstats
path: root/sonar-server/src/test
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-09-24 13:38:18 +0200
committerDavid Gageot <david@gageot.net>2012-09-24 13:49:03 +0200
commit7a0aa306e3971891f9e3bbb8bd1037d8d02f3516 (patch)
tree202d1eb9fefbbb96a97b7ceece8b48dda2094414 /sonar-server/src/test
parent58d867edbfa4c93538355237d1937b046c053e9a (diff)
downloadsonarqube-7a0aa306e3971891f9e3bbb8bd1037d8d02f3516.tar.gz
sonarqube-7a0aa306e3971891f9e3bbb8bd1037d8d02f3516.zip
SONAR-3529 API: ability to define property sets
Diffstat (limited to 'sonar-server/src/test')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/startup/RegisterPropertySetsTest.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RegisterPropertySetsTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RegisterPropertySetsTest.java
new file mode 100644
index 00000000000..b74d1b8eb54
--- /dev/null
+++ b/sonar-server/src/test/java/org/sonar/server/startup/RegisterPropertySetsTest.java
@@ -0,0 +1,55 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.server.startup;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.config.PropertySet;
+import org.sonar.api.config.PropertySetDefinitions;
+import org.sonar.api.config.PropertySetTemplate;
+
+import static org.mockito.Mockito.*;
+
+public class RegisterPropertySetsTest {
+ private RegisterPropertySets task;
+ private PropertySetDefinitions propertySetDefinitions = mock(PropertySetDefinitions.class);
+ private PropertySetTemplate firstTemplate = mock(PropertySetTemplate.class);
+ private PropertySetTemplate secondTemplate = mock(PropertySetTemplate.class);
+ private PropertySet firstPropertySet = mock(PropertySet.class);
+ private PropertySet secondPropertySet = mock(PropertySet.class);
+
+ @Before
+ public void init() {
+ task = new RegisterPropertySets(new PropertySetTemplate[]{firstTemplate, secondTemplate}, propertySetDefinitions);
+ }
+
+ @Test
+ public void should_register_on_startup() {
+ when(firstTemplate.getName()).thenReturn("first");
+ when(secondTemplate.getName()).thenReturn("second");
+ when(firstTemplate.createPropertySet()).thenReturn(firstPropertySet);
+ when(secondTemplate.createPropertySet()).thenReturn(secondPropertySet);
+
+ task.start();
+
+ verify(propertySetDefinitions).register("first", firstPropertySet);
+ verify(propertySetDefinitions).register("second", secondPropertySet);
+ }
+}