test_class.declarator: resourceUpgrade
test_class.original_string: ResourceUpgradeUse resourceUpgrade;
test_class.type: ResourceUpgradeUse
test_class.var_name: resourceUpgrade
test_class.file: api/src/test/java/com/abiquo/scheduler/ResourceUpgradeUseTest.java
test_class.identifier: ResourceUpgradeUseTest
test_class.superclass: extends AbstractUnitTest
test_case.body: @Test
      public void testGetFreeVLANFromUsedList()
      {
          List<Integer> vlanListUsed = new ArrayList<Integer>();
          int freeVlan = 0;
          Rack rack = rackGenerator.createUniqueInstance();
          rack.setVlanIdMin(2);
          rack.setVlanIdMax(10);
  
          rack.setVlansIdAvoided("");
          int[] arrayInt7 = {1, 2};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt7, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(3, freeVlan);
  
          rack.setVlansIdAvoided("");
          vlanListUsed = new ArrayList<Integer>();
          int[] arrayInt = {3, 4, 5};
          arrayToList(arrayInt, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(2, freeVlan);
  
          rack.setVlansIdAvoided("");
          int[] arrayInt2 = {2, 4, 5};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt2, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(3, freeVlan);
  
          rack.setVlansIdAvoided("2");
          int[] arrayInt3 = {4, 5};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt3, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(3, freeVlan);
  
          rack.setVlansIdAvoided("2");
          int[] arrayInt4 = {2, 3, 4, 5};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt4, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(6, freeVlan);
  
          rack.setVlansIdAvoided("2-8");
          int[] arrayInt5 = {};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt5, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(9, freeVlan);
  
          rack.setVlansIdAvoided("2-8,9");
          int[] arrayInt6 = {};
          vlanListUsed = new ArrayList<Integer>();
          arrayToList(arrayInt6, vlanListUsed);
          freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          Assert.assertEquals(10, freeVlan);
  
          // rack.setVlansIdAvoided("2-10");
          // int[] arrayInt7 = {};
          // vlanListUsed = new ArrayList<Integer>();
          // arrayToList(arrayInt7, vlanListUsed);
          // freeVlan = resourceUpgrade.getFreeVLANFromUsedList(vlanListUsed, rack);
          // Assert.assertEquals(10, freeVlan);
  
      }
test_case.class_method_signature: ResourceUpgradeUseTest.testGetFreeVLANFromUsedList()
test_case.full_signature: @Test public void testGetFreeVLANFromUsedList()
test_case.identifier: testGetFreeVLANFromUsedList
test_case.invocations: createUniqueInstance setVlanIdMin setVlanIdMax setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals setVlansIdAvoided arrayToList getFreeVLANFromUsedList assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetFreeVLANFromUsedList()
focal_class.declarator: log = LoggerFactory.getLogger(ResourceUpgradeUse.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger log = LoggerFactory.getLogger(ResourceUpgradeUse.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: datastoreDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private DatastoreDAO datastoreDao;
focal_class.type: DatastoreDAO
focal_class.var_name: datastoreDao
focal_class.declarator: netAssignDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private NetworkAssignmentDAO netAssignDao;
focal_class.type: NetworkAssignmentDAO
focal_class.var_name: netAssignDao
focal_class.declarator: ipPoolManDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private IpPoolManagementDAO ipPoolManDao;
focal_class.type: IpPoolManagementDAO
focal_class.var_name: ipPoolManDao
focal_class.declarator: vlanNetworkDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private VLANNetworkDAO vlanNetworkDao;
focal_class.type: VLANNetworkDAO
focal_class.var_name: vlanNetworkDao
focal_class.declarator: hypervisorDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private HypervisorDAO hypervisorDao;
focal_class.type: HypervisorDAO
focal_class.var_name: hypervisorDao
focal_class.declarator: allocationService
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private VirtualimageAllocationService allocationService;
focal_class.type: VirtualimageAllocationService
focal_class.var_name: allocationService
focal_class.declarator: infrastructureService
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private InfrastructureService infrastructureService;
focal_class.type: InfrastructureService
focal_class.var_name: infrastructureService
focal_class.declarator: fitPolicyDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private FitPolicyRuleDAO fitPolicyDao;
focal_class.type: FitPolicyRuleDAO
focal_class.var_name: fitPolicyDao
focal_class.file: api/src/main/java/com/abiquo/scheduler/ResourceUpgradeUse.java
focal_class.identifier: ResourceUpgradeUse
focal_class.interfaces: implements IResourceUpgradeUse
focal_class.class_method_signature: ResourceUpgradeUse.ResourceUpgradeUse()
focal_class.full_signature: public  ResourceUpgradeUse()
focal_class.identifier: ResourceUpgradeUse
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ResourceUpgradeUse()
focal_class.class_method_signature: ResourceUpgradeUse.ResourceUpgradeUse(final EntityManager em)
focal_class.full_signature: public  ResourceUpgradeUse(final EntityManager em)
focal_class.identifier: ResourceUpgradeUse
focal_class.modifiers: public
focal_class.parameters: (final EntityManager em)
focal_class.signature:  ResourceUpgradeUse(final EntityManager em)
focal_class.class_method_signature: ResourceUpgradeUse.updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine)
focal_class.full_signature: @Override public void updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine)
focal_class.identifier: updateUse
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine)
focal_class.return: void
focal_class.signature: void updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine)
focal_class.class_method_signature: ResourceUpgradeUse.updateUseHa(final VirtualMachine virtualMachine, final Machine machine)
focal_class.full_signature: @Override public void updateUseHa(final VirtualMachine virtualMachine, final Machine machine)
focal_class.identifier: updateUseHa
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualMachine virtualMachine, final Machine machine)
focal_class.return: void
focal_class.signature: void updateUseHa(final VirtualMachine virtualMachine, final Machine machine)
focal_class.class_method_signature: ResourceUpgradeUse.updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine, final boolean isHA)
focal_class.full_signature: private void updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine, final boolean isHA)
focal_class.identifier: updateUse
focal_class.modifiers: private
focal_class.parameters: (final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine, final boolean isHA)
focal_class.return: void
focal_class.signature: void updateUse(final VirtualAppliance virtualAppliance,
          final VirtualMachine virtualMachine, final boolean isHA)
