@Test public void testJobIdOrdering() { String job1 = "job_20120101000000_0001"; String job2 = "job_20120101000000_1111"; String job3 = "job_20120101000000_2222"; String job4 = "job_20120101000000_11111"; String job5 = "job_20120201000000_0001"; JobId jobId1 = new JobId(job1); JobId jobId2 = new JobId(job2); JobId jobId3 = new JobId(job3); JobId jobId4 = new JobId(job4); JobId jobId5 = new JobId(job5); JobIdConverter conv = new JobIdConverter(); byte[] job1Bytes = conv.toBytes(jobId1); byte[] job2Bytes = conv.toBytes(jobId2); byte[] job3Bytes = conv.toBytes(jobId3); byte[] job4Bytes = conv.toBytes(jobId4); byte[] job5Bytes = conv.toBytes(jobId5); assertTrue(Bytes.compareTo(job1Bytes, job2Bytes) < 0); assertTrue(Bytes.compareTo(job2Bytes, job3Bytes) < 0); assertTrue(Bytes.compareTo(job3Bytes, job4Bytes) < 0); assertTrue(Bytes.compareTo(job4Bytes, job5Bytes) < 0); }
@Override public int compareTo(JobId o) { if (o == null) { return -1; } return new CompareToBuilder() .append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()) .toComparison(); }
JobId implements Comparable<JobId> { @Override public int compareTo(JobId o) { if (o == null) { return -1; } return new CompareToBuilder() .append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()) .toComparison(); } }
JobId implements Comparable<JobId> { @Override public int compareTo(JobId o) { if (o == null) { return -1; } return new CompareToBuilder() .append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()) .toComparison(); } @JsonCreator  JobId(@JsonProperty("jobIdString") String jobId);  JobId(long epoch, long seq);  JobId(JobId idToCopy); }
JobId implements Comparable<JobId> { @Override public int compareTo(JobId o) { if (o == null) { return -1; } return new CompareToBuilder() .append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()) .toComparison(); } @JsonCreator  JobId(@JsonProperty("jobIdString") String jobId);  JobId(long epoch, long seq);  JobId(JobId idToCopy); long getJobEpoch(); long getJobSequence(); String getJobIdString(); String toString(); @Override int compareTo(JobId o); @Override boolean equals(Object other); @Override int hashCode(); }
JobId implements Comparable<JobId> { @Override public int compareTo(JobId o) { if (o == null) { return -1; } return new CompareToBuilder() .append(this.jobEpoch, o.getJobEpoch()) .append(this.jobSequence, o.getJobSequence()) .toComparison(); } @JsonCreator  JobId(@JsonProperty("jobIdString") String jobId);  JobId(long epoch, long seq);  JobId(JobId idToCopy); long getJobEpoch(); long getJobSequence(); String getJobIdString(); String toString(); @Override int compareTo(JobId o); @Override boolean equals(Object other); @Override int hashCode();  }