Search in sources :

Example 1 with Request

use of org.apache.directory.api.ldap.model.message.Request in project directory-ldap-api by apache.

the class BatchRequestTest method testResponseWith1AuthRequestAnd1AddRequest.

/**
 * Test parsing of a Request with 1 AuthRequest and 1 AddRequest
 */
@Test
public void testResponseWith1AuthRequestAnd1AddRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_AuthRequest_1_AddRequest.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    BatchRequestDsml batchRequest = parser.getBatchRequest();
    List<DsmlDecorator<? extends Request>> requests = batchRequest.getRequests();
    assertEquals(2, requests.size());
    if (requests.get(0) instanceof BindRequest) {
        assertTrue(true);
    } else {
        fail();
    }
    if (requests.get(1) 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) ModifyRequest(org.apache.directory.api.ldap.model.message.ModifyRequest) SearchRequest(org.apache.directory.api.ldap.model.message.SearchRequest) CompareRequest(org.apache.directory.api.ldap.model.message.CompareRequest) Request(org.apache.directory.api.ldap.model.message.Request) BindRequest(org.apache.directory.api.ldap.model.message.BindRequest) AddRequest(org.apache.directory.api.ldap.model.message.AddRequest) ModifyDnRequest(org.apache.directory.api.ldap.model.message.ModifyDnRequest) AbandonRequest(org.apache.directory.api.ldap.model.message.AbandonRequest) DeleteRequest(org.apache.directory.api.ldap.model.message.DeleteRequest) ExtendedRequest(org.apache.directory.api.ldap.model.message.ExtendedRequest) BindRequest(org.apache.directory.api.ldap.model.message.BindRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) DsmlDecorator(org.apache.directory.api.dsmlv2.DsmlDecorator) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Aggregations

AbstractTest (org.apache.directory.api.dsmlv2.AbstractTest)1 DsmlDecorator (org.apache.directory.api.dsmlv2.DsmlDecorator)1 Dsmlv2Parser (org.apache.directory.api.dsmlv2.Dsmlv2Parser)1 BatchRequestDsml (org.apache.directory.api.dsmlv2.request.BatchRequestDsml)1 AbandonRequest (org.apache.directory.api.ldap.model.message.AbandonRequest)1 AddRequest (org.apache.directory.api.ldap.model.message.AddRequest)1 BindRequest (org.apache.directory.api.ldap.model.message.BindRequest)1 CompareRequest (org.apache.directory.api.ldap.model.message.CompareRequest)1 DeleteRequest (org.apache.directory.api.ldap.model.message.DeleteRequest)1 ExtendedRequest (org.apache.directory.api.ldap.model.message.ExtendedRequest)1 ModifyDnRequest (org.apache.directory.api.ldap.model.message.ModifyDnRequest)1 ModifyRequest (org.apache.directory.api.ldap.model.message.ModifyRequest)1 Request (org.apache.directory.api.ldap.model.message.Request)1 SearchRequest (org.apache.directory.api.ldap.model.message.SearchRequest)1 Test (org.junit.Test)1