]> source.dussan.org Git - sonarqube.git/commitdiff
Fix package of class CopyDeprecatedServerId
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 16 Oct 2017 09:59:23 +0000 (11:59 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 16 Oct 2017 11:57:02 +0000 (13:57 +0200)
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CopyDeprecatedServerId.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java [new file with mode: 0644]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerIdTest.java

diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CopyDeprecatedServerId.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CopyDeprecatedServerId.java
deleted file mode 100644 (file)
index d2a0a31..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.server.platform.db.migration.version.v66;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.step.Select;
-
-public class CopyDeprecatedServerId extends DataChange {
-
-  private static final String DEPRECATED_KEY = "sonar.server_id";
-  private static final String NEW_KEY = "sonar.core.id";
-
-  public CopyDeprecatedServerId(Database db) {
-    super(db);
-  }
-
-  @Override
-  protected void execute(Context context) throws SQLException {
-    String deprecatedValue = context
-      .prepareSelect("select text_value from properties where prop_key = '" + DEPRECATED_KEY + "'")
-      .get(new Select.StringReader());
-    if (deprecatedValue != null && !deprecatedValue.isEmpty()) {
-      deleteProperty(context, NEW_KEY);
-      context.prepareUpsert("insert into properties" +
-        " (prop_key, is_empty, text_value, created_at)" +
-        " values " +
-        " (?, ?, ?, ?)")
-        .setString(1, NEW_KEY)
-        .setBoolean(2, false)
-        .setString(3, deprecatedValue)
-        .setLong(4, System.currentTimeMillis())
-        .execute()
-        .commit();
-    }
-    deleteProperty(context, DEPRECATED_KEY);
-  }
-
-  private static void deleteProperty(Context context, String key) throws SQLException {
-    context.prepareUpsert("delete from properties where prop_key = '" + key + "'")
-      .execute()
-      .commit();
-  }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java
new file mode 100644 (file)
index 0000000..812c5af
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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.server.platform.db.migration.version.v67;
+
+import java.sql.SQLException;
+import org.sonar.db.Database;
+import org.sonar.server.platform.db.migration.step.DataChange;
+import org.sonar.server.platform.db.migration.step.Select;
+
+public class CopyDeprecatedServerId extends DataChange {
+
+  private static final String DEPRECATED_KEY = "sonar.server_id";
+  private static final String NEW_KEY = "sonar.core.id";
+
+  public CopyDeprecatedServerId(Database db) {
+    super(db);
+  }
+
+  @Override
+  protected void execute(Context context) throws SQLException {
+    String deprecatedValue = context
+      .prepareSelect("select text_value from properties where prop_key = '" + DEPRECATED_KEY + "'")
+      .get(new Select.StringReader());
+    if (deprecatedValue != null && !deprecatedValue.isEmpty()) {
+      deleteProperty(context, NEW_KEY);
+      context.prepareUpsert("insert into properties" +
+        " (prop_key, is_empty, text_value, created_at)" +
+        " values " +
+        " (?, ?, ?, ?)")
+        .setString(1, NEW_KEY)
+        .setBoolean(2, false)
+        .setString(3, deprecatedValue)
+        .setLong(4, System.currentTimeMillis())
+        .execute()
+        .commit();
+    }
+    deleteProperty(context, DEPRECATED_KEY);
+  }
+
+  private static void deleteProperty(Context context, String key) throws SQLException {
+    context.prepareUpsert("delete from properties where prop_key = '" + key + "'")
+      .execute()
+      .commit();
+  }
+
+}
index 9743728de76b2ce9cdb04ce6b5b95f779c77cca8..b02a60659975ebe5bba2f50c7e553e2fbbf79bfc 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.platform.db.migration.version.v67;
 
 import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
 import org.sonar.server.platform.db.migration.version.DbVersion;
-import org.sonar.server.platform.db.migration.version.v66.CopyDeprecatedServerId;
 
 public class DbVersion67 implements DbVersion {
   @Override
index 7f43080267fde72b63746234a7a33c8fe268ab74..7d4e7f55ad90169ee042348b2a734f6753c45255 100644 (file)
@@ -24,7 +24,6 @@ import java.util.List;
 import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.db.CoreDbTester;
-import org.sonar.server.platform.db.migration.version.v66.CopyDeprecatedServerId;
 
 import static org.assertj.core.api.Assertions.assertThat;