Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Santhosh Gandhe <[email protected]>
  • Loading branch information
san81 committed Jan 27, 2025
1 parent 3d7e2f0 commit e2fd7be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Map<String, Object> getKeyAttributes() {
@Override
public Instant getLastModifiedAt() {
long updatedAtMillis = getMetadataField(Constants.UPDATED);
long createdAtMillis = getMetadataField(CREATED);
long createdAtMillis = getMetadataField(Constants.CREATED);
return createdAtMillis > updatedAtMillis ?
Instant.ofEpochMilli(createdAtMillis) : Instant.ofEpochMilli(updatedAtMillis);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.opensearch.dataprepper.plugins.source.jira.utils.Constants;

import java.time.Instant;
import java.util.Map;
Expand Down Expand Up @@ -95,12 +96,12 @@ void testGetPartitionKey() {

@Test
void testGetLastModifiedAt() {
when(metadata.getOrDefault("updated", "0")).thenReturn("5");
when(metadata.getOrDefault("created", "0")).thenReturn("0");
when(metadata.get(Constants.UPDATED)).thenReturn("5");
when(metadata.get(Constants.CREATED)).thenReturn("0");
assertEquals(Instant.ofEpochMilli(5), jiraItemInfo.getLastModifiedAt());

when(metadata.getOrDefault("updated", "0")).thenReturn("5");
when(metadata.getOrDefault("created", "0")).thenReturn("7");
when(metadata.get(Constants.UPDATED)).thenReturn("5");
when(metadata.get(Constants.CREATED)).thenReturn("7");
assertEquals(Instant.ofEpochMilli(7), jiraItemInfo.getLastModifiedAt());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
@ExtendWith(MockitoExtension.class)
public class CrawlerTest {
private static final int DEFAULT_BATCH_SIZE = 50;
Instant lastPollTime = Instant.ofEpochMilli(0);
@Mock
private AcknowledgementSet acknowledgementSet;
@Mock
Expand All @@ -50,6 +49,7 @@ public class CrawlerTest {
@Mock
private LeaderPartition leaderPartition;
private Crawler crawler;
private final Instant lastPollTime = Instant.ofEpochMilli(0);

@BeforeEach
public void setup() {
Expand Down

0 comments on commit e2fd7be

Please sign in to comment.