/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyrighted 2015 Intellectual Reserve, Inc (IRI)
*/
/*
* Portions copyright 2015 ForgeRock AS
*/
/**
* Test for the <code>RadiusRequestHandler</code> class.
*
* @see org.forgerock.openam.radius.server.RadiusRequestHandler
*/
public class RadiusRequestHandlerTest {
+ "98 f4 22 7a 01 06 6e 65 6d 6f 02 12 0d be 70 8d " + "93 d4 13 ce 31 96 e4 3f 78 2a 0a ee 04 06 c0 a8 "
+ "01 10 05 06 00 00 00 03";
/**
* Test that when run is called with an AcceptAllHandler then the RadiusAuthResponse contains a success code and an
* AcceptResponse is sent.
*
* @throws InterruptedException - when an interrupt occurs.
* @throws RadiusProcessingException - when something goes wrong processing a RADIUS packet.
* @throws UnknownHostException - if the host can't be determined
*/
public void testRun() throws UnknownHostException, InterruptedException, RadiusProcessingException {
// given
when(accessRequestHandlerFactory.getAccessRequestHandler(reqCtx)).thenReturn(new AcceptAllHandler());
final RadiusRequestHandler handler = new RadiusRequestHandler(accessRequestHandlerFactory, reqCtx, bfr, promise,
// when
// then
}
/**
* Test that when run is called with an RejectAllHandler that the resultant promise returns a RadiusResponse
* containing an ACCESS_REJECT packet.
*
* @throws InterruptedException - when an interrupt occurs.
* @throws RadiusProcessingException - when something goes wrong processing a RADIUS packet.
* @throws UnknownHostException - if the host can't be determined
*/
public void testRunReject()
// given
when(accessRequestHandlerFactory.getAccessRequestHandler(reqCtx)).thenReturn(new RejectAllHandler());
final RadiusRequestHandler handler = new RadiusRequestHandler(accessRequestHandlerFactory, reqCtx, bfr, promise,
// when
// then
}
/**
* Test that when run is called with an CatestrophicHandler that the promise returns a RadiusProcessingException.
*
* @throws InterruptedException - when an interrupt occurs.
* @throws RadiusProcessingException - when something goes wrong processing a RADIUS packet.
* @throws UnknownHostException - if the host can't be determined
*/
public void testRunCatestrophic() throws InterruptedException, RadiusProcessingException, UnknownHostException {
// given
when(accessRequestHandlerFactory.getAccessRequestHandler(reqCtx)).thenReturn(new CatastrophicHandler());
final RadiusRequestHandler handler = new RadiusRequestHandler(accessRequestHandlerFactory, reqCtx, bfr, promise,
// when
// then
}
}