diff options
Diffstat (limited to 'sonar-server/src/test')
11 files changed, 347 insertions, 73 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java b/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java index 37e28fb7b5d..e3874c385af 100644 --- a/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java +++ b/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java @@ -28,31 +28,25 @@ import org.sonar.api.database.DatabaseProperties; import org.sonar.jpa.entity.SchemaMigration; import javax.naming.Context; -import javax.naming.spi.InitialContextFactory; import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.util.Hashtable; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; public class JndiDatabaseConnectorTest { - private Configuration conf; private String currentInitialContextFacto; private JndiDatabaseConnector connector; private int emfCreationCounter; @Before public void setup() { - conf = new PropertiesConfiguration(); - conf.setProperty(DatabaseProperties.PROP_JNDI_NAME, "jdbc/sonar"); + Configuration conf = new PropertiesConfiguration(); conf.setProperty(DatabaseProperties.PROP_DIALECT, DatabaseProperties.DIALECT_HSQLDB); + conf.setProperty(DatabaseProperties.PROP_URL, "jdbc:hsqldb:mem:sonar"); + conf.setProperty(DatabaseProperties.PROP_DRIVER, "org.hsqldb.jdbcDriver"); currentInitialContextFacto = System.getProperty(Context.INITIAL_CONTEXT_FACTORY); connector = getTestJndiConnector(conf); - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestInitialContextFactory.class.getName()); } @After @@ -75,16 +69,6 @@ public class JndiDatabaseConnectorTest { assertEquals(2, emfCreationCounter); } - @Test - public void transactionIsolationCorrectlySet() throws Exception { - int fakeTransactionIsolation = 9; - conf.setProperty(DatabaseProperties.PROP_ISOLATION, fakeTransactionIsolation); - connector.start(); - Connection c = connector.getConnection(); - // start method call get a connection to test it, so total number is 2 - verify(c, times(2)).setTransactionIsolation(fakeTransactionIsolation); - } - private JndiDatabaseConnector getTestJndiConnector(Configuration conf) { JndiDatabaseConnector connector = new JndiDatabaseConnector(conf) { @Override @@ -102,28 +86,5 @@ public class JndiDatabaseConnectorTest { return connector; } - public static class TestInitialContextFactory implements InitialContextFactory { - - private Connection c; - - public Context getInitialContext(Hashtable env) { - Context envContext = mock(Context.class); - Context context = mock(Context.class); - DataSource ds = mock(DataSource.class); - DatabaseMetaData m = mock(DatabaseMetaData.class); - c = mock(Connection.class); - try { - when(envContext.lookup(JndiDatabaseConnector.JNDI_ENV_CONTEXT)).thenReturn(context); - when(context.lookup("jdbc/sonar")).thenReturn(ds); - when(ds.getConnection()).thenReturn(c); - when(m.getURL()).thenReturn("jdbc:test"); - when(c.getMetaData()).thenReturn(m); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return envContext; - } - } } diff --git a/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java new file mode 100644 index 00000000000..354e19435ea --- /dev/null +++ b/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java @@ -0,0 +1,82 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 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.server.platform; + +import org.apache.commons.lang.StringUtils; +import org.hamcrest.core.Is; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import static org.hamcrest.text.StringStartsWith.startsWith; +import static org.junit.Assert.assertThat; + +public class ServerIdGeneratorTest { + + private static InetAddress localhost; + + @BeforeClass + public static void init() throws UnknownHostException { + localhost = InetAddress.getLocalHost(); + } + + @Test + public void idShouldHaveTenCharacters() { + String id = new ServerIdGenerator().toId("SonarSource", localhost); + assertThat(id.length(), Is.is(15)); // first character is version + 14 characters for checksum + assertThat(StringUtils.isBlank(id), Is.is(false)); + } + + @Test + public void idShouldStartWithVersion() { + String id = new ServerIdGenerator().toId("SonarSource", localhost); + assertThat(id, startsWith(ServerIdGenerator.VERSION)); + } + + @Test + public void loopbackAddressesShouldNotBeAccepted() throws UnknownHostException { + assertThat(new ServerIdGenerator().isFixed(InetAddress.getByName("127.0.0.1")), Is.is(false)); + } + + @Test + public void publicAddressesNotBeAccepted() throws UnknownHostException { + assertThat(new ServerIdGenerator().isFixed(InetAddress.getByName("sonarsource.com")), Is.is(true)); + } + + @Test + public void idShouldBeUniquePerOrganisation() { + ServerIdGenerator generator = new ServerIdGenerator(true); + + String k1 = generator.generate("Corp One", "127.0.0.1"); + String k2 = generator.generate("Corp Two", "127.0.0.1"); + assertThat(StringUtils.equals(k1, k2), Is.is(false)); + } + + @Test + public void idShouldBeReproducible() { + ServerIdGenerator generator = new ServerIdGenerator(true); + String i1 = generator.generate("SonarSource", "127.0.0.1"); + String i2 = generator.generate("SonarSource", "127.0.0.1"); + assertThat(StringUtils.equals(i1, i2), Is.is(true)); + } + +} diff --git a/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java index 583772a50bb..145970608c5 100644 --- a/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/ServerImplTest.java @@ -19,18 +19,21 @@ */ package org.sonar.server.platform; +import org.hamcrest.core.Is; import org.junit.Test; +import org.sonar.jpa.test.AbstractDbUnitTestCase; import java.io.IOException; +import java.util.Date; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; -public class ServerImplTest { +public class ServerImplTest extends AbstractDbUnitTestCase { @Test public void alwaysReturnTheSameValues() { - ServerImpl server = new ServerImpl(); + ServerImpl server = new ServerImpl(getSessionFactory()); + server.start(); assertNotNull(server.getId()); assertEquals(server.getId(), server.getId()); @@ -44,21 +47,31 @@ public class ServerImplTest { @Test public void getVersionFromFile() throws IOException { - assertEquals("1.0", new ServerImpl().loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-with-version.properties")); + assertEquals("1.0", new ServerImpl(getSessionFactory()).loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-with-version.properties")); } @Test public void testFileWithNoVersion() throws IOException { - assertEquals("", new ServerImpl().loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-without-version.properties")); + assertEquals("", new ServerImpl(getSessionFactory()).loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-without-version.properties")); } @Test public void testFileWithEmptyVersionParameter() throws IOException { - assertEquals("", new ServerImpl().loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-with-empty-version.properties")); + assertEquals("", new ServerImpl(getSessionFactory()).loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/pom-with-empty-version.properties")); } @Test public void shouldNotFailIfFileNotFound() throws IOException { - assertEquals("", new ServerImpl().loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/unknown-file.properties")); + assertEquals("", new ServerImpl(getSessionFactory()).loadVersionFromManifest("/org/sonar/server/platform/ServerImplTest/unknown-file.properties")); + } + + @Test + public void shouldLoadServerIdFromDatabase() { + setupData("shouldLoadServerIdFromDatabase"); + + ServerImpl server = new ServerImpl(getSessionFactory(), new Date()); + server.start(); + + assertThat(server.getPermanentServerId(), Is.is("abcde")); } } diff --git a/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java index 0e980f3983d..efa3a4adae1 100644 --- a/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/ServerLifecycleNotifierTest.java @@ -99,4 +99,8 @@ class FakeServer extends Server { public String getURL() { return null; } + + public String getPermanentServerId() { + return null; + } } diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/ServerPluginRepositoryTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java index dcc85e5b519..afe742b1887 100644 --- a/sonar-server/src/test/java/org/sonar/server/plugins/ServerPluginRepositoryTest.java +++ b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java @@ -26,22 +26,25 @@ import org.junit.Test; import org.picocontainer.containers.TransientPicoContainer; import org.sonar.api.*; import org.sonar.api.platform.PluginMetadata; +import org.sonar.batch.Batch; import org.sonar.core.plugins.DefaultPluginMetadata; import java.io.File; import java.util.Arrays; import java.util.List; +import static junit.framework.Assert.assertFalse; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ServerPluginRepositoryTest { +public class DefaultServerPluginRepositoryTest { - private ServerPluginRepository repository; + private DefaultServerPluginRepository repository; @After public void stop() { @@ -53,14 +56,14 @@ public class ServerPluginRepositoryTest { @Test public void testStart() { PluginDeployer deployer = mock(PluginDeployer.class); - File pluginFile = FileUtils.toFile(getClass().getResource("/org/sonar/server/plugins/ServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar")); + File pluginFile = FileUtils.toFile(getClass().getResource("/org/sonar/server/plugins/DefaultServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar")); PluginMetadata plugin = DefaultPluginMetadata.create(pluginFile) .setKey("artifactsize") .setMainClass("org.sonar.plugins.artifactsize.ArtifactSizePlugin") .addDeployedFile(pluginFile); when(deployer.getMetadata()).thenReturn(Arrays.asList(plugin)); - repository = new ServerPluginRepository(deployer); + repository = new DefaultServerPluginRepository(deployer); repository.start(); assertThat(repository.getPlugins().size(), Is.is(1)); @@ -73,7 +76,7 @@ public class ServerPluginRepositoryTest { @Test public void shouldRegisterServerExtensions() { - ServerPluginRepository repository = new ServerPluginRepository(mock(PluginDeployer.class)); + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); TransientPicoContainer container = new TransientPicoContainer(); repository.registerExtensions(container, Arrays.<Plugin>asList(new FakePlugin(Arrays.<Class>asList(FakeBatchExtension.class, FakeServerExtension.class)))); @@ -84,8 +87,8 @@ public class ServerPluginRepositoryTest { } @Test - public void shouldInvokeServerExtensionProviderss() { - ServerPluginRepository repository = new ServerPluginRepository(mock(PluginDeployer.class)); + public void shouldInvokeServerExtensionProviders() { + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); TransientPicoContainer container = new TransientPicoContainer(); repository.registerExtensions(container, Arrays.<Plugin>asList(new FakePlugin(Arrays.<Class>asList(FakeExtensionProvider.class)))); @@ -95,6 +98,68 @@ public class ServerPluginRepositoryTest { assertThat(container.getComponents(FakeBatchExtension.class).size(), is(0)); } + @Test + public void shouldNotSupportProvidersOfProviders() { + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); + + TransientPicoContainer container = new TransientPicoContainer(); + repository.registerExtensions(container, Arrays.<Plugin>asList(new FakePlugin(Arrays.<Class>asList(SuperExtensionProvider.class)))); + + assertThat(container.getComponents(FakeBatchExtension.class).size(), is(0)); + assertThat(container.getComponents(FakeServerExtension.class).size(), is(0)); + } + + @Test + public void shouldDisablePlugin() { + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); + repository.disable("checkstyle"); + + assertTrue(repository.isDisabled("checkstyle")); + assertFalse(repository.isDisabled("sqale")); + } + + @Test + public void shouldDisableDependentPlugins() { + PluginDeployer deployer = mock(PluginDeployer.class); + List<PluginMetadata> metadata = Arrays.asList( + newMetadata("checkstyle", null), + newMetadata("checkstyle-extensions", "checkstyle"), + newMetadata("sqale", null) + ); + when(deployer.getMetadata()).thenReturn(metadata); + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(deployer); + + repository.disable("checkstyle"); + + assertTrue(repository.isDisabled("checkstyle")); + assertTrue(repository.isDisabled("checkstyle-extensions")); + assertFalse(repository.isDisabled("sqale")); + } + + @Test + public void shouldNotDisableBasePlugin() { + PluginDeployer deployer = mock(PluginDeployer.class); + List<PluginMetadata> metadata = Arrays.asList( + newMetadata("checkstyle", null), + newMetadata("checkstyle-extensions", "checkstyle"), + newMetadata("sqale", null) + ); + when(deployer.getMetadata()).thenReturn(metadata); + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(deployer); + + repository.disable("checkstyle-extensions"); + + assertFalse(repository.isDisabled("checkstyle")); + assertTrue(repository.isDisabled("checkstyle-extensions")); + } + + private PluginMetadata newMetadata(String pluginKey, String basePluginKey) { + PluginMetadata plugin = mock(PluginMetadata.class); + when(plugin.getKey()).thenReturn(pluginKey); + when(plugin.getBasePlugin()).thenReturn(basePluginKey); + return plugin; + } + public static class FakePlugin extends SonarPlugin { private List<Class> extensions; @@ -122,4 +187,12 @@ public class ServerPluginRepositoryTest { return Arrays.asList(FakeBatchExtension.class, FakeServerExtension.class); } } + + public static class SuperExtensionProvider extends ExtensionProvider implements ServerExtension { + + @Override + public Object provide() { + return FakeExtensionProvider.class; + } + } } diff --git a/sonar-server/src/test/java/org/sonar/server/startup/GeneratePluginIndexTest.java b/sonar-server/src/test/java/org/sonar/server/startup/GeneratePluginIndexTest.java new file mode 100644 index 00000000000..38c26893317 --- /dev/null +++ b/sonar-server/src/test/java/org/sonar/server/startup/GeneratePluginIndexTest.java @@ -0,0 +1,89 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 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.server.startup; + +import org.apache.commons.io.FileUtils; +import org.hamcrest.core.Is; +import org.junit.Before; +import org.junit.Test; +import org.sonar.api.platform.PluginMetadata; +import org.sonar.core.plugins.DefaultPluginMetadata; +import org.sonar.server.platform.DefaultServerFileSystem; +import org.sonar.server.plugins.DefaultServerPluginRepository; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertThat; +import static org.junit.matchers.JUnitMatchers.containsString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class GeneratePluginIndexTest { + + private DefaultServerFileSystem fileSystem; + private File index; + + @Before + public void createIndexFile() { + fileSystem = mock(DefaultServerFileSystem.class); + index = new File("target/test-tmp/GeneratePluginIndexTest/plugins.txt"); + when(fileSystem.getPluginIndex()).thenReturn(index); + } + + @Test + public void shouldWriteIndex() throws IOException { + DefaultServerPluginRepository repository = mock(DefaultServerPluginRepository.class); + PluginMetadata sqale = newMetadata("sqale"); + PluginMetadata checkstyle = newMetadata("checkstyle"); + when(repository.getMetadata()).thenReturn(Arrays.asList(sqale, checkstyle)); + + new GeneratePluginIndex(fileSystem, repository).start(); + + List<String> lines = FileUtils.readLines(index); + assertThat(lines.size(), Is.is(2)); + assertThat(lines.get(0), containsString("sqale")); + assertThat(lines.get(1), containsString("checkstyle")); + } + + @Test + public void shouldSkipDisabledPlugin() throws IOException { + DefaultServerPluginRepository repository = mock(DefaultServerPluginRepository.class); + PluginMetadata sqale = newMetadata("sqale"); + PluginMetadata checkstyle = newMetadata("checkstyle"); + when(repository.getMetadata()).thenReturn(Arrays.asList(sqale, checkstyle)); + when(repository.isDisabled("checkstyle")).thenReturn(true); + + new GeneratePluginIndex(fileSystem, repository).start(); + + List<String> lines = FileUtils.readLines(index); + assertThat(lines.size(), Is.is(1)); + assertThat(lines.get(0), containsString("sqale")); + } + + private PluginMetadata newMetadata(String pluginKey) { + PluginMetadata plugin = mock(DefaultPluginMetadata.class); + when(plugin.getKey()).thenReturn(pluginKey); + when(plugin.getFile()).thenReturn(new File(pluginKey + ".jar")); + return plugin; + } +} diff --git a/sonar-server/src/test/java/org/sonar/server/startup/ServerMetadataPersisterTest.java b/sonar-server/src/test/java/org/sonar/server/startup/ServerMetadataPersisterTest.java index 81ed38316dd..4a22f851b6d 100644 --- a/sonar-server/src/test/java/org/sonar/server/startup/ServerMetadataPersisterTest.java +++ b/sonar-server/src/test/java/org/sonar/server/startup/ServerMetadataPersisterTest.java @@ -19,42 +19,72 @@ */ package org.sonar.server.startup; +import org.junit.After; +import org.junit.Before; import org.junit.Test; -import org.sonar.jpa.test.AbstractDbUnitTestCase; import org.sonar.api.platform.Server; -import org.sonar.server.platform.ServerImpl; +import org.sonar.jpa.test.AbstractDbUnitTestCase; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + public class ServerMetadataPersisterTest extends AbstractDbUnitTestCase { + private TimeZone initialTimeZone; + + @Before + public void fixTimeZone() { + initialTimeZone = TimeZone.getDefault(); + TimeZone.setDefault(TimeZone.getTimeZone("GMT")); + } + + @After + public void revertTimeZone() { + TimeZone.setDefault(initialTimeZone); + } + @Test public void testSaveProperties() throws ParseException { setupData("testSaveProperties"); - persist(); + persist(newServer()); checkTables("testSaveProperties", "properties"); } @Test public void testUpdateExistingProperties() throws ParseException { setupData("testUpdateExistingProperties"); - persist(); + persist(newServer()); checkTables("testUpdateExistingProperties", "properties"); } - private void persist() throws ParseException { - TimeZone initialZone = TimeZone.getDefault(); - try { - TimeZone.setDefault(TimeZone.getTimeZone("GMT")); - Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2010-05-18 17:59"); - Server server = new ServerImpl("123", "2.2", date); - ServerMetadataPersister persister = new ServerMetadataPersister(server, getSession()); - persister.start(); - } finally { - TimeZone.setDefault(initialZone); - } + @Test + public void testDeleteProperties() throws ParseException { + setupData("testDeleteProperties"); + Server server = mock(Server.class); + when(server.getStartedAt()).thenReturn(new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2010-05-18 17:59"));//this is a mandatory not-null property + persist(server); + checkTables("testDeleteProperties", "properties"); + } + + private void persist(Server server) { + ServerMetadataPersister persister = new ServerMetadataPersister(server, getSession()); + persister.start(); + } + + private Server newServer() throws ParseException { + Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2010-05-18 17:59"); + Server server = mock(Server.class); + when(server.getPermanentServerId()).thenReturn("1abcdef"); + when(server.getId()).thenReturn("123"); + when(server.getVersion()).thenReturn("2.2"); + when(server.getStartedAt()).thenReturn(date); + + return server; + } } diff --git a/sonar-server/src/test/resources/org/sonar/server/platform/ServerImplTest/shouldLoadServerIdFromDatabase.xml b/sonar-server/src/test/resources/org/sonar/server/platform/ServerImplTest/shouldLoadServerIdFromDatabase.xml new file mode 100644 index 00000000000..6e0919bd266 --- /dev/null +++ b/sonar-server/src/test/resources/org/sonar/server/platform/ServerImplTest/shouldLoadServerIdFromDatabase.xml @@ -0,0 +1,6 @@ +<dataset> + + <properties id="1" prop_key="sonar.server_id" text_value="abcde" resource_id="[null]" user_id="[null]"/> + <properties id="2" prop_key="sonar.core.serverBaseURL" text_value="http://192.168.0.1" resource_id="[null]" user_id="[null]"/> + +</dataset>
\ No newline at end of file diff --git a/sonar-server/src/test/resources/org/sonar/server/plugins/ServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar b/sonar-server/src/test/resources/org/sonar/server/plugins/DefaultServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar Binary files differindex 19533234582..19533234582 100644 --- a/sonar-server/src/test/resources/org/sonar/server/plugins/ServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar +++ b/sonar-server/src/test/resources/org/sonar/server/plugins/DefaultServerPluginRepositoryTest/sonar-artifact-size-plugin-0.2.jar diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties-result.xml b/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties-result.xml new file mode 100644 index 00000000000..f7ada567379 --- /dev/null +++ b/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties-result.xml @@ -0,0 +1,7 @@ +<dataset> + + <properties id="1" prop_key="other" resource_id="[null]" text_value="some text" user_id="[null]"/> + + <!-- not null property --> + <properties id="4" prop_key="sonar.core.startTime" resource_id="[null]" text_value="2010-05-18T17:59:00+0000" user_id="[null]"/> +</dataset>
\ No newline at end of file diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties.xml b/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties.xml new file mode 100644 index 00000000000..ec292a1388d --- /dev/null +++ b/sonar-server/src/test/resources/org/sonar/server/startup/ServerMetadataPersisterTest/testDeleteProperties.xml @@ -0,0 +1,9 @@ +<dataset> + + <properties id="1" prop_key="other" resource_id="[null]" text_value="some text" user_id="[null]" /> + + <properties id="2" prop_key="sonar.core.id" resource_id="[null]" text_value="123" user_id="[null]"/> + <properties id="3" prop_key="sonar.core.version" resource_id="[null]" text_value="2.2" user_id="[null]"/> + <properties id="4" prop_key="sonar.core.startTime" resource_id="[null]" text_value="2010-05-18T17:59:00+0000" user_id="[null]"/> + +</dataset>
\ No newline at end of file |