focal_class.class_method_signature: ResourceUpgradeUse.rollbackUseHA(final VirtualMachine virtualMachine, final Machine machine)
focal_class.full_signature: @Override public void rollbackUseHA(final VirtualMachine virtualMachine, final Machine machine)
focal_class.identifier: rollbackUseHA
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualMachine virtualMachine, final Machine machine)
focal_class.return: void
focal_class.signature: void rollbackUseHA(final VirtualMachine virtualMachine, final Machine machine)
focal_class.class_method_signature: ResourceUpgradeUse.rollbackUse(final VirtualMachine virtualMachine)
focal_class.full_signature: @Override public void rollbackUse(final VirtualMachine virtualMachine)
focal_class.identifier: rollbackUse
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualMachine virtualMachine)
focal_class.return: void
focal_class.signature: void rollbackUse(final VirtualMachine virtualMachine)
focal_class.class_method_signature: ResourceUpgradeUse.updateNewtorkingResourcesHA(final Machine haPhysicalTarget,
          final VirtualMachine virtualMachine)
focal_class.full_signature: private void updateNewtorkingResourcesHA(final Machine haPhysicalTarget,
          final VirtualMachine virtualMachine)
focal_class.identifier: updateNewtorkingResourcesHA
focal_class.modifiers: private
focal_class.parameters: (final Machine haPhysicalTarget,
          final VirtualMachine virtualMachine)
focal_class.return: void
focal_class.signature: void updateNewtorkingResourcesHA(final Machine haPhysicalTarget,
          final VirtualMachine virtualMachine)
