浏览代码

FD3-295 fix test onu rest controller

Guillermo Espinoza 7 年之前
父节点
当前提交
612768d929

+ 30 - 22
src/FTTHBundle/Entity/OLT.php

@@ -20,7 +20,7 @@ use WorkflowBundle\Entity\Traits\WorkflowTrait;
 /**
  * @ORM\Entity
  * @UniqueEntity("ip")
- * 
+ *
  * @ValidatorAssert\Device
  */
 class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface, WorkflowInterface
@@ -49,7 +49,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
 
     /**
      * @var string $ip
-     * 
+     *
      * @ORM\Column(type="string", length=50, nullable=false, unique=true)
      * @Assert\NotNull
      */
@@ -86,32 +86,32 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * @ORM\ManyToOne(targetEntity="OLTModel", inversedBy="olts", fetch="EXTRA_LAZY")
      * @ORM\JoinColumn(name="model_id", referencedColumnName="id", onDelete="SET NULL")
-     * 
+     *
      * @JMS\MaxDepth(1)
      */
     protected $model;
 
     /**
      * @ORM\OneToMany(targetEntity="ONU", mappedBy="olt", fetch="EXTRA_LAZY")
-     * 
+     *
      * @JMS\MaxDepth(2)
      */
     protected $onus;
 
     /**
-     * @ORM\Column(type="string", nullable=true) 
+     * @ORM\Column(type="string", nullable=true)
      */
     protected $currentState = null;
 
     /**
-     * @ORM\Column(type="string", nullable=false, options={"default": "success"}) 
+     * @ORM\Column(type="string", nullable=false, options={"default": "success"})
      */
     protected $transitionState = 'success';
 
     /**
      * @ORM\ManyToOne(targetEntity="\WorkflowBundle\Entity\Workflow", fetch="EXTRA_LAZY")
      * @ORM\JoinColumn(name="workflow_id", referencedColumnName="id", onDelete="SET NULL")
-     * 
+     *
      * @JMS\MaxDepth(1)
      */
     protected $workflow;
@@ -140,12 +140,12 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      * @ORM\Column(type="integer", options={"unsigned":true, "default":5})
      */
     protected $timeOnuStats = 5;
-    
+
     /**
      * @ORM\Column(type="string", nullable=true)
      */
     protected $enable;
-    
+
 
     /**
      * @return string
@@ -281,7 +281,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     }
 
     /**
-     * @return Doctrine\Common\Collections\Collection 
+     * @return Doctrine\Common\Collections\Collection
      */
     public function getOnus()
     {
@@ -373,7 +373,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Get executeSnmp
      *
-     * @return boolean 
+     * @return boolean
      */
     public function getExecuteSnmp()
     {
@@ -393,7 +393,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Get timeScan
      *
-     * @return integer 
+     * @return integer
      */
     public function getTimeScan()
     {
@@ -413,7 +413,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Get timeOltOctets
      *
-     * @return integer 
+     * @return integer
      */
     public function getTimeOltOctets()
     {
@@ -433,7 +433,7 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Get timeOnuStats
      *
-     * @return integer 
+     * @return integer
      */
     public function getTimeOnuStats()
     {
@@ -453,31 +453,39 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     /**
      * Get timePonStats
      *
-     * @return integer 
+     * @return integer
      */
     public function getTimePonStats()
     {
         return $this->timePonStats;
     }
-    
+
     /**
      * @return string
      */
-    public function getEnable() 
+    public function getEnable()
     {
         return $this->enable;
     }
 
     /**
      * @param string $enable
-     * 
+     *
      * @return $this
      */
-    public function setEnable($enable) 
+    public function setEnable($enable)
     {
         $this->enable = $enable;
-        
+
         return $this;
-    }   
+    }
+
+    /**
+    * @return int
+    */
+    public function getLibraryVersion()
+    {
+        return $this->libraryVersion;
+    }
 
-}
+}

+ 13 - 12
src/FTTHBundle/Entity/ONU.php

@@ -126,9 +126,9 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
 
     /**
      * @ORM\ManyToOne(targetEntity="NAP", inversedBy="onus", fetch="EXTRA_LAZY")
-     * 
+     *
      * @JMS\MaxDepth(1)
-     * 
+     *
      * @Assert\NotNull
      */
     protected $nap;
@@ -153,7 +153,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     private $position = 0;
 
-    
+
     /**
      * @return string
      */
@@ -183,7 +183,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     {
         $this->id = $id;
 
-	return $this;
+	      return $this;
     }
 
     /**
@@ -326,7 +326,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     public function setCreated($d)
     {
         $this->created = $d;
-	return $this;
+	      return $this;
     }
 
 
@@ -347,6 +347,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     public function setUpdated($updated)
     {
         $this->updated = $updated;
+
         return $this;
     }
 
@@ -377,10 +378,10 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
     {
         return $this->olt;
     }
-        
+
     /**
      * @param OLT $olt
-     * 
+     *
      * @return $this
      */
     public function setOlt($olt)
@@ -447,10 +448,10 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
 
         return $this;
     }
-    
+
     /**
      * @global AppKernel $kernel
-     * 
+     *
      * @return string
      */
     public function getLog()
@@ -503,7 +504,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
 
         return $this;
     }
-    
+
     /**
      * @return int
      */
@@ -513,7 +514,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         if ($this->nap) {
             $olt = $this->nap->getSlot();
         }
-        
+
         return $olt;
     }
 
@@ -526,7 +527,7 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         if ($this->nap) {
             $olt = $this->nap->getLink();
         }
-        
+
         return $olt;
     }
 

+ 2 - 1
src/FTTHBundle/Form/NAPType.php

@@ -16,11 +16,12 @@ class NAPType extends AbstractType
     {
         $builder
             ->add('name')
+            ->add('olt')
             ->add('extraData')
             ->add('tenancyId')
         ;
     }
-    
+
     /**
      * @param OptionsResolver $resolver
      */

+ 7 - 0
src/FTTHBundle/tests/ONURESTControllerTest.php

@@ -132,6 +132,11 @@ class ONURESTControllerTest extends WebTestCaseBase
         $datos = array();
         $datos['name'] = 'OLT';
         $datos['ip'] = '127.0.0.1';
+        $datos['transitionState'] = 'success';
+        $datos['timeScan'] = 10;
+        $datos['timeOltOctets'] = 5;
+        $datos['timePonStats'] = 5;
+        $datos['timeOnuStats'] = 5;
         $datos['tenancyId'] = 1;
 
         if ($key == null) {
@@ -197,7 +202,9 @@ class ONURESTControllerTest extends WebTestCaseBase
         $this->setListener();
         // hago la inserccion llamando al servicio por post
         $this->getClient()->request('POST', $this->getOLTUri(), $this->obtainOLTData());
+        $response = $this->getClient()->getResponse();
         $this->getClient()->request('POST', $this->getNAPUri(), $this->obtainNAPData());
+        $response = $this->getClient()->getResponse();
         $this->getClient()->request('POST', $this->getUri(), $this->obtainData());
         // obtengo la respuesta
         $response = $this->getClient()->getResponse();