Search in sources :

Example 21 with Dsmlv2Parser

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

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

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

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

Example 25 with Dsmlv2Parser

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

the class CompareRequestTest method testRequestWithDn.

/**
 * Test parsing of a request with the dn attribute
 */
@Test
public void testRequestWithDn() {
    Dsmlv2Parser parser = null;
    try {
        parser = newParser();
        parser.setInput(CompareRequestTest.class.getResource("request_with_dn_attribute.xml").openStream(), "UTF-8");
        parser.parse();
    } catch (Exception e) {
        fail(e.getMessage());
    }
    CompareRequest compareRequest = (CompareRequest) parser.getBatchRequest().getCurrentRequest();
    assertTrue(compareRequest.getName().equals("cn=Bob Rush,ou=Dev,dc=Example,dc=COM"));
}
Also used : 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)

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