Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 02c57a94110d
Choose a base ref
...
head repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d2e50940627b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 9, 2013

  1. TRUNK-4113 Modify the ObsValidator to allow the storage of obs text l…

    …arger than 50 chars(cherry picked from commit e6b5558)
    Dedunu Dhananjaya authored and dkayiwa committed Dec 9, 2013
    Copy the full SHA
    6003ef8 View commit details
  2. TRUNK-4113 Modify the ObsValidator to allow the storage of obs text l…

    …arger than 50 chars(cherry picked from commit 8d8e5e1)
    Dedunu Dhananjaya authored and dkayiwa committed Dec 9, 2013
    Copy the full SHA
    d2e5094 View commit details
Showing with 10 additions and 3 deletions.
  1. +1 −1 api/src/main/java/org/openmrs/validator/ObsValidator.java
  2. +9 −2 api/src/test/java/org/openmrs/validator/ObsValidatorTest.java
2 changes: 1 addition & 1 deletion api/src/main/java/org/openmrs/validator/ObsValidator.java
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@
@Handler(supports = { Obs.class }, order = 50)
public class ObsValidator implements Validator {

public final static int VALUE_TEXT_MAX_LENGTH = 50;
public final static int VALUE_TEXT_MAX_LENGTH = 1000;

/**
* @see org.springframework.validation.Validator#supports(java.lang.Class)
11 changes: 9 additions & 2 deletions api/src/test/java/org/openmrs/validator/ObsValidatorTest.java
Original file line number Diff line number Diff line change
@@ -304,8 +304,15 @@ public void validate_shouldFailValidationIfValueTextIsGreaterThanTheMaximumLengt
obs.setPerson(Context.getPersonService().getPerson(2));
obs.setConcept(Context.getConceptService().getConcept(19));
obs.setObsDatetime(new Date());
obs
.setValueText("the limit of valueText is 50. So we are trying to test it with more than 50 characters and this is the test text 1");

// Generate 1800+ characters length text.
String valueText = "";
for (int i = 0; i < 20; i++) {
valueText = valueText
+ "This text should not exceed 1000 characters. Below code will generate a text more than 1000";
}

obs.setValueText(valueText);

Errors errors = new BindException(obs, "obs");
new ObsValidator().validate(obs, errors);