Search in sources :

Example 16 with Dsmlv2Parser

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

the class BatchRequestTest method testResponseWith2DelRequest.

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

Example 17 with Dsmlv2Parser

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

the class BatchRequestTest method testResponseWith2SearchRequest.

/**
 * Test parsing of a Request with 2 SearchRequest
 */
@Test
public void testResponseWith2SearchRequest() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(BatchRequestTest.class.getResource("request_with_2_SearchRequest.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 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 18 with Dsmlv2Parser

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

the class BatchRequestTest method testResponseWith2AbandonRequest.

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

Example 19 with Dsmlv2Parser

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

the class BatchRequestTest method testResponseWith2ModifyRequest.

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

Example 20 with Dsmlv2Parser

use of org.apache.directory.api.dsmlv2.Dsmlv2Parser 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)

Aggregations

Dsmlv2Parser (org.apache.directory.api.dsmlv2.Dsmlv2Parser)171 Test (org.junit.Test)168 AbstractTest (org.apache.directory.api.dsmlv2.AbstractTest)164 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)78 SearchRequest (org.apache.directory.api.ldap.model.message.SearchRequest)67 DsmlControl (org.apache.directory.api.dsmlv2.DsmlControl)45 Control (org.apache.directory.api.ldap.model.message.Control)45 ExprNode (org.apache.directory.api.ldap.model.filter.ExprNode)40 BatchRequestDsml (org.apache.directory.api.dsmlv2.request.BatchRequestDsml)23 ModifyRequest (org.apache.directory.api.ldap.model.message.ModifyRequest)18 AddRequest (org.apache.directory.api.ldap.model.message.AddRequest)16 ModifyDnRequest (org.apache.directory.api.ldap.model.message.ModifyDnRequest)15 SubstringNode (org.apache.directory.api.ldap.model.filter.SubstringNode)14 CompareRequest (org.apache.directory.api.ldap.model.message.CompareRequest)13 Attribute (org.apache.directory.api.ldap.model.entry.Attribute)12 AbandonRequest (org.apache.directory.api.ldap.model.message.AbandonRequest)10 DeleteRequest (org.apache.directory.api.ldap.model.message.DeleteRequest)10 ExtendedRequestDsml (org.apache.directory.api.dsmlv2.request.ExtendedRequestDsml)9 Modification (org.apache.directory.api.ldap.model.entry.Modification)9 ExtensibleNode (org.apache.directory.api.ldap.model.filter.ExtensibleNode)9