use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel in project hub-alert by blackducksoftware.
the class GlobalEmailConfigActionsTest method testInvalidConfig.
@Override
public void testInvalidConfig() {
final MockEmailGlobalRestModel mockUtil = new MockEmailGlobalRestModel();
mockUtil.setMailSmtpPort("qq");
mockUtil.setMailSmtpConnectionTimeout("qq");
mockUtil.setMailSmtpTimeout("qq");
mockUtil.setMailSmtpEhlo(false);
mockUtil.setMailSmtpAuth(true);
mockUtil.setMailSmtpAllow8bitmime(false);
mockUtil.setMailSmtpSendPartial(false);
final GlobalEmailConfigRestModel restModel = mockUtil.createGlobalRestModel();
String result = null;
try {
result = configActions.validateConfig(restModel);
fail();
} catch (final AlertFieldException e) {
assertTrue(true);
}
assertNull(result);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel 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);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel 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);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel 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);
}
Aggregations