Search in sources :

Example 21 with BatchResponseDsml

use of org.apache.directory.api.dsmlv2.response.BatchResponseDsml in project directory-ldap-api by apache.

the class ParserUtilsTest method testStyleDocumentWithBatchResponse.

/**
 * Test for DIRAPI-238: DSML pretty print does not work, prints error.
 *
 * Indirect test of ParserUtils.styleDocument() via BatchResponseDsml.toDsml()
 */
@Test
public void testStyleDocumentWithBatchResponse() throws Exception {
    Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser(getCodec());
    parser.setInput(BatchResponseTest.class.getResource("response_with_2_SearchResponse.xml").openStream(), "UTF-8");
    parser.parse();
    BatchResponseDsml batchResponse = parser.getBatchResponse();
    String dsml = batchResponse.toDsml();
    assertNotNull(dsml);
    assertEquals("Pretty printed DSML should contain newlines", 12, countNewlines(dsml));
    assertEquals("Pretty printed DSML should contain indention", 18, countIndention(dsml));
}
Also used : BatchResponseDsml(org.apache.directory.api.dsmlv2.response.BatchResponseDsml) Test(org.junit.Test) BatchRequestTest(org.apache.directory.api.dsmlv2.batchRequest.BatchRequestTest) BatchResponseTest(org.apache.directory.api.dsmlv2.batchResponse.BatchResponseTest)

Aggregations

BatchResponseDsml (org.apache.directory.api.dsmlv2.response.BatchResponseDsml)21 Test (org.junit.Test)21 AbstractResponseTest (org.apache.directory.api.dsmlv2.AbstractResponseTest)20 Dsmlv2ResponseParser (org.apache.directory.api.dsmlv2.Dsmlv2ResponseParser)20 ErrorResponse (org.apache.directory.api.dsmlv2.response.ErrorResponse)2 SearchResponse (org.apache.directory.api.dsmlv2.response.SearchResponse)2 AddResponse (org.apache.directory.api.ldap.model.message.AddResponse)2 BindResponse (org.apache.directory.api.ldap.model.message.BindResponse)2 CompareResponse (org.apache.directory.api.ldap.model.message.CompareResponse)2 DeleteResponse (org.apache.directory.api.ldap.model.message.DeleteResponse)2 ExtendedResponse (org.apache.directory.api.ldap.model.message.ExtendedResponse)2 ModifyDnResponse (org.apache.directory.api.ldap.model.message.ModifyDnResponse)2 ModifyResponse (org.apache.directory.api.ldap.model.message.ModifyResponse)2 BatchRequestTest (org.apache.directory.api.dsmlv2.batchRequest.BatchRequestTest)1 BatchResponseTest (org.apache.directory.api.dsmlv2.batchResponse.BatchResponseTest)1