Search in sources :

Example 1 with MockEmailGlobalEntity

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);
}
Also used : GlobalEmailConfigEntity(com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity) EmailGroupChannel(com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel) MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity) GlobalEmailRepositoryWrapper(com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailRepositoryWrapper) Test(org.junit.Test)

Example 2 with MockEmailGlobalEntity

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();
}
Also used : MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity)

Example 3 with MockEmailGlobalEntity

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();
}
Also used : MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity)

Example 4 with MockEmailGlobalEntity

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);
}
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 5 with MockEmailGlobalEntity

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());
}
Also used : MockEmailGlobalEntity(com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity) Test(org.junit.Test)

Aggregations

MockEmailGlobalEntity (com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity)7 Test (org.junit.Test)5 GlobalEmailConfigEntity (com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity)4 GlobalEmailConfigRestModel (com.blackducksoftware.integration.hub.alert.channel.email.controller.global.GlobalEmailConfigRestModel)3 MockEmailGlobalRestModel (com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalRestModel)3 EmailGroupChannel (com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel)1 GlobalEmailRepositoryWrapper (com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailRepositoryWrapper)1