use of com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubEntity in project hub-alert by blackducksoftware.
the class ObjectTransformerTest method testTransformGlobalModels.
@Test
public void testTransformGlobalModels() throws Exception {
final ObjectTransformer objectTransformer = new ObjectTransformer();
final MockGlobalHubRestModel globalHubMockUtils = new MockGlobalHubRestModel();
final MockGlobalHubEntity mockGlobalHubEntity = new MockGlobalHubEntity();
final GlobalHubConfigRestModel restModel = globalHubMockUtils.createGlobalRestModel();
final GlobalHubConfigEntity configEntity = mockGlobalHubEntity.createGlobalEntity();
final GlobalHubConfigEntity transformedConfigEntity = objectTransformer.configRestModelToDatabaseEntity(restModel, GlobalHubConfigEntity.class);
final GlobalHubConfigRestModel transformedConfigRestModel = objectTransformer.databaseEntityToConfigRestModel(configEntity, GlobalHubConfigRestModel.class);
assertNull(transformedConfigRestModel.getHubAlwaysTrustCertificate());
assertEquals(restModel.getHubApiKey(), transformedConfigRestModel.getHubApiKey());
assertNull(transformedConfigRestModel.getHubProxyHost());
assertNull(transformedConfigRestModel.getHubProxyPassword());
assertNull(transformedConfigRestModel.getHubProxyPort());
assertNull(transformedConfigRestModel.getHubProxyUsername());
assertEquals(restModel.getHubTimeout(), transformedConfigRestModel.getHubTimeout());
assertNull(transformedConfigRestModel.getHubUrl());
assertEquals(restModel.getId(), transformedConfigRestModel.getId());
assertEquals(configEntity.getHubApiKey(), transformedConfigEntity.getHubApiKey());
assertEquals(configEntity.getHubTimeout(), transformedConfigEntity.getHubTimeout());
assertEquals(configEntity.getId(), transformedConfigEntity.getId());
}
use of com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubEntity in project hub-alert by blackducksoftware.
the class GlobalHubRepositoryWrapperTest method getEntityToDecrypt.
@Override
public GlobalHubConfigEntity getEntityToDecrypt() throws EncryptionException {
final MockGlobalHubEntity mockGlobalHubEntity = new MockGlobalHubEntity();
final String encryptedApiKey = PasswordEncrypter.encrypt(mockGlobalHubEntity.getHubApiKey());
mockGlobalHubEntity.setHubApiKey(encryptedApiKey);
return mockGlobalHubEntity.createGlobalEntity();
}
use of com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubEntity in project hub-alert by blackducksoftware.
the class GlobalHubRepositoryWrapperTest method encryptedEntity.
@Override
public GlobalHubConfigEntity encryptedEntity() throws EncryptionException {
final MockGlobalHubEntity mockGlobalHubEntity = new MockGlobalHubEntity();
mockGlobalHubEntity.setHubApiKey(PasswordEncrypter.encrypt(mockGlobalHubEntity.getHubApiKey()));
return mockGlobalHubEntity.createGlobalEntity();
}
Aggregations