]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5815 Fix server tests
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 3 Nov 2014 13:17:35 +0000 (14:17 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Mon, 3 Nov 2014 13:17:35 +0000 (14:17 +0100)
17 files changed:
server/sonar-server/src/test/java/org/sonar/server/batch/ProjectReferentialsActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/not_returned_secured_settings_with_only_preview_permission.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_active_rules.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_project_settings.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_project_with_module_settings.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_project_with_module_settings_inherited_from_project.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_project_with_module_with_sub_module.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_project_with_two_modules.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_provisioned_project_profile.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_default_profile.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_given_profile_name.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles_even_when_project_does_not_exists.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_sub_module_settings.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_sub_module_settings_including_settings_from_parent_modules.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_sub_module_settings_inherited_from_project.json
server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_sub_module_settings_inherited_from_project_and_module.json

index 7604621f58006e22097c563619473812cc0c8057..0f6972c1ab6053f5c602e17a9cd1aa33dcab60e1 100644 (file)
@@ -142,7 +142,7 @@ public class ProjectReferentialsActionTest {
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
-    ));
+      ));
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key()).setParam("preview", "true");
     request.execute().assertJson(getClass(), "not_returned_secured_settings_with_only_preview_permission.json");
@@ -158,7 +158,7 @@ public class ProjectReferentialsActionTest {
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER"),
@@ -224,17 +224,17 @@ public class ProjectReferentialsActionTest {
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER"),
       // This property should not be found on the other module
       new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(module2.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-APPLICATION")
-    ));
+      ));
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
     request.execute().assertJson(getClass(), "return_project_with_two_modules.json");
@@ -250,7 +250,7 @@ public class ProjectReferentialsActionTest {
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
-    ));
+      ));
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
     request.execute().assertJson(getClass(), "return_project_settings.json");
@@ -265,7 +265,7 @@ public class ProjectReferentialsActionTest {
 
     when(qProfileFactory.getByProjectAndLanguage(session, project.key(), "java")).thenReturn(
       QualityProfileDto.createFor("abcd").setName("SonarQube way").setLanguage("java").setRulesUpdatedAt("2014-01-14T14:00:00+0200")
-    );
+      );
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
     request.execute().assertJson(getClass(), "return_provisioned_project_profile.json");
@@ -283,7 +283,7 @@ public class ProjectReferentialsActionTest {
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john"),
       new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
-    ));
+      ));
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", subModule.key());
     request.execute().assertJson(getClass(), "return_sub_module_settings.json");
@@ -299,15 +299,15 @@ public class ProjectReferentialsActionTest {
 
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(subModule.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
-    ));
+      ));
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", subModule.key());
     request.execute().assertJson(getClass(), "return_sub_module_settings_including_settings_from_parent_modules.json");
@@ -343,11 +343,11 @@ public class ProjectReferentialsActionTest {
     when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.login.secured").setValue("john"),
       new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
-    ));
+      ));
 
     when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
       new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER")
-    ));
+      ));
 
     // No settings on sub module -> All setting should come from the project and the module
 
@@ -415,7 +415,7 @@ public class ProjectReferentialsActionTest {
 
     when(qProfileFactory.getDefault(session, "java")).thenReturn(
       QualityProfileDto.createFor("abcd").setName("Default").setLanguage("java").setRulesUpdatedAt("2014-01-14T14:00:00+0200")
-    );
+      );
 
     WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", projectKey);
     request.execute().assertJson(getClass(), "return_quality_profiles_even_when_project_does_not_exists.json");
@@ -453,7 +453,7 @@ public class ProjectReferentialsActionTest {
     try {
       WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
       request.execute();
-    } catch(Exception e){
+    } catch (Exception e) {
       assertThat(e).isInstanceOf(ForbiddenException.class).hasMessage("You're not authorized to execute any SonarQube analysis. Please contact your SonarQube administrator.");
     }
   }
@@ -465,9 +465,10 @@ public class ProjectReferentialsActionTest {
     try {
       WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key()).setParam("preview", "false");
       request.execute();
-    } catch(Exception e){
-      assertThat(e).isInstanceOf(ForbiddenException.class).hasMessage("You're only authorized to execute a local (dry run) SonarQube analysis without pushing the results to the SonarQube server. " +
-        "Please contact your SonarQube administrator.");
+    } catch (Exception e) {
+      assertThat(e).isInstanceOf(ForbiddenException.class).hasMessage(
+        "You're only authorized to execute a local (dry run) SonarQube analysis without pushing the results to the SonarQube server. " +
+          "Please contact your SonarQube administrator.");
     }
   }
 
index 6116fecdd8b234f436a04c2dc9c1f515ebc76292..03e475b2afa6a3b01998cf7f965a175508466edf 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [
index b04e7414a43953daee634c58d387853b538760e9..c7ac51a9af3383106106403734663af2cf1840f2 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 252c6057e59bc3e6a166816f73e97c345fe0d746..7aaec4b548384a55a441b50bf9477483d603b53c 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index f55a39dffb921ca151ced757d7f5366149dd9e86..ccaaedd13f03273ac8520937e20340680745c481 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 90731677dd63a0e84f6abd6df67e9826a50eb9f9..85b6e165fcaef8e07ae801336cf9012dd5f7eaa1 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 6960c295245b2d22b826021b2d0972b0a5b6a049..5e435288c7b3325bbcfded8e756e9f2d12160949 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "SonarQube way",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 061111c9fb882718085b5dba395d47a1f8e45ad3..ef28667d07f8e5ef0aecff0d9e738875aae8c107 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 061111c9fb882718085b5dba395d47a1f8e45ad3..ef28667d07f8e5ef0aecff0d9e738875aae8c107 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index 6960c295245b2d22b826021b2d0972b0a5b6a049..5e435288c7b3325bbcfded8e756e9f2d12160949 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "SonarQube way",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index cdb88917efc7d1a46530fbc36e9e280ddc0de6f5..a43f52bcbdfb290ddac5ccb29522a27cf78c84fe 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],
index cdb88917efc7d1a46530fbc36e9e280ddc0de6f5..a43f52bcbdfb290ddac5ccb29522a27cf78c84fe 100644 (file)
@@ -5,7 +5,7 @@
       "key": "abcd",
       "name": "Default",
       "language": "java",
-      "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+      "rulesUpdatedAt": "2014-01-14T13:00:00+0100"
     }
   },
   "activeRules": [],