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