*/
@Test
public void findBusiness() throws Throwable
{
//Get an AuthToken.
GetAuthenticationToken getAuthenticationToken = new GetAuthenticationToken();
getAuthenticationToken.run();
//Uses lists in config/data/default/
GeneralDataProvider data = GeneralDataProvider.getInstance();
//Pick a random number of services to publish under the business.
int numberOfBusinessService = XltRandom.nextInt(getProperty("maxNumberOfBusinessServices", 1)) + 1;
if(dataPool.getSize() <= 50)
{
//Pick a company name from a previously generated list of business names.
String businessName = data.getCompany(false);
//Register the business with services
RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
businessName, numberOfBusinessService);
Thread.sleep(4000);
//Add the returnThread.sleep(8000);ed BusinessEntity to the data pool.
dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0), 100);
}
else
{
//Get a business entity from the pool.
BusinessEntity businessEntity= dataPool.getDataElement();
if (businessEntity == null)
{
//Pick a company name from a previously generated list of business names.
String businessName = data.getCompany(false);
//Register the business with services
RegisterBusinessFlow registerBusinessFlow = new RegisterBusinessFlow(getAuthenticationToken.getAuthenticationToken(),
businessName, numberOfBusinessService);
Thread.sleep(4000);
//Add the returnThread.sleep(8000);ed BusinessEntity to the data pool.
dataPool.add(registerBusinessFlow.getBusinessDetail().getBusinessEntity().get(0), 100);
}
else
{
//Find the random business by passing it's name and the AuthToken.
FindBusinessByName findBusinessByName = new FindBusinessByName(getAuthenticationToken.getAuthenticationToken(),
businessEntity.getName().get(0).getValue());
findBusinessByName.run();
//Offer the business entity back to the pool with 50% chance that it will be rejected
//if the pool is full.