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();
}
}
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();
}
}
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();
}
}
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();
}
}
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"));
}
Aggregations