VIVO-869 ABoxRecomputer should pause the SearchIndexer during a rebuild.

This commit is contained in:
Jim Blake 2015-01-22 15:49:08 -05:00
parent ccb2063aa4
commit de5b80bf75
6 changed files with 137 additions and 11 deletions

View file

@ -7,6 +7,10 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import stubs.edu.cornell.mannlib.vitro.webapp.modules.ApplicationStub;
import stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineStub;
import stubs.javax.servlet.ServletContextStub;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntProperty;
@ -29,6 +33,10 @@ public class SimpleReasonerInversePropertyTest extends SimpleReasonerTBoxHelper
setLoggerLevel(SimpleReasonerTBoxListener.class, Level.OFF);
setLoggerLevel(ABoxRecomputer.class, Level.OFF);
}
@Before public void setup() {
ApplicationStub.setup(new ServletContextStub(), new SearchEngineStub());
}
@Test
public void addABoxAssertion1Test(){

View file

@ -6,6 +6,7 @@ import java.lang.reflect.Field;
import javax.servlet.ServletContext;
import stubs.edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexerStub;
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.application.VitroHomeDirectory;
import edu.cornell.mannlib.vitro.webapp.modules.Application;
@ -42,10 +43,14 @@ public class ApplicationStub implements Application {
private final ServletContext ctx;
private final SearchEngine searchEngine;
private final SearchIndexer searchIndexer;
public ApplicationStub(ServletContext ctx, SearchEngine searchEngine) {
this.ctx = ctx;
this.searchEngine = searchEngine;
this.searchIndexer = new SearchIndexerStub();
this.searchIndexer.unpause();
}
// ----------------------------------------------------------------------
@ -62,6 +67,11 @@ public class ApplicationStub implements Application {
return searchEngine;
}
@Override
public SearchIndexer getSearchIndexer() {
return searchIndexer;
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@ -109,10 +119,4 @@ public class ApplicationStub implements Application {
"ApplicationStub.getTBoxReasonerModule() not implemented.");
}
@Override
public SearchIndexer getSearchIndexer() {
throw new RuntimeException(
"Application.getSearchIndexer() not implemented.");
}
}

View file

@ -0,0 +1,91 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package stubs.edu.cornell.mannlib.vitro.webapp.modules.searchIndexer;
import java.util.Collection;
import java.util.List;
import com.hp.hpl.jena.rdf.model.Statement;
import edu.cornell.mannlib.vitro.webapp.modules.Application;
import edu.cornell.mannlib.vitro.webapp.modules.ComponentStartupStatus;
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexer;
import edu.cornell.mannlib.vitro.webapp.modules.searchIndexer.SearchIndexerStatus;
/**
* TODO
*/
public class SearchIndexerStub implements SearchIndexer {
// ----------------------------------------------------------------------
// Stub infrastructure
// ----------------------------------------------------------------------
private boolean paused = true;
// ----------------------------------------------------------------------
// Stub methods
// ----------------------------------------------------------------------
@Override
public void pause() {
paused = true;
}
@Override
public void unpause() {
paused = false;
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@Override
public void startup(Application application, ComponentStartupStatus ss) {
throw new RuntimeException(
"SearchIndexerStub.startup() not implemented.");
}
@Override
public void scheduleUpdatesForStatements(List<Statement> changes) {
throw new RuntimeException(
"SearchIndexerStub.scheduleUpdatesForStatements() not implemented.");
}
@Override
public void scheduleUpdatesForUris(Collection<String> uris) {
throw new RuntimeException(
"SearchIndexerStub.scheduleUpdatesForUris() not implemented.");
}
@Override
public void rebuildIndex() {
throw new RuntimeException(
"SearchIndexerStub.rebuildIndex() not implemented.");
}
@Override
public SearchIndexerStatus getStatus() {
throw new RuntimeException(
"SearchIndexerStub.getStatus() not implemented.");
}
@Override
public void addListener(Listener listener) {
throw new RuntimeException(
"SearchIndexerStub.addListener() not implemented.");
}
@Override
public void removeListener(Listener listener) {
throw new RuntimeException(
"SearchIndexerStub.removeListener() not implemented.");
}
@Override
public void shutdown(Application app) {
throw new RuntimeException(
"SearchIndexerStub.shutdown() not implemented.");
}
}