diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-02-25 22:22:20 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-03-02 11:02:08 +0100 |
commit | af3d0b3c6b555616b3f6207620dd92360a653996 (patch) | |
tree | 3f48b9d5324e89e40590a7b67c5cf514ef54839e /sonar-plugin-api/src/test | |
parent | 4ea0dd1c85069c253e4dbdc1b7c6e203b5beb082 (diff) | |
download | sonarqube-af3d0b3c6b555616b3f6207620dd92360a653996.tar.gz sonarqube-af3d0b3c6b555616b3f6207620dd92360a653996.zip |
Refactor table ANALYSIS_REPORTS because of MySQL packet size limitation
* do not store report zip in table ANALYSIS_REPORTS but in FS dir {home}/data/analysis
* do not store snapshot id in table but in protobuf report
Diffstat (limited to 'sonar-plugin-api/src/test')
3 files changed, 62 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/JUnitTempFolderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/JUnitTempFolderTest.java new file mode 100644 index 00000000000..c2086e05c36 --- /dev/null +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/internal/JUnitTempFolderTest.java @@ -0,0 +1,53 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube 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. + * + * SonarQube 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.api.utils.internal; + +import org.junit.Test; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; + +public class JUnitTempFolderTest { + + @Test + public void apply() throws Throwable { + JUnitTempFolder temp = new JUnitTempFolder(); + temp.before(); + File dir1 = temp.newDir(); + assertThat(dir1).isDirectory().exists(); + + File dir2 = temp.newDir("foo"); + assertThat(dir2).isDirectory().exists(); + + File file1 = temp.newFile(); + assertThat(file1).isFile().exists(); + + File file2 = temp.newFile("foo", "txt"); + assertThat(file2).isFile().exists(); + + temp.after(); + assertThat(dir1).doesNotExist(); + assertThat(dir2).doesNotExist(); + assertThat(file1).doesNotExist(); + assertThat(file2).doesNotExist(); + } + +} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java index 9fd01343f34..9880b1ef13a 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java @@ -54,9 +54,13 @@ public class LogTesterTest { Loggers.get("logger2").warn("warning: {}", 42); assertThat(sut.logs()).containsExactly("an information", "warning: 42"); + assertThat(sut.logs(LoggerLevel.ERROR)).isEmpty(); + assertThat(sut.logs(LoggerLevel.INFO)).containsOnly("an information"); + assertThat(sut.logs(LoggerLevel.WARN)).containsOnly("warning: 42"); sut.clear(); assertThat(sut.logs()).isEmpty(); + assertThat(sut.logs(LoggerLevel.INFO)).isEmpty(); sut.after(); assertThat(LogInterceptors.get()).isSameAs(NullInterceptor.NULL_INSTANCE); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java index ca4d14e4890..f410fcd80ae 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/NullInterceptorTest.java @@ -28,10 +28,10 @@ public class NullInterceptorTest { @Test public void do_not_throws_exception() throws Exception { // verify that... it does nothing - NullInterceptor.NULL_INSTANCE.log("foo"); - NullInterceptor.NULL_INSTANCE.log("foo {}", 42); - NullInterceptor.NULL_INSTANCE.log("foo {} {}", 42, 66); - NullInterceptor.NULL_INSTANCE.log("foo {} {} {}", 42, 66, 84); - NullInterceptor.NULL_INSTANCE.log("foo", mock(Exception.class)); + NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo"); + NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {}", 42); + NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {} {}", 42, 66); + NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo {} {} {}", 42, 66, 84); + NullInterceptor.NULL_INSTANCE.log(LoggerLevel.INFO, "foo", mock(Exception.class)); } } |