Search in sources :

Example 66 with ObjectMapper

use of org.codehaus.jackson.map.ObjectMapper in project head by mifos.

the class RESTAPITest method centerChargesByGlobalNum.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(groups = "readOnly")
public void centerChargesByGlobalNum() throws Exception {
    String type = Type.CENTER;
    String by = By.GLOBAL_NUMBER;
    String value = CENTER_GLOBAL_ID + Op.CHARGES;
    String actualJSON = helper.getJSONFromUI(type, by, value);
    String expectedJSON = helper.getJSONFromDataSet(type, by, value);
    ObjectMapper mapper = helper.getObjectMapper();
    Assert.assertEquals(mapper.readTree(expectedJSON), mapper.readTree(actualJSON));
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.testng.annotations.Test)

Example 67 with ObjectMapper

use of org.codehaus.jackson.map.ObjectMapper in project head by mifos.

the class RESTAPITest method groupByGlobalNum.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(groups = "readOnly")
public void groupByGlobalNum() throws Exception {
    String type = Type.GROUP;
    String by = By.GLOBAL_NUMBER;
    String value = GROUP_GLOBAL_ID;
    String actualJSON = helper.getJSONFromUI(type, by, value);
    String expectedJSON = helper.getJSONFromDataSet(type, by, value);
    ObjectMapper mapper = helper.getObjectMapper();
    Assert.assertEquals(mapper.readTree(expectedJSON), mapper.readTree(actualJSON));
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.testng.annotations.Test)

Example 68 with ObjectMapper

use of org.codehaus.jackson.map.ObjectMapper in project head by mifos.

the class RESTAPITest method loanRepaymentScheduleByGlobalNum.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(groups = "readOnly")
public void loanRepaymentScheduleByGlobalNum() throws Exception {
    String type = Type.LOAN;
    String by = By.GLOBAL_NUMBER;
    String value = LOAN_ACCOUNT_GLOBAL_ID + Op.SCHEDULE;
    String actualJSON = helper.getJSONFromUI(type, by, value);
    String expectedJSON = helper.getJSONFromDataSet(type, by, value);
    ObjectMapper mapper = helper.getObjectMapper();
    Assert.assertEquals(mapper.readTree(expectedJSON), mapper.readTree(actualJSON));
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.testng.annotations.Test)

Example 69 with ObjectMapper

use of org.codehaus.jackson.map.ObjectMapper in project head by mifos.

the class RESTAPITest method applicableFeesForClientByGlobalNum.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(groups = "readOnly")
public void applicableFeesForClientByGlobalNum() throws Exception {
    String type = Type.CUSTOMER;
    String by = By.GLOBAL_NUMBER;
    String value = CLIENT_GLOBAL_ID + Op.APPLICABLE_FEES;
    String actualJSON = helper.getJSONFromUI(type, by, value);
    String expectedJSON = helper.getJSONFromDataSet(type, by, value);
    ObjectMapper mapper = helper.getObjectMapper();
    Assert.assertEquals(mapper.readTree(expectedJSON), mapper.readTree(actualJSON));
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.testng.annotations.Test)

Example 70 with ObjectMapper

use of org.codehaus.jackson.map.ObjectMapper in project head by mifos.

the class RESTAPITestHelper method getObjectMapper.

public ObjectMapper getObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY, true);
    mapper.configure(DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS, true);
    mapper.configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, false);
    mapper.configure(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS, true);
    return mapper;
}
Also used : ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Aggregations

ObjectMapper (org.codehaus.jackson.map.ObjectMapper)386 IOException (java.io.IOException)85 Test (org.junit.Test)61 JsonNode (org.codehaus.jackson.JsonNode)50 HashMap (java.util.HashMap)46 ArrayList (java.util.ArrayList)45 Test (org.testng.annotations.Test)37 Map (java.util.Map)34 List (java.util.List)26 File (java.io.File)22 StringWriter (java.io.StringWriter)22 JSONObject (org.json.JSONObject)18 SimpleModule (org.codehaus.jackson.map.module.SimpleModule)17 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)16 ByteArrayInputStream (java.io.ByteArrayInputStream)14 Version (org.codehaus.jackson.Version)14 JsonFactory (org.codehaus.jackson.JsonFactory)13 JSONObject (org.codehaus.jettison.json.JSONObject)13 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 JsonGenerator (org.codehaus.jackson.JsonGenerator)11