Search in sources :

Example 6 with DataProvider

use of org.finra.herd.model.api.xml.DataProvider 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 7 with DataProvider

use of org.finra.herd.model.api.xml.DataProvider 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)

Example 8 with DataProvider

use of org.finra.herd.model.api.xml.DataProvider 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 9 with DataProvider

use of org.finra.herd.model.api.xml.DataProvider 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 10 with DataProvider

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

the class DataProviderRestControllerTest method testDeleteDataProvider.

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

Aggregations

DataProvider (org.finra.herd.model.api.xml.DataProvider)16 Test (org.junit.Test)15 DataProviderKey (org.finra.herd.model.api.xml.DataProviderKey)10 DataProviderCreateRequest (org.finra.herd.model.api.xml.DataProviderCreateRequest)5