aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2012-12-04 14:35:07 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2012-12-04 15:04:30 +0100
commitcdf6262009b0245c719ffefd746a996f2f48a289 (patch)
treeae450bf79559cc92e9ae35e403400c1140398565 /plugins
parenteb8e412ce6d8c0b38fcda7ee4e077bddf79cb06c (diff)
downloadsonarqube-cdf6262009b0245c719ffefd746a996f2f48a289.tar.gz
sonarqube-cdf6262009b0245c719ffefd746a996f2f48a289.zip
SONAR-3306 Refactoring to use DatabaseSemaphore instead of SemaphoreDao
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java1
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DatabaseSemaphoreImpl.java43
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/DatabaseSemaphoreImplTest.java48
3 files changed, 0 insertions, 92 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index 810a5aa06bf..1cbc4f387fc 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -394,7 +394,6 @@ public final class CorePlugin extends SonarPlugin {
DefaultResourceTypes.class,
UserManagedMetrics.class,
ProjectFileSystemLogger.class,
- DatabaseSemaphoreImpl.class,
Periods.class,
// maven
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DatabaseSemaphoreImpl.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DatabaseSemaphoreImpl.java
deleted file mode 100644
index 813a679bce9..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DatabaseSemaphoreImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.plugins.core;
-
-import org.sonar.api.utils.DatabaseSemaphore;
-import org.sonar.core.persistence.SemaphoreDao;
-
-/**
- * @since 3.4
- */
-public class DatabaseSemaphoreImpl implements DatabaseSemaphore {
-
- private SemaphoreDao dao;
-
- public DatabaseSemaphoreImpl(SemaphoreDao dao) {
- this.dao = dao;
- }
-
- public boolean acquire(String name, int maxDurationInSeconds) {
- return dao.acquire(name, maxDurationInSeconds).isAcquired();
- }
-
- public void release(String name) {
- dao.release(name);
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/DatabaseSemaphoreImplTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/DatabaseSemaphoreImplTest.java
deleted file mode 100644
index e4f99459d67..00000000000
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/DatabaseSemaphoreImplTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.plugins.core;
-
-import org.junit.Test;
-import org.sonar.core.persistence.Lock;
-import org.sonar.core.persistence.SemaphoreDao;
-
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class DatabaseSemaphoreImplTest {
-
- @Test
- public void should_be_a_bridge_over_dao() {
- Lock lock = mock(Lock.class);
- SemaphoreDao dao = mock(SemaphoreDao.class);
- when(dao.acquire(anyString(), anyInt())).thenReturn(lock);
-
- DatabaseSemaphoreImpl impl = new DatabaseSemaphoreImpl(dao);
-
- impl.acquire("do-xxx", 50000);
- verify(dao).acquire("do-xxx", 50000);
-
- impl.release("do-xxx");
- verify(dao).release("do-xxx");
- }
-}