Search in sources :

Example 1 with MockGlobalHubEntity

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());
}
Also used : GlobalHubConfigRestModel(com.blackducksoftware.integration.hub.alert.hub.controller.global.GlobalHubConfigRestModel) MockGlobalHubRestModel(com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubRestModel) MockGlobalHubEntity(com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubEntity) GlobalHubConfigEntity(com.blackducksoftware.integration.hub.alert.datasource.entity.global.GlobalHubConfigEntity) Test(org.junit.Test)

Example 2 with MockGlobalHubEntity

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

Example 3 with MockGlobalHubEntity

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

Aggregations

MockGlobalHubEntity (com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubEntity)3 GlobalHubConfigEntity (com.blackducksoftware.integration.hub.alert.datasource.entity.global.GlobalHubConfigEntity)1 GlobalHubConfigRestModel (com.blackducksoftware.integration.hub.alert.hub.controller.global.GlobalHubConfigRestModel)1 MockGlobalHubRestModel (com.blackducksoftware.integration.hub.alert.hub.mock.MockGlobalHubRestModel)1 Test (org.junit.Test)1