Search in sources :

Example 16 with BatchRequestDsml

use of org.apache.directory.api.dsmlv2.request.BatchRequestDsml in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWith2CompareRequest.

/**
 * Test parsing of a Request with 2 CompareRequest
 */
@Test
public void testResponseWith2CompareRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_2_CompareRequest.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    assertEquals(2, batchRequest.getRequests().size());
    if (batchRequest.getCurrentRequest() instanceof CompareRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) CompareRequest(org.apache.directory.api.ldap.model.message.CompareRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 17 with BatchRequestDsml

use of org.apache.directory.api.dsmlv2.request.BatchRequestDsml in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWith1AddRequest.

/**
 * Test parsing of a Request with 1 AddRequest
 */
@Test
public void testResponseWith1AddRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_AddRequest.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    assertEquals(1, batchRequest.getRequests().size());
    if (batchRequest.getCurrentRequest() instanceof AddRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) AddRequest(org.apache.directory.api.ldap.model.message.AddRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 18 with BatchRequestDsml

use of org.apache.directory.api.dsmlv2.request.BatchRequestDsml in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWith2AddRequest.

/**
 * Test parsing of a Request with 2 AddRequest
 */
@Test
public void testResponseWith2AddRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_2_AddRequest.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    assertEquals(2, batchRequest.getRequests().size());
    if (batchRequest.getCurrentRequest() instanceof AddRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) AddRequest(org.apache.directory.api.ldap.model.message.AddRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 19 with BatchRequestDsml

use of org.apache.directory.api.dsmlv2.request.BatchRequestDsml in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWithRequestId.

/**
 * Test parsing of a Request with the (optional) requestID attribute
 */
@Test
public void testResponseWithRequestId() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_requestID_attribute.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    assertEquals(1234567890, batchRequest.getRequestID());
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 20 with BatchRequestDsml

use of org.apache.directory.api.dsmlv2.request.BatchRequestDsml in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWith2ExtendedRequest.

/**
 * Test parsing of a Request with 2 ExtendedRequest
 */
@Test
public void testResponseWith2ExtendedRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_2_ExtendedRequest.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    assertEquals(2, batchRequest.getRequests().size());
    if (batchRequest.getCurrentRequest() instanceof ExtendedRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) ExtendedRequest(org.apache.directory.api.ldap.model.message.ExtendedRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Aggregations

BatchRequestDsml (org.apache.directory.api.dsmlv2.request.BatchRequestDsml)24 Test (org.junit.Test)23 Dsmlv2Parser (org.apache.directory.api.dsmlv2.Dsmlv2Parser)22 AbstractTest (org.apache.directory.api.dsmlv2.AbstractTest)21 SearchRequest (org.apache.directory.api.ldap.model.message.SearchRequest)4 AbandonRequest (org.apache.directory.api.ldap.model.message.AbandonRequest)3 AddRequest (org.apache.directory.api.ldap.model.message.AddRequest)3 CompareRequest (org.apache.directory.api.ldap.model.message.CompareRequest)3 DeleteRequest (org.apache.directory.api.ldap.model.message.DeleteRequest)3 ExtendedRequest (org.apache.directory.api.ldap.model.message.ExtendedRequest)3 ModifyDnRequest (org.apache.directory.api.ldap.model.message.ModifyDnRequest)3 ModifyRequest (org.apache.directory.api.ldap.model.message.ModifyRequest)3 BindRequest (org.apache.directory.api.ldap.model.message.BindRequest)2 IOException (java.io.IOException)1 DsmlDecorator (org.apache.directory.api.dsmlv2.DsmlDecorator)1 BatchRequestTest (org.apache.directory.api.dsmlv2.batchRequest.BatchRequestTest)1 BatchResponseTest (org.apache.directory.api.dsmlv2.batchResponse.BatchResponseTest)1 Request (org.apache.directory.api.ldap.model.message.Request)1 XmlPullParser (org.xmlpull.v1.XmlPullParser)1 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)1