Search in sources :

Example 1 with DataProviderCreateRequest

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

the class DataProviderRestControllerTest method testCreateDataProvider.

@Test
public void testCreateDataProvider() throws Exception {
    DataProviderCreateRequest dataProviderCreateRequest = new DataProviderCreateRequest(DATA_PROVIDER_NAME);
    // Create a data provider.
    DataProvider dataProvider = new DataProvider(DATA_PROVIDER_NAME);
    when(dataProviderService.createDataProvider(dataProviderCreateRequest)).thenReturn(dataProvider);
    DataProvider resultDataProvider = dataProviderRestController.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME));
    // Validate the returned object.
    assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider);
    // Verify the external calls.
    verify(dataProviderService).createDataProvider(dataProviderCreateRequest);
    verifyNoMoreInteractions(dataProviderService);
    // Validate the returned object.
    assertEquals(dataProvider, resultDataProvider);
}
Also used : DataProvider(org.finra.herd.model.api.xml.DataProvider) DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Example 2 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderMissingRequiredParameters.

@Test
public void testCreateDataProviderMissingRequiredParameters() {
    // Try to create a data provider instance when data provider name is not specified.
    try {
        dataProviderService.createDataProvider(new DataProviderCreateRequest(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 : DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Example 3 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderUpperCaseParameters.

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

Example 4 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProviderInvalidParameters.

@Test
public void testCreateDataProviderInvalidParameters() {
    // Try to create a data provider instance when data provider name contains a forward slash character.
    try {
        dataProviderService.createDataProvider(new DataProviderCreateRequest(addSlash(DATA_PROVIDER_NAME)));
        fail("Should throw an IllegalArgumentException when data provider name contains a forward slash character.");
    } catch (IllegalArgumentException e) {
        assertEquals("Data provider name can not contain a forward slash character.", e.getMessage());
    }
}
Also used : DataProviderCreateRequest(org.finra.herd.model.api.xml.DataProviderCreateRequest) Test(org.junit.Test)

Example 5 with DataProviderCreateRequest

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

the class DataProviderServiceTest method testCreateDataProvider.

@Test
public void testCreateDataProvider() throws Exception {
    // Create a data provider.
    DataProvider resultDataProvider = dataProviderService.createDataProvider(new DataProviderCreateRequest(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)

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