Search in sources :

Example 6 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderLowerCaseParameters.

@Test
public void testCreateDataProviderLowerCaseParameters() {
    // Create a data provider using lower case input parameters.
    DataProvider resultDataProvider = dataProviderService.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME.toLowerCase()));
    // Validate the returned object.
    assertEquals(new DataProvider(DATA_PROVIDER_NAME.toLowerCase()), resultDataProvider);
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Example 7 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderTrimParameters.

@Test
public void testCreateDataProviderTrimParameters() {
    // Create a data provider using input parameters with leading and trailing empty spaces.
    DataProvider resultDataProvider = dataProviderService.createDataProvider(new DataProviderCreateRequest(addWhitespace(DATA_PROVIDER_NAME)));
    // Validate the returned object.
    assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Example 8 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderAlreadyExists.

@Test
public void testCreateDataProviderAlreadyExists() throws Exception {
    // Create and persist a data provider.
    dataProviderDaoTestHelper.createDataProviderEntity(DATA_PROVIDER_NAME);
    // Try to create a data provider when it already exists.
    try {
        dataProviderService.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME));
        fail("Should throw an AlreadyExistsException when data provider already exists.");
    } catch (AlreadyExistsException e) {
        assertEquals(String.format("Unable to create data provider \"%s\" because it already exists.", DATA_PROVIDER_NAME), e.getMessage());
    }
}
Also used : AlreadyExistsException(org.finra.herd.model.AlreadyExistsException) DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Aggregations

DataProviderCreateRequest (org.finra.herd.model.api.xml.DataProviderCreateRequest)8 Test (org.junit.Test)8 DataProvider (org.finra.herd.model.api.xml.DataProvider)5 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1