Package dev.galasa.framework.spi
Class FrameworkResourcePoolingService
java.lang.Object
dev.galasa.framework.spi.FrameworkResourcePoolingService
- All Implemented Interfaces:
IResourcePoolingService
This class provides the Resource pooling service to the framework. It can
generate resources to a number of specifications. When params are not given,
defaults are used.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionobtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.obtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.obtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, int returnConsecutive) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.obtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, int returnConsecutive, IDynamicStatusStoreService dss, String keyPrefix) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.obtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, IDynamicStatusStoreService dss, String keyPrefix) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.obtainResources
(@NotNull List<String> resourceStrings, List<String> rejectedResources, IDynamicStatusStoreService dss, String keyPrefix) This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list.
-
Constructor Details
-
FrameworkResourcePoolingService
public FrameworkResourcePoolingService()
-
-
Method Details
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. The default return list length is 10.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources, IDynamicStatusStoreService dss, String keyPrefix) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. Additionally this method checks against a Dynamic status store for the resources to ensure they are not in use. The default return list length is 10.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.dss
- - the dynamic status store to check for the resources.keyPrefix
- - the keyprefix for the resource for it to be found in the DSS.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. Additonally this method allows for the number of resources returned in the list to be defined.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.returnMinimum
- - the number of resources to return.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, IDynamicStatusStoreService dss, String keyPrefix) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. Additionally this method checks against a Dynamic status store for the resources to ensure they are not in use. As well, this method allows the number of resources returned to be defined.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.dss
- - the dynamic status store to check for the resources.keyPrefix
- - the keyprefix for the resource for it to be found in the DSS.returnMinimum
- - the number of resources to return.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, int returnConsecutive) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. Additonally this method allows for the number of resources returned in the list to be defined, in sections of consecutive resources. For example if i asked for 30 resources with a returnConsecutive of 10, then 3 lots of 10 resources would be in the list. Each 10 would be in a continuous chain.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.returnMinimum
- - the number of resources to return.returnConsecutive
- - the size of the "chunks" to find consectutive reosources in.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-
obtainResources
public List<String> obtainResources(@NotNull @NotNull List<String> resourceStrings, List<String> rejectedResources, int returnMinimum, int returnConsecutive, IDynamicStatusStoreService dss, String keyPrefix) throws InsufficientResourcesAvailableException This method obtaines resources from given definitions, but allowing rejected resources to be disgarded from any returned list. Additonally this method allows for the number of resources returned in the list to be defined, in sections of consecutive resources. For example if i asked for 30 resources with a returnConsecutive of 10, then 3 lots of 10 resources would be in the list. Each 10 would be in a continuous chain. This method also checks the DSS for the resources to ensure they are not in use.- Specified by:
obtainResources
in interfaceIResourcePoolingService
- Parameters:
resourceStrings
- - this is a string list of all the definitions for resources to select from.rejectedResources
- - this is a list of resource names NOT to be included in the returned list.returnMinimum
- - the number of resources to return.dss
- - the dynamic status store to check for the resources.keyPrefix
- - the keyprefix for the resource for it to be found in the DSS.returnConsecutive
- - the size of the "chunks" to find consectutive reosources in.- Returns:
- - a list of available reosurces from the defined acceptable resources.
- Throws:
InsufficientResourcesAvailableException
- - If unable to generate the return minimum
-