aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-04-26 13:52:03 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-04-26 13:52:03 +0200
commit23b537d98fe681bf12d04ef7a8b17a92e59c2e18 (patch)
tree86eecfc3a51987655579c0864f6353e16bcce2c5
parentd56bd3f6b8675e76b6de0a94d0f77729d3505a7e (diff)
downloadsonarqube-23b537d98fe681bf12d04ef7a8b17a92e59c2e18.tar.gz
sonarqube-23b537d98fe681bf12d04ef7a8b17a92e59c2e18.zip
SONAR-3893 Renamed column in SNAPSHOT_DATA from data to value
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/ComponentDataPersister.java2
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/index/ComponentDataPersisterTest/should_persist_component_data-result.xml4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/core/source/jdbc/SnapshotDataDto.java10
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml10
-rw-r--r--sonar-core/src/test/java/org/sonar/core/source/jdbc/SnapshotDataDaoTest.java6
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/source/HtmlSourceDecoratorTest/shared.xml8
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/source/jdbc/SnapshotDataDaoTest/shared.xml4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/config/environment.rb205
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb2
17 files changed, 142 insertions, 132 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ComponentDataPersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/ComponentDataPersister.java
index d0ef14aebeb..5a875e32312 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/ComponentDataPersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/ComponentDataPersister.java
@@ -47,7 +47,7 @@ public class ComponentDataPersister implements ScanPersister {
dto.setSnapshotId(snapshot.getId());
dto.setResourceId(snapshot.getResourceId());
dto.setDataType(dataEntry.key());
- dto.setData(dataEntry.value().writeString());
+ dto.setValue(dataEntry.value().writeString());
// TODO bulk insert
dao.insert(dto);
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/ComponentDataPersisterTest/should_persist_component_data-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/ComponentDataPersisterTest/should_persist_component_data-result.xml
index 2795b1bee33..559c33319a2 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/index/ComponentDataPersisterTest/should_persist_component_data-result.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/index/ComponentDataPersisterTest/should_persist_component_data-result.xml
@@ -1,5 +1,5 @@
<dataset>
<snapshots id="100" project_id="200" islast="[true]"/>
- <snapshot_data id="1" snapshot_id="100" resource_id="200" data="content of symbol" data_type="SYMBOL" created_at="[null]" updated_at="[null]"/>
- <snapshot_data id="2" snapshot_id="100" resource_id="200" data="content of syntax" data_type="SYNTAX" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="1" snapshot_id="100" resource_id="200" value="content of symbol" data_type="SYMBOL" created_at="[null]" updated_at="[null]"/>
+ <snapshot_data id="2" snapshot_id="100" resource_id="200" value="content of syntax" data_type="SYNTAX" created_at="[null]" updated_at="[null]" />
</dataset> \ No newline at end of file
diff --git a/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java b/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java
index 91936ce34ee..085f8eb4990 100644
--- a/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java
+++ b/sonar-core/src/main/java/org/sonar/core/source/HtmlSourceDecorator.java
@@ -73,11 +73,11 @@ public class HtmlSourceDecorator implements ServerComponent {
}
private void loadSnapshotData(DecorationDataHolder decorationDataHolder, SnapshotDataDto snapshotDataEntry) {
- if(!Strings.isNullOrEmpty(snapshotDataEntry.getData())) {
+ if(!Strings.isNullOrEmpty(snapshotDataEntry.getValue())) {
if (SnapshotDataType.isSyntaxHighlighting(snapshotDataEntry.getDataType())) {
- decorationDataHolder.loadSyntaxHighlightingData(snapshotDataEntry.getData());
+ decorationDataHolder.loadSyntaxHighlightingData(snapshotDataEntry.getValue());
} else if (SnapshotDataType.isSymbolHighlighting(snapshotDataEntry.getDataType())) {
- decorationDataHolder.loadSymbolReferences(snapshotDataEntry.getData());
+ decorationDataHolder.loadSymbolReferences(snapshotDataEntry.getValue());
}
}
}
diff --git a/sonar-core/src/main/java/org/sonar/core/source/jdbc/SnapshotDataDto.java b/sonar-core/src/main/java/org/sonar/core/source/jdbc/SnapshotDataDto.java
index 5d70fda1689..e42c122bd94 100644
--- a/sonar-core/src/main/java/org/sonar/core/source/jdbc/SnapshotDataDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/source/jdbc/SnapshotDataDto.java
@@ -28,7 +28,7 @@ public class SnapshotDataDto {
private long id;
private long snapshotId;
private long resourceId;
- private String data;
+ private String value;
private String dataType;
public long getSnapshotId() {
@@ -39,8 +39,8 @@ public class SnapshotDataDto {
return resourceId;
}
- public String getData() {
- return data;
+ public String getValue() {
+ return value;
}
public String getDataType() {
@@ -63,8 +63,8 @@ public class SnapshotDataDto {
this.resourceId = resourceId;
}
- public void setData(String data) {
- this.data = data;
+ public void setValue(String value) {
+ this.value = value;
}
public void setDataType(String dataType) {
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
index 0a9816efc1a..598a8a1f50b 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
@@ -554,7 +554,7 @@ CREATE TABLE "SNAPSHOT_DATA" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
"SNAPSHOT_ID" INTEGER,
"RESOURCE_ID" INTEGER,
- "DATA" VARCHAR(16777215),
+ "VALUE" VARCHAR(16777215),
"DATA_TYPE" VARCHAR(50),
"CREATED_AT" TIMESTAMP,
"UPDATED_AT" TIMESTAMP,
diff --git a/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml b/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml
index 23b52c89411..ca10588f169 100644
--- a/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml
@@ -6,7 +6,7 @@
<select id="selectSnapshotData" parameterType="map" resultType="SnapshotData">
SELECT
snapshot_id AS "snapshotId",
- data,
+ value,
data_type AS "dataType"
FROM snapshot_data
WHERE snapshot_id = #{sid}
@@ -15,9 +15,9 @@
<insert id="insert" parameterType="SnapshotData" useGeneratedKeys="false">
insert into snapshot_data
- (resource_id, snapshot_id, data, data_type, created_at, updated_at)
+ (resource_id, snapshot_id, value, data_type, created_at, updated_at)
values (
- #{resourceId}, #{snapshotId}, #{data}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
+ #{resourceId}, #{snapshotId}, #{value}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
</insert>
<!-- Oracle -->
@@ -26,9 +26,9 @@
select snapshot_data_seq.NEXTVAL from DUAL
</selectKey>
insert into snapshot_data
- (id, resource_id, snapshot_id, data, data_type, created_at, updated_at)
+ (id, resource_id, snapshot_id, value, data_type, created_at, updated_at)
values (
- #{id}, #{resourceId}, #{snapshotId}, #{data}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
+ #{id}, #{resourceId}, #{snapshotId}, #{value}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
</insert>
</mapper>
diff --git a/sonar-core/src/test/java/org/sonar/core/source/jdbc/SnapshotDataDaoTest.java b/sonar-core/src/test/java/org/sonar/core/source/jdbc/SnapshotDataDaoTest.java
index 873b7d67236..722bd427fa6 100644
--- a/sonar-core/src/test/java/org/sonar/core/source/jdbc/SnapshotDataDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/source/jdbc/SnapshotDataDaoTest.java
@@ -46,7 +46,7 @@ public class SnapshotDataDaoTest extends AbstractDaoTestCase {
assertThat(data).onProperty("snapshotId").containsOnly(10L, 10L);
assertThat(data).onProperty("dataType").containsOnly("highlight_syntax", "symbol");
- assertThat(data).onProperty("data").containsOnly("0,10,k;", "20,25,20,35,45;");
+ assertThat(data).onProperty("value").containsOnly("0,10,k;", "20,25,20,35,45;");
}
@Test
@@ -58,7 +58,7 @@ public class SnapshotDataDaoTest extends AbstractDaoTestCase {
SnapshotDataDto dto = new SnapshotDataDto();
dto.setResourceId(1L);
dto.setSnapshotId(11L);
- dto.setData(data);
+ dto.setValue(data);
dto.setDataType(dataType);
dao.insert(dto);
@@ -67,6 +67,6 @@ public class SnapshotDataDaoTest extends AbstractDaoTestCase {
assertThat(serializedData).onProperty("snapshotId").containsOnly(11L);
assertThat(serializedData).onProperty("dataType").containsOnly(dataType);
- assertThat(serializedData).onProperty("data").containsOnly(data);
+ assertThat(serializedData).onProperty("value").containsOnly(data);
}
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
index 7be3147f96a..e30cf0771ff 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
@@ -34,6 +34,6 @@
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
event_date="2008-12-02 13:58:00.00" created_at="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0" end_line="0"/>
- <snapshot_data id="1" resource_id="1" snapshot_id="1" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="1" resource_id="1" snapshot_id="1" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
index e7921e3d701..c0ec987c1c0 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
@@ -32,7 +32,7 @@
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
event_date="2008-12-02 13:58:00.00" created_at="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0" end_line="0"/>
- <snapshot_data id="1" resource_id="1" snapshot_id="1" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="1" resource_id="1" snapshot_id="1" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
<!-- snapshot to remove, id 5 on resource 5-->
@@ -74,7 +74,7 @@
<events id="2" name="Version 1.0" resource_id="5" snapshot_id="5" category="VERSION" description="[null]"
event_date="2008-12-02 13:58:00.00" created_at="[null]"/>
<duplications_index id="2" project_snapshot_id="5" snapshot_id="5" hash="bb" index_in_file="0" start_line="0" end_line="0"/>
- <snapshot_data id="2" resource_id="5" snapshot_id="5" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="2" resource_id="5" snapshot_id="5" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
index f8217f8bf39..c549d4d9aa9 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
@@ -98,6 +98,6 @@ Note that measures, events and reviews are not deleted.
rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER"
user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/>
- <snapshot_data id="2" resource_id="5" snapshot_id="5" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="2" resource_id="5" snapshot_id="5" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
index 4ed12bbedac..2bc87ca4bc6 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
@@ -44,7 +44,7 @@
rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER"
user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/>
- <snapshot_data id="1" resource_id="1" snapshot_id="1" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="1" resource_id="1" snapshot_id="1" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
<!-- The following is not purged but is kept for DBUnit -->
@@ -92,6 +92,6 @@
rule_failure_permanent_id="1" resolution="[null]" created_at="[null]" updated_at="[null]" resource_line="200" severity="BLOCKER"
user_id="300" assignee_id="300" rule_id="500" manual_violation="[true]" manual_severity="[false]" title="[null]" data="[null]"/>
- <snapshot_data id="2" resource_id="5" snapshot_id="5" data="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
+ <snapshot_data id="2" resource_id="5" snapshot_id="5" value="0,10,k" data_type="highlight_syntax" created_at="[null]" updated_at="[null]" />
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/source/HtmlSourceDecoratorTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/source/HtmlSourceDecoratorTest/shared.xml
index 965effbcffe..28d52215a19 100644
--- a/sonar-core/src/test/resources/org/sonar/core/source/HtmlSourceDecoratorTest/shared.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/source/HtmlSourceDecoratorTest/shared.xml
@@ -7,10 +7,10 @@
<snapshots id="13" project_id="3" islast="[true]" />
<snapshots id="14" project_id="3" islast="[true]" />
- <snapshot_data id="101" resource_id="1" snapshot_id="11" data="0,16,cppd;18,25,k;25,31,k;" data_type="highlight_syntax" />
- <snapshot_data id="102" resource_id="2" snapshot_id="12" data="31,41,31;" data_type="symbol" />
- <snapshot_data id="103" resource_id="3" snapshot_id="13" data="0,16,cppd;18,25,k;25,31,k;46,52,k;53,57,k;72,78,k;79,83,k;" data_type="highlight_syntax" />
- <snapshot_data id="104" resource_id="3" snapshot_id="13" data="31,41,31;58,61,58,96;84,87,84;" data_type="symbol" />
+ <snapshot_data id="101" resource_id="1" snapshot_id="11" value="0,16,cppd;18,25,k;25,31,k;" data_type="highlight_syntax" />
+ <snapshot_data id="102" resource_id="2" snapshot_id="12" value="31,41,31;" data_type="symbol" />
+ <snapshot_data id="103" resource_id="3" snapshot_id="13" value="0,16,cppd;18,25,k;25,31,k;46,52,k;53,57,k;72,78,k;79,83,k;" data_type="highlight_syntax" />
+ <snapshot_data id="104" resource_id="3" snapshot_id="13" value="31,41,31;58,61,58,96;84,87,84;" data_type="symbol" />
<snapshot_sources id="101" snapshot_id="11" data="/*&#10; * Header&#10; */&#10;&#10;public class HelloWorld {&#10;}" />
<snapshot_sources id="102" snapshot_id="12" data="/*&#10; * Header&#10; */&#10;&#10;public class HelloWorld {&#10;}" />
diff --git a/sonar-core/src/test/resources/org/sonar/core/source/jdbc/SnapshotDataDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/source/jdbc/SnapshotDataDaoTest/shared.xml
index 4c56793e9eb..dae0a67012d 100644
--- a/sonar-core/src/test/resources/org/sonar/core/source/jdbc/SnapshotDataDaoTest/shared.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/source/jdbc/SnapshotDataDaoTest/shared.xml
@@ -5,7 +5,7 @@
<snapshots id="10" project_id="1" islast="[false]" />
<snapshots id="11" project_id="1" islast="[true]" />
- <snapshot_data id="101" resource_id="1" snapshot_id="10" data="0,10,k;" data_type="highlight_syntax" />
- <snapshot_data id="102" resource_id="1" snapshot_id="10" data="20,25,20,35,45;" data_type="symbol" />
+ <snapshot_data id="101" resource_id="1" snapshot_id="10" value="0,10,k;" data_type="highlight_syntax" />
+ <snapshot_data id="102" resource_id="1" snapshot_id="10" value="20,25,20,35,45;" data_type="symbol" />
</dataset> \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
index 4cd2a19f6b7..570e8830f90 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
@@ -17,6 +17,7 @@
* 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.api.config;
import com.google.common.base.Preconditions;
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb
index daa44db4de6..397803ebcd5 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb
@@ -17,6 +17,8 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+require "color"
+
class MeasureColor
MIN_COLOR=Color::RGB.from_html("EE0000") # red
diff --git a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb
index a83470fee39..1141006d46b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb
@@ -1,143 +1,149 @@
RAILS_GEM_VERSION = '2.3.15'
+if ENV['RAILS_ENV'] == "test"
+
+
+
+else
+
# Avoid conflict with local ruby installations
# See http://jira.codehaus.org/browse/SONAR-3579
-ENV['GEM_HOME'] = $servlet_context.getRealPath('/WEB-INF/gems')
+ ENV['GEM_HOME'] = $servlet_context.getRealPath('/WEB-INF/gems')
# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-require 'color'
+ require File.join(File.dirname(__FILE__), 'boot')
+ require 'color'
# Disable all the warnings :
# Gem::SourceIndex#initialize called from /.../war/sonar-server/WEB-INF/gems/gems/rails-2.3.15/lib/rails/vendor_gem_source_index.rb:100.
# The other solutions are to upgrade to rails 3 or to use gembundler.com
-require 'rubygems'
-Gem::Deprecate.skip = (RAILS_ENV == 'production')
+ require 'rubygems'
+ Gem::Deprecate.skip = (RAILS_ENV == 'production')
#
# Limitation of Rails 2.3 and Rails Engines (plugins) when threadsafe! is enabled in production mode
# See http://groups.google.com/group/rubyonrails-core/browse_thread/thread/9067bce01444fb24?pli=1
#
-class EagerPluginLoader < Rails::Plugin::Loader
- def add_plugin_load_paths
- super
- plugins.each do |plugin|
- if configuration.cache_classes
- configuration.eager_load_paths += plugin.load_paths
+ class EagerPluginLoader < Rails::Plugin::Loader
+ def add_plugin_load_paths
+ super
+ plugins.each do |plugin|
+ if configuration.cache_classes
+ configuration.eager_load_paths += plugin.load_paths
+ end
end
end
end
-end
-Rails::Initializer.run do |config|
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
- # See Rails::Configuration for more options.
+ Rails::Initializer.run do |config|
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+ # See Rails::Configuration for more options.
- # Skip frameworks you're not going to use. To use Rails without a database
- # you must remove the Active Record framework.
- config.frameworks -= [:action_mailer]
+ # Skip frameworks you're not going to use. To use Rails without a database
+ # you must remove the Active Record framework.
+ config.frameworks -= [:action_mailer]
- # This property can't be set in config/environments because of execution order
- # See http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/
- config.reload_plugins=(RAILS_ENV == 'development')
+ # This property can't be set in config/environments because of execution order
+ # See http://strd6.com/2009/04/cant-dup-nilclass-maybe-try-unloadable/
+ config.reload_plugins=(RAILS_ENV == 'development')
- config.plugin_loader = EagerPluginLoader
+ config.plugin_loader = EagerPluginLoader
- # Load the applications that are packaged with sonar plugins.
- # The development mode (real-time edition of ruby code) can be enabled on an app by replacing the
- # following line by :
- # config.plugin_paths << '/absolute/path/to/myproject/src/main/resources/org/sonar/ror'
- config.plugin_paths << "#{Java::OrgSonarServerUi::JRubyFacade.getInstance().getServerHome()}/temp/ror"
+ # Load the applications that are packaged with sonar plugins.
+ # The development mode (real-time edition of ruby code) can be enabled on an app by replacing the
+ # following line by :
+ # config.plugin_paths << '/absolute/path/to/myproject/src/main/resources/org/sonar/ror'
+ config.plugin_paths << "#{Java::OrgSonarServerUi::JRubyFacade.getInstance().getServerHome()}/temp/ror"
- # Force all environments to use the same logger level
- # (by default production uses :info, the others :debug)
- # config.log_level = :debug
+ # Force all environments to use the same logger level
+ # (by default production uses :info, the others :debug)
+ # config.log_level = :debug
- # Make Time.zone default to the specified zone, and make Active Record store time values
- # in the database in UTC, and return them converted to the specified local zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
- # config.time_zone = 'UTC'
+ # Make Time.zone default to the specified zone, and make Active Record store time values
+ # in the database in UTC, and return them converted to the specified local zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
+ # config.time_zone = 'UTC'
- # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
- # All files from config/locales/*.rb,yml are added automatically.
+ # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
+ # All files from config/locales/*.rb,yml are added automatically.
- # Default locales provided by Ruby on Rails
- config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '**', '*.{rb,yml}')]
+ # Default locales provided by Ruby on Rails
+ config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '**', '*.{rb,yml}')]
- # Overridden bundles
- config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '*.{rb,yml}')]
+ # Overridden bundles
+ config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'config', 'locales', '*.{rb,yml}')]
- config.i18n.default_locale = :en
+ config.i18n.default_locale = :en
- # Provided by JRuby-Rack
- config.action_controller.session_store = :java_servlet_store
+ # Provided by JRuby-Rack
+ config.action_controller.session_store = :java_servlet_store
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
- # Activate observers that should always be running
- # Please note that observers generated using script/generate observer need to have an _observer suffix
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
-end
+ # Activate observers that should always be running
+ # Please note that observers generated using script/generate observer need to have an _observer suffix
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+ end
-class ActiveRecord::Migration
- def self.dialect
- ActiveRecord::Base.configurations[ENV['RAILS_ENV']]['dialect']
- end
+ class ActiveRecord::Migration
+ def self.dialect
+ ActiveRecord::Base.configurations[ENV['RAILS_ENV']]['dialect']
+ end
- def self.add_index(table_name, column_name, options = {})
- # ActiveRecord can generate index names longer than 30 characters, but that's
- # not supported by Oracle, the "Enterprise" database.
- # For this reason we force to set name of indexes.
- raise ArgumentError, 'Missing index name' unless options[:name]
- super(table_name, column_name, options)
- end
+ def self.add_index(table_name, column_name, options = {})
+ # ActiveRecord can generate index names longer than 30 characters, but that's
+ # not supported by Oracle, the "Enterprise" database.
+ # For this reason we force to set name of indexes.
+ raise ArgumentError, 'Missing index name' unless options[:name]
+ super(table_name, column_name, options)
+ end
- def self.alter_to_big_primary_key(tablename)
- case dialect()
- when "postgre"
- execute "ALTER TABLE #{tablename} ALTER COLUMN id TYPE bigint"
- when "mysql"
- execute "ALTER TABLE #{tablename} CHANGE id id BIGINT AUTO_INCREMENT"
- when "h2"
- # not needed?
- when "oracle"
- # do nothing, oracle integer are big enough
- when "sqlserver"
- constraint=select_one "select name from sysobjects where parent_obj = (select id from sysobjects where name = '#{tablename}')"
- execute "ALTER TABLE #{tablename} DROP CONSTRAINT #{constraint["name"]}"
- execute "ALTER TABLE #{tablename} ALTER COLUMN id bigint"
- execute "ALTER TABLE #{tablename} ADD PRIMARY KEY(id)"
+ def self.alter_to_big_primary_key(tablename)
+ case dialect()
+ when "postgre"
+ execute "ALTER TABLE #{tablename} ALTER COLUMN id TYPE bigint"
+ when "mysql"
+ execute "ALTER TABLE #{tablename} CHANGE id id BIGINT AUTO_INCREMENT"
+ when "h2"
+ # not needed?
+ when "oracle"
+ # do nothing, oracle integer are big enough
+ when "sqlserver"
+ constraint=select_one "select name from sysobjects where parent_obj = (select id from sysobjects where name = '#{tablename}')"
+ execute "ALTER TABLE #{tablename} DROP CONSTRAINT #{constraint["name"]}"
+ execute "ALTER TABLE #{tablename} ALTER COLUMN id bigint"
+ execute "ALTER TABLE #{tablename} ADD PRIMARY KEY(id)"
+ end
end
- end
- def self.alter_to_big_integer(tablename, columnname, indexname=nil)
- case dialect()
- when "sqlserver"
- execute "DROP INDEX #{indexname} on #{tablename}" if indexname
- change_column(tablename, columnname, :big_integer, :null => true)
- execute "CREATE INDEX #{indexname} on #{tablename}(#{columnname})" if indexname
- else
- change_column(tablename, columnname, :big_integer, :null => true)
+ def self.alter_to_big_integer(tablename, columnname, indexname=nil)
+ case dialect()
+ when "sqlserver"
+ execute "DROP INDEX #{indexname} on #{tablename}" if indexname
+ change_column(tablename, columnname, :big_integer, :null => true)
+ execute "CREATE INDEX #{indexname} on #{tablename}(#{columnname})" if indexname
+ else
+ change_column(tablename, columnname, :big_integer, :null => true)
+ end
end
end
-end
# patch for SONAR-1182. GWT does not support ISO8601 dates that end with 'Z'
# http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/i18n/client/DateTimeFormat.html
-module ActiveSupport
- class TimeWithZone
- def xmlschema
- # initial code: "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, 'Z')}"
- "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, nil)}"
+ module ActiveSupport
+ class TimeWithZone
+ def xmlschema
+ # initial code: "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, 'Z')}"
+ "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, nil)}"
+ end
end
end
-end
#
# other patches :
@@ -145,9 +151,9 @@ end
# See https://github.com/rails/rails/issues/585
# - actionview NumberHelper, patch for number_with_precision()
-require File.dirname(__FILE__) + '/../lib/sonar_webservice_plugins.rb'
-require File.dirname(__FILE__) + '/../lib/database_version.rb'
-DatabaseVersion.automatic_setup
+ require File.dirname(__FILE__) + '/../lib/sonar_webservice_plugins.rb'
+ require File.dirname(__FILE__) + '/../lib/database_version.rb'
+ DatabaseVersion.automatic_setup
#
@@ -156,4 +162,5 @@ DatabaseVersion.automatic_setup
# Some changes have been done in activerecord-jdbc-adapter. Most of them relate to column types.
# All these changes are prefixed by the comment #sonar
#
-# \ No newline at end of file
+#
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
index 9fe097a2683..0a889e264d0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/387_create_snapshot_data.rb
@@ -28,7 +28,7 @@ class CreateSnapshotData < ActiveRecord::Migration
create_table :snapshot_data do |t|
t.column :snapshot_id, :integer, :null => true
t.column :resource_id, :integer, :null => true
- t.column :data, :text, :null => true
+ t.column :value, :text, :null => true
t.column :data_type, :string, :null => true, :limit => 50
t.timestamps
end