From 81ae9d67d0e0eebb06c50ac2ee101f54863dfab2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Vilain Date: Thu, 11 Jul 2013 11:39:00 +0200 Subject: [PATCH] SONAR-4464 Added permission template tables to the set of tables copied when starting a dry run analysis --- .../persistence/DryRunDatabaseFactoryTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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 { -- 2.39.5