use of net.java.slee.resource.diameter.cca.events.CreditControlAnswer in project jain-slee.diameter by RestComm.
the class CreditControlServerSessionImpl method sendCreditControlAnswer.
/*
* (non-Javadoc)
*
* @see net.java.slee.resource.diameter.cca.CreditControlServerSession#sendCreditControlAnswer(net.java.slee.resource.diameter.cca.events.CreditControlAnswer)
*/
public void sendCreditControlAnswer(CreditControlAnswer cca) throws IOException {
fetchCurrentState(cca);
DiameterMessageImpl msg = (DiameterMessageImpl) cca;
try {
session.sendCreditControlAnswer(new JCreditControlAnswerImpl((Answer) msg.getGenericData()));
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
AvpNotAllowedException anae = new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
throw anae;
} catch (Exception e) {
e.printStackTrace();
IOException ioe = new IOException("Failed to send message, due to: " + e);
throw ioe;
}
}
use of net.java.slee.resource.diameter.cca.events.CreditControlAnswer in project jain-slee.diameter by RestComm.
the class CCAFactoriesTest method testGettersAndSettersCCA.
@Test
public void testGettersAndSettersCCA() throws Exception {
CreditControlAnswer cca = ccaMessageFactory.createCreditControlAnswer(ccaMessageFactory.createCreditControlRequest("582364567346578348"));
int nFailures = CCAAvpAssistant.INSTANCE.testMethods(cca, CreditControlAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
use of net.java.slee.resource.diameter.cca.events.CreditControlAnswer in project jain-slee.diameter by RestComm.
the class CCAFactoriesTest method hasDestinationHostCCA.
@Test
public void hasDestinationHostCCA() throws Exception {
CreditControlAnswer cca = ccaMessageFactory.createCreditControlAnswer(ccaMessageFactory.createCreditControlRequest("582364567346578348"));
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", cca.getDestinationHost());
}
use of net.java.slee.resource.diameter.cca.events.CreditControlAnswer in project jain-slee.diameter by RestComm.
the class CCAFactoriesTest method isProxiableCopiedCCA.
@Test
public void isProxiableCopiedCCA() throws Exception {
CreditControlRequest ccr = ccaMessageFactory.createCreditControlRequest();
CreditControlAnswer cca = ccaMessageFactory.createCreditControlAnswer(ccr);
assertEquals("The 'P' bit is not copied from request in Credit-Control-Answer, it should. [RFC3588/6.2]", ccr.getHeader().isProxiable(), cca.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) ccr).getGenericData().setProxiable(!ccr.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Credit-Control-Request, it should.", ccr.getHeader().isProxiable() != cca.getHeader().isProxiable());
cca = ccaMessageFactory.createCreditControlAnswer(ccr);
assertEquals("The 'P' bit is not copied from request in Credit-Control-Answer, it should. [RFC3588/6.2]", ccr.getHeader().isProxiable(), cca.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.cca.events.CreditControlAnswer in project jain-slee.diameter by RestComm.
the class CCAFactoriesTest method hasTFlagSetCCA.
@Test
public void hasTFlagSetCCA() throws Exception {
CreditControlRequest ccr = ccaMessageFactory.createCreditControlRequest();
((DiameterMessageImpl) ccr).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Credit-Control-Request", ccr.getHeader().isPotentiallyRetransmitted());
CreditControlAnswer cca = ccaMessageFactory.createCreditControlAnswer(ccr);
assertFalse("The 'T' flag should not be set in Credit-Control-Answer", cca.getHeader().isPotentiallyRetransmitted());
}
Aggregations