aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-02-19 16:49:10 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-02-19 22:28:59 +0100
commit0f517d524485bcc0acb47a7f00d54b2e1bac4f50 (patch)
treeff618f5e8d4886dae0f2e16254f76b67dd2203fc /plugins/sonar-xoo-plugin/src/test
parenteac465bea9f5bf89a7beb8036e4d8eea4723f421 (diff)
downloadsonarqube-0f517d524485bcc0acb47a7f00d54b2e1bac4f50.tar.gz
sonarqube-0f517d524485bcc0acb47a7f00d54b2e1bac4f50.zip
SONAR-5931 Remove beta test API
Diffstat (limited to 'plugins/sonar-xoo-plugin/src/test')
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java109
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java109
2 files changed, 0 insertions, 218 deletions
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java
deleted file mode 100644
index 4b57e397362..00000000000
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.xoo.lang;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.sonar.api.batch.fs.InputFile.Type;
-import org.sonar.api.batch.fs.internal.DefaultFileSystem;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.sensor.SensorContext;
-import org.sonar.api.batch.sensor.SensorStorage;
-import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
-import org.sonar.api.batch.sensor.test.TestCaseCoverage;
-import org.sonar.api.batch.sensor.test.internal.DefaultTestCaseCoverage;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class CoveragePerTestSensorTest {
-
- private CoveragePerTestSensor sensor;
- private SensorContext context = mock(SensorContext.class);
- private DefaultFileSystem fileSystem;
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
- private File baseDir;
-
- @Before
- public void prepare() throws IOException {
- baseDir = temp.newFolder();
- sensor = new CoveragePerTestSensor();
- fileSystem = new DefaultFileSystem(baseDir.toPath());
- when(context.fileSystem()).thenReturn(fileSystem);
- }
-
- @Test
- public void testDescriptor() {
- sensor.describe(new DefaultSensorDescriptor());
- }
-
- @Test
- public void testNoExecutionIfCoveragePerTestFile() {
- DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo")
- .setType(Type.TEST);
- fileSystem.add(testFile);
- sensor.execute(context);
- }
-
- @Test
- public void testExecution() throws IOException {
- File coverPerTest = new File(baseDir, "test/fooTest.xoo.coveragePerTest");
- FileUtils.write(coverPerTest, "test1:src/foo.xoo:1,2,3,4\ntest2:src/foo.xoo:5,6,7\n\n#comment");
- DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo");
- DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo")
- .setType(Type.TEST);
- fileSystem.add(inputFile);
- fileSystem.add(testFile);
-
- final SensorStorage sensorStorage = mock(SensorStorage.class);
-
- when(context.newTestCaseCoverage()).thenAnswer(new Answer<TestCaseCoverage>() {
- @Override
- public TestCaseCoverage answer(InvocationOnMock invocation) throws Throwable {
- return new DefaultTestCaseCoverage(sensorStorage);
- }
- });
-
- sensor.execute(context);
-
- verify(sensorStorage).store(new DefaultTestCaseCoverage()
- .testFile(testFile)
- .testName("test1")
- .cover(inputFile)
- .onLines(Arrays.asList(1, 2, 3, 4)));
- verify(sensorStorage).store(new DefaultTestCaseCoverage()
- .testFile(testFile)
- .testName("test2")
- .cover(inputFile)
- .onLines(Arrays.asList(5, 6, 7)));
- }
-}
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java
deleted file mode 100644
index 5e1a1344f4e..00000000000
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.xoo.lang;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.sonar.api.batch.fs.InputFile.Type;
-import org.sonar.api.batch.fs.internal.DefaultFileSystem;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.sensor.SensorContext;
-import org.sonar.api.batch.sensor.SensorStorage;
-import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
-import org.sonar.api.batch.sensor.test.TestCaseExecution;
-import org.sonar.api.batch.sensor.test.internal.DefaultTestCaseExecution;
-
-import java.io.File;
-import java.io.IOException;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class TestCaseSensorTest {
-
- private TestCaseSensor sensor;
- private SensorContext context = mock(SensorContext.class);
- private DefaultFileSystem fileSystem;
-
- @Rule
- public TemporaryFolder temp = new TemporaryFolder();
- private File baseDir;
-
- @Before
- public void prepare() throws IOException {
- baseDir = temp.newFolder();
- sensor = new TestCaseSensor();
- fileSystem = new DefaultFileSystem(baseDir.toPath());
- when(context.fileSystem()).thenReturn(fileSystem);
- }
-
- @Test
- public void testDescriptor() {
- sensor.describe(new DefaultSensorDescriptor());
- }
-
- @Test
- public void testNoExecutionIfNoTestFile() {
- DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo")
- .setType(Type.TEST);
- fileSystem.add(testFile);
- sensor.execute(context);
- }
-
- @Test
- public void testExecution() throws IOException {
- File testPlan = new File(baseDir, "test/fooTest.xoo.testplan");
- FileUtils.write(testPlan, "test1:UNIT:OK:::10\ntest2:INTEGRATION:ERROR:message:stack:15\n\n#comment");
- DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo")
- .setType(Type.TEST);
- fileSystem.add(testFile);
-
- final SensorStorage sensorStorage = mock(SensorStorage.class);
-
- when(context.newTestCaseExecution()).thenAnswer(new Answer<TestCaseExecution>() {
- @Override
- public TestCaseExecution answer(InvocationOnMock invocation) throws Throwable {
- return new DefaultTestCaseExecution(sensorStorage);
- }
- });
-
- sensor.execute(context);
-
- verify(sensorStorage).store(new DefaultTestCaseExecution(null)
- .inTestFile(testFile)
- .name("test1")
- .durationInMs(10));
- verify(sensorStorage).store(new DefaultTestCaseExecution(null)
- .inTestFile(testFile)
- .name("test2")
- .ofType(TestCaseExecution.Type.INTEGRATION)
- .status(TestCaseExecution.Status.ERROR)
- .message("message")
- .stackTrace("stack")
- .durationInMs(15));
- }
-
-}