Search in sources :

Example 1 with MultimediaAuthenticationAnswer

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer in project jain-slee.diameter by RestComm.

the class CxDxServerSessionImpl method createMultimediaAuthenticationAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#createMultimediaAuthenticationAnswer()
   */
public MultimediaAuthenticationAnswer createMultimediaAuthenticationAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof MultimediaAuthenticationRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        MultimediaAuthenticationAnswer maa = (MultimediaAuthenticationAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, MultimediaAuthenticationAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(maa);
        return maa;
    } catch (InternalException e) {
        logger.error("Failed to create Multimedia-Authentication-Answer.", e);
    }
    return null;
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) InternalException(org.jdiameter.api.InternalException)

Example 2 with MultimediaAuthenticationAnswer

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method hasDestinationRealmMAA.

@Test
public void hasDestinationRealmMAA() throws Exception {
    serverSession.fetchSessionData(cxdxMessageFactory.createMultimediaAuthenticationRequest());
    MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", maa.getDestinationRealm());
}
Also used : MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with MultimediaAuthenticationAnswer

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method hasTFlagSetMAA.

@Test
public void hasTFlagSetMAA() throws Exception {
    MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
    ((DiameterMessageImpl) mar).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Multimedia-Authentication-Request", mar.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(mar);
    MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
    assertFalse("The 'T' flag should not be set in Multimedia-Authentication-Answer", maa.getHeader().isPotentiallyRetransmitted());
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with MultimediaAuthenticationAnswer

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isProxiableCopiedMAA.

@Test
public void isProxiableCopiedMAA() throws Exception {
    MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
    serverSession.fetchSessionData(mar);
    MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
    assertEquals("The 'P' bit is not copied from request in Multimedia-Authentication-Answer, it should. [RFC3588/6.2]", mar.getHeader().isProxiable(), maa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) mar).getGenericData().setProxiable(!mar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Multimedia-Authentication-Request, it should.", mar.getHeader().isProxiable() != maa.getHeader().isProxiable());
    serverSession.fetchSessionData(mar);
    maa = serverSession.createMultimediaAuthenticationAnswer();
    assertEquals("The 'P' bit is not copied from request in Multimedia-Authentication-Answer, it should. [RFC3588/6.2]", mar.getHeader().isProxiable(), maa.getHeader().isProxiable());
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with MultimediaAuthenticationAnswer

use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testGettersAndSettersMAA.

@Test
public void testGettersAndSettersMAA() throws Exception {
    serverSession.fetchSessionData(cxdxMessageFactory.createMultimediaAuthenticationRequest());
    MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
    int nFailures = CxDxAvpAssistant.INSTANCE.testMethods(maa, MultimediaAuthenticationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : MultimediaAuthenticationAnswer(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

MultimediaAuthenticationAnswer (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)8 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 MultimediaAuthenticationRequest (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)4 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 ApplicationId (org.jdiameter.api.ApplicationId)1 InternalException (org.jdiameter.api.InternalException)1 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)1