use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.
the class DataProviderServiceTest method testDeleteDataProvider.
@Test
public void testDeleteDataProvider() throws Exception {
// Create a data provider key.
DataProviderKey dataProviderKey = new DataProviderKey(DATA_PROVIDER_NAME);
// Create and persist a data provider entity.
dataProviderDaoTestHelper.createDataProviderEntity(DATA_PROVIDER_NAME);
// Validate that this data provider exists.
assertNotNull(dataProviderDao.getDataProviderByKey(dataProviderKey));
// Delete this data provider.
DataProvider deletedDataProvider = dataProviderService.deleteDataProvider(new DataProviderKey(DATA_PROVIDER_NAME));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME), deletedDataProvider);
// Ensure that this data provider is no longer there.
assertNull(dataProviderDao.getDataProviderByKey(dataProviderKey));
}
use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.
the class DataProviderServiceTest method testGetDataProviderNoExists.
@Test
public void testGetDataProviderNoExists() throws Exception {
// Try to get a non-existing data provider.
try {
dataProviderService.getDataProvider(new DataProviderKey(DATA_PROVIDER_NAME));
fail("Should throw an ObjectNotFoundException when data provider doesn't exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Data provider with name \"%s\" doesn't exist.", DATA_PROVIDER_NAME), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.
the class DataProviderServiceTest method testGetDataProviderTrimParameters.
@Test
public void testGetDataProviderTrimParameters() {
// Create and persist a data provider entity.
dataProviderDaoTestHelper.createDataProviderEntity(DATA_PROVIDER_NAME);
// Retrieve the data provider using input parameters with leading and trailing empty spaces.
DataProvider resultDataProvider = dataProviderService.getDataProvider(new DataProviderKey(addWhitespace(DATA_PROVIDER_NAME)));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
}
use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.
the class DataProviderServiceTest method testGetDataProviderUpperCaseParameters.
@Test
public void testGetDataProviderUpperCaseParameters() {
// Create and persist a data provider entity.
dataProviderDaoTestHelper.createDataProviderEntity(DATA_PROVIDER_NAME);
// Retrieve the data provider using upper case input parameters.
DataProvider resultDataProvider = dataProviderService.getDataProvider(new DataProviderKey(DATA_PROVIDER_NAME.toUpperCase()));
// Validate the returned object.
assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
}
Aggregations