focal_class.class_method_signature: ResourceUpgradeUse.updateNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine, final VirtualAppliance vapp)
focal_class.full_signature: public void updateNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine, final VirtualAppliance vapp)
focal_class.identifier: updateNetworkingResources
focal_class.modifiers: public
focal_class.parameters: (final Machine physicalTarget,
          final VirtualMachine virtualMachine, final VirtualAppliance vapp)
focal_class.return: void
focal_class.signature: void updateNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine, final VirtualAppliance vapp)
focal_class.class_method_signature: ResourceUpgradeUse.rollbackNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine)
focal_class.full_signature: private void rollbackNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine)
focal_class.identifier: rollbackNetworkingResources
focal_class.modifiers: private
focal_class.parameters: (final Machine physicalTarget,
          final VirtualMachine virtualMachine)
focal_class.return: void
focal_class.signature: void rollbackNetworkingResources(final Machine physicalTarget,
          final VirtualMachine virtualMachine)
focal_class.class_method_signature: ResourceUpgradeUse.updateUsagePhysicalMachine(final Machine machine, final VirtualMachine used,
          final boolean isRollback)
focal_class.full_signature: public void updateUsagePhysicalMachine(final Machine machine, final VirtualMachine used,
          final boolean isRollback)
focal_class.identifier: updateUsagePhysicalMachine
focal_class.modifiers: public
focal_class.parameters: (final Machine machine, final VirtualMachine used,
          final boolean isRollback)
focal_class.return: void
focal_class.signature: void updateUsagePhysicalMachine(final Machine machine, final VirtualMachine used,
          final boolean isRollback)
focal_class.class_method_signature: ResourceUpgradeUse.updateUsed(final Machine machine, final Datastore datastore,
          final VirtualMachineRequirements requirements)
focal_class.full_signature: @Override public void updateUsed(final Machine machine, final Datastore datastore,
          final VirtualMachineRequirements requirements)
focal_class.identifier: updateUsed
focal_class.modifiers: @Override public
focal_class.parameters: (final Machine machine, final Datastore datastore,
          final VirtualMachineRequirements requirements)
focal_class.return: void
focal_class.signature: void updateUsed(final Machine machine, final Datastore datastore,
          final VirtualMachineRequirements requirements)
focal_class.class_method_signature: ResourceUpgradeUse.updateUsageDatastore(final VirtualMachine virtual, final boolean isRollback)
focal_class.full_signature: private void updateUsageDatastore(final VirtualMachine virtual, final boolean isRollback)
focal_class.identifier: updateUsageDatastore
focal_class.modifiers: private
focal_class.parameters: (final VirtualMachine virtual, final boolean isRollback)
focal_class.return: void
focal_class.signature: void updateUsageDatastore(final VirtualMachine virtual, final boolean isRollback)
focal_class.class_method_signature: ResourceUpgradeUse.updateDatastore(final Datastore datastore, final Long requestSize,
          final boolean isRollback)
focal_class.full_signature: private void updateDatastore(final Datastore datastore, final Long requestSize,
          final boolean isRollback)
focal_class.identifier: updateDatastore
focal_class.modifiers: private
focal_class.parameters: (final Datastore datastore, final Long requestSize,
          final boolean isRollback)
focal_class.return: void
focal_class.signature: void updateDatastore(final Datastore datastore, final Long requestSize,
          final boolean isRollback)
