use of com.synopsys.integration.alert.database.api.mock.MockCustomCertificateRepository in project hub-alert by blackducksoftware.
the class DefaultCustomCertificateAccessorTest method storeCertificateIdDoesNotExistTest.
@Test
public void storeCertificateIdDoesNotExistTest() {
CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository();
DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository);
try {
CustomCertificateModel certificateModel = new CustomCertificateModel(9L, alias, content, testDate.toString());
customCertificateAccessor.storeCertificate(certificateModel);
fail();
} catch (AlertConfigurationException e) {
assertNotNull(e);
}
}
use of com.synopsys.integration.alert.database.api.mock.MockCustomCertificateRepository in project hub-alert by blackducksoftware.
the class DefaultCustomCertificateAccessorTest method getCertificatesTest.
@Test
public void getCertificatesTest() {
CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate);
DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository);
List<CustomCertificateModel> customCertificateModelList = customCertificateAccessor.getCertificates();
assertEquals(1, customCertificateModelList.size());
CustomCertificateModel customCertificateModel = customCertificateModelList.get(0);
testCustomCertificateModel(expectedCustomCertificateModel, customCertificateModel);
}
use of com.synopsys.integration.alert.database.api.mock.MockCustomCertificateRepository in project hub-alert by blackducksoftware.
the class DefaultCustomCertificateAccessorTest method getCertificateTest.
@Test
public void getCertificateTest() {
CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate);
DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository);
Optional<CustomCertificateModel> customCertificateModelOptional = customCertificateAccessor.getCertificate(0L);
Optional<CustomCertificateModel> customCertificateModelOptionalEmpty = customCertificateAccessor.getCertificate(9L);
assertTrue(customCertificateModelOptional.isPresent());
assertFalse(customCertificateModelOptionalEmpty.isPresent());
CustomCertificateModel customCertificateModel = customCertificateModelOptional.get();
testCustomCertificateModel(expectedCustomCertificateModel, customCertificateModel);
}
use of com.synopsys.integration.alert.database.api.mock.MockCustomCertificateRepository in project hub-alert by blackducksoftware.
the class DefaultCustomCertificateAccessorTest method deleteCertificateByIdTest.
@Test
public void deleteCertificateByIdTest() {
CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate);
DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository);
List<CustomCertificateModel> customCertificateModelList = customCertificateAccessor.getCertificates();
assertEquals(1, customCertificateModelList.size());
CustomCertificateModel customCertificateModel = customCertificateModelList.get(0);
testCustomCertificateModel(expectedCustomCertificateModel, customCertificateModel);
customCertificateAccessor.deleteCertificate(0L);
customCertificateModelList = customCertificateAccessor.getCertificates();
assertTrue(customCertificateModelList.isEmpty());
}
use of com.synopsys.integration.alert.database.api.mock.MockCustomCertificateRepository in project hub-alert by blackducksoftware.
the class DefaultCustomCertificateAccessorTest method deleteCertificateByAliasTest.
@Test
public void deleteCertificateByAliasTest() {
CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate);
DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository);
List<CustomCertificateModel> customCertificateModelList = customCertificateAccessor.getCertificates();
assertEquals(1, customCertificateModelList.size());
CustomCertificateModel customCertificateModel = customCertificateModelList.get(0);
testCustomCertificateModel(expectedCustomCertificateModel, customCertificateModel);
customCertificateAccessor.deleteCertificate(alias);
customCertificateModelList = customCertificateAccessor.getCertificates();
assertTrue(customCertificateModelList.isEmpty());
}
Aggregations