Skip to content

Commit

Permalink
Modified solrObject tests to only compare keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tdl-jturner committed Aug 19, 2019
1 parent 5bdc7ba commit c6dc61a
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ protected void waitForSolrIndex(E obj){
}
}

//As Solr Object parses out some fields, only search for a matching key
private Boolean containsObjectKey(List<E> objList, E obj) {
for(E e : objList) {
if(e.keys().equals(obj.keys())) return true;
}
return false;
}

private E prepCache() {
E obj = prepObject();
E cachedObject;
Expand Down Expand Up @@ -420,7 +428,7 @@ public void testEqualsWithBadObject() {
}

@Test
public void testGetAllBySolrQuery() throws InterruptedException {
public void testGetAllBySolrQuery() {

E obj = prepObject();

Expand All @@ -439,7 +447,7 @@ public void testGetAllBySolrQuery() throws InterruptedException {
}

@Test
public void testGetCountBySolrQuery() throws InterruptedException {
public void testGetCountBySolrQuery() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR)) {
Expand All @@ -455,7 +463,7 @@ public void testGetCountBySolrQuery() throws InterruptedException {
}

@Test
public void testGetAllBySolrQueryWithOptions() throws InterruptedException {
public void testGetAllBySolrQueryWithOptions() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR)) {
Expand All @@ -473,7 +481,7 @@ public void testGetAllBySolrQueryWithOptions() throws InterruptedException {


@Test
public void testGetCountBySolrQueryWithOptions() throws InterruptedException {
public void testGetCountBySolrQueryWithOptions() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR)) {
Expand All @@ -489,7 +497,7 @@ public void testGetCountBySolrQueryWithOptions() throws InterruptedException {
}

@Test
public void testGetAllBySolrObject() throws InterruptedException {
public void testGetAllBySolrObject() {

E obj = prepObject();

Expand All @@ -498,7 +506,7 @@ public void testGetAllBySolrObject() throws InterruptedException {
List<E> tstObj = this.getCasquatchDao().getAllBySolr(this.entityClass, obj);
assertNotNull(tstObj);
assert(tstObj.size()>0);
assert(tstObj.contains(obj));
assert(containsObjectKey(tstObj,obj));
}
else {
assertThrows(DriverException.class, () -> this.getCasquatchDao().getAllBySolr(this.entityClass, obj));
Expand All @@ -508,7 +516,7 @@ public void testGetAllBySolrObject() throws InterruptedException {
}

@Test
public void testGetCountBySolrObject() throws InterruptedException {
public void testGetCountBySolrObject() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR_OBJECT)) {
Expand All @@ -524,15 +532,15 @@ public void testGetCountBySolrObject() throws InterruptedException {
}

@Test
public void testGetAllBySolrObjectWithOptions() throws InterruptedException {
public void testGetAllBySolrObjectWithOptions() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR_OBJECT)) {
waitForSolrIndex(obj);
List<E> tstObj = this.getCasquatchDao().getAllBySolr(this.entityClass,obj,queryOptions.withConsistencyLevel("LOCAL_ONE").withAllColumns());
assertNotNull(tstObj);
assert(tstObj.size()>0);
assert(tstObj.contains(obj));
assert(containsObjectKey(tstObj,obj));
}
else {
assertThrows(DriverException.class, () -> this.getCasquatchDao().getAllBySolr(this.entityClass, obj));
Expand All @@ -542,7 +550,7 @@ public void testGetAllBySolrObjectWithOptions() throws InterruptedException {


@Test
public void testGetCountBySolrObjectWithOptions() throws InterruptedException {
public void testGetCountBySolrObjectWithOptions() {
E obj = prepObject();

if(getCasquatchDao().checkFeature(CasquatchDao.FEATURES.SOLR_OBJECT)) {
Expand Down

0 comments on commit c6dc61a

Please sign in to comment.