use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity in project hub-alert by blackducksoftware.
the class DistributionChannelTest method getGlobalConfigEntityTest.
@Test
public void getGlobalConfigEntityTest() {
final GlobalEmailRepositoryWrapper globalEmailRepositoryWrapper = Mockito.mock(GlobalEmailRepositoryWrapper.class);
final EmailGroupChannel channel = new EmailGroupChannel(null, null, null, globalEmailRepositoryWrapper, null, null);
final MockEmailGlobalEntity mockEntity = new MockEmailGlobalEntity();
final GlobalEmailConfigEntity entity = mockEntity.createGlobalEntity();
Mockito.when(globalEmailRepositoryWrapper.findAll()).thenReturn(Arrays.asList(entity));
final GlobalEmailConfigEntity globalEntity = channel.getGlobalConfigEntity();
assertEquals(entity, globalEntity);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity in project hub-alert by blackducksoftware.
the class GlobalEmailRepositoryWrapperTest method encryptedEntity.
@Override
public GlobalEmailConfigEntity encryptedEntity() throws EncryptionException {
final MockEmailGlobalEntity mockEmailGlobalEntity = new MockEmailGlobalEntity();
mockEmailGlobalEntity.setMailSmtpPassword(PasswordEncrypter.encrypt(mockEmailGlobalEntity.getMailSmtpPassword()));
return mockEmailGlobalEntity.createGlobalEntity();
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity in project hub-alert by blackducksoftware.
the class GlobalEmailRepositoryWrapperTest method getEntityToDecrypt.
@Override
public GlobalEmailConfigEntity getEntityToDecrypt() throws EncryptionException {
final MockEmailGlobalEntity mockEmailGlobalEntity = new MockEmailGlobalEntity();
final String encryptedPassword = PasswordEncrypter.encrypt(mockEmailGlobalEntity.getMailSmtpPassword());
mockEmailGlobalEntity.setMailSmtpPassword(encryptedPassword);
return mockEmailGlobalEntity.createGlobalEntity();
}
use of com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity 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.MockEmailGlobalEntity in project hub-alert by blackducksoftware.
the class EmailPropertyTest method testProperties.
@Test
public void testProperties() {
final MockEmailGlobalEntity emailGlobalEntity = new MockEmailGlobalEntity();
final EmailProperties emailProperties = new EmailProperties(emailGlobalEntity.createGlobalEntity());
assertEquals(emailGlobalEntity.getMailSmtpPassword(), emailProperties.getMailSmtpPassword());
}
Aggregations