diff options
author | David Gageot <david@gageot.net> | 2012-07-09 16:00:49 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-10 08:50:59 +0200 |
commit | 9a1dfc90225636f980821a4c4be971035f0e6e05 (patch) | |
tree | f27949099ecbfb35d0a3322ebebc9c48ddf4ad9b /sonar-batch/src/test | |
parent | 4bc518ebc8b51e8ee64d4bb3d86136a5b7d12043 (diff) | |
download | sonarqube-9a1dfc90225636f980821a4c4be971035f0e6e05.tar.gz sonarqube-9a1dfc90225636f980821a4c4be971035f0e6e05.zip |
SONAR-3437 Use MyBatis in batch mode
Diffstat (limited to 'sonar-batch/src/test')
2 files changed, 29 insertions, 0 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java index 3bb6707129a..f1ba1fb750a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java @@ -19,6 +19,7 @@ */ package org.sonar.batch.index; +import org.apache.commons.lang.StringUtils; import org.junit.Before; import org.junit.Test; import org.sonar.api.database.model.MeasureModel; @@ -94,6 +95,16 @@ public class MeasurePersisterTest extends AbstractDaoTestCase { } @Test + public void shouldInsertMeasureWithTextData() { + setupData("empty"); + + measurePersister.saveMeasure(project, new Measure(ncloc()).setData("SHORT")); + measurePersister.saveMeasure(project, new Measure(ncloc()).setData(StringUtils.repeat("0123456789", 10))); + + checkTables("shouldInsertMeasureWithLargeData", "project_measures", "measure_data"); + } + + @Test public void shouldUpdateMeasure() { setupData("data"); diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/MeasurePersisterTest/shouldInsertMeasureWithLargeData-result.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/MeasurePersisterTest/shouldInsertMeasureWithLargeData-result.xml new file mode 100644 index 00000000000..c90db3d3f14 --- /dev/null +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/MeasurePersisterTest/shouldInsertMeasureWithLargeData-result.xml @@ -0,0 +1,18 @@ +<dataset> + + <project_measures id="1" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" + RULE_ID="[null]" text_value="SHORT" tendency="[null]" measure_date="[null]" project_id="[null]" + alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" + person_id="[null]" + variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> + + <project_measures id="2" VALUE="[null]" METRIC_ID="1" SNAPSHOT_ID="3001" alert_text="[null]" RULES_CATEGORY_ID="[null]" + RULE_ID="[null]" text_value="[null]" + tendency="[null]" measure_date="[null]" project_id="[null]" + alert_status="[null]" description="[null]" rule_priority="[null]" characteristic_id="[null]" url="[null]" + person_id="[null]" + variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"/> + + <measure_data id="1" measure_id="2" snapshot_id="3001" data="MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OQ=="/> + +</dataset> |