Search in sources :

Example 6 with UpdateLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasTFlagSetULA.

@Test
public void hasTFlagSetULA() throws Exception {
    UpdateLocationRequest ulr = s6aMessageFactory.createUpdateLocationRequest();
    ((DiameterMessageImpl) ulr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Update-Location-Request", ulr.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(ulr);
    UpdateLocationAnswer ula = serverSession.createUpdateLocationAnswer();
    assertFalse("The 'T' flag should not be set in Update-Location-Answer", ula.getHeader().isPotentiallyRetransmitted());
}
Also used : UpdateLocationAnswer(net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer) UpdateLocationRequest(net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with UpdateLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testGettersAndSettersULA.

@Test
public void testGettersAndSettersULA() throws Exception {
    UpdateLocationRequest ulr = s6aMessageFactory.createUpdateLocationRequest();
    serverSession.fetchSessionData(ulr);
    UpdateLocationAnswer ula = serverSession.createUpdateLocationAnswer();
    int nFailures = S6aAvpAssistant.INSTANCE.testMethods(ula, UpdateLocationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : UpdateLocationAnswer(net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer) UpdateLocationRequest(net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with UpdateLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testServerSessionApplicationIdChangeULA.

@Test
public void testServerSessionApplicationIdChangeULA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for S6a is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    UpdateLocationRequest ulr = s6aMessageFactory.createUpdateLocationRequest();
    serverSession.fetchSessionData(ulr);
    UpdateLocationAnswer originalULA = serverSession.createUpdateLocationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalULA);
    // now we switch..
    originalULA = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    UpdateLocationAnswer changedULA = serverSession.createUpdateLocationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedULA);
    // revert back to default
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : S6aMessageFactoryImpl(org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl) UpdateLocationAnswer(net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer) ApplicationId(org.jdiameter.api.ApplicationId) UpdateLocationRequest(net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with UpdateLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasDestinationHostULA.

@Test
public void hasDestinationHostULA() throws Exception {
    UpdateLocationRequest ulr = s6aMessageFactory.createUpdateLocationRequest();
    serverSession.fetchSessionData(ulr);
    UpdateLocationAnswer ula = serverSession.createUpdateLocationAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", ula.getDestinationHost());
}
Also used : UpdateLocationAnswer(net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer) UpdateLocationRequest(net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

UpdateLocationAnswer (net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer)9 UpdateLocationRequest (net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest)9 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 ApplicationId (org.jdiameter.api.ApplicationId)1 InternalException (org.jdiameter.api.InternalException)1 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)1