Search in sources :

Example 6 with DataProviderKey

use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.

the class DataProviderServiceTest method testGetDataProvider.

@Test
public void testGetDataProvider() throws Exception {
    // Create and persist a data provider entity.
    dataProviderDaoTestHelper.createDataProviderEntity(DATA_PROVIDER_NAME);
    // Retrieve the data provider.
    DataProvider resultDataProvider = dataProviderService.getDataProvider(new DataProviderKey(DATA_PROVIDER_NAME));
    // Validate the returned object.
    assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderKey(org.finra.herd.model.api.xml.DataProviderKey) Test(org.junit.Test)

Example 7 with DataProviderKey

use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.

the class DataProviderServiceTest method testDeleteDataProviderUpperCaseParameters.

@Test
public void testDeleteDataProviderUpperCaseParameters() {
    // 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 using upper case input parameters.
    DataProvider deletedDataProvider = dataProviderService.deleteDataProvider(new DataProviderKey(DATA_PROVIDER_NAME.toUpperCase()));
    // Validate the returned object.
    assertEquals(new DataProvider(DATA_PROVIDER_NAME), deletedDataProvider);
    // Ensure that this data provider is no longer there.
    assertNull(dataProviderDao.getDataProviderByKey(dataProviderKey));
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderKey(org.finra.herd.model.api.xml.DataProviderKey) Test(org.junit.Test)

Example 8 with DataProviderKey

use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.

the class DataProviderServiceTest method testDeleteDataProviderMissingRequiredParameters.

@Test
public void testDeleteDataProviderMissingRequiredParameters() {
    // Try to delete a data provider instance when data provider name is not specified.
    try {
        dataProviderService.deleteDataProvider(new DataProviderKey(BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when data provider name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A data provider name must be specified.", e.getMessage());
    }
}
Also used : DataProviderKey(org.finra.herd.model.api.xml.DataProviderKey) Test(org.junit.Test)

Example 9 with DataProviderKey

use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.

the class DataProviderServiceTest method testDeleteDataProviderTrimParameters.

@Test
public void testDeleteDataProviderTrimParameters() {
    // 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 using input parameters with leading and trailing empty spaces.
    DataProvider deletedDataProvider = dataProviderService.deleteDataProvider(new DataProviderKey(addWhitespace(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));
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderKey(org.finra.herd.model.api.xml.DataProviderKey) Test(org.junit.Test)

Example 10 with DataProviderKey

use of org.finra.herd.model.api.xml.DataProviderKey in project herd by FINRAOS.

the class DataProviderServiceTest method testGetDataProviders.

@Test
public void testGetDataProviders() throws Exception {
    // Create and persist data provider entities.
    for (DataProviderKey key : DATA_PROVIDER_KEYS) {
        dataProviderDaoTestHelper.createDataProviderEntity(key.getDataProviderName());
    }
    // Retrieve a list of data provider keys.
    DataProviderKeys resultDataProviderKeys = dataProviderService.getDataProviders();
    // Validate the returned object.
    assertEquals(DATA_PROVIDER_KEYS, resultDataProviderKeys.getDataProviderKeys());
}
Also used : DataProviderKeys(org.finra.herd.model.api.xml.DataProviderKeys) DataProviderKey(org.finra.herd.model.api.xml.DataProviderKey) Test(org.junit.Test)

Aggregations

DataProviderKey (org.finra.herd.model.api.xml.DataProviderKey)19 Test (org.junit.Test)17 DataProvider (org.finra.herd.model.api.xml.DataProvider)10 DataProviderEntity (org.finra.herd.model.jpa.DataProviderEntity)3 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 DataProviderKeys (org.finra.herd.model.api.xml.DataProviderKeys)2 ArrayList (java.util.ArrayList)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1