From: Jean-Baptiste Vilain Date: Thu, 11 Jul 2013 09:39:00 +0000 (+0200) Subject: SONAR-4464 Added permission template tables to the set of tables copied when starting... X-Git-Tag: 3.7~162 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=81ae9d67d0e0eebb06c50ac2ee101f54863dfab2;p=sonarqube.git SONAR-4464 Added permission template tables to the set of tables copied when starting a dry run analysis --- diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java index 3e0e4bc69ff..c4c7c9a1986 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java @@ -21,7 +21,6 @@ package org.sonar.core.persistence; import com.google.common.io.Files; import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -143,7 +142,19 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { byte[] database = localDatabaseFactory.createDatabaseForDryRun(302L); dataSource = createDatabase(database); assertThat(rowCount("issues")).isEqualTo(0); - FileUtils.cleanDirectory(temporaryFolder.newFolder()); + } + + @Test + public void should_copy_permission_templates_data() throws Exception { + setupData("should_copy_permission_templates"); + + when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder()); + + byte[] database = localDatabaseFactory.createDatabaseForDryRun(null); + dataSource = createDatabase(database); + assertThat(rowCount("permission_templates")).isEqualTo(1); + assertThat(rowCount("perm_templates_users")).isEqualTo(1); + assertThat(rowCount("perm_templates_groups")).isEqualTo(1); } private BasicDataSource createDatabase(byte[] db) throws IOException {