use of org.apache.directory.api.dsmlv2.DsmlDecorator in project directory-ldap-api by apache.
the class BatchResponseTest method testResponseWith2ErrorResponse.
/**
* Test parsing of a Response with the 2 ErrorResponse
*/
@Test
public void testResponseWith2ErrorResponse() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(BatchResponseTest.class.getResource("response_with_2_ErrorResponse.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
BatchResponseDsml batchResponse = parser.getBatchResponse();
assertEquals(2, batchResponse.getResponses().size());
DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();
if (response instanceof ErrorResponse) {
assertTrue(true);
} else {
fail();
}
}
use of org.apache.directory.api.dsmlv2.DsmlDecorator in project directory-ldap-api by apache.
the class BatchResponseTest method testResponseWith2DelResponse.
/**
* Test parsing of a Response with the 2 DelResponse
*/
@Test
public void testResponseWith2DelResponse() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(BatchResponseTest.class.getResource("response_with_2_DelResponse.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
BatchResponseDsml batchResponse = parser.getBatchResponse();
assertEquals(2, batchResponse.getResponses().size());
DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();
if (response instanceof DeleteResponse) {
assertTrue(true);
} else {
fail();
}
}
use of org.apache.directory.api.dsmlv2.DsmlDecorator in project directory-ldap-api by apache.
the class BatchResponseTest method testResponseWith1ModDNResponse.
/**
* Test parsing of a Response with the 1 ModDNResponse
*/
@Test
public void testResponseWith1ModDNResponse() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(BatchResponseTest.class.getResource("response_with_1_ModDNResponse.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
BatchResponseDsml batchResponse = parser.getBatchResponse();
assertEquals(1, batchResponse.getResponses().size());
DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();
if (response instanceof ModifyDnResponse) {
assertTrue(true);
} else {
fail();
}
}
use of org.apache.directory.api.dsmlv2.DsmlDecorator in project directory-ldap-api by apache.
the class BatchResponseTest method testResponseWith2AddResponse.
/**
* Test parsing of a Response with the 2 AddResponse
*/
@Test
public void testResponseWith2AddResponse() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(BatchResponseTest.class.getResource("response_with_2_AddResponse.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
BatchResponseDsml batchResponse = parser.getBatchResponse();
assertEquals(2, batchResponse.getResponses().size());
DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();
if (response instanceof AddResponse) {
assertTrue(true);
} else {
fail();
}
}
use of org.apache.directory.api.dsmlv2.DsmlDecorator in project directory-ldap-api by apache.
the class BatchResponseTest method testResponseWith2ExtendedResponse.
/**
* Test parsing of a Response with the 2 ExtendedResponse
*/
@Test
public void testResponseWith2ExtendedResponse() {
Dsmlv2ResponseParser parser = null;
try {
parser = new Dsmlv2ResponseParser(getCodec());
parser.setInput(BatchResponseTest.class.getResource("response_with_2_ExtendedResponse.xml").openStream(), "UTF-8");
parser.parse();
} catch (Exception e) {
fail(e.getMessage());
}
BatchResponseDsml batchResponse = parser.getBatchResponse();
assertEquals(2, batchResponse.getResponses().size());
DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();
if (response instanceof ExtendedResponse) {
assertTrue(true);
} else {
fail();
}
}
Aggregations