]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4464 Added permission template tables to the set of tables copied when starting...
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Thu, 11 Jul 2013 09:39:00 +0000 (11:39 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Thu, 11 Jul 2013 09:39:00 +0000 (11:39 +0200)
sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java

index 3e0e4bc69ffe7721a9a1e3f305401c33a8a4d135..c4c7c9a1986a920863c5b0543ba71eb57b6e9f34 100644 (file)
@@ -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 {