Search in sources :

Example 6 with BatchRequestDsml

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

the class BatchRequestTest method testResponseWith0Request.

/**
 * Test parsing of a Request with the (optional) requestID attribute
 */
@Test
public void testResponseWith0Request() {
    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(0, batchRequest.getRequests().size());
}
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 7 with BatchRequestDsml

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

the class BatchRequestTest method testResponseWith1ExtendedRequest.

/**
 * Test parsing of a Request with 1 ExtendedRequest
 */
@Test
public void testResponseWith1ExtendedRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_ExtendedRequest.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 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)

Example 8 with BatchRequestDsml

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

the class BatchRequestTest method testResponseWith1SearchRequest.

/**
 * Test parsing of a Request with 1 SearchRequest
 */
@Test
public void testResponseWith1SearchRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_SearchRequest.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 SearchRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) SearchRequest(org.apache.directory.api.ldap.model.message.SearchRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 9 with BatchRequestDsml

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

the class BatchRequestTest method testResponseWith1AuthRequest.

/**
 * Test parsing of a Request with 1 AuthRequest
 */
@Test
public void testResponseWith1AuthRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_AuthRequest.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 BindRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) BindRequest(org.apache.directory.api.ldap.model.message.BindRequest) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) Test(org.junit.Test) AbstractTest(org.apache.directory.api.dsmlv2.AbstractTest)

Example 10 with BatchRequestDsml

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

the class BatchRequestTest method testResponseWith1DelRequest.

/**
 * Test parsing of a Request with 1 DelRequest
 */
@Test
public void testResponseWith1DelRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_1_DelRequest.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 DeleteRequest) {
        assertTrue(true);
    } else {
        fail();
    }
}
Also used : BatchRequestDsml(org.apache.directory.api.dsmlv2.request.BatchRequestDsml) Dsmlv2Parser(org.apache.directory.api.dsmlv2.Dsmlv2Parser) DeleteRequest(org.apache.directory.api.ldap.model.message.DeleteRequest) 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