]> source.dussan.org Git - sonarqube.git/commitdiff
Move PurgeCeActivitiesTest in correct package
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 22 Feb 2017 10:49:38 +0000 (11:49 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 22 Feb 2017 16:10:15 +0000 (17:10 +0100)
server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/queue/PurgeCeActivitiesTest.java [new file with mode: 0644]

diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java
deleted file mode 100644 (file)
index ffc6d44..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.platform.Server;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-import org.sonar.db.ce.CeActivityDto;
-import org.sonar.db.ce.CeQueueDto;
-import org.sonar.db.ce.CeTaskTypes;
-import org.sonar.server.computation.queue.PurgeCeActivities;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-public class PurgeCeActivitiesTest {
-
-  private System2 system2 = spy(System2.INSTANCE);
-
-  @Rule
-  public DbTester dbTester = DbTester.create(system2);
-
-  private PurgeCeActivities underTest = new PurgeCeActivities(dbTester.getDbClient(), system2);
-
-  @Test
-  public void delete_older_than_6_months() throws Exception {
-    insertWithDate("VERY_OLD", 1_000_000_000_000L);
-    insertWithDate("RECENT", 1_500_000_000_000L);
-    when(system2.now()).thenReturn(1_500_000_000_100L);
-
-    underTest.onServerStart(mock(Server.class));
-
-    assertThat(dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), "VERY_OLD").isPresent()).isFalse();
-    assertThat(dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), "RECENT").isPresent()).isTrue();
-  }
-
-  private void insertWithDate(String uuid, long date) {
-    CeQueueDto queueDto = new CeQueueDto();
-    queueDto.setUuid(uuid);
-    queueDto.setTaskType(CeTaskTypes.REPORT);
-
-    CeActivityDto dto = new CeActivityDto(queueDto);
-    dto.setStatus(CeActivityDto.Status.SUCCESS);
-    when(system2.now()).thenReturn(date);
-    dbTester.getDbClient().ceActivityDao().insert(dbTester.getSession(), dto);
-    dbTester.getSession().commit();
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/PurgeCeActivitiesTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/PurgeCeActivitiesTest.java
new file mode 100644 (file)
index 0000000..e6d2058
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.computation.queue;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonar.api.platform.Server;
+import org.sonar.api.utils.System2;
+import org.sonar.db.DbTester;
+import org.sonar.db.ce.CeActivityDto;
+import org.sonar.db.ce.CeQueueDto;
+import org.sonar.db.ce.CeTaskTypes;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+public class PurgeCeActivitiesTest {
+
+  private System2 system2 = spy(System2.INSTANCE);
+
+  @Rule
+  public DbTester dbTester = DbTester.create(system2);
+
+  private PurgeCeActivities underTest = new PurgeCeActivities(dbTester.getDbClient(), system2);
+
+  @Test
+  public void delete_older_than_6_months() throws Exception {
+    insertWithDate("VERY_OLD", 1_000_000_000_000L);
+    insertWithDate("RECENT", 1_500_000_000_000L);
+    when(system2.now()).thenReturn(1_500_000_000_100L);
+
+    underTest.onServerStart(mock(Server.class));
+
+    assertThat(dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), "VERY_OLD").isPresent()).isFalse();
+    assertThat(dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), "RECENT").isPresent()).isTrue();
+  }
+
+  private void insertWithDate(String uuid, long date) {
+    CeQueueDto queueDto = new CeQueueDto();
+    queueDto.setUuid(uuid);
+    queueDto.setTaskType(CeTaskTypes.REPORT);
+
+    CeActivityDto dto = new CeActivityDto(queueDto);
+    dto.setStatus(CeActivityDto.Status.SUCCESS);
+    when(system2.now()).thenReturn(date);
+    dbTester.getDbClient().ceActivityDao().insert(dbTester.getSession(), dto);
+    dbTester.getSession().commit();
+  }
+}