]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2501 rename GraphDbTest to GraphDaoTest
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 28 Jan 2013 11:22:32 +0000 (12:22 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 28 Jan 2013 11:22:32 +0000 (12:22 +0100)
sonar-core/src/test/java/org/sonar/core/graph/GraphDaoTest.java [new file with mode: 0644]
sonar-core/src/test/java/org/sonar/core/graph/GraphDbTest.java [deleted file]
sonar-core/src/test/resources/org/sonar/core/graph/GraphDaoTest/shared.xml [new file with mode: 0644]
sonar-core/src/test/resources/org/sonar/core/graph/GraphDbTest/shared.xml [deleted file]

diff --git a/sonar-core/src/test/java/org/sonar/core/graph/GraphDaoTest.java b/sonar-core/src/test/java/org/sonar/core/graph/GraphDaoTest.java
new file mode 100644 (file)
index 0000000..3433898
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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.core.graph;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.core.persistence.AbstractDaoTestCase;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class GraphDaoTest extends AbstractDaoTestCase {
+  private GraphDao dao;
+
+  @Before
+  public void createDao() {
+    dao = new GraphDao(getMyBatis());
+    setupData("shared");
+  }
+
+  @Test
+  public void select_graph_by_snapshot() {
+    GraphDto testPlan = dao.selectBySnapshot("testplan", 11L);
+
+    assertThat(testPlan.getId()).isEqualTo(101L);
+    assertThat(testPlan.getSnapshotId()).isEqualTo(11L);
+    assertThat(testPlan.getFormat()).isEqualTo("graphson");
+    assertThat(testPlan.getVersion()).isEqualTo(1);
+    assertThat(testPlan.getPerspective()).isEqualTo("testplan");
+    assertThat(testPlan.getRootVertexId()).isEqualTo("3456");
+    assertThat(testPlan.getData()).isEqualTo("{testplan of snapshot 123}");
+  }
+
+  @Test
+  public void select_by_snapshot_and_missing_perspective() {
+    assertThat(dao.selectBySnapshot("duplicable", 123L)).isNull();
+  }
+
+  @Test
+  public void select_by_missing_snapshot() {
+    assertThat(dao.selectBySnapshot("duplicable", 7777L)).isNull();
+  }
+
+  @Test
+  public void select_by_component() {
+    GraphDto testPlan = dao.selectByComponent("testplan", "org.apache.struts:struts");
+
+    assertThat(testPlan.getId()).isEqualTo(101L);
+    assertThat(testPlan.getSnapshotId()).isEqualTo(11L);
+    assertThat(testPlan.getFormat()).isEqualTo("graphson");
+    assertThat(testPlan.getVersion()).isEqualTo(1);
+    assertThat(testPlan.getPerspective()).isEqualTo("testplan");
+    assertThat(testPlan.getRootVertexId()).isEqualTo("3456");
+    assertThat(testPlan.getData()).isEqualTo("{testplan of snapshot 123}");
+  }
+
+  @Test
+  public void select_by_missing_component() {
+    assertThat(dao.selectByComponent("testplan", "org.other:unknown")).isNull();
+  }
+}
diff --git a/sonar-core/src/test/java/org/sonar/core/graph/GraphDbTest.java b/sonar-core/src/test/java/org/sonar/core/graph/GraphDbTest.java
deleted file mode 100644 (file)
index 922931a..0000000
+++ /dev/null
@@ -1,77 +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.core.graph;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.core.persistence.AbstractDaoTestCase;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class GraphDbTest extends AbstractDaoTestCase {
-  private GraphDao dao;
-
-  @Before
-  public void createDao() {
-    dao = new GraphDao(getMyBatis());
-    setupData("shared");
-  }
-
-  @Test
-  public void select_graph_by_snapshot() {
-    GraphDto testPlan = dao.selectBySnapshot("testplan", 11L);
-
-    assertThat(testPlan.getId()).isEqualTo(101L);
-    assertThat(testPlan.getSnapshotId()).isEqualTo(11L);
-    assertThat(testPlan.getFormat()).isEqualTo("graphson");
-    assertThat(testPlan.getVersion()).isEqualTo(1);
-    assertThat(testPlan.getPerspective()).isEqualTo("testplan");
-    assertThat(testPlan.getRootVertexId()).isEqualTo("3456");
-    assertThat(testPlan.getData()).isEqualTo("{testplan of snapshot 123}");
-  }
-
-  @Test
-  public void select_by_snapshot_and_missing_perspective() {
-    assertThat(dao.selectBySnapshot("duplicable", 123L)).isNull();
-  }
-
-  @Test
-  public void select_by_missing_snapshot() {
-    assertThat(dao.selectBySnapshot("duplicable", 7777L)).isNull();
-  }
-
-  @Test
-  public void select_by_component() {
-    GraphDto testPlan = dao.selectByComponent("testplan", "org.apache.struts:struts");
-
-    assertThat(testPlan.getId()).isEqualTo(101L);
-    assertThat(testPlan.getSnapshotId()).isEqualTo(11L);
-    assertThat(testPlan.getFormat()).isEqualTo("graphson");
-    assertThat(testPlan.getVersion()).isEqualTo(1);
-    assertThat(testPlan.getPerspective()).isEqualTo("testplan");
-    assertThat(testPlan.getRootVertexId()).isEqualTo("3456");
-    assertThat(testPlan.getData()).isEqualTo("{testplan of snapshot 123}");
-  }
-
-  @Test
-  public void select_by_missing_component() {
-    assertThat(dao.selectByComponent("testplan", "org.other:unknown")).isNull();
-  }
-}
diff --git a/sonar-core/src/test/resources/org/sonar/core/graph/GraphDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/graph/GraphDaoTest/shared.xml
new file mode 100644 (file)
index 0000000..dfd0305
--- /dev/null
@@ -0,0 +1,9 @@
+<dataset>
+  <projects id="1" kee="org.apache.struts:struts" enabled="true"/>
+
+  <snapshots id="10" project_id="1" islast="false" />
+  <snapshots id="11" project_id="1" islast="true" />
+
+  <graphs id="100" snapshot_id="11" format="graphson" version="1" perspective="testable" root_vertex_id="7890" data="{testable of snapshot 123}"/>
+  <graphs id="101" snapshot_id="11" format="graphson" version="1" perspective="testplan" root_vertex_id="3456" data="{testplan of snapshot 123}"/>
+</dataset>
\ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/core/graph/GraphDbTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/graph/GraphDbTest/shared.xml
deleted file mode 100644 (file)
index dfd0305..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<dataset>
-  <projects id="1" kee="org.apache.struts:struts" enabled="true"/>
-
-  <snapshots id="10" project_id="1" islast="false" />
-  <snapshots id="11" project_id="1" islast="true" />
-
-  <graphs id="100" snapshot_id="11" format="graphson" version="1" perspective="testable" root_vertex_id="7890" data="{testable of snapshot 123}"/>
-  <graphs id="101" snapshot_id="11" format="graphson" version="1" perspective="testplan" root_vertex_id="3456" data="{testplan of snapshot 123}"/>
-</dataset>
\ No newline at end of file