use of net.java.slee.resource.diameter.base.events.AccountingAnswer in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method testGettersAndSettersACA.
@Test
public void testGettersAndSettersACA() throws Exception {
AccountingAnswer aca = messageFactory.createAccountingAnswer(messageFactory.createAccountingRequest());
int nFailures = AvpAssistant.INSTANCE.testMethods(aca, AccountingAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
use of net.java.slee.resource.diameter.base.events.AccountingAnswer in project jain-slee.diameter by RestComm.
the class BaseFactoriesTest method isProxiableCopiedACA.
@Test
public void isProxiableCopiedACA() throws Exception {
AccountingRequest acr = messageFactory.createAccountingRequest();
acr.setSessionId("sssxxx");
AccountingAnswer aca = messageFactory.createAccountingAnswer(acr);
System.out.println(aca);
assertEquals("The 'P' bit is not copied from request in Accounting-Answer, it should. [RFC3588/6.2]", acr.getHeader().isProxiable(), aca.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) acr).getGenericData().setProxiable(!acr.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Accounting-Request, it should.", acr.getHeader().isProxiable() != aca.getHeader().isProxiable());
aca = messageFactory.createAccountingAnswer(acr);
assertEquals("The 'P' bit is not copied from request in Accounting-Answer, it should. [RFC3588/6.2]", acr.getHeader().isProxiable(), aca.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.base.events.AccountingAnswer in project jain-slee.diameter by RestComm.
the class AccountingServerSessionActivityImpl method createAccountAnswer.
public AccountingAnswer createAccountAnswer(AccountingRequest request, int resultCode) {
AccountingAnswer answer = this.createAccountingAnswer(request);
answer.setResultCode(resultCode);
return answer;
}
use of net.java.slee.resource.diameter.base.events.AccountingAnswer in project jain-slee.diameter by RestComm.
the class AccountingServerSessionActivityImpl method sendAccountingAnswer.
public void sendAccountingAnswer(AccountingAnswer answer) throws IOException {
try {
AccountingAnswerImpl aca = (AccountingAnswerImpl) answer;
this.serverSession.sendAccountAnswer(new AccountAnswerImpl((Answer) aca.getGenericData()));
// FIXME: check this?
if (this.serverSession.isStateless()) {
endActivity();
} else if (aca.getAccountingRecordType() == AccountingRecordType.STOP_RECORD) {
endActivity();
}
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message, due to: ", e);
}
throw new IOException("Failed to send message, due to: " + e.getMessage());
}
}
use of net.java.slee.resource.diameter.base.events.AccountingAnswer in project jain-slee.diameter by RestComm.
the class DiameterMessageFactoryImpl method createAccountingAnswer.
public AccountingAnswer createAccountingAnswer(AccountingRequest request, DiameterAvp[] avps) throws AvpNotAllowedException {
AccountingAnswer msg = (AccountingAnswer) this.createDiameterMessage(request.getHeader(), avps, Message.ACCOUNTING_ANSWER, getApplicationId(request));
// Add Session-Id AVP if not present
addSessionIdAvp(msg);
return msg;
}
Aggregations