Search in sources :

Example 1 with GlobalEmailConfigRestModel

use of com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel in project hub-alert by blackducksoftware.

the class ObjectTransformerTest method testTransformNullModels.

@Test
public void testTransformNullModels() throws Exception {
    final MockEmailGlobalRestModel restGlobalEmailMockUtil = new MockEmailGlobalRestModel();
    final MockEmailGlobalEntity mockEmailGlobalEntity = new MockEmailGlobalEntity();
    final ObjectTransformer objectTransformer = new ObjectTransformer();
    GlobalEmailConfigEntity transformedConfigEntity = objectTransformer.configRestModelToDatabaseEntity(null, GlobalEmailConfigEntity.class);
    GlobalEmailConfigRestModel transformedConfigRestModel = objectTransformer.databaseEntityToConfigRestModel(null, GlobalEmailConfigRestModel.class);
    assertNull(transformedConfigRestModel);
    assertNull(transformedConfigEntity);
    transformedConfigEntity = objectTransformer.configRestModelToDatabaseEntity(restGlobalEmailMockUtil.createGlobalRestModel(), null);
    transformedConfigRestModel = objectTransformer.databaseEntityToConfigRestModel(mockEmailGlobalEntity.createGlobalEntity(), null);
    assertNull(transformedConfigRestModel);
    assertNull(transformedConfigEntity);
    transformedConfigEntity = objectTransformer.configRestModelToDatabaseEntity(null, null);
    transformedConfigRestModel = objectTransformer.databaseEntityToConfigRestModel(null, null);
    assertNull(transformedConfigRestModel);
    assertNull(transformedConfigEntity);
}
Also used : GlobalEmailConfigEntity(com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity) MockEmailGlobalRestModel(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel) MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity) GlobalEmailConfigRestModel(com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel) Test(org.junit.Test)

Example 2 with GlobalEmailConfigRestModel

use of com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel in project hub-alert by blackducksoftware.

the class ObjectTransformerTest method testTransformListsOfModels.

@Test
public void testTransformListsOfModels() throws Exception {
    final MockEmailGlobalRestModel restGlobalEmailMockUtil = new MockEmailGlobalRestModel();
    final MockEmailGlobalEntity mockEmailGlobalEntity = new MockEmailGlobalEntity();
    final ObjectTransformer objectTransformer = new ObjectTransformer();
    final GlobalEmailConfigRestModel restModel = restGlobalEmailMockUtil.createGlobalRestModel();
    final GlobalEmailConfigEntity configEntity = mockEmailGlobalEntity.createGlobalEntity();
    List<GlobalEmailConfigEntity> transformedConfigEntities = objectTransformer.configRestModelsToDatabaseEntities(Arrays.asList(restModel), GlobalEmailConfigEntity.class);
    List<GlobalEmailConfigRestModel> transformedConfigRestModels = objectTransformer.databaseEntitiesToConfigRestModels(Arrays.asList(configEntity), GlobalEmailConfigRestModel.class);
    assertNotNull(transformedConfigEntities);
    assertNotNull(transformedConfigRestModels);
    assertTrue(transformedConfigEntities.size() == 1);
    assertTrue(transformedConfigRestModels.size() == 1);
    assertEquals(restModel, transformedConfigRestModels.get(0));
    assertEquals(configEntity, transformedConfigEntities.get(0));
    transformedConfigEntities = objectTransformer.configRestModelsToDatabaseEntities(null, GlobalEmailConfigEntity.class);
    transformedConfigRestModels = objectTransformer.databaseEntitiesToConfigRestModels(null, GlobalEmailConfigRestModel.class);
}
Also used : GlobalEmailConfigEntity(com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity) MockEmailGlobalRestModel(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel) MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity) GlobalEmailConfigRestModel(com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel) Test(org.junit.Test)

Example 3 with GlobalEmailConfigRestModel

use of com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel in project hub-alert by blackducksoftware.

the class ObjectTransformerTest method testTransformEmailModels.

@Test
public void testTransformEmailModels() throws Exception {
    final MockEmailGlobalRestModel restGlobalEmailMockUtil = new MockEmailGlobalRestModel();
    final MockEmailGlobalEntity mockEmailGlobalEntity = new MockEmailGlobalEntity();
    final ObjectTransformer objectTransformer = new ObjectTransformer();
    final GlobalEmailConfigRestModel restModel = restGlobalEmailMockUtil.createGlobalRestModel();
    final GlobalEmailConfigEntity configEntity = mockEmailGlobalEntity.createGlobalEntity();
    final GlobalEmailConfigEntity transformedConfigEntity = objectTransformer.configRestModelToDatabaseEntity(restModel, GlobalEmailConfigEntity.class);
    final GlobalEmailConfigRestModel transformedConfigRestModel = objectTransformer.databaseEntityToConfigRestModel(configEntity, GlobalEmailConfigRestModel.class);
    assertEquals(restModel, transformedConfigRestModel);
    assertEquals(configEntity, transformedConfigEntity);
}
Also used : GlobalEmailConfigEntity(com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity) MockEmailGlobalRestModel(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel) MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity) GlobalEmailConfigRestModel(com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel) Test(org.junit.Test)

Aggregations

GlobalEmailConfigRestModel (com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel)3 MockEmailGlobalEntity (com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity)3 MockEmailGlobalRestModel (com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel)3 GlobalEmailConfigEntity (com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity)3 Test (org.junit.Test)3