Exemplo n.º 1
0
 public function testConfiguration3()
 {
     $customersResourceSet = $this->_northWindMetadata->resolveResourceSet('Customers');
     $this->assertNotNull($customersResourceSet);
     $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 0);
     $this->_dataServiceConfiguration->setEntitySetPageSize('Customers', 5);
     $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 5);
     $this->_dataServiceConfiguration->setEntitySetPageSize('*', 4);
     $ordersResourceSet = $this->_northWindMetadata->resolveResourceSet('Orders');
     $this->assertNotNull($ordersResourceSet);
     $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($ordersResourceSet), 4);
     $this->assertEquals($this->_dataServiceConfiguration->getEntitySetPageSize($customersResourceSet), 5);
     try {
         $this->_dataServiceConfiguration->setEntitySetPageSize('NonExistEntitySet', 7);
         $this->fail('An expected InvalidArgumentException for \'non-exist entity set name\' was not thrown for month');
     } catch (\InvalidArgumentException $exception) {
         $this->AssertEquals('The given name \'NonExistEntitySet\' was not found in the entity sets', $exception->getMessage());
     }
     try {
         $this->_dataServiceConfiguration->setMaxResultsPerCollection(5);
         $this->fail('An expected InvalidOperationException for \'page size and max result per collection mutual exclusion\' was not thrown for month');
     } catch (InvalidOperationException $exception) {
         $this->assertStringEndsWith('mutually exclusive with the specification of \'maximum result per collection\' in configuration', $exception->getMessage());
     }
 }
Exemplo n.º 2
0
 public function initialize(ServiceConfiguration $config)
 {
     $config->setEntitySetPageSize('*', $this->maxPageSize);
     $config->setEntitySetAccessRule('*', EntitySetRights::ALL);
     $config->setAcceptCountRequests(true);
     $config->setAcceptProjectionRequests(true);
 }
Exemplo n.º 3
0
 /**
  * This method is called only once to initialize service-wide policies
  * 
  * @param ServiceConfiguration $config Data service configuration object
  * 
  * @return void
  */
 public function initialize(ServiceConfiguration $config)
 {
     $config->setEntitySetPageSize('*', 5);
     $config->setEntitySetAccessRule('*', EntitySetRights::ALL);
     $config->setAcceptCountRequests(true);
     $config->setAcceptProjectionRequests(true);
     $config->setMaxDataServiceVersion(ProtocolVersion::V3());
 }
Exemplo n.º 4
0
 /**
  * This method is called only once to initialize service-wide policies
  * 
  * @param ServiceConfiguration $config
  */
 public function initialize(ServiceConfiguration $config)
 {
     $config->setEntitySetAccessRule('*', EntitySetRights::ALL);
     //we are using V1 protocol, but still we set page size because with
     //a top value which is less than pagesize we can use V1 protocol
     //even though paging is enabled.
     $config->setEntitySetPageSize('*', 5);
     $config->setAcceptCountRequests(true);
     $config->setAcceptProjectionRequests(true);
     $config->setMaxDataServiceVersion(ProtocolVersion::V1());
 }