Skip to content

Commit ed0156f

Browse files
Ajit GeorgeAjit George
authored andcommitted
Changes done after review.
1 parent 92a1e91 commit ed0156f

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

test-complete/src/test/java/com/marklogic/client/functionaltest/TestPOJOReadWrite1.java

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public class TestPOJOReadWrite1 extends BasicJavaClientREST {
5454
Calendar calOne = null;
5555
Calendar calTwo = null;
5656

57-
Date dateOne = null;
58-
Date dateTwo = null;
5957
/*
6058
* @Id annotation on String type
6159
*/
@@ -193,11 +191,11 @@ public Artifact getArtifact(int counter) {
193191
return cogs;
194192
}
195193

196-
public void validateArtifact(Artifact art) {
197-
assertNotNull("Artifact object should never be Null",art);
198-
assertNotNull("Id should never be Null",art.id);
199-
assertTrue("Inventry is always greater than 1000", art.getInventory()>1000);
200-
}
194+
public void validateArtifact(Artifact art) {
195+
assertNotNull("Artifact object should never be Null",art);
196+
assertNotNull("Id should never be Null",art.id);
197+
assertTrue("Inventry is always greater than 1000", art.getInventory()>1000);
198+
}
201199

202200
//This test is to persist a simple design model objects in ML, read from ML, delete all
203201
@Test
@@ -215,7 +213,7 @@ public void testPOJOWrite() {
215213
this.validateArtifact(products.read(i));
216214
}
217215
products.deleteAll();
218-
for(long i=1;i<112;i++){
216+
for(long i=1;i<112;i++) {
219217
assertFalse("Product id exists ?",products.exists(i));
220218
}
221219
}
@@ -246,7 +244,7 @@ public void testPOJOWriteWithCollection() {
246244
//Load more than 110 objects into different collections
247245
products.deleteAll();
248246
for(int i=112;i<222;i++) {
249-
if(i%2==0) {
247+
if (i%2 == 0) {
250248
products.write(this.getArtifact(i),"even","numbers");
251249
}
252250
else {
@@ -280,11 +278,11 @@ public void testPOJOWriteWithPojoPage() {
280278
PojoRepository<Artifact,Long> products = client.newPojoRepository(Artifact.class, Long.class);
281279
//Load more than 110 objects into different collections
282280
products.deleteAll();
283-
Long[] ids= new Long[112];
281+
Long[] ids = new Long[112];
284282
int j=0;
285283
for(int i=222;i<333;i++) {
286-
ids[j] =(long) i;j++;
287-
if(i%2==0) {
284+
ids[j] = (long) i;j++;
285+
if (i%2 == 0) {
288286
products.write(this.getArtifact(i),"even","numbers");
289287
}
290288
else {
@@ -299,7 +297,7 @@ public void testPOJOWriteWithPojoPage() {
299297
System.out.println("Default Page length setting on docMgr :"+products.getPageLength());
300298
assertEquals("Default setting for page length",50,products.getPageLength());
301299

302-
PojoPage<Artifact> p= products.read(ids);
300+
PojoPage<Artifact> p = products.read(ids);
303301
// test for page methods
304302
System.out.println("Total number of estimated results:"+p.getTotalSize()+ids.length);
305303
System.out.println("Total number of estimated pages :"+p.getTotalPages());
@@ -323,7 +321,7 @@ public void testPOJOWriteWithPojoPageReadAll() {
323321
//Load more than 110 objects into different collections
324322
products.deleteAll();
325323
for(int i=222;i<333;i++) {
326-
if(i%2==0) {
324+
if (i%2 == 0) {
327325
products.write(this.getArtifact(i),"even","numbers");
328326
}
329327
else {
@@ -357,9 +355,9 @@ public void testPOJOWriteWithPojoPageReadAll() {
357355
long pageNo=1,count=0;
358356
do {
359357
count=0;
360-
p= products.readAll(pageNo);
358+
p = products.readAll(pageNo);
361359

362-
if(pageNo >1) {
360+
if (pageNo >1) {
363361
assertFalse("Is this first Page", p.isFirstPage());
364362
assertTrue("Is page has previous page ?",p.hasPreviousPage());
365363
}
@@ -371,7 +369,7 @@ public void testPOJOWriteWithPojoPageReadAll() {
371369
assertEquals("document count", p.size(),count);
372370

373371
pageNo = pageNo + p.getPageSize();
374-
}while(!(p.isLastPage()) && pageNo < p.getTotalSize());
372+
} while(!(p.isLastPage()) && pageNo < p.getTotalSize());
375373
assertTrue("page count is 111 ",pageNo == p.getTotalPages());
376374
assertTrue("Page has previous page ?",p.hasPreviousPage());
377375
assertEquals("page size", 1,p.getPageSize());
@@ -462,7 +460,7 @@ public void testPOJORangeQueryOnCalendar() throws Exception {
462460
count++;
463461
}
464462
assertEquals("Page size",count, p.size());
465-
pageNo=pageNo+p.getPageSize();
463+
pageNo = pageNo+p.getPageSize();
466464
} while(!p.isLastPage() && pageNo<=p.getTotalSize());
467465
assertEquals("page number after the loop", 1, p.getPageNumber());
468466
assertEquals("total no of pages", 1, p.getTotalPages());
@@ -484,12 +482,12 @@ public void testPOJORangeQueryOnCalendar() throws Exception {
484482

485483
if (a.getId() == 97) {
486484
assertTrue("Expiry date incorrect",a.getExpiryDate().getTime().equals(calTwo.getTime()));
487-
assertTrue("Expiry date incorrect", a.getInventory() == 1097);
488-
assertTrue("Expiry date incorrect", a.getName().equalsIgnoreCase("Cogs special 97"));
489-
assertTrue("Expiry date incorrect", a.getManufacturer().getLatitude() == 138.998);
490-
assertTrue("Expiry date incorrect", a.getManufacturer().getLongitude() == 9.03400000000001);
491-
assertTrue("Expiry date incorrect", a.getManufacturer().getName().equalsIgnoreCase("Acme special, Inc."));
492-
assertTrue("Expiry date incorrect", a.getManufacturer().getWebsite().equalsIgnoreCase("http://www.acme special.com"));
485+
assertTrue("Artifact inventory incorrect", a.getInventory() == 1097);
486+
assertTrue("Artifact name incorrect", a.getName().equalsIgnoreCase("Cogs special 97"));
487+
assertTrue("Artifact manufacturer latitude incorrect", a.getManufacturer().getLatitude() == 138.998);
488+
assertTrue("Artifact manufacturer longitude incorrect", a.getManufacturer().getLongitude() == 9.03400000000001);
489+
assertTrue("Artifact manufacturer name incorrect", a.getManufacturer().getName().equalsIgnoreCase("Acme special, Inc."));
490+
assertTrue("Artifact website incorrect incorrect", a.getManufacturer().getWebsite().equalsIgnoreCase("http://www.acme special.com"));
493491

494492
bFound = true;
495493
}
@@ -499,9 +497,9 @@ public void testPOJORangeQueryOnCalendar() throws Exception {
499497
if (!bFound) {
500498
fail("Range Query on Calendar type failed when greater than or equal used.");
501499
}
502-
assertEquals("Number of rows returned count should be 14", count, 14);
500+
assertEquals("Number of rows returned count should be 14", 14, count);
503501
assertEquals("Page size",count, p.size());
504-
pageNo=pageNo+p.getPageSize();
502+
pageNo = pageNo+p.getPageSize();
505503
} while(!p.isLastPage() && pageNo<=p.getTotalSize());
506504
assertEquals("page number after the loop", 1, p.getPageNumber());
507505
assertEquals("total no of pages", 1, p.getTotalPages());
@@ -527,17 +525,17 @@ public void testPOJORangeQueryOnCalendar() throws Exception {
527525
count++;
528526
}
529527

530-
assertEquals("Number of rows returned count should be 13", count, 13);
528+
assertEquals("Number of rows returned count should be 13", 13, count);
531529
assertEquals("Page size",count, p.size());
532-
pageNo=pageNo+p.getPageSize();
530+
pageNo = pageNo+p.getPageSize();
533531
} while(!p.isLastPage() && pageNo<=p.getTotalSize());
534532
assertEquals("page number after the loop", 1, p.getPageNumber());
535533
assertEquals("total no of pages", 1, p.getTotalPages());
536534
}
537535

538536
public void loadSimplePojos(PojoRepository rangeQueryRepos) {
539537
for(int i=1;i<111;i++) {
540-
if(i%2==0) {
538+
if (i%2 == 0) {
541539
rangeQueryRepos.write(this.getArtifactIndexedOnCalendar(i),"even","numbers");
542540
}
543541
else {
@@ -559,7 +557,7 @@ public ArtifactIndexedOnCalendar getArtifactIndexedOnCalendar(int counter) {
559557
// there will be difference on times between client and ML server values.
560558
Calendar expiryDate = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
561559

562-
if( counter % 57 == 0) {
560+
if (counter % 57 == 0) {
563561
calOne = expiryDate;
564562

565563
Company acme = new Company();
@@ -571,7 +569,7 @@ public ArtifactIndexedOnCalendar getArtifactIndexedOnCalendar(int counter) {
571569
cogs.setExpiryDate(expiryDate);
572570
cogs.setName("Cogs special 57");
573571
}
574-
else if( counter % 97 == 0) {
572+
else if (counter % 97 == 0) {
575573
calTwo = expiryDate;
576574

577575
Company acme = new Company();

0 commit comments

Comments
 (0)