Search in sources :

Example 1 with UpdateModel

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

the class UpdateCheckerTest method testAlertIsOlderSnapshot.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsOlderSnapshot(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", 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 2 with UpdateModel

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

the class UpdateCheckerTest method testAlertIsNewerSnapshotPatch.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsNewerSnapshotPatch(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0.1-" + versionSuffix, null, "1.0.0", 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 3 with UpdateModel

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

the class UpdateCheckerTest method testAlertIsNewerButCloseSnapshot.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsNewerButCloseSnapshot(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", 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 4 with UpdateModel

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

the class UpdateCheckerTest method testAlertIsOlderButCloseDockerSnapshot.

@ParameterizedTest
@ValueSource(strings = { SUFFIX_SNAPSHOT, SUFFIX_SIGQA_1, SUFFIX_OTHER_TEXT })
public void testAlertIsOlderButCloseDockerSnapshot(String versionSuffix) {
    UpdateChecker updateChecker = getEmptyUpdateChecker();
    OffsetDateTime alertTime = DateUtils.createCurrentDateTimestamp();
    OffsetDateTime dockerTagDate = alertTime.plusMinutes(20);
    UpdateModel updateModel = updateChecker.getUpdateModel("1.0.0", 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 5 with UpdateModel

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

the class UpdateCheckerTest method testAlertIsNewerPatch.

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

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