コード例 #1
0
ファイル: EnforceAuthRulesTest.cpp プロジェクト: ciuc/sipxecs
 void setUp()
    {
       SipXauthIdentity::setSecret("fixed");
       RouteState::setSecret("fixed");
       TestDbContext.setSipxDir(SipXecsService::ConfigurationDirType);
       TestDbContext.inputFile("permission.xml");
       TestDbContext.inputFile("credential.xml");
    }
コード例 #2
0
   void instantiateAllTestFixtures( UtlString resourceListFile,
                                    //< Name of the resource list to use for the test.  The filename
                                    //< specified mus texist in .../sipXrls/src/test/rlsdata/
                                    UtlString subscriptionDbName, 
                                    //< Specifies the subscription DB to use for the test.  The name 
                                    //< is used to select which of the files in .../sipXrls/src/test/rlsdata/
                                    //< will get used to preload the subscription IMDB.  The name provided here is the 
                                    //< xml file in .../sipXrls/src/test/rlsdata/ without the ".xml" extension.
                                    UtlString credentialDbName,
                                    //< Specifies the credential DB to use for the test.  The name 
                                    //< is used to select which of the files in .../sipXrls/src/test/rlsdata/
                                    //< will get used to preload the credential IMDB.  The name provided here is the 
                                    //< xml file in .../sipXrls/src/test/rlsdata/ without the ".xml" extension.
                                    UtlString domianName,
                                    //< Specify the domain name to use for the test
                                    UtlBoolean routeAllRequestsToRlsServer
                                    //< Send all requests to either the RLS Server UA or the RLS Client UA
                                    //< The Client UA typically deals with the outgoing subscriptions and
                                    //< the Server UA deals witht the incoming subscriptions
                                    )
   {
      mCredentialDbName = credentialDbName;
      // force copy of input files into the 'work' directory
      sipDbContext.inputFile( subscriptionDbName + ".xml" );
      sipDbContext.inputFile( credentialDbName + ".xml" );
      UtlString tempResourceListFile = UtlString(TEST_DATA_DIR) + "/" + resourceListFile;

      pSipUserAgent = new SipUserAgent( 45141, 45141, 45142
                                       ,"127.0.0.1"  // default publicAddress
                                       ,NULL         // default defaultUser
                                       ,"127.0.0.1" );  // default defaultSipAddress

      // Stop SipUserAgent from rejecting all SUBSCRIBEs
      pSipUserAgent->allowMethod(SIP_SUBSCRIBE_METHOD, true);

      SipXecsService* rlsTestService = new SipXecsService("sipxrlsTest", "SIPX_RLS", "TestCase");

      pResourceServerUnderTest = new ResourceListServer(rlsTestService,
                                       domianName, // domain 
                                       "rlstest.test", // realm
                                       NULL, 
                                       DIALOG_EVENT_TYPE, 
                                      DIALOG_EVENT_CONTENT_TYPE,
                                       45140, // TCP port
                                       45140, // UDP port
                                       45140, // TLS port
                                       "127.0.0.1", // Bind IP address
                                       &tempResourceListFile,
                                       (60 * 60), // Default subscription resubscribe interval.
                                       (40 * 60), // Default minimum subscription resubscribe interval.
                                       250,  // publishing delay? 
                                       20,   // The maximum number of reg subscriptions per resource.
                                       20,   // The maximum number of contacts per reg subscription.
                                       20,   // The maximum number of resource instances per contact
                                       20,    // The maximum number of dialogs per resource instance
                                       32, 3600, 86400, // Subscribe server expiration parameters
                                       subscriptionDbName,
                                       credentialDbName );

      pUacOutputProcessor = new OutputProcessorFixture();
      pUasOutputProcessor = new OutputProcessorFixture();
      
      pResourceServerUnderTest->mClientUserAgent.addSipOutputProcessor( pUacOutputProcessor );
      pResourceServerUnderTest->mServerUserAgent.addSipOutputProcessor( pUasOutputProcessor );

      UtlString proxyAddress;
      if(routeAllRequestsToRlsServer)
      {
         proxyAddress = "127.0.0.1:45140";
      }
      else
      {
         int pPort;
         pResourceServerUnderTest->mClientUserAgent.getLocalAddress(&proxyAddress, &pPort);
         proxyAddress.append(':');
         proxyAddress.appendNumber(pPort);
      }

      pSipUserAgent->setProxyServers(proxyAddress.data());

      pResourceServerUnderTest->start();
   }
コード例 #3
0
   void instantiateAllTestFixtures( UtlString AppearanceGroupFile,
                                    //< Name of the appearance group file to use for the test.  The filename
                                    //< specified must exist in .../sipXrls/src/test/saadata/
                                    UtlString subscriptionDbName,
                                    //< Specifies the subscription DB to use for the test.  The name
                                    //< is used to select which of the files in .../sipXrls/src/test/saadata/
                                    //< will get used to preload the subscription IMDB.  The name provided here is the
                                    //< xml file in .../sipXrls/src/test/saadata/ without the ".xml" extension.
                                    UtlString credentialDbName,
                                    //< Specifies the credential DB to use for the test.  The name
                                    //< is used to select which of the files in .../sipXrls/src/test/saadata/
                                    //< will get used to preload the credential IMDB.  The name provided here is the
                                    //< xml file in .../sipXrls/src/test/saadata/ without the ".xml" extension.
                                    UtlString domainName
                                    //< Specify the domain name to use for the test
                                    )
   {
      mCredentialDbName = credentialDbName;
      // force copy of input files into the 'work' directory
      sipDbContext.inputFile( subscriptionDbName + ".xml" );
      sipDbContext.inputFile( credentialDbName + ".xml" );
      UtlString tempAppearanceGroupFile = UtlString(TEST_DATA_DIR) + "/" + AppearanceGroupFile;

      pSipUserAgent = new SipUserAgent( 45141, 45141, 45142
                                       ,"127.0.0.1"  // default publicAddress
                                       ,NULL         // default defaultUser
                                       ,"127.0.0.1" );  // default defaultSipAddress

      // Stop SipUserAgent from rejecting all SUBSCRIBEs
      pSipUserAgent->allowMethod(SIP_SUBSCRIBE_METHOD, true);

      SipXecsService* saaTestService = new SipXecsService("sipxsaaTest", "SIPX_SAA", "TestCase");

      pAppearanceAgentUnderTest = new AppearanceAgent(saaTestService,
                                       domainName, // domain
                                       "rlstest.test", // realm
                                       NULL,  // line manager
                                       45140, // TCP port
                                       45140, // UDP port
                                       45140, // TLS port
                                       "127.0.0.1", // Bind IP address
                                       &tempAppearanceGroupFile,
                                       (24 * 60 * 60), // Default subscription refresh interval
                                       (60 * 60), // Default subscription resubscribe interval.
                                       (40 * 60), // Default minimum subscription resubscribe interval.
                                       (20 * 60), // Default seized subscription resubscribe interval.
                                       250,  // publishing delay?
                                       20,   // The maximum number of reg subscriptions per group.
                                       32, 3600, 86400, // Subscribe server expiration parameters
                                       subscriptionDbName,
                                       credentialDbName );

      pUasOutputProcessor = new OutputProcessorFixture();

      pAppearanceAgentUnderTest->mServerUserAgent.addSipOutputProcessor( pUasOutputProcessor );

      UtlString proxyAddress;
      proxyAddress = "127.0.0.1:45140";

      pSipUserAgent->setProxyServers(proxyAddress.data());

      pAppearanceAgentUnderTest->start();
   }