Search in sources :

Example 16 with Project

use of net.nemerosa.ontrack.model.structure.Project in project ontrack by nemerosa.

the class EntityDataStoreRecordTest method compare_on_date_only.

@Test
public void compare_on_date_only() {
    Project project = Project.of(NameDescription.nd("P", ""));
    LocalDateTime now = Time.now();
    LocalDateTime t1 = now.minusDays(1);
    LocalDateTime t2 = now.minusDays(2);
    List<EntityDataStoreRecord> records = Arrays.asList(new EntityDataStoreRecord(1, project, "TEST", "N1", null, Signature.of(t1, "test"), new IntNode(10)), new EntityDataStoreRecord(2, project, "TEST", "N1", null, Signature.of(t2, "test"), new IntNode(10)));
    records.sort(Comparator.naturalOrder());
    assertTrue("Newest record is first", records.get(0).getId() == 1);
}
Also used : LocalDateTime(java.time.LocalDateTime) Project(net.nemerosa.ontrack.model.structure.Project) IntNode(com.fasterxml.jackson.databind.node.IntNode) Test(org.junit.Test)

Aggregations

Project (net.nemerosa.ontrack.model.structure.Project)16 Test (org.junit.Test)13 Branch (net.nemerosa.ontrack.model.structure.Branch)5 NameDescription (net.nemerosa.ontrack.model.structure.NameDescription)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 HttpOutputMessage (org.springframework.http.HttpOutputMessage)3 IntNode (com.fasterxml.jackson.databind.node.IntNode)2 IOException (java.io.IOException)2 LocalDateTime (java.time.LocalDateTime)2 Account (net.nemerosa.ontrack.model.security.Account)2 ID (net.nemerosa.ontrack.model.structure.ID)2 StringUtils (org.apache.commons.lang3.StringUtils)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 AccessDeniedException (org.springframework.security.access.AccessDeniedException)2 GraphQLInt (graphql.Scalars.GraphQLInt)1 GraphQLString (graphql.Scalars.GraphQLString)1 DataFetcher (graphql.schema.DataFetcher)1 GraphQLArgument.newArgument (graphql.schema.GraphQLArgument.newArgument)1 GraphQLFieldDefinition (graphql.schema.GraphQLFieldDefinition)1