PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/servers/diameter/testsuite/tests/src/test/java/org/mobicents/slee/resources/diameter/tests/factories/RfFactoriesTest.java

http://mobicents.googlecode.com/
Java | 1632 lines | 718 code | 475 blank | 439 comment | 15 complexity | 024e6e271aadf0da5cb64b7c3f23eab0 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2008-2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.slee.resources.diameter.tests.factories;
  23. import static org.jdiameter.client.impl.helpers.Parameters.AcctApplId;
  24. import static org.jdiameter.client.impl.helpers.Parameters.ApplicationId;
  25. import static org.jdiameter.client.impl.helpers.Parameters.Assembler;
  26. import static org.jdiameter.client.impl.helpers.Parameters.AuthApplId;
  27. import static org.jdiameter.client.impl.helpers.Parameters.OwnDiameterURI;
  28. import static org.jdiameter.client.impl.helpers.Parameters.OwnRealm;
  29. import static org.jdiameter.client.impl.helpers.Parameters.OwnVendorID;
  30. import static org.jdiameter.client.impl.helpers.Parameters.PeerName;
  31. import static org.jdiameter.client.impl.helpers.Parameters.PeerRating;
  32. import static org.jdiameter.client.impl.helpers.Parameters.PeerTable;
  33. import static org.jdiameter.client.impl.helpers.Parameters.RealmEntry;
  34. import static org.jdiameter.client.impl.helpers.Parameters.RealmTable;
  35. import static org.jdiameter.client.impl.helpers.Parameters.VendorId;
  36. import static org.jdiameter.server.impl.helpers.Parameters.RealmEntryExpTime;
  37. import static org.jdiameter.server.impl.helpers.Parameters.RealmEntryIsDynamic;
  38. import static org.jdiameter.server.impl.helpers.Parameters.RealmHosts;
  39. import static org.jdiameter.server.impl.helpers.Parameters.RealmLocalAction;
  40. import static org.jdiameter.server.impl.helpers.Parameters.RealmName;
  41. import static org.junit.Assert.assertEquals;
  42. import static org.junit.Assert.assertFalse;
  43. import static org.junit.Assert.assertNull;
  44. import static org.junit.Assert.assertTrue;
  45. import static org.mobicents.slee.resources.diameter.tests.factories.BaseFactoriesTest.*;
  46. import net.java.slee.resource.diameter.base.DiameterActivity;
  47. import net.java.slee.resource.diameter.base.events.avp.AccountingRecordType;
  48. import net.java.slee.resource.diameter.rf.RfAvpFactory;
  49. import net.java.slee.resource.diameter.rf.RfMessageFactory;
  50. import net.java.slee.resource.diameter.rf.RfServerSessionActivity;
  51. import net.java.slee.resource.diameter.rf.events.RfAccountingAnswer;
  52. import net.java.slee.resource.diameter.rf.events.RfAccountingRequest;
  53. import net.java.slee.resource.diameter.rf.events.avp.AdditionalContentInformation;
  54. import net.java.slee.resource.diameter.rf.events.avp.AddressDomain;
  55. import net.java.slee.resource.diameter.rf.events.avp.ApplicationServerInformation;
  56. import net.java.slee.resource.diameter.rf.events.avp.EventType;
  57. import net.java.slee.resource.diameter.rf.events.avp.ImsInformation;
  58. import net.java.slee.resource.diameter.rf.events.avp.InterOperatorIdentifier;
  59. import net.java.slee.resource.diameter.rf.events.avp.LcsClientId;
  60. import net.java.slee.resource.diameter.rf.events.avp.LcsClientName;
  61. import net.java.slee.resource.diameter.rf.events.avp.LcsInformation;
  62. import net.java.slee.resource.diameter.rf.events.avp.LcsRequestorId;
  63. import net.java.slee.resource.diameter.rf.events.avp.LocationType;
  64. import net.java.slee.resource.diameter.rf.events.avp.MbmsInformation;
  65. import net.java.slee.resource.diameter.rf.events.avp.MbmsServiceType;
  66. import net.java.slee.resource.diameter.rf.events.avp.MbmsUserServiceType;
  67. import net.java.slee.resource.diameter.rf.events.avp.MessageBody;
  68. import net.java.slee.resource.diameter.rf.events.avp.MessageClass;
  69. import net.java.slee.resource.diameter.rf.events.avp.MmContentType;
  70. import net.java.slee.resource.diameter.rf.events.avp.MmsInformation;
  71. import net.java.slee.resource.diameter.rf.events.avp.NodeFunctionality;
  72. import net.java.slee.resource.diameter.rf.events.avp.OriginatorAddress;
  73. import net.java.slee.resource.diameter.rf.events.avp.PocInformation;
  74. import net.java.slee.resource.diameter.rf.events.avp.PsFurnishChargingInformation;
  75. import net.java.slee.resource.diameter.rf.events.avp.PsInformation;
  76. import net.java.slee.resource.diameter.rf.events.avp.RecipientAddress;
  77. import net.java.slee.resource.diameter.rf.events.avp.SdpMediaComponent;
  78. import net.java.slee.resource.diameter.rf.events.avp.ServiceInformation;
  79. import net.java.slee.resource.diameter.rf.events.avp.TalkBurstExchange;
  80. import net.java.slee.resource.diameter.rf.events.avp.TimeStamps;
  81. import net.java.slee.resource.diameter.rf.events.avp.TrunkGroupId;
  82. import net.java.slee.resource.diameter.rf.events.avp.WlanInformation;
  83. import org.jdiameter.api.ApplicationId;
  84. import org.jdiameter.api.Message;
  85. import org.jdiameter.api.SessionFactory;
  86. import org.jdiameter.api.Stack;
  87. import org.jdiameter.api.rf.ClientRfSession;
  88. import org.jdiameter.api.rf.ServerRfSession;
  89. import org.jdiameter.client.api.ISessionFactory;
  90. import org.jdiameter.client.impl.helpers.EmptyConfiguration;
  91. import org.junit.Assert;
  92. import org.junit.Test;
  93. import org.mobicents.diameter.dictionary.AvpDictionary;
  94. import org.mobicents.slee.resource.diameter.base.DiameterActivityHandle;
  95. import org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl;
  96. import org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl;
  97. import org.mobicents.slee.resource.diameter.base.handlers.DiameterRAInterface;
  98. import org.mobicents.slee.resource.diameter.rf.RfAvpFactoryImpl;
  99. import org.mobicents.slee.resource.diameter.rf.RfMessageFactoryImpl;
  100. import org.mobicents.slee.resource.diameter.rf.RfServerSessionActivityImpl;
  101. import org.mobicents.slee.resource.diameter.rf.handlers.RfSessionFactory;
  102. /**
  103. * Test class for JAIN SLEE Diameter Rf (Offline Charging) RA Message and AVP Factories
  104. *
  105. * @author <a href="mailto:brainslog@gmail.com"> Alexandre Mendonca </a>
  106. */
  107. public class RfFactoriesTest implements DiameterRAInterface {
  108. private static String clientHost = "127.0.0.1";
  109. private static String clientPort = "13868";
  110. private static String clientURI = "aaa://" + clientHost + ":" + clientPort;
  111. private static String serverHost = "localhost";
  112. private static String serverPort = "3868";
  113. private static String serverURI = "aaa://" + serverHost + ":" + serverPort;
  114. private static String realmName = "mobicents.org";
  115. private static RfMessageFactory rfMessageFactory;
  116. private static RfAvpFactory rfAvpFactory;
  117. private static Stack stack;
  118. private static ServerRfSession serverSession;
  119. // private static ClientRfSession clientSession;
  120. static {
  121. stack = new org.jdiameter.client.impl.StackImpl();
  122. try {
  123. stack.init(new MyConfiguration());
  124. }
  125. catch (Exception e) {
  126. throw new RuntimeException("Failed to initialize the stack.");
  127. }
  128. DiameterMessageFactoryImpl baseFactory = new DiameterMessageFactoryImpl(stack);
  129. // DiameterAvpFactoryImpl baseAvpFactory = new DiameterAvpFactoryImpl();
  130. rfMessageFactory = new RfMessageFactoryImpl(baseFactory, null, stack);
  131. rfAvpFactory = new RfAvpFactoryImpl();
  132. try {
  133. AvpDictionary.INSTANCE.parseDictionary(RfFactoriesTest.class.getClassLoader().getResourceAsStream("dictionary.xml"));
  134. }
  135. catch (Exception e) {
  136. throw new RuntimeException("Failed to parse dictionary file.");
  137. }
  138. }
  139. private RfServerSessionActivity rfServerSession = null;
  140. // private RfClientSessionActivity rfClientSession = null;
  141. private RfSessionFactory accSessionFactory;
  142. public RfFactoriesTest() {
  143. try {
  144. SessionFactory sf = stack.getSessionFactory();
  145. this.accSessionFactory = new RfSessionFactory(this, sf);
  146. // this.accSessionFactory.registerListener(this, 5000L, sf);
  147. ((ISessionFactory) sf).registerAppFacory(ServerRfSession.class, accSessionFactory);
  148. ((ISessionFactory) sf).registerAppFacory(ClientRfSession.class, accSessionFactory);
  149. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  150. acr.setAccountingRecordNumber(5L); // needed for answer creation later ...
  151. serverSession = ((ISessionFactory) sf).getNewAppSession(null, null, ServerRfSession.class, ((DiameterMessageImpl) acr).getGenericData());
  152. // clientSession = ((ISessionFactory) sf).getNewAppSession(null, null, ClientRfSession.class);
  153. rfServerSession = new RfServerSessionActivityImpl(rfMessageFactory, rfAvpFactory, serverSession, null, null, stack);
  154. // rfClientSession = new RfClientSessionActivityImpl(rfMessageFactory, rfAvpFactory, clientSession, null, null, stack);
  155. // FIXME: ammendonca: this is needed?
  156. ((RfServerSessionActivityImpl) rfServerSession).fetchSessionData(acr, true);
  157. // ((RfServerSessionActivityImpl)rfServerSession).setSession(serverSession);
  158. }
  159. catch (Exception e) {
  160. e.printStackTrace();
  161. Assert.fail(e.getMessage());
  162. }
  163. }
  164. @Test
  165. public void isRequestACR() throws Exception {
  166. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  167. assertTrue("Request Flag in Accounting-Request is not set.", acr.getHeader().isRequest());
  168. }
  169. @Test
  170. public void isProxiableACR() throws Exception {
  171. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  172. assertTrue("The 'P' bit is not set by default in Accounting-Request, it should.", acr.getHeader().isProxiable());
  173. }
  174. @Test
  175. public void testGettersAndSettersACR() throws Exception {
  176. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  177. int nFailures = AvpAssistant.testMethods(acr, RfAccountingRequest.class);
  178. assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
  179. }
  180. @Test
  181. public void hasRfApplicationIdACR() throws Exception {
  182. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  183. assertTrue("Acct-Application-Id AVP in Rf ACR must be 3, it is " + acr.getAcctApplicationId(), acr.getAcctApplicationId() == 3);
  184. }
  185. @Test
  186. public void isAnswerACA() throws Exception {
  187. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer();
  188. assertFalse("Request Flag in Accounting-Answer is set.", aca.getHeader().isRequest());
  189. }
  190. @Test
  191. public void isProxiableCopiedACA() throws Exception {
  192. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  193. acr.setAccountingRecordNumber(5L); // needed ...
  194. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer(acr);
  195. assertEquals("The 'P' bit is not copied from request in Accounting-Answer, it should. [RFC3588/6.2]", acr.getHeader().isProxiable(), aca.getHeader().isProxiable());
  196. // Reverse 'P' bit ...
  197. ((DiameterMessageImpl) acr).getGenericData().setProxiable(!acr.getHeader().isProxiable());
  198. assertTrue("The 'P' bit was not modified in Accounting-Request, it should.", acr.getHeader().isProxiable() != aca.getHeader().isProxiable());
  199. aca = rfServerSession.createRfAccountingAnswer(acr);
  200. assertEquals("The 'P' bit is not copied from request in Accounting-Answer, it should. [RFC3588/6.2]", acr.getHeader().isProxiable(), aca.getHeader().isProxiable());
  201. }
  202. @Test
  203. public void hasTFlagSetACA() throws Exception {
  204. RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
  205. acr.setAccountingRecordNumber(5L); // needed ...
  206. ((DiameterMessageImpl) acr).getGenericData().setReTransmitted(true);
  207. assertTrue("The 'T' flag should be set in Accounting-Request", acr.getHeader().isPotentiallyRetransmitted());
  208. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer(acr);
  209. assertFalse("The 'T' flag should not be set in Accounting-Answer", aca.getHeader().isPotentiallyRetransmitted());
  210. }
  211. @Test
  212. public void testGettersAndSettersACA() throws Exception {
  213. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer();
  214. int nFailures = AvpAssistant.testMethods(aca, RfAccountingAnswer.class);
  215. assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
  216. }
  217. @Test
  218. public void hasRfApplicationIdACA() throws Exception {
  219. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer();
  220. assertTrue("Acct-Application-Id AVP in Ro ACA must be 3, it is " + aca.getAcctApplicationId(), aca.getAcctApplicationId() == 3);
  221. }
  222. @Test
  223. public void hasDestinationHostACA() throws Exception {
  224. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer();
  225. assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aca.getDestinationHost());
  226. }
  227. @Test
  228. public void hasDestinationRealmACA() throws Exception {
  229. RfAccountingAnswer aca = rfServerSession.createRfAccountingAnswer();
  230. assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aca.getDestinationRealm());
  231. }
  232. // AVP Factory
  233. @Test
  234. public void testAvpFactoryCreateAdditionalContentInformation() throws Exception {
  235. String avpName = "Additional-Content-Information";
  236. // Create AVP with mandatory values
  237. AdditionalContentInformation aciAvp1 = rfAvpFactory.createAdditionalContentInformation();
  238. // Make sure it's not null
  239. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", aciAvp1);
  240. // Create AVP with default constructor
  241. AdditionalContentInformation aciAvp2 = rfAvpFactory.createAdditionalContentInformation();
  242. // Should not contain mandatory values
  243. // Set mandatory values
  244. // Make sure it's equal to the one created with mandatory values constructor
  245. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", aciAvp1, aciAvp2);
  246. // Make new copy
  247. aciAvp2 = rfAvpFactory.createAdditionalContentInformation();
  248. // And set all values using setters
  249. AvpAssistant.testSetters(aciAvp2);
  250. // Create empty...
  251. AdditionalContentInformation aciAvp3 = rfAvpFactory.createAdditionalContentInformation();
  252. // Verify that no values have been set
  253. AvpAssistant.testHassers(aciAvp3, false);
  254. // Set all previous values
  255. aciAvp3.setExtensionAvps(aciAvp2.getExtensionAvps());
  256. // Verify if values have been set
  257. AvpAssistant.testHassers(aciAvp3, true);
  258. // Verify if values have been correctly set
  259. AvpAssistant.testGetters(aciAvp3);
  260. // Make sure they match!
  261. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", aciAvp2, aciAvp3);
  262. }
  263. @Test
  264. public void testAvpFactoryCreateAddressDomain() throws Exception {
  265. String avpName = "Address-Domain";
  266. // Create AVP with mandatory values
  267. AddressDomain adAvp1 = rfAvpFactory.createAddressDomain();
  268. // Make sure it's not null
  269. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", adAvp1);
  270. // Create AVP with default constructor
  271. AddressDomain adAvp2 = rfAvpFactory.createAddressDomain();
  272. // Should not contain mandatory values
  273. // Set mandatory values
  274. // Make sure it's equal to the one created with mandatory values constructor
  275. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", adAvp1, adAvp2);
  276. // Make new copy
  277. adAvp2 = rfAvpFactory.createAddressDomain();
  278. // And set all values using setters
  279. AvpAssistant.testSetters(adAvp2);
  280. // Create empty...
  281. AddressDomain adAvp3 = rfAvpFactory.createAddressDomain();
  282. // Verify that no values have been set
  283. AvpAssistant.testHassers(adAvp3, false);
  284. // Set all previous values
  285. adAvp3.setExtensionAvps(adAvp2.getExtensionAvps());
  286. // Verify if values have been set
  287. AvpAssistant.testHassers(adAvp3, true);
  288. // Verify if values have been correctly set
  289. AvpAssistant.testGetters(adAvp3);
  290. // Make sure they match!
  291. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", adAvp2, adAvp3);
  292. }
  293. @Test
  294. public void testAvpFactoryCreateApplicationServerInformation() throws Exception {
  295. String avpName = "Application-Server-Information";
  296. // Create AVP with mandatory values
  297. ApplicationServerInformation asiAvp1 = rfAvpFactory.createApplicationServerInformation();
  298. // Make sure it's not null
  299. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", asiAvp1);
  300. // Create AVP with default constructor
  301. ApplicationServerInformation asiAvp2 = rfAvpFactory.createApplicationServerInformation();
  302. // Should not contain mandatory values
  303. // Set mandatory values
  304. // Make sure it's equal to the one created with mandatory values constructor
  305. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", asiAvp1, asiAvp2);
  306. // Make new copy
  307. asiAvp2 = rfAvpFactory.createApplicationServerInformation();
  308. // And set all values using setters
  309. AvpAssistant.testSetters(asiAvp2);
  310. // Create empty...
  311. ApplicationServerInformation asiAvp3 = rfAvpFactory.createApplicationServerInformation();
  312. // Verify that no values have been set
  313. AvpAssistant.testHassers(asiAvp3, false);
  314. // Set all previous values
  315. asiAvp3.setExtensionAvps(asiAvp2.getExtensionAvps());
  316. // Verify if values have been set
  317. AvpAssistant.testHassers(asiAvp3, true);
  318. // Verify if values have been correctly set
  319. AvpAssistant.testGetters(asiAvp3);
  320. // Make sure they match!
  321. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", asiAvp2, asiAvp3);
  322. }
  323. @Test
  324. public void testAvpFactoryCreateEventType() throws Exception {
  325. String avpName = "Event-Type";
  326. // Create AVP with mandatory values
  327. EventType etAvp1 = rfAvpFactory.createEventType();
  328. // Make sure it's not null
  329. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", etAvp1);
  330. // Create AVP with default constructor
  331. EventType etAvp2 = rfAvpFactory.createEventType();
  332. // Should not contain mandatory values
  333. // Set mandatory values
  334. // Make sure it's equal to the one created with mandatory values constructor
  335. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", etAvp1, etAvp2);
  336. // Make new copy
  337. etAvp2 = rfAvpFactory.createEventType();
  338. // And set all values using setters
  339. AvpAssistant.testSetters(etAvp2);
  340. // Create empty...
  341. EventType etAvp3 = rfAvpFactory.createEventType();
  342. // Verify that no values have been set
  343. AvpAssistant.testHassers(etAvp3, false);
  344. // Set all previous values
  345. etAvp3.setExtensionAvps(etAvp2.getExtensionAvps());
  346. // Verify if values have been set
  347. AvpAssistant.testHassers(etAvp3, true);
  348. // Verify if values have been correctly set
  349. AvpAssistant.testGetters(etAvp3);
  350. // Make sure they match!
  351. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", etAvp2, etAvp3);
  352. }
  353. @Test
  354. public void testAvpFactoryCreateImsInformation() throws Exception {
  355. String avpName = "IMS-Information";
  356. // Create AVP with mandatory values
  357. ImsInformation iiAvp1 = rfAvpFactory.createImsInformation(NodeFunctionality.AS);
  358. // Make sure it's not null
  359. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", iiAvp1);
  360. // Create AVP with default constructor
  361. ImsInformation iiAvp2 = rfAvpFactory.createImsInformation();
  362. // Should not contain mandatory values
  363. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have Node-Functionality AVP.", iiAvp2.hasNodeFunctionality());
  364. // Set mandatory values
  365. iiAvp2.setNodeFunctionality(NodeFunctionality.AS);
  366. // Make sure it's equal to the one created with mandatory values constructor
  367. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", iiAvp1, iiAvp2);
  368. // Make new copy
  369. iiAvp2 = rfAvpFactory.createImsInformation();
  370. // And set all values using setters
  371. AvpAssistant.testSetters(iiAvp2);
  372. // Create empty...
  373. ImsInformation iiAvp3 = rfAvpFactory.createImsInformation();
  374. // Verify that no values have been set
  375. AvpAssistant.testHassers(iiAvp3, false);
  376. // Set all previous values
  377. iiAvp3.setExtensionAvps(iiAvp2.getExtensionAvps());
  378. // Verify if values have been set
  379. AvpAssistant.testHassers(iiAvp3, true);
  380. // Verify if values have been correctly set
  381. AvpAssistant.testGetters(iiAvp3);
  382. // Make sure they match!
  383. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", iiAvp2, iiAvp3);
  384. }
  385. @Test
  386. public void testAvpFactoryCreateInterOperatorIdentifier() throws Exception {
  387. String avpName = "Inter-Operator-Identifier";
  388. // Create AVP with mandatory values
  389. InterOperatorIdentifier ioiAvp1 = rfAvpFactory.createInterOperatorIdentifier();
  390. // Make sure it's not null
  391. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", ioiAvp1);
  392. // Create AVP with default constructor
  393. InterOperatorIdentifier ioiAvp2 = rfAvpFactory.createInterOperatorIdentifier();
  394. // Should not contain mandatory values
  395. // Set mandatory values
  396. // Make sure it's equal to the one created with mandatory values constructor
  397. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", ioiAvp1, ioiAvp2);
  398. // Make new copy
  399. ioiAvp2 = rfAvpFactory.createInterOperatorIdentifier();
  400. // And set all values using setters
  401. AvpAssistant.testSetters(ioiAvp2);
  402. // Create empty...
  403. InterOperatorIdentifier ioiAvp3 = rfAvpFactory.createInterOperatorIdentifier();
  404. // Verify that no values have been set
  405. AvpAssistant.testHassers(ioiAvp3, false);
  406. // Set all previous values
  407. ioiAvp3.setExtensionAvps(ioiAvp2.getExtensionAvps());
  408. // Verify if values have been set
  409. AvpAssistant.testHassers(ioiAvp3, true);
  410. // Verify if values have been correctly set
  411. AvpAssistant.testGetters(ioiAvp3);
  412. // Make sure they match!
  413. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", ioiAvp2, ioiAvp3);
  414. }
  415. @Test
  416. public void testAvpFactoryCreateLcsClientId() throws Exception {
  417. String avpName = "LCS-Client-Id";
  418. // Create AVP with mandatory values
  419. LcsClientId lcidAvp1 = rfAvpFactory.createLcsClientId();
  420. // Make sure it's not null
  421. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", lcidAvp1);
  422. // Create AVP with default constructor
  423. LcsClientId lcidAvp2 = rfAvpFactory.createLcsClientId();
  424. // Should not contain mandatory values
  425. // Set mandatory values
  426. // Make sure it's equal to the one created with mandatory values constructor
  427. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", lcidAvp1, lcidAvp2);
  428. // Make new copy
  429. lcidAvp2 = rfAvpFactory.createLcsClientId();
  430. // And set all values using setters
  431. AvpAssistant.testSetters(lcidAvp2);
  432. // Create empty...
  433. LcsClientId lcidAvp3 = rfAvpFactory.createLcsClientId();
  434. // Verify that no values have been set
  435. AvpAssistant.testHassers(lcidAvp3, false);
  436. // Set all previous values
  437. lcidAvp3.setExtensionAvps(lcidAvp2.getExtensionAvps());
  438. // Verify if values have been set
  439. AvpAssistant.testHassers(lcidAvp3, true);
  440. // Verify if values have been correctly set
  441. AvpAssistant.testGetters(lcidAvp3);
  442. // Make sure they match!
  443. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", lcidAvp2, lcidAvp3);
  444. }
  445. @Test
  446. public void testAvpFactoryCreateLcsClientName() throws Exception {
  447. String avpName = "LCS-Client-Name";
  448. // Create AVP with mandatory values
  449. LcsClientName lcnAvp1 = rfAvpFactory.createLcsClientName();
  450. // Make sure it's not null
  451. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", lcnAvp1);
  452. // Create AVP with default constructor
  453. LcsClientName lcnAvp2 = rfAvpFactory.createLcsClientName();
  454. // Should not contain mandatory values
  455. // Set mandatory values
  456. // Make sure it's equal to the one created with mandatory values constructor
  457. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", lcnAvp1, lcnAvp2);
  458. // Make new copy
  459. lcnAvp2 = rfAvpFactory.createLcsClientName();
  460. // And set all values using setters
  461. AvpAssistant.testSetters(lcnAvp2);
  462. // Create empty...
  463. LcsClientName lcnAvp3 = rfAvpFactory.createLcsClientName();
  464. // Verify that no values have been set
  465. AvpAssistant.testHassers(lcnAvp3, false);
  466. // Set all previous values
  467. lcnAvp3.setExtensionAvps(lcnAvp2.getExtensionAvps());
  468. // Verify if values have been set
  469. AvpAssistant.testHassers(lcnAvp3, true);
  470. // Verify if values have been correctly set
  471. AvpAssistant.testGetters(lcnAvp3);
  472. // Make sure they match!
  473. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", lcnAvp2, lcnAvp3);
  474. }
  475. @Test
  476. public void testAvpFactoryCreateLcsInformation() throws Exception {
  477. String avpName = "LCS-Information";
  478. // Create AVP with mandatory values
  479. LcsInformation liAvp1 = rfAvpFactory.createLcsInformation();
  480. // Make sure it's not null
  481. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", liAvp1);
  482. // Create AVP with default constructor
  483. LcsInformation liAvp2 = rfAvpFactory.createLcsInformation();
  484. // Should not contain mandatory values
  485. // Set mandatory values
  486. // Make sure it's equal to the one created with mandatory values constructor
  487. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", liAvp1, liAvp2);
  488. // Make new copy
  489. liAvp2 = rfAvpFactory.createLcsInformation();
  490. // And set all values using setters
  491. AvpAssistant.testSetters(liAvp2);
  492. // Create empty...
  493. LcsInformation liAvp3 = rfAvpFactory.createLcsInformation();
  494. // Verify that no values have been set
  495. AvpAssistant.testHassers(liAvp3, false);
  496. // Set all previous values
  497. liAvp3.setExtensionAvps(liAvp2.getExtensionAvps());
  498. // Verify if values have been set
  499. AvpAssistant.testHassers(liAvp3, true);
  500. // Verify if values have been correctly set
  501. AvpAssistant.testGetters(liAvp3);
  502. // Make sure they match!
  503. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", liAvp2, liAvp3);
  504. }
  505. @Test
  506. public void testAvpFactoryCreateLcsRequestorId() throws Exception {
  507. String avpName = "LCS-Requestor-Id";
  508. // Create AVP with mandatory values
  509. LcsRequestorId lriAvp1 = rfAvpFactory.createLcsRequestorId();
  510. // Make sure it's not null
  511. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", lriAvp1);
  512. // Create AVP with default constructor
  513. LcsRequestorId lriAvp2 = rfAvpFactory.createLcsRequestorId();
  514. // Should not contain mandatory values
  515. // Set mandatory values
  516. // Make sure it's equal to the one created with mandatory values constructor
  517. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", lriAvp1, lriAvp2);
  518. // Make new copy
  519. lriAvp2 = rfAvpFactory.createLcsRequestorId();
  520. // And set all values using setters
  521. AvpAssistant.testSetters(lriAvp2);
  522. // Create empty...
  523. LcsRequestorId lriAvp3 = rfAvpFactory.createLcsRequestorId();
  524. // Verify that no values have been set
  525. AvpAssistant.testHassers(lriAvp3, false);
  526. // Set all previous values
  527. lriAvp3.setExtensionAvps(lriAvp2.getExtensionAvps());
  528. // Verify if values have been set
  529. AvpAssistant.testHassers(lriAvp3, true);
  530. // Verify if values have been correctly set
  531. AvpAssistant.testGetters(lriAvp3);
  532. // Make sure they match!
  533. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", lriAvp2, lriAvp3);
  534. }
  535. @Test
  536. public void testAvpFactoryCreateLocationType() throws Exception {
  537. String avpName = "Location-Type";
  538. // Create AVP with mandatory values
  539. LocationType ltAvp1 = rfAvpFactory.createLocationType();
  540. // Make sure it's not null
  541. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", ltAvp1);
  542. // Create AVP with default constructor
  543. LocationType ltAvp2 = rfAvpFactory.createLocationType();
  544. // Should not contain mandatory values
  545. // Set mandatory values
  546. // Make sure it's equal to the one created with mandatory values constructor
  547. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", ltAvp1, ltAvp2);
  548. // Make new copy
  549. ltAvp2 = rfAvpFactory.createLocationType();
  550. // And set all values using setters
  551. AvpAssistant.testSetters(ltAvp2);
  552. // Create empty...
  553. LocationType ltAvp3 = rfAvpFactory.createLocationType();
  554. // Verify that no values have been set
  555. AvpAssistant.testHassers(ltAvp3, false);
  556. // Set all previous values
  557. ltAvp3.setExtensionAvps(ltAvp2.getExtensionAvps());
  558. // Verify if values have been set
  559. AvpAssistant.testHassers(ltAvp3, true);
  560. // Verify if values have been correctly set
  561. AvpAssistant.testGetters(ltAvp3);
  562. // Make sure they match!
  563. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", ltAvp2, ltAvp3);
  564. }
  565. @Test
  566. public void testAvpFactoryCreateMbmsInformation() throws Exception {
  567. String avpName = "MBMS-Information";
  568. // Create AVP with mandatory values
  569. MbmsInformation miAvp1 = rfAvpFactory.createMbmsInformation("abc".getBytes(), MbmsServiceType.MULTICAST, MbmsUserServiceType.DOWNLOAD);
  570. // Make sure it's not null
  571. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", miAvp1);
  572. // Create AVP with default constructor
  573. MbmsInformation miAvp2 = rfAvpFactory.createMbmsInformation();
  574. // Should not contain mandatory values
  575. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have TMGI AVP.", miAvp2.hasTmgi());
  576. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have MBMS-Service-Type AVP.", miAvp2.hasMbmsServiceType());
  577. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have MBMS-User-Service-Type AVP.", miAvp2.hasMbmsUserServiceType());
  578. // Set mandatory values
  579. miAvp2.setTmgi("abc".getBytes());
  580. miAvp2.setMbmsServiceType(MbmsServiceType.MULTICAST);
  581. miAvp2.setMbmsUserServiceType(MbmsUserServiceType.DOWNLOAD);
  582. // Make sure it's equal to the one created with mandatory values constructor
  583. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", miAvp1, miAvp2);
  584. // Make new copy
  585. miAvp2 = rfAvpFactory.createMbmsInformation();
  586. // And set all values using setters
  587. AvpAssistant.testSetters(miAvp2);
  588. // Create empty...
  589. MbmsInformation miAvp3 = rfAvpFactory.createMbmsInformation();
  590. // Verify that no values have been set
  591. AvpAssistant.testHassers(miAvp3, false);
  592. // Set all previous values
  593. miAvp3.setExtensionAvps(miAvp2.getExtensionAvps());
  594. // Verify if values have been set
  595. AvpAssistant.testHassers(miAvp3, true);
  596. // Verify if values have been correctly set
  597. AvpAssistant.testGetters(miAvp3);
  598. // Make sure they match!
  599. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", miAvp2, miAvp3);
  600. }
  601. @Test
  602. public void testAvpFactoryCreateMessageBody() throws Exception {
  603. String avpName = "Message-Body";
  604. // Create AVP with mandatory values
  605. MessageBody mbAvp1 = rfAvpFactory.createMessageBody();
  606. // Make sure it's not null
  607. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", mbAvp1);
  608. // Create AVP with default constructor
  609. MessageBody mbAvp2 = rfAvpFactory.createMessageBody();
  610. // Should not contain mandatory values
  611. // Set mandatory values
  612. // Make sure it's equal to the one created with mandatory values constructor
  613. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", mbAvp1, mbAvp2);
  614. // Make new copy
  615. mbAvp2 = rfAvpFactory.createMessageBody();
  616. // And set all values using setters
  617. AvpAssistant.testSetters(mbAvp2);
  618. // Create empty...
  619. MessageBody mbAvp3 = rfAvpFactory.createMessageBody();
  620. // Verify that no values have been set
  621. AvpAssistant.testHassers(mbAvp3, false);
  622. // Set all previous values
  623. mbAvp3.setExtensionAvps(mbAvp2.getExtensionAvps());
  624. // Verify if values have been set
  625. AvpAssistant.testHassers(mbAvp3, true);
  626. // Verify if values have been correctly set
  627. AvpAssistant.testGetters(mbAvp3);
  628. // Make sure they match!
  629. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", mbAvp2, mbAvp3);
  630. }
  631. @Test
  632. public void testAvpFactoryCreateMessageClass() throws Exception {
  633. String avpName = "Message-Class";
  634. // Create AVP with mandatory values
  635. MessageClass mbAvp1 = rfAvpFactory.createMessageClass();
  636. // Make sure it's not null
  637. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", mbAvp1);
  638. // Create AVP with default constructor
  639. MessageClass mbAvp2 = rfAvpFactory.createMessageClass();
  640. // Should not contain mandatory values
  641. // Set mandatory values
  642. // Make sure it's equal to the one created with mandatory values constructor
  643. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", mbAvp1, mbAvp2);
  644. // Make new copy
  645. mbAvp2 = rfAvpFactory.createMessageClass();
  646. // And set all values using setters
  647. AvpAssistant.testSetters(mbAvp2);
  648. // Create empty...
  649. MessageClass mbAvp3 = rfAvpFactory.createMessageClass();
  650. // Verify that no values have been set
  651. AvpAssistant.testHassers(mbAvp3, false);
  652. // Set all previous values
  653. mbAvp3.setExtensionAvps(mbAvp2.getExtensionAvps());
  654. // Verify if values have been set
  655. AvpAssistant.testHassers(mbAvp3, true);
  656. // Verify if values have been correctly set
  657. AvpAssistant.testGetters(mbAvp3);
  658. // Make sure they match!
  659. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", mbAvp2, mbAvp3);
  660. }
  661. @Test
  662. public void testAvpFactoryCreateMmContentType() throws Exception {
  663. String avpName = "MM-Content-Type";
  664. // Create AVP with mandatory values
  665. MmContentType mmctAvp1 = rfAvpFactory.createMmContentType();
  666. // Make sure it's not null
  667. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", mmctAvp1);
  668. // Create AVP with default constructor
  669. MmContentType mmctAvp2 = rfAvpFactory.createMmContentType();
  670. // Should not contain mandatory values
  671. // Set mandatory values
  672. // Make sure it's equal to the one created with mandatory values constructor
  673. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", mmctAvp1, mmctAvp2);
  674. // Make new copy
  675. mmctAvp2 = rfAvpFactory.createMmContentType();
  676. // And set all values using setters
  677. AvpAssistant.testSetters(mmctAvp2);
  678. // Create empty...
  679. MmContentType mmctAvp3 = rfAvpFactory.createMmContentType();
  680. // Verify that no values have been set
  681. AvpAssistant.testHassers(mmctAvp3, false);
  682. // Set all previous values
  683. mmctAvp3.setExtensionAvps(mmctAvp2.getExtensionAvps());
  684. // Verify if values have been set
  685. AvpAssistant.testHassers(mmctAvp3, true);
  686. // Verify if values have been correctly set
  687. AvpAssistant.testGetters(mmctAvp3);
  688. // Make sure they match!
  689. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", mmctAvp2, mmctAvp3);
  690. }
  691. @Test
  692. public void testAvpFactoryCreateMmsInformation() throws Exception {
  693. String avpName = "MMS-Information";
  694. // Create AVP with mandatory values
  695. MmsInformation mmsiAvp1 = rfAvpFactory.createMmsInformation();
  696. // Make sure it's not null
  697. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", mmsiAvp1);
  698. // Create AVP with default constructor
  699. MmsInformation mmsiAvp2 = rfAvpFactory.createMmsInformation();
  700. // Should not contain mandatory values
  701. // Set mandatory values
  702. // Make sure it's equal to the one created with mandatory values constructor
  703. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", mmsiAvp1, mmsiAvp2);
  704. // Make new copy
  705. mmsiAvp2 = rfAvpFactory.createMmsInformation();
  706. // And set all values using setters
  707. AvpAssistant.testSetters(mmsiAvp2);
  708. // Create empty...
  709. MmsInformation mmsiAvp3 = rfAvpFactory.createMmsInformation();
  710. // Verify that no values have been set
  711. AvpAssistant.testHassers(mmsiAvp3, false);
  712. // Set all previous values
  713. mmsiAvp3.setExtensionAvps(mmsiAvp2.getExtensionAvps());
  714. // Verify if values have been set
  715. AvpAssistant.testHassers(mmsiAvp3, true);
  716. // Verify if values have been correctly set
  717. AvpAssistant.testGetters(mmsiAvp3);
  718. // Make sure they match!
  719. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", mmsiAvp2, mmsiAvp3);
  720. }
  721. @Test
  722. public void testAvpFactoryCreateOriginatorAddress() throws Exception {
  723. String avpName = "Originator-Address";
  724. // Create AVP with mandatory values
  725. OriginatorAddress oaAvp1 = rfAvpFactory.createOriginatorAddress();
  726. // Make sure it's not null
  727. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", oaAvp1);
  728. // Create AVP with default constructor
  729. OriginatorAddress oaAvp2 = rfAvpFactory.createOriginatorAddress();
  730. // Should not contain mandatory values
  731. // Set mandatory values
  732. // Make sure it's equal to the one created with mandatory values constructor
  733. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", oaAvp1, oaAvp2);
  734. // Make new copy
  735. oaAvp2 = rfAvpFactory.createOriginatorAddress();
  736. // And set all values using setters
  737. AvpAssistant.testSetters(oaAvp2);
  738. // Create empty...
  739. OriginatorAddress oaAvp3 = rfAvpFactory.createOriginatorAddress();
  740. // Verify that no values have been set
  741. AvpAssistant.testHassers(oaAvp3, false);
  742. // Set all previous values
  743. oaAvp3.setExtensionAvps(oaAvp2.getExtensionAvps());
  744. // Verify if values have been set
  745. AvpAssistant.testHassers(oaAvp3, true);
  746. // Verify if values have been correctly set
  747. AvpAssistant.testGetters(oaAvp3);
  748. // Make sure they match!
  749. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", oaAvp2, oaAvp3);
  750. }
  751. @Test
  752. public void testAvpFactoryCreatePocInformation() throws Exception {
  753. String avpName = "PoC-Information";
  754. // Create AVP with mandatory values
  755. PocInformation piAvp1 = rfAvpFactory.createPocInformation();
  756. // Make sure it's not null
  757. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", piAvp1);
  758. // Create AVP with default constructor
  759. PocInformation piAvp2 = rfAvpFactory.createPocInformation();
  760. // Should not contain mandatory values
  761. // Set mandatory values
  762. // Make sure it's equal to the one created with mandatory values constructor
  763. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", piAvp1, piAvp2);
  764. // Make new copy
  765. piAvp2 = rfAvpFactory.createPocInformation();
  766. // And set all values using setters
  767. AvpAssistant.testSetters(piAvp2);
  768. // Create empty...
  769. PocInformation piAvp3 = rfAvpFactory.createPocInformation();
  770. // Verify that no values have been set
  771. AvpAssistant.testHassers(piAvp3, false);
  772. // Set all previous values
  773. piAvp3.setExtensionAvps(piAvp2.getExtensionAvps());
  774. // Verify if values have been set
  775. AvpAssistant.testHassers(piAvp3, true);
  776. // Verify if values have been correctly set
  777. AvpAssistant.testGetters(piAvp3);
  778. // Make sure they match!
  779. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", piAvp2, piAvp3);
  780. }
  781. @Test
  782. public void testAvpFactoryCreatePsFurnishChargingInformation() throws Exception {
  783. String avpName = "PS-Furnish-Charging-Information";
  784. // Create AVP with mandatory values
  785. PsFurnishChargingInformation piAvp1 = rfAvpFactory.createPsFurnishChargingInformation("123".getBytes(), "456".getBytes());
  786. // Make sure it's not null
  787. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", piAvp1);
  788. // Create AVP with default constructor
  789. PsFurnishChargingInformation piAvp2 = rfAvpFactory.createPsFurnishChargingInformation();
  790. // Should not contain mandatory values
  791. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have 3GPP-Charging-Id AVP.", piAvp2.hasTgppChargingId());
  792. Assert.assertFalse("Created " + avpName + " AVP from default constructor should not have PS-Free-Format-Data AVP.", piAvp2.hasPsFreeFormatData());
  793. // Set mandatory values
  794. piAvp2.setTgppChargingId("123".getBytes());
  795. piAvp2.setPsFreeFormatData("456".getBytes());
  796. // Make sure it's equal to the one created with mandatory values constructor
  797. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", piAvp1, piAvp2);
  798. // Make new copy
  799. piAvp2 = rfAvpFactory.createPsFurnishChargingInformation();
  800. // And set all values using setters
  801. AvpAssistant.testSetters(piAvp2);
  802. // Create empty...
  803. PsFurnishChargingInformation piAvp3 = rfAvpFactory.createPsFurnishChargingInformation();
  804. // Verify that no values have been set
  805. AvpAssistant.testHassers(piAvp3, false);
  806. // Set all previous values
  807. piAvp3.setExtensionAvps(piAvp2.getExtensionAvps());
  808. // Verify if values have been set
  809. AvpAssistant.testHassers(piAvp3, true);
  810. // Verify if values have been correctly set
  811. AvpAssistant.testGetters(piAvp3);
  812. // Make sure they match!
  813. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", piAvp2, piAvp3);
  814. }
  815. @Test
  816. public void testAvpFactoryCreatePsInformation() throws Exception {
  817. String avpName = "PS-Information";
  818. // Create AVP with mandatory values
  819. PsInformation piAvp1 = rfAvpFactory.createPsInformation();
  820. // Make sure it's not null
  821. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", piAvp1);
  822. // Create AVP with default constructor
  823. PsInformation piAvp2 = rfAvpFactory.createPsInformation();
  824. // Should not contain mandatory values
  825. // Set mandatory values
  826. // Make sure it's equal to the one created with mandatory values constructor
  827. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", piAvp1, piAvp2);
  828. // Make new copy
  829. piAvp2 = rfAvpFactory.createPsInformation();
  830. // And set all values using setters
  831. AvpAssistant.testSetters(piAvp2);
  832. // Create empty...
  833. PsInformation piAvp3 = rfAvpFactory.createPsInformation();
  834. // Verify that no values have been set
  835. AvpAssistant.testHassers(piAvp3, false);
  836. // Set all previous values
  837. piAvp3.setExtensionAvps(piAvp2.getExtensionAvps());
  838. // Verify if values have been set
  839. AvpAssistant.testHassers(piAvp3, true);
  840. // Verify if values have been correctly set
  841. AvpAssistant.testGetters(piAvp3);
  842. // Make sure they match!
  843. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", piAvp2, piAvp3);
  844. }
  845. @Test
  846. public void testAvpFactoryCreateRecipientAddress() throws Exception {
  847. String avpName = "Recipient-Address";
  848. // Create AVP with mandatory values
  849. RecipientAddress piAvp1 = rfAvpFactory.createRecipientAddress();
  850. // Make sure it's not null
  851. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", piAvp1);
  852. // Create AVP with default constructor
  853. RecipientAddress piAvp2 = rfAvpFactory.createRecipientAddress();
  854. // Should not contain mandatory values
  855. // Set mandatory values
  856. // Make sure it's equal to the one created with mandatory values constructor
  857. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", piAvp1, piAvp2);
  858. // Make new copy
  859. piAvp2 = rfAvpFactory.createRecipientAddress();
  860. // And set all values using setters
  861. AvpAssistant.testSetters(piAvp2);
  862. // Create empty...
  863. RecipientAddress piAvp3 = rfAvpFactory.createRecipientAddress();
  864. // Verify that no values have been set
  865. AvpAssistant.testHassers(piAvp3, false);
  866. // Set all previous values
  867. piAvp3.setExtensionAvps(piAvp2.getExtensionAvps());
  868. // Verify if values have been set
  869. AvpAssistant.testHassers(piAvp3, true);
  870. // Verify if values have been correctly set
  871. AvpAssistant.testGetters(piAvp3);
  872. // Make sure they match!
  873. Assert.assertEquals("Created " + avpName + " AVP from default constructor + setExtensionAvps should be equal to original.", piAvp2, piAvp3);
  874. }
  875. @Test
  876. public void testAvpFactoryCreateSdpMediaComponent() throws Exception {
  877. String avpName = "SDP-Media-Component";
  878. // Create AVP with mandatory values
  879. SdpMediaComponent piAvp1 = rfAvpFactory.createSdpMediaComponent();
  880. // Make sure it's not null
  881. Assert.assertNotNull("Created " + avpName + " AVP from objects should not be null.", piAvp1);
  882. // Create AVP with default constructor
  883. SdpMediaComponent piAvp2 = rfAvpFactory.createSdpMediaComponent();
  884. // Should not contain mandatory values
  885. // Set mandatory values
  886. // Make sure it's equal to the one created with mandatory values constructor
  887. Assert.assertEquals("Created " + avpName + " AVP from default constructor + set<Mandatory-AVPs> should be equal to original.", piAvp1, piAvp2);
  888. // Make new copy
  889. piAvp2 = rfAvpFactory.createSdpMediaComponent();
  890. // And set all values using setters
  891. AvpAssistant.testSetters(piAvp2);
  892. // Create empty...
  893. SdpMediaComponent piAvp3 = rfAvpFactory.createSdpMediaComponent();

Large files files are truncated, but you can click here to view the full file