Search in sources :

Example 6 with UpdateModel

use of com.synopsys.integration.alert.update.model.UpdateModel in project hub-alert by blackducksoftware.

the class UpdateCheckerTest method testAlertIsOlderDockerPatch.

@Test
public void testAlertIsOlderDockerPatch() {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0", null, "1.0.0.1", null, null);
    assertTrue(updateModel.getUpdatable());
}
Also used : UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with UpdateModel

use of com.synopsys.integration.alert.update.model.UpdateModel in project hub-alert by blackducksoftware.

the class UpdateCheckerTest method testAlertIsNewerBothSnapshot.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsNewerBothSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, null, "0.1.0-" + versionSuffix, null, null);
    assertFalse(updateModel.getUpdatable());
}
Also used : UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with UpdateModel

use of com.synopsys.integration.alert.update.model.UpdateModel in project hub-alert by blackducksoftware.

the class UpdateCheckerTest method testAlertIsOlderSnapshotDockerPatch.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsOlderSnapshotDockerPatch(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(80);
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0.1", formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);
    assertTrue(updateModel.getUpdatable());
}
Also used : OffsetDateTime(java.time.OffsetDateTime) UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with UpdateModel

use of com.synopsys.integration.alert.update.model.UpdateModel in project hub-alert by blackducksoftware.

the class UpdateCheckerTest method testAlertIsNewerButCloseBothSnapshot.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsNewerButCloseBothSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.minusMinutes(20);
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0-" + versionSuffix, formatDate(alertTime, DOCKER_DATE_FORMAT), "1.0.0-" + versionSuffix, formatDate(dockerTagDate, DOCKER_DATE_FORMAT), null);
    assertFalse(updateModel.getUpdatable());
}
Also used : OffsetDateTime(java.time.OffsetDateTime) UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with UpdateModel

use of com.synopsys.integration.alert.update.model.UpdateModel in project hub-alert by blackducksoftware.

the class UpdateNotifierTask method runTask.

@Override
public void runTask() {
    UpdateModel updateModel = updateChecker.getUpdateModel();
    if (updateModel.getUpdatable()) {
        addSystemMessage(updateModel.getDockerTagVersion());
        updateEmailService.sendUpdateEmail(updateModel);
    }
}
Also used : UpdateModel(com.synopsys.integration.alert.update.model.UpdateModel)

Aggregations

UpdateModel (com.synopsys.integration.alert.update.model.UpdateModel)20 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)19 ValueSource (org.junit.jupiter.params.provider.ValueSource)13 OffsetDateTime (java.time.OffsetDateTime)10 Test (org.junit.jupiter.api.Test)6 AlertProperties (com.synopsys.integration.alert.common.AlertProperties)1 AlertWebServerUrlManager (com.synopsys.integration.alert.common.rest.AlertWebServerUrlManager)1 ProxyManager (com.synopsys.integration.alert.common.rest.proxy.ProxyManager)1 DefaultSystemStatusAccessor (com.synopsys.integration.alert.database.api.DefaultSystemStatusAccessor)1 TestTags (com.synopsys.integration.alert.test.common.TestTags)1 AboutReader (com.synopsys.integration.alert.web.api.about.AboutReader)1 DescriptorMetadataActions (com.synopsys.integration.alert.web.api.metadata.DescriptorMetadataActions)1 DescriptorsResponseModel (com.synopsys.integration.alert.web.api.metadata.model.DescriptorsResponseModel)1 Tags (org.junit.jupiter.api.Tags)1