Lines Matching defs:csn1
117 public void csnHashCode(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
119 assertEquals(csn1.hashCode(), csn2.hashCode());
124 public void csnEquals(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
126 assertFalse(csn1.equals(new Object()));
127 assertEquals(csn1, csn1);
128 assertEquals(csn1, csn2);
129 assertFalse(csn1.equals(csn3));
130 assertFalse(csn1.equals(csn4));
131 assertFalse(csn1.equals(csn5));
136 public void csnGetTimeSec(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
139 assertEquals(csn1.getTime()/1000, csn1.getTimeSec());
148 public void csnCompare(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
152 assertTrue(CSN.compare(csn1, null) > 0);
153 assertTrue(CSN.compare(csn1, csn2) == 0);
154 assertTrue(CSN.compare(csn1, csn3) < 0);
155 assertTrue(CSN.compare(csn3, csn1) > 0);
156 assertTrue(CSN.compare(csn1, csn4) < 0);
157 assertTrue(CSN.compare(csn4, csn1) > 0);
158 assertTrue(CSN.compare(csn1, csn5) < 0);
159 assertTrue(CSN.compare(csn5, csn1) > 0);
164 public void csnOlder(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
166 assertFalse(csn1.isOlderThan(null));
167 assertFalse(csn1.isOlderThan(csn1));
168 assertTrue(csn1.isOlderThan(csn3));
169 assertTrue(csn1.isOlderThan(csn4));
170 assertTrue(csn1.isOlderThan(csn5));
175 public void csnOlderOrEqual(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
177 assertFalse(csn1.isOlderThanOrEqualTo(null));
178 assertTrue(csn1.isOlderThanOrEqualTo(csn1));
179 assertTrue(csn1.isOlderThanOrEqualTo(csn3));
180 assertTrue(csn1.isOlderThanOrEqualTo(csn4));
181 assertTrue(csn1.isOlderThanOrEqualTo(csn5));
186 public void csnNewer(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
188 assertTrue(csn1.isNewerThan(null));
189 assertFalse(csn1.isNewerThan(csn1));
190 assertFalse(csn1.isNewerThan(csn3));
191 assertFalse(csn1.isNewerThan(csn4));
192 assertFalse(csn1.isNewerThan(csn5));
197 public void csnNewerOrEquals(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception
199 assertTrue(csn1.isNewerThanOrEqualTo(null));
200 assertTrue(csn1.isNewerThanOrEqualTo(csn1));
201 assertFalse(csn1.isNewerThanOrEqualTo(csn3));
202 assertFalse(csn1.isNewerThanOrEqualTo(csn4));
203 assertFalse(csn1.isNewerThanOrEqualTo(csn5));
218 CSN csn1;
225 csn1 = csng.newCSN();
227 assertTrue(csn1.compareTo(csn2) != 0);
233 assertTrue(csn1.compareTo(csn2) != 0);
239 assertTrue(csn1.compareTo(csn2) != 0);
242 csng.adjust(csn1);
244 assertTrue(csn1.compareTo(csn2) != 0 );
248 csn1 = csn2;
250 assertTrue(csn1.compareTo(csn2) != 0 );
253 csn1 = new CSN(csn2.getTime() +300 ,csn2.getSeqnum(), csn2.getServerId());
254 csng.adjust(csn1);
256 assertTrue(csn1.compareTo(csn2) != 0 );
259 csn1 = new CSN(csn2.getTime() ,csn2.getSeqnum() +10, csn2.getServerId());
260 csng.adjust(csn1);
262 assertTrue(csn1.compareTo(csn2) != 0 );
265 csn1 = new CSN(csn2.getTime() ,0XFFFF +10,csn2.getServerId());
266 csng.adjust(csn1);
268 assertTrue(csn1.compareTo(csn2) != 0 );
277 CSN csn1;
280 csn1 = new CSN(0, 3, 0);
284 assertEquals(CSN.diffSeqNum(csn1, csn2), 3);
288 assertEquals(CSN.diffSeqNum(csn1, csn2), 2);
292 assertEquals(CSN.diffSeqNum(csn1, csn2), 0);
294 // 3-4 = 0 (csn1 must be newer otherwise 0 should be returned)
296 assertEquals(CSN.diffSeqNum(csn1, csn2), 0);
298 csn1 = new CSN(0, 0, 0);
302 assertEquals(CSN.diffSeqNum(csn1, csn2), 0);
304 // 0-1 = 0 (csn1 must be newer otherwise 0 should be returned)
306 assertEquals(CSN.diffSeqNum(csn1, csn2), 0);
308 csn1 = new CSN(0, 5, 0);
312 assertEquals(CSN.diffSeqNum(csn1, null), 5);
320 csn1 = new CSN(1111111, 2, 0);
323 // csn1 older than csn2 -> 0
324 assertEquals(CSN.diffSeqNum(csn1, csn2), 0);
326 csn1 = new CSN(3333333, 1, 0);
329 // csn1 seqnum looped
330 assertEquals(CSN.diffSeqNum(csn1, csn2), 3);
343 for (Object csn1 : allCSNs)
349 * reflexive, and it is also ok to compare csn1 to csn2, and csn2 to
350 * csn1 to ensure operations are symmetric
352 results.add(new Object[] { csn1, csn2 });
359 public void compareToEquivalentToEquals(CSN csn1, CSN csn2) throws Exception
361 assertEquals(csn1.compareTo(csn2) == 0, csn1.equals(csn2));
365 public void hashCodesEqualWhenCSNsEqual(CSN csn1, CSN csn2) throws Exception
367 if (csn1.equals(csn2))
369 assertEquals(csn1.hashCode(), csn2.hashCode());
374 public void hashCodesEqualWhenCompareToEqual(CSN csn1, CSN csn2) throws Exception
376 if (csn1.compareTo(csn2) == 0)
378 assertEquals(csn1.hashCode(), csn2.hashCode());