--- /dev/null
+/*
+ * 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();
+ }
+}
+++ /dev/null
-/*
- * 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();
- }
-}
--- /dev/null
+<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
+++ /dev/null
-<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