focal_class.class_method_signature: ResourceUpgradeUse.getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
focal_class.full_signature: public Integer getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
focal_class.identifier: getFreeVLANFromUsedList
focal_class.modifiers: public
focal_class.parameters: (final List<Integer> vlanIds, final Rack rack)
focal_class.return: Integer
focal_class.signature: Integer getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
focal_class.class_method_signature: ResourceUpgradeUse.getVlansIdAvoidAsCollection(final Rack rack)
focal_class.full_signature: public Collection<Integer> getVlansIdAvoidAsCollection(final Rack rack)
focal_class.identifier: getVlansIdAvoidAsCollection
focal_class.modifiers: public
focal_class.parameters: (final Rack rack)
focal_class.return: Collection<Integer>
focal_class.signature: Collection<Integer> getVlansIdAvoidAsCollection(final Rack rack)
focal_class.class_method_signature: ResourceUpgradeUse.getPublicVLANTagsFROMVLANNetworkList(
          final List<VLANNetwork> vlanNetworkList)
focal_class.full_signature: public List<Integer> getPublicVLANTagsFROMVLANNetworkList(
          final List<VLANNetwork> vlanNetworkList)
focal_class.identifier: getPublicVLANTagsFROMVLANNetworkList
focal_class.modifiers: public
focal_class.parameters: (
          final List<VLANNetwork> vlanNetworkList)
focal_class.return: List<Integer>
focal_class.signature: List<Integer> getPublicVLANTagsFROMVLANNetworkList(
          final List<VLANNetwork> vlanNetworkList)
focal_class.class_method_signature: ResourceUpgradeUse.getAllocationFitPolicyOnDatacenter(final Integer idDatacenter)
focal_class.full_signature: protected FitPolicy getAllocationFitPolicyOnDatacenter(final Integer idDatacenter)
focal_class.identifier: getAllocationFitPolicyOnDatacenter
focal_class.modifiers: protected
focal_class.parameters: (final Integer idDatacenter)
focal_class.return: FitPolicy
focal_class.signature: FitPolicy getAllocationFitPolicyOnDatacenter(final Integer idDatacenter)
focal_class.class_method_signature: ResourceUpgradeUse.getDisksSizeInBytes(final VirtualMachine vm)
focal_class.full_signature: private long getDisksSizeInBytes(final VirtualMachine vm)
focal_class.identifier: getDisksSizeInBytes
focal_class.modifiers: private
focal_class.parameters: (final VirtualMachine vm)
focal_class.return: long
focal_class.signature: long getDisksSizeInBytes(final VirtualMachine vm)
focal_method.body: public Integer getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
          throws NotEnoughResourcesException
      {
          // Adding Vlans Id not to add
          vlanIds.addAll(getVlansIdAvoidAsCollection(rack));
  
          // Create a HashSet which allows no duplicates
          HashSet<Integer> hashSet = new HashSet<Integer>(vlanIds);
  
          // Assign the HashSet to a new ArrayList
          List<Integer> vlanIdsOrdered = new ArrayList<Integer>(hashSet);
          Collections.sort(vlanIdsOrdered);
  
          List<Integer> vlanTemp = new ArrayList<Integer>(vlanIdsOrdered);
  
          // Removing used port groups minor than minId and bigger then maxId
          // (that could be only public and external networks with tags ouside the
          // minid-maxid range)
          for (Integer vlanId : vlanTemp)
          {
              if (vlanId.intValue() < rack.getVlanIdMin())
              {
                  vlanIdsOrdered.remove(vlanId);
              }
          }
  
          for (Integer i = rack.getVlanIdMin(); i <= rack.getVlanIdMax(); i++)
          {
              if (!vlanIdsOrdered.contains(i))
              {
                  return i;
              }
          }
  
          throw new NotEnoughResourcesException("The maximun number of VLAN tag has been reached");
      }
focal_method.class_method_signature: ResourceUpgradeUse.getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
focal_method.full_signature: public Integer getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)
focal_method.identifier: getFreeVLANFromUsedList
focal_method.invocations: addAll getVlansIdAvoidAsCollection sort intValue getVlanIdMin remove getVlanIdMin getVlanIdMax contains
focal_method.modifiers: public
focal_method.parameters: (final List<Integer> vlanIds, final Rack rack)
focal_method.return: Integer
focal_method.signature: Integer getFreeVLANFromUsedList(final List<Integer> vlanIds, final Rack rack)