diff options
author | David Gageot <david@gageot.net> | 2012-07-10 17:47:04 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-10 18:20:20 +0200 |
commit | 28c9f88fc9ceb6c29d91c8422bbdd4aa71a425ef (patch) | |
tree | 975ecd410a8856d514b38431e8c76a8b6b3faa7c /sonar-core | |
parent | 9b845d63a452794a347dbf78ddb600bed0b7adcb (diff) | |
download | sonarqube-28c9f88fc9ceb6c29d91c8422bbdd4aa71a425ef.tar.gz sonarqube-28c9f88fc9ceb6c29d91c8422bbdd4aa71a425ef.zip |
Fix ResourceDao test on Oracle
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java | 28 | ||||
-rw-r--r-- | sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert-result.xml | 11 | ||||
-rw-r--r-- | sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert.xml | 3 | ||||
-rw-r--r-- | sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate-result.xml | 15 | ||||
-rw-r--r-- | sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update-result.xml | 7 | ||||
-rw-r--r-- | sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update.xml (renamed from sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate.xml) | 2 |
6 files changed, 39 insertions, 27 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java index 503056ee794..9899b31cd2f 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceDaoTest.java @@ -141,16 +141,24 @@ public class ResourceDaoTest extends AbstractDaoTestCase { } @Test - public void insertOrUpdate() { - setupData("insertOrUpdate"); + public void should_update() { + setupData("update"); - // to be updated ResourceDto project = new ResourceDto() - .setKey("org.struts:struts").setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT) - .setName("Struts").setLongName("Apache Struts").setLanguage("java").setDescription("MVC Framework") - .setId(100L); + .setKey("org.struts:struts").setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT) + .setName("Struts").setLongName("Apache Struts").setLanguage("java").setDescription("MVC Framework") + .setId(1L); + + dao.insertOrUpdate(project); + + assertThat(project.getId()).isNotNull(); + checkTables("update", "projects"); + } + + @Test + public void should_insert() { + setupData("insert"); - // to be inserted ResourceDto file1 = new ResourceDto() .setKey("org.struts:struts:org.struts.Action").setScope(Scopes.FILE).setQualifier(Qualifiers.FILE) .setLanguage("java").setName("Action").setLongName("org.struts.Action"); @@ -158,13 +166,11 @@ public class ResourceDaoTest extends AbstractDaoTestCase { .setKey("org.struts:struts:org.struts.Filter").setScope(Scopes.FILE).setQualifier(Qualifiers.FILE) .setLanguage("java").setName("Filter").setLongName("org.struts.Filter"); - dao.insertOrUpdate(project, file1, file2); + dao.insertOrUpdate(file1, file2); - assertThat(project.getId()).isNotNull(); assertThat(file1.getId()).isNotNull(); assertThat(file2.getId()).isNotNull(); - checkTables("insertOrUpdate", new String[]{"id"}, "projects"); + checkTables("insert", "projects"); } - } diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert-result.xml new file mode 100644 index 00000000000..f2075f14ddc --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert-result.xml @@ -0,0 +1,11 @@ +<dataset> + + <projects id="1" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:org.struts.Action" name="Action" + description="[null]" long_name="org.struts.Action" + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + + <projects id="2" root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:org.struts.Filter" name="Filter" + description="[null]" long_name="org.struts.Filter" + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + +</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert.xml new file mode 100644 index 00000000000..871dedcb5e9 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insert.xml @@ -0,0 +1,3 @@ +<dataset> + +</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate-result.xml deleted file mode 100644 index a1cae231f15..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate-result.xml +++ /dev/null @@ -1,15 +0,0 @@ -<dataset> - - <projects root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="MVC Framework" long_name="Apache Struts" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> - - <projects root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:org.struts.Action" name="Action" - description="[null]" long_name="org.struts.Action" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> - - <projects root_id="[null]" scope="FIL" qualifier="FIL" kee="org.struts:struts:org.struts.Filter" name="Filter" - description="[null]" long_name="org.struts.Filter" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> - -</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update-result.xml new file mode 100644 index 00000000000..a95233b81f6 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update-result.xml @@ -0,0 +1,7 @@ +<dataset> + + <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" + description="MVC Framework" long_name="Apache Struts" + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + +</dataset> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update.xml index 1a5e2978a07..10fdddc66ff 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/insertOrUpdate.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/update.xml @@ -1,6 +1,6 @@ <dataset> - <projects id="100" root_id="200" scope="PRJ" qualifier="TRK" kee="old key" name="old name" + <projects id="1" root_id="200" scope="PRJ" qualifier="TRK" kee="old key" name="old name" description="old name" long_name="old long name" enabled="[false]" language="old" copy_resource_id="2" person_id="3" profile_id="4"/> |