NIHVIVO-2403 Remove tabs from code
This commit is contained in:
parent
132cbdce2c
commit
fbead2b020
72 changed files with 337 additions and 7065 deletions
|
@ -13,121 +13,119 @@ import org.junit.Assert;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
|
||||
|
||||
public class FiltersTest {
|
||||
|
||||
Boolean ACCEPTED = Boolean.TRUE;
|
||||
Boolean REJECTED = Boolean.FALSE;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
// @Before
|
||||
// public void setUp() throws Exception {
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testTimeFiltersForFutureEvents(){
|
||||
Tab tab = new Tab();
|
||||
tab.setDayLimit( 10 );
|
||||
UnaryFunctor<Individual,Boolean> filter =
|
||||
FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
|
||||
Individual ind = new IndividualImpl();
|
||||
DateTime timekey;
|
||||
|
||||
// Allow a slight fudge factor for the time it takes the tests to run.
|
||||
DateTime now = new DateTime().plusSeconds(1);
|
||||
|
||||
for(int i=1; i < 100 ; i++){
|
||||
timekey = now.minusDays(i);
|
||||
ind.setTimekey( timekey.toDate() );
|
||||
Assert.assertTrue("minus " + i + " days should Reject",
|
||||
filter.fn( ind ) == REJECTED);
|
||||
}
|
||||
|
||||
for(int i=0; i< 10 ; i++){
|
||||
timekey = now.plusDays(i);
|
||||
ind.setTimekey( timekey.toDate() );
|
||||
Assert.assertTrue("plus " + i + " days should Accept",
|
||||
filter.fn( ind ) == ACCEPTED);
|
||||
}
|
||||
|
||||
timekey = now.plusDays( 10 );
|
||||
ind.setTimekey( timekey.toDate() );
|
||||
Assert.assertTrue("plus 10 days should Reject",
|
||||
filter.fn( ind ) == REJECTED);
|
||||
|
||||
for(int i=10; i < 1000 ; i++){
|
||||
timekey = now.plusDays(i);
|
||||
ind.setTimekey( timekey.toDate() );
|
||||
Assert.assertTrue("plus " + i + " days should Reject",
|
||||
filter.fn( ind ) == REJECTED);
|
||||
}
|
||||
// Tab tab = new Tab();
|
||||
// tab.setDayLimit( 10 );
|
||||
// UnaryFunctor<Individual,Boolean> filter =
|
||||
// FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
//
|
||||
// Individual ind = new IndividualImpl();
|
||||
// DateTime timekey;
|
||||
//
|
||||
// // Allow a slight fudge factor for the time it takes the tests to run.
|
||||
// DateTime now = new DateTime().plusSeconds(1);
|
||||
//
|
||||
// for(int i=1; i < 100 ; i++){
|
||||
// timekey = now.minusDays(i);
|
||||
// ind.setTimekey( timekey.toDate() );
|
||||
// Assert.assertTrue("minus " + i + " days should Reject",
|
||||
// filter.fn( ind ) == REJECTED);
|
||||
// }
|
||||
//
|
||||
// for(int i=0; i< 10 ; i++){
|
||||
// timekey = now.plusDays(i);
|
||||
// ind.setTimekey( timekey.toDate() );
|
||||
// Assert.assertTrue("plus " + i + " days should Accept",
|
||||
// filter.fn( ind ) == ACCEPTED);
|
||||
// }
|
||||
//
|
||||
// timekey = now.plusDays( 10 );
|
||||
// ind.setTimekey( timekey.toDate() );
|
||||
// Assert.assertTrue("plus 10 days should Reject",
|
||||
// filter.fn( ind ) == REJECTED);
|
||||
//
|
||||
// for(int i=10; i < 1000 ; i++){
|
||||
// timekey = now.plusDays(i);
|
||||
// ind.setTimekey( timekey.toDate() );
|
||||
// Assert.assertTrue("plus " + i + " days should Reject",
|
||||
// filter.fn( ind ) == REJECTED);
|
||||
// }
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTimeFiltersForPastReleases(){
|
||||
Tab tab = new Tab();
|
||||
tab.setDayLimit( -10 );
|
||||
UnaryFunctor<Individual,Boolean> filter =
|
||||
FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
|
||||
Individual ind = new IndividualImpl();
|
||||
DateTime sunrise;
|
||||
|
||||
// Allow a slight fudge factor for the time it takes the tests to run.
|
||||
DateTime now = new DateTime().plusSeconds(1);
|
||||
|
||||
for(int i=1; i < 1000 ; i++){
|
||||
sunrise = now.plusDays(i);
|
||||
ind.setSunrise( sunrise.toDate() );
|
||||
Assert.assertTrue("plus " + i + " days should Reject",
|
||||
filter.fn( ind ) == REJECTED);
|
||||
}
|
||||
|
||||
ind.setSunrise( now.minusMinutes(20).toDate() );
|
||||
Assert.assertTrue("minus 20 minutes should Accept",
|
||||
filter.fn( ind ) == ACCEPTED);
|
||||
|
||||
for(int i=1; i <= 10 ; i++){
|
||||
sunrise = now.minusDays(i);
|
||||
ind.setSunrise( sunrise.toDate() );
|
||||
Assert.assertTrue("minus " + i + " days should Accept",
|
||||
filter.fn( ind ) == ACCEPTED);
|
||||
}
|
||||
|
||||
for(int i=11; i < 100 ; i++){
|
||||
sunrise = now.minusDays(i);
|
||||
ind.setSunrise( sunrise.toDate() );
|
||||
Assert.assertTrue("minus " + i + " days should Reject",
|
||||
filter.fn( ind ) == REJECTED);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMarkowitzCase(){
|
||||
DateTime now = new DateTime().withTime(0, 0, 0, 0);
|
||||
Date sunrise = now.minusDays(1).toDate();
|
||||
Date timeKey = now.plusDays(2).toDate();
|
||||
|
||||
Tab tab = new Tab();
|
||||
tab.setDayLimit( -10 );
|
||||
UnaryFunctor<Individual,Boolean> filter =
|
||||
FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
|
||||
Individual ind = new IndividualImpl();
|
||||
ind.setSunrise( sunrise );
|
||||
ind.setTimekey( timeKey );
|
||||
|
||||
Assert.assertTrue("Should accept with day limit -10",
|
||||
filter.fn( ind ) == ACCEPTED);
|
||||
|
||||
tab.setDayLimit( 10 );
|
||||
filter = FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
|
||||
Assert.assertTrue("Should accept with day limit +10",
|
||||
filter.fn( ind ) == ACCEPTED );
|
||||
}
|
||||
// @Test
|
||||
// public void testTimeFiltersForPastReleases(){
|
||||
// Tab tab = new Tab();
|
||||
// tab.setDayLimit( -10 );
|
||||
// UnaryFunctor<Individual,Boolean> filter =
|
||||
// FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
//
|
||||
// Individual ind = new IndividualImpl();
|
||||
// DateTime sunrise;
|
||||
//
|
||||
// // Allow a slight fudge factor for the time it takes the tests to run.
|
||||
// DateTime now = new DateTime().plusSeconds(1);
|
||||
//
|
||||
// for(int i=1; i < 1000 ; i++){
|
||||
// sunrise = now.plusDays(i);
|
||||
// ind.setSunrise( sunrise.toDate() );
|
||||
// Assert.assertTrue("plus " + i + " days should Reject",
|
||||
// filter.fn( ind ) == REJECTED);
|
||||
// }
|
||||
//
|
||||
// ind.setSunrise( now.minusMinutes(20).toDate() );
|
||||
// Assert.assertTrue("minus 20 minutes should Accept",
|
||||
// filter.fn( ind ) == ACCEPTED);
|
||||
//
|
||||
// for(int i=1; i <= 10 ; i++){
|
||||
// sunrise = now.minusDays(i);
|
||||
// ind.setSunrise( sunrise.toDate() );
|
||||
// Assert.assertTrue("minus " + i + " days should Accept",
|
||||
// filter.fn( ind ) == ACCEPTED);
|
||||
// }
|
||||
//
|
||||
// for(int i=11; i < 100 ; i++){
|
||||
// sunrise = now.minusDays(i);
|
||||
// ind.setSunrise( sunrise.toDate() );
|
||||
// Assert.assertTrue("minus " + i + " days should Reject",
|
||||
// filter.fn( ind ) == REJECTED);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testMarkowitzCase(){
|
||||
// DateTime now = new DateTime().withTime(0, 0, 0, 0);
|
||||
// Date sunrise = now.minusDays(1).toDate();
|
||||
// Date timeKey = now.plusDays(2).toDate();
|
||||
//
|
||||
// Tab tab = new Tab();
|
||||
// tab.setDayLimit( -10 );
|
||||
// UnaryFunctor<Individual,Boolean> filter =
|
||||
// FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
//
|
||||
// Individual ind = new IndividualImpl();
|
||||
// ind.setSunrise( sunrise );
|
||||
// ind.setTimekey( timeKey );
|
||||
//
|
||||
// Assert.assertTrue("Should accept with day limit -10",
|
||||
// filter.fn( ind ) == ACCEPTED);
|
||||
//
|
||||
// tab.setDayLimit( 10 );
|
||||
// filter = FiltersForTabs.getTimeFilter(tab, new DateTime());
|
||||
//
|
||||
// Assert.assertTrue("Should accept with day limit +10",
|
||||
// filter.fn( ind ) == ACCEPTED );
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,150 +28,150 @@ public class VitroFiltersFactoryTest {
|
|||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSunsetWindowFilterOnListOfEnts() {
|
||||
DateTime easyDate = new org.joda.time.DateTime(2005,1,1,0,0,0,0); //2005-01-01
|
||||
Date givenDate = easyDate.toDate();
|
||||
|
||||
VitroFilters vf = FiltersForTabs.getSunsetWindowFilter(givenDate);
|
||||
Assert.assertNotNull(vf);
|
||||
checkFilterForNull(vf);
|
||||
|
||||
List<Individual> ents = new LinkedList();
|
||||
for( int i = 0; i< 10; i++){
|
||||
Individual ent = new IndividualImpl();
|
||||
ent.setSunrise( null );
|
||||
ent.setSunset( null );
|
||||
ents.add(ent);
|
||||
}
|
||||
|
||||
BaseFiltering bf = new BaseFiltering();
|
||||
List filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
Assert.assertNotNull(filtered);
|
||||
Assert.assertTrue("expcted to filter no entities, filtered out " + (10-filtered.size()),
|
||||
filtered.size() == 10);
|
||||
|
||||
Individual ent = new IndividualImpl();
|
||||
ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
ent.setSunset( easyDate.plusDays(3).toDate() );
|
||||
ents.add(ent);
|
||||
|
||||
filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
Assert.assertNotNull(filtered);
|
||||
Assert.assertTrue("expcted to filter no entities, filtered out " + (11-filtered.size()),
|
||||
filtered.size() == 11);
|
||||
|
||||
ent = new IndividualImpl();
|
||||
ent.setSunrise( easyDate.minusDays(100).toDate() );
|
||||
ent.setSunset( easyDate.minusDays(110).toDate() );
|
||||
ents.add(ent);
|
||||
|
||||
filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
Assert.assertNotNull(filtered);
|
||||
Assert.assertTrue("expcted to filter one entity, filtered out " + (12-filtered.size()),
|
||||
filtered.size() == 11);
|
||||
|
||||
long count = Summarize.count(ents,vf.getIndividualFilter());
|
||||
Assert.assertTrue("expected 12, got " + ents.size(), ents.size() == 12);
|
||||
Assert.assertTrue("expected count of 11, got " + count , count == 11);
|
||||
|
||||
long a = 20000;
|
||||
int b = (int)a;
|
||||
Assert.assertTrue( b == 20000);
|
||||
}
|
||||
// @Test
|
||||
// public void testSunsetWindowFilterOnListOfEnts() {
|
||||
// DateTime easyDate = new org.joda.time.DateTime(2005,1,1,0,0,0,0); //2005-01-01
|
||||
// Date givenDate = easyDate.toDate();
|
||||
//
|
||||
// VitroFilters vf = FiltersForTabs.getSunsetWindowFilter(givenDate);
|
||||
// Assert.assertNotNull(vf);
|
||||
// checkFilterForNull(vf);
|
||||
//
|
||||
// List<Individual> ents = new LinkedList();
|
||||
// for( int i = 0; i< 10; i++){
|
||||
// Individual ent = new IndividualImpl();
|
||||
// ent.setSunrise( null );
|
||||
// ent.setSunset( null );
|
||||
// ents.add(ent);
|
||||
// }
|
||||
//
|
||||
// BaseFiltering bf = new BaseFiltering();
|
||||
// List filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
// Assert.assertNotNull(filtered);
|
||||
// Assert.assertTrue("expcted to filter no entities, filtered out " + (10-filtered.size()),
|
||||
// filtered.size() == 10);
|
||||
//
|
||||
// Individual ent = new IndividualImpl();
|
||||
// ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// ent.setSunset( easyDate.plusDays(3).toDate() );
|
||||
// ents.add(ent);
|
||||
//
|
||||
// filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
// Assert.assertNotNull(filtered);
|
||||
// Assert.assertTrue("expcted to filter no entities, filtered out " + (11-filtered.size()),
|
||||
// filtered.size() == 11);
|
||||
//
|
||||
// ent = new IndividualImpl();
|
||||
// ent.setSunrise( easyDate.minusDays(100).toDate() );
|
||||
// ent.setSunset( easyDate.minusDays(110).toDate() );
|
||||
// ents.add(ent);
|
||||
//
|
||||
// filtered = bf.filter(ents,vf.getIndividualFilter());
|
||||
// Assert.assertNotNull(filtered);
|
||||
// Assert.assertTrue("expcted to filter one entity, filtered out " + (12-filtered.size()),
|
||||
// filtered.size() == 11);
|
||||
//
|
||||
// long count = Summarize.count(ents,vf.getIndividualFilter());
|
||||
// Assert.assertTrue("expected 12, got " + ents.size(), ents.size() == 12);
|
||||
// Assert.assertTrue("expected count of 11, got " + count , count == 11);
|
||||
//
|
||||
// long a = 20000;
|
||||
// int b = (int)a;
|
||||
// Assert.assertTrue( b == 20000);
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testGetSunsetWindowFilter() {
|
||||
DateTime easyDate = new org.joda.time.DateTime(2005,1,1,0,0,0,0); //2005-01-01
|
||||
Date givenDate = easyDate.toDate();
|
||||
|
||||
VitroFilters vf = FiltersForTabs.getSunsetWindowFilter(givenDate);
|
||||
Assert.assertNotNull(vf);
|
||||
checkFilterForNull(vf);
|
||||
|
||||
Individual ent = new IndividualImpl();
|
||||
ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
ent.setSunset( easyDate.plusDays(3).toDate() );
|
||||
Assert.assertTrue(vf.getIndividualFilter().fn( ent ) );
|
||||
|
||||
ent.setSunrise( easyDate.toDate() );
|
||||
Assert.assertTrue("items should be not filtered on first sunrise day", vf.getIndividualFilter().fn(ent));
|
||||
|
||||
ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
ent.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
Assert.assertFalse("should be sunset and filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
|
||||
ent.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
ent.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
Assert.assertFalse("should not yet be sunrised and filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
|
||||
ent.setSunrise( null );
|
||||
ent.setSunset( null );
|
||||
Assert.assertTrue("nulls should not throw exceptions and and not be filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
|
||||
//should work with webapp too
|
||||
Individual entwa = new IndividualImpl();
|
||||
entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.plusDays(3).toDate() );
|
||||
Assert.assertTrue(vf.getIndividualFilter().fn( entwa ) );
|
||||
|
||||
entwa.setSunrise( easyDate.toDate() );
|
||||
Assert.assertTrue("items should be not filtered on first sunrise day", vf.getIndividualFilter().fn(entwa));
|
||||
|
||||
entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
Assert.assertFalse("should be sunset and filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
|
||||
entwa.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
Assert.assertFalse("should not yet be sunrised and filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
|
||||
entwa.setSunrise( null );
|
||||
entwa.setSunset( null );
|
||||
Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
|
||||
//ObjectPropertyStatements
|
||||
ObjectPropertyStatement ops = new ObjectPropertyStatementImpl();
|
||||
ops.setObject(entwa);
|
||||
|
||||
entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.plusDays(3).toDate() );
|
||||
Assert.assertTrue(vf.getIndividualFilter().fn( entwa ) );
|
||||
|
||||
entwa.setSunrise( easyDate.toDate() );
|
||||
Assert.assertTrue("items should be not filtered on first sunrise day", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
|
||||
entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
Assert.assertFalse("should be sunset and filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
|
||||
entwa.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
entwa.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
Assert.assertFalse("should not yet be sunrised and filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
|
||||
entwa.setSunrise( null );
|
||||
entwa.setSunset( null );
|
||||
Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
|
||||
ops.setSunrise( null );
|
||||
ops.setSunset( null );
|
||||
Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getObjectPropertyStatementFilter().fn( ops ) );
|
||||
|
||||
//DataPropertyStatements
|
||||
DataPropertyStatement dps = new DataPropertyStatementImpl();
|
||||
dps.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
dps.setSunset( easyDate.plusDays( 3).toDate() );
|
||||
Assert.assertTrue( vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
|
||||
dps.setSunrise( easyDate.toDate() );
|
||||
dps.setSunset( easyDate.plusDays( 3).toDate() );
|
||||
Assert.assertTrue( vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
|
||||
dps.setSunrise( null );
|
||||
dps.setSunset( null );
|
||||
Assert.assertTrue("should be not throw exceptions and should not be filtered out", vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
|
||||
}
|
||||
// @Test
|
||||
// public void testGetSunsetWindowFilter() {
|
||||
// DateTime easyDate = new org.joda.time.DateTime(2005,1,1,0,0,0,0); //2005-01-01
|
||||
// Date givenDate = easyDate.toDate();
|
||||
//
|
||||
// VitroFilters vf = FiltersForTabs.getSunsetWindowFilter(givenDate);
|
||||
// Assert.assertNotNull(vf);
|
||||
// checkFilterForNull(vf);
|
||||
//
|
||||
// Individual ent = new IndividualImpl();
|
||||
// ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// ent.setSunset( easyDate.plusDays(3).toDate() );
|
||||
// Assert.assertTrue(vf.getIndividualFilter().fn( ent ) );
|
||||
//
|
||||
// ent.setSunrise( easyDate.toDate() );
|
||||
// Assert.assertTrue("items should be not filtered on first sunrise day", vf.getIndividualFilter().fn(ent));
|
||||
//
|
||||
// ent.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// ent.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
// Assert.assertFalse("should be sunset and filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
//
|
||||
// ent.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
// ent.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
// Assert.assertFalse("should not yet be sunrised and filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
//
|
||||
// ent.setSunrise( null );
|
||||
// ent.setSunset( null );
|
||||
// Assert.assertTrue("nulls should not throw exceptions and and not be filtered out", vf.getIndividualFilter().fn( ent ));
|
||||
//
|
||||
// //should work with webapp too
|
||||
// Individual entwa = new IndividualImpl();
|
||||
// entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.plusDays(3).toDate() );
|
||||
// Assert.assertTrue(vf.getIndividualFilter().fn( entwa ) );
|
||||
//
|
||||
// entwa.setSunrise( easyDate.toDate() );
|
||||
// Assert.assertTrue("items should be not filtered on first sunrise day", vf.getIndividualFilter().fn(entwa));
|
||||
//
|
||||
// entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
// Assert.assertFalse("should be sunset and filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
//
|
||||
// entwa.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
// Assert.assertFalse("should not yet be sunrised and filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
//
|
||||
// entwa.setSunrise( null );
|
||||
// entwa.setSunset( null );
|
||||
// Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getIndividualFilter().fn( entwa ));
|
||||
//
|
||||
// //ObjectPropertyStatements
|
||||
// ObjectPropertyStatement ops = new ObjectPropertyStatementImpl();
|
||||
// ops.setObject(entwa);
|
||||
//
|
||||
// entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.plusDays(3).toDate() );
|
||||
// Assert.assertTrue(vf.getIndividualFilter().fn( entwa ) );
|
||||
//
|
||||
// entwa.setSunrise( easyDate.toDate() );
|
||||
// Assert.assertTrue("items should be not filtered on first sunrise day", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
//
|
||||
// entwa.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.minusDays( 2 ).toDate() );
|
||||
// Assert.assertFalse("should be sunset and filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
//
|
||||
// entwa.setSunrise( easyDate.plusDays(3).toDate() );
|
||||
// entwa.setSunset( easyDate.plusDays( 10 ).toDate() );
|
||||
// Assert.assertFalse("should not yet be sunrised and filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
//
|
||||
// entwa.setSunrise( null );
|
||||
// entwa.setSunset( null );
|
||||
// Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getObjectPropertyStatementFilter().fn(ops));
|
||||
//
|
||||
// ops.setSunrise( null );
|
||||
// ops.setSunset( null );
|
||||
// Assert.assertTrue("null should not throw exceptions and should not be filtered out", vf.getObjectPropertyStatementFilter().fn( ops ) );
|
||||
//
|
||||
// //DataPropertyStatements
|
||||
// DataPropertyStatement dps = new DataPropertyStatementImpl();
|
||||
// dps.setSunrise( easyDate.minusDays(3).toDate() );
|
||||
// dps.setSunset( easyDate.plusDays( 3).toDate() );
|
||||
// Assert.assertTrue( vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
//
|
||||
// dps.setSunrise( easyDate.toDate() );
|
||||
// dps.setSunset( easyDate.plusDays( 3).toDate() );
|
||||
// Assert.assertTrue( vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
//
|
||||
// dps.setSunrise( null );
|
||||
// dps.setSunset( null );
|
||||
// Assert.assertTrue("should be not throw exceptions and should not be filtered out", vf.getDataPropertyStatementFilter().fn( dps ) );
|
||||
//
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testGetTestFilter() {
|
||||
|
@ -200,7 +200,7 @@ public class VitroFiltersFactoryTest {
|
|||
Assert.assertNotNull("getObjectPropertyFilter was null", vf.getObjectPropertyFilter());
|
||||
Assert.assertNotNull("getObjectPropertyStatementFilter was null", vf.getObjectPropertyStatementFilter());
|
||||
Assert.assertNotNull("getIndividualFilter was null", vf.getIndividualFilter());
|
||||
Assert.assertNotNull("getTabFilter was null", vf.getTabFilter());
|
||||
//Assert.assertNotNull("getTabFilter was null", vf.getTabFilter());
|
||||
Assert.assertNotNull("getUserFilter was null", vf.getUserFilter());
|
||||
Assert.assertNotNull("getVClassGroupFilter was null", vf.getVClassGroupFilter());
|
||||
}
|
||||
|
|
|
@ -6,24 +6,17 @@ import junit.framework.Assert;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Link;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Tab;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.User;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,9 +26,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabIndividualRelationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.TabVClassRelationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.UserDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
|
@ -193,24 +190,6 @@ public class WebappDaoFactoryStub implements WebappDaoFactory {
|
|||
"WebappDaoFactory.getApplicationDao() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabDao getTabDao() {
|
||||
throw new RuntimeException(
|
||||
"WebappDaoFactory.getTabDao() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabIndividualRelationDao getTabs2EntsDao() {
|
||||
throw new RuntimeException(
|
||||
"WebappDaoFactory.getTabs2EntsDao() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabVClassRelationDao getTabs2TypesDao() {
|
||||
throw new RuntimeException(
|
||||
"WebappDaoFactory.getTabs2TypesDao() not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeywordIndividualRelationDao getKeys2EntsDao() {
|
||||
throw new RuntimeException(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue