Sprint i18n with main (#209)

* Layer uqam updates onto master (minus trailing whitespace)

* Update RDFServiceFactorySingle.java

* Sprint i18n whitespace (#143)

* Removed extraneous whitespace
   - modified:   api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/BaseEditElementVTwo.java

* move RootUserPolicy.java from VIVO to Vitro repo.

* Remove blank line

* Fixed indentations

* Update whitespace for: TemplateProcessingHelper.java

* Update whitespace for: RDFServiceModel.java

* Removed extraneous whitespaces.

* Tagging UQAM Comments with following tags

-Add-Feature
-Optimization
-Linguistic-Management
-Bug-Correction

* Resolve compilation failures in Vitro tests

* Remove whitespace changes from SelectListGeneratorVTwo.java

* Add null check on field values of RDF Form (#158)

Resolves: https://jira.lyrasis.org/browse/VIVO-1800

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Fix incorrect tool-tip in language selection dropdown (#156)

Resolves: https://jira.lyrasis.org/browse/VIVO-1783

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Sprint i18n/lang filtering model (#159)

* Add language-aware graph filtering instead of layering on additional RDFService

Resolves: https://jira.lyrasis.org/browse/VIVO-1771

* Remove hardcoded link label (#161)

Resolves: https://jira.lyrasis.org/browse/VIVO-1779

* Enable filtering of non-enabled i18n language files from being loaded into triple store (#160)

Define name of available language listing file (found in Vitro-languages)
Update RDFFilesLoader method interfaces to include ServletContext

Part of resolution to: https://jira.lyrasis.org/browse/VIVO-1836

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Add i18n version of Edit page title (#157)

Related to: https://jira.lyrasis.org/browse/VIVO-1779

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Changing ontology extensions for n3 & assigning a base IRI to each (#163)

ontology

Co-authored-by: michelheon <heon@videotorn.ca>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

https://jira.lyrasis.org/browse/VIVO-1862

* Update sprint-i18n with master branch (#166)

* Make data property richtext editor option selectable from UI

* [VIVO-1755] - Better error handling when reasoner disabled (#137)

* Better error handling when reasoner disabled

* Change reasoner error log message to debug

* Extend reasoner status error handling

* Improve reasoner error log message and extend to JenaAdminActions

* Bump up log level for admin action to 'warn' and edit admin panel error message

* Change Model writer lang from "N3-PP" to "N3" (#149)

Resolves: https://jira.lyrasis.org/browse/VIVO-1761

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [VIVO-1851] - Add 'remove' option to named graph management page (#162)

* Add 'remove' option to named graph management page

Resolves: https://jira.lyrasis.org/browse/VIVO-1851

* [VIVO-1872] - Add download option to SPARQL Query page (#164)

* Add download option to SPARQL Query page

* Set SPARQL query results content type even if downloading

* Address pull request comments

Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [VIVO-1839] - Use language name for selector instead of flags (#165)

* Use language name for selector instead of flags
* Add country name to language selector
* Increase min-width of language dropdown
* Update data tree comment in languageSelector.ftl
* Min-width for language dropdown
* Language dropdown css adjustment
* Capitalize locale label
* Indent on languageSelector.ftl

Resolves: https://jira.lyrasis.org/browse/VIVO-1839

* Adds internationalization to the admin/sparql-query page (#167)

* Adds internationalization to the admin/sparql-query page

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1873

* Add i18n for 'save query result'

Related to: https://jira.lyrasis.org/browse/VIVO-1873

* code review

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* removed redundat files which are now available via Vitro- and VIVO-languages

* Making UQAM-optimization aware of https://

* Add parent reference to installer/pom.xml (#174)

Resolves: https://jira.lyrasis.org/browse/VIVO-1903

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Revert non-function RDF changes (#177)

Related to: https://jira.lyrasis.org/browse/VIVO-1905

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Ensure 'other' in Individual->Teaching->advisees->type is translated

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1881

* Re-add logic from commit 7420957

* [VIVO-1812] use i18n translation for validation messages (#179)

* replace constants with i18n text in BasicValidationVTwo
* use constants for i18n template key

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1812

* added js_string at i18n strings to handle quotes properly, ticket vivo-1842 (#180)

Partial resolution for: https://jira.lyrasis.org/browse/VIVO-1842

* [VIVO-1870] simplify and concat translation for browse by vclass (#182)

* simplify and concat translation for browse by vclass

Partial resolution of: https://jira.lyrasis.org/browse/VIVO-1870

* [VIVO-1900] i18n: added empty check for getCountry, fixing bug with spanish label (es) (#181)

* added empty check for getCountry, fixing bug with spanish label (es), ticket vivo-1900

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1900

* [VIVO 1870] update i18n key to JavaScript mapping (#183)

* update menupage-script i18n key to JavaScript mapping

Follow-on to resolution of: https://jira.lyrasis.org/browse/VIVO-1870

* [VIVO-1837] get i18n bundle from WebappDaoFactoryConfig preferred locales (#178)

* apply i18n text to VClassDaoJena.getLabelForClass
* expose i18n bundle through webapp dao factory interface
* use whole messages for i18n
* if request available use request bundle else use context bundle
* clear cache when context theme directory changes
* make getOverridingLocale from context private
* select locale based on preferred locale from webapp dao factory
* use first preferred local even when no selectable locales available on context
* build default preferred locales from default preferred languages

Resolves: https://jira.lyrasis.org/browse/VIVO-1837

* Ensure that "available langs" include base langs (#185)

Resolves: https://jira.lyrasis.org/browse/VIVO-1922

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Ensure I18nStub is initialized before pertinent tests (#186)

Resolves: https://jira.lyrasis.org/browse/VIVO-1923

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* add additional null checks to ensure context is ready for theme change (#187)

* [VIVO-1915] i18n - Adding a label with language tag through the "new" manageLabelsForindividualAddForm.ftl does not take the setting for language tag (#184)

* Fixed bug when addng a label with language tag through managLabelsForindividualAddForm, re ticket VIVO-1915

* removed the language select for managing multi language labels, ticket vivo-1915

* readded the fix for language selection because of the fr-CA version of the manageLabelsForIndividualftl, ticket vivo-1915

* removed earlier fix, removed comments, modified ManageLabelGenrator, ticket vivo-1915

Partial resolution to: https://jira.lyrasis.org/browse/VIVO-1915

* - replaced hard coded "or"s with i18n().or

* [VIVO-1925] i18n: Editing labels results in new label (#188)

* fixed bug: Editing language labels results in new label, ticket vivo-1925

Resolves: https://jira.lyrasis.org/browse/VIVO-1925

* Enable lang selection without need for 'available-langs.properties' (#169)

* Enable lang selection without need for 'available-langs.properties'
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Reduce number of times QuerySolutions are looped in LanguageFilteringRDFService (#194)

- No functional change in this update

Resolves: https://jira.lyrasis.org/browse/VIVO-1931

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Prevent 'ProcessRdfForm.parseN3ToRDF' from using null linguisticContext (#197)

Resolves: https://jira.lyrasis.org/browse/VIVO-1944

Co-authored-by: Andrew Woods <awoods@duraspace.org>

* [Vivo 1918] i18n: Reload firsttime files on start-up if changed (#195)

Co-authored-by: Andrew Woods <awoods@lyrasis.org>

* [VIVO-1936] i18n: updated the language comment in runtime.properties

* ftl function to capitalize group name affording override

* Further i18n for BasicValidationVTwo.java

* Fixed DeletePropertyController.java - getting localname of property properly (#200)

* Fixed DeletePropertyController.java - getting localname of property properly

Resolves: https://jira.lyrasis.org/browse/VIVO-1816

* Removed hardcoded time units by properties calls in dateTimeWithPrecision.ftl

* Use i18n values for date time form (#204)

Resolves: https://jira.lyrasis.org/browse/VIVO-1953

* VIVO-1929: patch authorizing create individual form (#206)

* patch authorizing create individual form

Resolves: https://jira.lyrasis.org/browse/VIVO-1929

* Issue/vivo 1947 (#205)

* Make data property richtext editor option selectable from UI
* Better error handling when reasoner disabled
* Change reasoner error log message to debug
* Extend reasoner status error handling
* Improve reasoner error log message and extend to JenaAdminActions
* Bump up log level for admin action to 'warn' and edit admin panel error message
* Change Model writer lang from "N3-PP" to "N3" (#149)
* Prevent ontology editor and N3 editing from deleting property values in languages other than the one associated with the editing request. [https://jira.lyrasis.org/browse/VIVO-1947]

Resolves: https://jira.lyrasis.org/browse/VIVO-1947

Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: Andrew Woods <awoods@lyrasis.org>
Co-authored-by: Andrew Woods <awoods@duraspace.org>

* Remove comments

Co-authored-by: Andrew Woods <awoods@duraspace.org>
Co-authored-by: Nicolas D <46490666+nicalico@users.noreply.github.com>
Co-authored-by: VIVO UQAM <62542918+UQAM-VIVO@users.noreply.github.com>
Co-authored-by: Matthias Luehr <luehr@hs-mittweida.de>
Co-authored-by: michelheonuqam <heon.michel@uqam.ca>
Co-authored-by: Brian Lowe <brianjlowe@gmail.com>
Co-authored-by: j-dornbusch <joachim.dornbusch@ehess.fr>
Co-authored-by: Michel Heon <heon@videotron.ca>
Co-authored-by: gneissone <mbgross@wustl.edu>
Co-authored-by: Ralph O'Flinn <roflinn@users.noreply.github.com>
Co-authored-by: dofeldsc <dofeldsc@uos.de>
Co-authored-by: root <root@vivo-development.hs-mittweida.de>
Co-authored-by: gneissone <mbgross@unavco.org>
Co-authored-by: William Welling <wwelling@library.tamu.edu>
Co-authored-by: Kampe <Benjamin.Kampe@tib.eu>
Co-authored-by: Gross, Benjamin <benjamin.gross@clarivate.com>
Co-authored-by: matthiasluehr <60263380+matthiasluehr@users.noreply.github.com>
Co-authored-by: nicolasdickner <dickner.nicolas@uqam.ca>
This commit is contained in:
Andrew Woods 2021-02-10 12:04:01 -05:00 committed by GitHub
parent 28188e9719
commit eb949919b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
175 changed files with 2748 additions and 2207 deletions

View file

@ -56,6 +56,7 @@ import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import stubs.edu.cornell.mannlib.vitro.webapp.i18n.I18nStub;
/**
* A collection of useful routines to help when testing.
@ -85,8 +86,21 @@ public abstract class AbstractTestClass {
* {@link Level#INFO}.
*/
@Before
public void setUp() {
initializeLogging();
useI18nStubBundles();
}
@After
public void initializeLogging() {
public void tearDown() {
initializeLogging();
}
protected void useI18nStubBundles() {
I18nStub.setup();
}
private void initializeLogging() {
LogManager.resetConfiguration();
Logger.getRootLogger().addAppender(new ConsoleAppender(patternLayout));
Logger.getRootLogger().setLevel(Level.INFO);

View file

@ -67,7 +67,7 @@ public class SelfEditingPolicyTest extends AbstractTestClass {
private OntModel ontModel;
@Before
public void setUp() throws Exception {
public void setUp() {
ctx = new ServletContextStub();
PropertyRestrictionBeanStub

View file

@ -75,7 +75,7 @@ public class SelfEditingPolicy_2_Test extends AbstractTestClass {
@Before
public void setUp() throws Exception {
public void setUp() {
ServletContextStub ctx = new ServletContextStub();
PropertyRestrictionBeanStub.getInstance(new String[] { ADMIN_NS });

View file

@ -48,7 +48,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList;
import edu.cornell.mannlib.vitro.webapp.beans.PermissionSet;
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator;
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.AuthenticatorStub;
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean;
import edu.cornell.mannlib.vitro.webapp.controller.login.LoginProcessBean.State;

View file

@ -11,6 +11,7 @@ import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
@ -65,9 +66,9 @@ public class DataPropertyDaoJenaTest extends AbstractTestClass {
property1.setPropertyValue(RDFS.domain, subModel.createResource("http://thisIsTheDomainClassURI"));
property1.setPropertyValue(RDFS.range, subModel.createResource("http://thisIsTheRangeClassURI"));
property1.addProperty(RDF.type, OWL.FunctionalProperty);
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), subModel.createTypedLiteral("this is the example"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), subModel.createTypedLiteral("this is the description"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT), subModel.createTypedLiteral("this is the public description"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), ResourceFactory.createLangLiteral("this is the example", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), ResourceFactory.createLangLiteral("this is the description", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT), ResourceFactory.createLangLiteral("this is the public description", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DISPLAY_RANK_ANNOT), subModel.createTypedLiteral(21));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DISPLAY_LIMIT), subModel.createTypedLiteral(5));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.HIDDEN_FROM_DISPLAY_BELOW_ROLE_LEVEL_ANNOT), subModel.createResource("http://vitro.mannlib.cornell.edu/ns/vitro/role#curator"));

View file

@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.io.StringReader;
import java.util.List;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Assert;
import org.apache.jena.rdf.model.Model;
@ -16,7 +17,7 @@ import org.apache.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
public class DependentResourceDeleteJenaTest {
public class DependentResourceDeleteJenaTest extends AbstractTestClass {
String isDependentRelation =
" <"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;

View file

@ -2,26 +2,29 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.StringReader;
import org.junit.Assert;
import org.junit.Test;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.ontology.OntProperty;
import org.apache.jena.ontology.OntResource;
import org.apache.jena.ontology.Restriction;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.XSD;
import org.junit.Assert;
import org.junit.Test;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
@ -35,7 +38,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
public class JenaBaseDaoTest {
public class JenaBaseDaoTest extends AbstractTestClass {
String isDependentRelation =
" <"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;
@ -457,6 +460,53 @@ public class JenaBaseDaoTest {
Assert.assertEquals(m.size(), 2); // just rdf:type for Class1 and Prop
}
@Test
/**
* Test that a resource's labels in one language are correctly updated without
* affecting labels in other languages.
*/
public void testUpdateRDFSLabel() {
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
WebappDaoFactoryJena wadf = new WebappDaoFactoryJena(m);
JenaBaseDao dao = new JenaBaseDao(wadf);
OntResource ontRes = m.createOntResource("http://example.com/i/n1");
// update one language
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US"));
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES"));
dao.updateRDFSLabel(ontRes, "engLabel2", "en-US");
assertEquals(2, m.size());
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel2", "en-US")));
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES")));
m.removeAll();
// update language-less
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US"));
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES"));
m.add(ontRes, RDFS.label, "languageLessLabel1");
dao.updateRDFSLabel(ontRes, "languageLessLabel2", null);
assertEquals(3, m.size());
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US")));
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES")));
Assert.assertTrue(m.contains(ontRes, RDFS.label, "languageLessLabel2"));
m.removeAll();
// remove a language
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US"));
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES"));
m.add(ontRes, RDFS.label, m.createTypedLiteral("stringLabel1"));
dao.updateRDFSLabel(ontRes, null, "en-US");
assertEquals(2, m.size());
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES")));
Assert.assertTrue(m.contains(ontRes, RDFS.label, m.createTypedLiteral("stringLabel1")));
m.removeAll();
// remove language-less labels
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US"));
m.add(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES"));
m.add(ontRes, RDFS.label, ResourceFactory.createPlainLiteral("languageLessLabel1"));
dao.updateRDFSLabel(ontRes, null, null);
assertEquals(2, m.size());
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("engLabel1", "en-US")));
Assert.assertTrue(m.contains(ontRes, RDFS.label, ResourceFactory.createLangLiteral("esLabel1", "es-ES")));
}
/**
* Compare the contents of the expected model with the actual model (not counting modification times).

View file

@ -48,6 +48,8 @@ public class JenaBaseDao_2_Test extends AbstractTestClass {
@Before
public void initializeThings() {
super.setUp();
ontModel = ModelFactory.createOntologyModel();
prop1 = ontModel.createProperty("property1");

View file

@ -27,7 +27,9 @@ public class MenuDaoJenaTest extends AbstractTestClass {
OntModel displayModel;
@Before
public void setUp() throws Exception {
public void setUp() {
super.setUp();
// Suppress error logging.
setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF);

View file

@ -9,6 +9,7 @@ import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.RDFS;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
@ -136,9 +137,9 @@ public class ObjectPropertyDaoJenaTest extends AbstractTestClass {
property1.setPropertyValue(RDFS.domain, subModel.createResource("http://thisIsTheDomainClassURI"));
property1.setPropertyValue(RDFS.range, subModel.createResource("http://thisIsTheRangeClassURI"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), subModel.createTypedLiteral("this is the example"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), subModel.createTypedLiteral("this is the description"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT), subModel.createTypedLiteral("this is the public description"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), ResourceFactory.createLangLiteral("this is the example", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), ResourceFactory.createLangLiteral("this is the description", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PUBLIC_DESCRIPTION_ANNOT), ResourceFactory.createLangLiteral("this is the public description", lang));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.DISPLAY_LIMIT), subModel.createTypedLiteral(6));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PROPERTY_ENTITYSORTFIELD), subModel.createTypedLiteral("this is the entity sort field"));
property1.setPropertyValue(subModel.createProperty(VitroVocabulary.PROPERTY_ENTITYSORTDIRECTION), subModel.createTypedLiteral("this is the entity sort direction"));

View file

@ -4,12 +4,13 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import static org.junit.Assert.*;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Test;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
public class ObjectPropertyStatementDaoJenaTest {
public class ObjectPropertyStatementDaoJenaTest extends AbstractTestClass {
/**
* Test if jena lib can parse N3 that it generates.

View file

@ -2,6 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Assert;
import org.junit.Ignore;
@ -28,11 +29,12 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
* @author bjl23
*
*/
public class OntModelSegementationTest {
public class OntModelSegementationTest extends AbstractTestClass {
private WebappDaoFactoryJena wadf;
@org.junit.Before
public void setUpWebappDaoFactoryJena() {
super.setUp();
wadf = new WebappDaoFactoryJena(new SimpleOntModelSelector());
}

View file

@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Assert;
import org.apache.jena.ontology.OntModel;
@ -20,7 +21,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public class PropertyInstanceDaoJenaTest {
public class PropertyInstanceDaoJenaTest extends AbstractTestClass {
String isDependentRelation =
" <"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;

View file

@ -74,6 +74,8 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass {
@Before
public void setup() throws IOException {
super.setUp();
InputStream stream = UserAccountsDaoJenaTest.class
.getResourceAsStream(N3_DATA_FILENAME);
Model model = ModelFactory.createDefaultModel();
@ -90,6 +92,8 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass {
@Before
public void createUserAccountValues() {
super.setUp();
user1 = userAccount(URI_USER1, "email@able.edu", "Zack", "Roberts",
"garbage", "" ,"", 0L, false, 5, 12345678L, Status.ACTIVE, "user1",
false, collection(URI_ROLE1), false, EMPTY);

View file

@ -3,19 +3,25 @@
package edu.cornell.mannlib.vitro.webapp.dao.jena;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.StringWriter;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Test;
import org.apache.jena.atlas.logging.Log;
import org.apache.jena.ontology.ObjectProperty;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.OWL;
import org.junit.Test;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
@ -24,7 +30,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
*
*/
public class VClassDaoTest {
public class VClassDaoTest extends AbstractTestClass {
@Test
// Test that the VClassDaoJena::updateVClass method will only update the jena model for
@ -62,9 +68,9 @@ public class VClassDaoTest {
class1.setLabel(rdfsLabel,lang); //rdfs:label
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.IN_CLASSGROUP), subModel.createResource("http://thisIsTheClassGroupURI"));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.SHORTDEF), subModel.createTypedLiteral("this is the short definition"));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), subModel.createTypedLiteral("this is the example - why is this a string?"));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), subModel.createTypedLiteral("this is the description"));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.SHORTDEF), ResourceFactory.createLangLiteral("this is the short definition", lang));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.EXAMPLE_ANNOT), ResourceFactory.createLangLiteral("this is the example - why is this a string?", lang));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.DESCRIPTION_ANNOT), ResourceFactory.createLangLiteral("this is the description", lang));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.DISPLAY_LIMIT), subModel.createTypedLiteral(-1));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.DISPLAY_RANK_ANNOT), subModel.createTypedLiteral(-11));
class1.setPropertyValue(subModel.createProperty(VitroVocabulary.SEARCH_BOOST_ANNOT), subModel.createTypedLiteral(2.4f));
@ -120,7 +126,7 @@ public class VClassDaoTest {
wipeOutModTime(superModel);
assertTrue(subModel.isIsomorphicWith(origSubModel));
assertTrue(superModel.isIsomorphicWith(origSuperModel));
assertTrue(superModel.isIsomorphicWith(origSuperModel));
}

View file

@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
import java.io.StringReader;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -14,10 +15,12 @@ import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.vocabulary.RDFS;
public class VClassGroupCacheTest {
public class VClassGroupCacheTest extends AbstractTestClass {
@Before
public void setUp() throws Exception {
public void setUp() {
// Not calling super.setUp() because we do not want to change the logging level
super.useI18nStubBundles();
}
@Test

View file

@ -7,6 +7,7 @@ import java.net.URLEncoder;
import java.util.Iterator;
import java.util.List;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import org.junit.Assert;
import org.junit.Test;
@ -49,7 +50,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
*
*/
public class VClassJenaTest {
public class VClassJenaTest extends AbstractTestClass {
@Test
// NIHVIVO-1157 introduced VClassJena.java, a lazy-loading version of VClass.java.

View file

@ -4,44 +4,46 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo;
import java.util.Collections;
import org.junit.Assert;
import javax.servlet.http.HttpServletRequest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import stubs.edu.cornell.mannlib.vitro.webapp.i18n.I18nStub;
import stubs.javax.servlet.http.HttpServletRequestStub;
public class BasicValidationVTwoTest {
@Before
public void useI18nStubBundles() {
I18nStub.setup();
}
@SuppressWarnings("unchecked")
@Test
public void testHttpUrlValidate() {
BasicValidationVTwo bv = new BasicValidationVTwo(Collections.EMPTY_MAP);
HttpServletRequest req = new HttpServletRequestStub();
BasicValidationVTwo bv = new BasicValidationVTwo(Collections.EMPTY_MAP, I18nStub.bundle(req));
String res;
res = bv.validate("httpUrl", "http://example.com/index");
Assert.assertEquals(res, BasicValidationVTwo.SUCCESS);
Assert.assertEquals(BasicValidationVTwo.SUCCESS, res);
res = bv.validate("httpUrl", "http://example.com/index?bogus=skjd%20skljd&something=sdkf");
Assert.assertEquals(res, BasicValidationVTwo.SUCCESS);
Assert.assertEquals(BasicValidationVTwo.SUCCESS, res);
res = bv.validate("httpUrl", "http://example.com/index#2.23?bogus=skjd%20skljd&something=sdkf");
Assert.assertEquals(res, BasicValidationVTwo.SUCCESS);
Assert.assertEquals(BasicValidationVTwo.SUCCESS, res);
}
@SuppressWarnings("unchecked")
@Test
public void testEmptyValidate(){
BasicValidationVTwo bv = new BasicValidationVTwo(Collections.EMPTY_MAP);
HttpServletRequest req = new HttpServletRequestStub();
BasicValidationVTwo bv = new BasicValidationVTwo(Collections.EMPTY_MAP, I18nStub.bundle(req));
Assert.assertEquals(
bv.validate("nonempty", null)
, BasicValidationVTwo.REQUIRED_FIELD_EMPTY_MSG);
Assert.assertEquals(
bv.validate("nonempty", "")
, BasicValidationVTwo.REQUIRED_FIELD_EMPTY_MSG);
Assert.assertEquals(
bv.validate("nonempty", "some value")
, BasicValidationVTwo.SUCCESS);
Assert.assertEquals(BasicValidationVTwo.REQUIRED_FIELD_EMPTY_MSG, bv.validate("nonempty", null));
Assert.assertEquals(BasicValidationVTwo.REQUIRED_FIELD_EMPTY_MSG, bv.validate("nonempty", ""));
Assert.assertEquals(BasicValidationVTwo.SUCCESS, bv.validate("nonempty", "some value"));
}
}

View file

@ -19,11 +19,13 @@ import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfigurationConstants;
import stubs.javax.servlet.http.HttpServletRequestStub;
public class ProcessRdfFormTest extends AbstractTestClass{
public class ProcessRdfFormTest extends AbstractTestClass {
@Test
public void basicNewStatementTest() throws Exception{
@ -40,14 +42,16 @@ public class ProcessRdfFormTest extends AbstractTestClass{
values.put("test3", (new String[] {"http://test.com/uri3"}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
/* test just the N3 substitution part */
List<String>req = config.getN3Required();
List<String>opt = config.getN3Optional();
processor.subInValuesToN3( config , submission, req, opt, null , null);
processor.subInValuesToN3( config , submission, req, opt, null , null, vreq);
assertNotNull(req);
assertTrue( req.size() > 0);
assertNotNull(req.get(0));
@ -102,7 +106,10 @@ public class ProcessRdfFormTest extends AbstractTestClass{
Map<String,String[]> values = new HashMap<String, String[]>();
values.put("testZ", (new String[] {testZURIChanged}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
AdditionsAndRetractions changes = processor.process( config, submission, null );
@ -176,14 +183,17 @@ public class ProcessRdfFormTest extends AbstractTestClass{
values.put("test2", (new String[] {test2}));
values.put("test3", (new String[] {test3}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
/* test just the N3 substitution part */
List<String>req = config.getN3Required();
List<String>opt = config.getN3Optional();
processor.subInValuesToN3( config , submission, req, opt, null , null);
processor.subInValuesToN3( config , submission, req, opt, null , null, vreq);
assertNotNull(req);
assertTrue( req.size() > 0);
assertNotNull(req.get(0));
@ -220,14 +230,16 @@ public class ProcessRdfFormTest extends AbstractTestClass{
values.put("test3", (new String[] {"http://test.com/uri3"}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
/* test just the N3 substitution part */
List<String>req = config.getN3Required();
List<String>opt = config.getN3Optional();
processor.subInValuesToN3( config , submission, req, opt, null , null);
processor.subInValuesToN3( config , submission, req, opt, null , null, vreq);
assertNotNull(req);
assertTrue( req.size() > 0);
assertNotNull(req.get(0));
@ -270,14 +282,16 @@ public class ProcessRdfFormTest extends AbstractTestClass{
values.put("test3", (new String[] {"http://test.com/uri3"}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
/* test just the N3 substitution part */
List<String>req = config.getN3Required();
List<String>opt = config.getN3Optional();
processor.subInValuesToN3( config , submission, req, opt, null , null);
processor.subInValuesToN3( config , submission, req, opt, null , null, vreq);
assertNotNull(req);
assertTrue( req.size() > 0);
assertNotNull(req.get(0));
@ -357,10 +371,13 @@ public class ProcessRdfFormTest extends AbstractTestClass{
values.put("testZ", (new String[] {testZURIChanged}));
values.put("zLabel", (new String[] {"New Z Label"}));
values.put("editKey", (new String[] {"mockEditKey"}));
MultiValueEditSubmission submission = new MultiValueEditSubmission(values, config);
VitroRequest vreq = createRequestWithParameters(values);
MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq, config);
ProcessRdfForm processor = new ProcessRdfForm(config,getMockNewURIMaker());
AdditionsAndRetractions changes = processor.process( config, submission, null );
AdditionsAndRetractions changes = processor.process( config, submission, vreq );
assertNotNull( changes );
assertNotNull( changes.getAdditions() );
@ -396,4 +413,16 @@ public class ProcessRdfFormTest extends AbstractTestClass{
}
};
}
private VitroRequest createRequestWithParameters(Map<String, String[]> parameters) {
HttpServletRequestStub req = new HttpServletRequestStub();
for (String key : parameters.keySet()) {
for (String value : parameters.get(key)) {
req.addParameter(key, value);
}
}
return new VitroRequest(req);
}
}

View file

@ -0,0 +1,62 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.vocabulary.RDFS;
import org.junit.Test;
import org.testng.Assert;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
public class LimitRemovalsToLanguageTest extends AbstractTestClass {
@Test
/**
* Test that retractions are properly limited to the specified language
*/
public void testPreprocess() {
LimitRemovalsToLanguage preproc = new LimitRemovalsToLanguage("en-US");
Model additions = ModelFactory.createDefaultModel();
Model retractions = ModelFactory.createDefaultModel();
Resource res = ResourceFactory.createResource("http://example.com/i/n1");
// eliminate Spanish retraction if only English is being edited
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US"));
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("es1", "es"));
additions.add(res, RDFS.label, ResourceFactory.createLangLiteral("en-US2", "en-US"));
preproc.preprocess(retractions, additions, null);
Assert.assertEquals(retractions.size(), 1);
Assert.assertTrue(retractions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US")));
Assert.assertEquals(additions.size(), 1);
Assert.assertTrue(additions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("en-US2", "en-US")));
additions.removeAll();
retractions.removeAll();
// Keep all retractions unmolested if no labels at all are being re-added.
// (The form may be trying to delete the entire individual.)
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US"));
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("es1", "es"));
preproc.preprocess(retractions, additions, null);
Assert.assertEquals(retractions.size(), 2);
Assert.assertTrue(retractions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US")));
Assert.assertTrue(retractions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("es1", "es")));
Assert.assertEquals(additions.size(), 0);
additions.removeAll();
retractions.removeAll();
// Keep both retractions if the form supplies new values for both languages
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US"));
retractions.add(res, RDFS.label, ResourceFactory.createLangLiteral("es1", "es"));
additions.add(res, RDFS.label, ResourceFactory.createLangLiteral("en-US2", "en-US"));
additions.add(res, RDFS.label, ResourceFactory.createLangLiteral("es2", "es"));
preproc.preprocess(retractions, additions, null);
Assert.assertEquals(retractions.size(), 2);
Assert.assertTrue(retractions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("en-US1", "en-US")));
Assert.assertTrue(retractions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("es1", "es")));
Assert.assertEquals(additions.size(), 2);
Assert.assertTrue(additions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("en-US2", "en-US")));
Assert.assertTrue(additions.contains(res, RDFS.label, ResourceFactory.createLangLiteral("es2", "es")));
additions.removeAll();
retractions.removeAll();
}
}

View file

@ -9,10 +9,13 @@ import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import stubs.javax.servlet.http.HttpServletRequestStub;
public class AntiXssValidationTest {
@Test
@ -29,8 +32,10 @@ public class AntiXssValidationTest {
String[] vals= { "some sort of string" };
params.put("X", vals);
VitroRequest vreq = createRequestWithParameters(params);
MultiValueEditSubmission mvEditSub =
new MultiValueEditSubmission(params,eConf);
new MultiValueEditSubmission(vreq,eConf);
Map<String, String> res = validator.validate(eConf, mvEditSub);
Assert.assertEquals(null, res);
@ -53,8 +58,10 @@ public class AntiXssValidationTest {
String[] strings2 = {"no problem 2"};
params.put("Z", strings2 );
VitroRequest vreq = createRequestWithParameters(params);
MultiValueEditSubmission mvEditSub =
new MultiValueEditSubmission(params,eConf);
new MultiValueEditSubmission(vreq,eConf);
Map<String, String> res = validator.validate(eConf, mvEditSub);
Assert.assertNull( res );
@ -72,8 +79,10 @@ public class AntiXssValidationTest {
Map<String, String[]> params = new HashMap<String,String[]>();
params.put("X", strings );
VitroRequest vreq = createRequestWithParameters(params);
MultiValueEditSubmission mvEditSub =
new MultiValueEditSubmission(params,eConf);
new MultiValueEditSubmission(vreq,eConf);
return validator.validate(eConf, mvEditSub);
}
@ -125,5 +134,15 @@ public class AntiXssValidationTest {
Assert.assertNotNull(result);
}
private VitroRequest createRequestWithParameters(Map<String, String[]> parameters) {
HttpServletRequestStub req = new HttpServletRequestStub();
for (String key : parameters.keySet()) {
for (String value : parameters.get(key)) {
req.addParameter(key, value);
}
}
return new VitroRequest(req);
}
}

View file

@ -282,12 +282,12 @@ public class LanguageFilteringRDFServiceTest extends AbstractTestClass {
private Comparator<Object> buildRowIndexedLiteralSortByLang() {
try {
Class<?> clazz = Class.forName(COLLATOR_CLASSNAME);
Class<?>[] argTypes = { LanguageFilteringRDFService.class };
Constructor<?> constructor = clazz.getDeclaredConstructor(argTypes);
Class<?>[] argTypes = { LanguageFilteringRDFService.class, List.class };
Constructor<?> constructor = clazz.getDeclaredConstructor(argTypes);
constructor.setAccessible(true);
return (Comparator<Object>) constructor
.newInstance(filteringRDFService);
.newInstance(filteringRDFService, new AcceptableLanguages(
preferredLanguages));
} catch (Exception e) {
throw new RuntimeException("Could not create a collator", e);
}

View file

@ -37,7 +37,7 @@ public class ThumbnailImageURLTest extends AbstractTestClass{
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
public void setUp() {
setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF);
ApplicationStub.setup(new ServletContextStub(), new SearchEngineStub());

View file

@ -32,7 +32,7 @@ public class DataGetterUtilsTest extends AbstractTestClass{
String dataGetterX = "http://vitro.mannlib.cornell.edu/ontologies/display/1.1#pageDataGetterX";
@Before
public void setUp() throws Exception {
public void setUp() {
// Suppress error logging.
setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF);

View file

@ -36,7 +36,7 @@ public class SparqlQueryDataGetterTest extends AbstractTestClass{
VitroRequest vreq;
@Before
public void setUp() throws Exception {
public void setUp() {
// Suppress error logging.
setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF);

View file

@ -23,6 +23,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
/**
* A minimal implementation of the WebappDaoFactory.
@ -267,4 +268,9 @@ public class WebappDaoFactoryStub implements WebappDaoFactory {
throw new RuntimeException("WebappDaoFactory.close() not implemented.");
}
@Override
public I18nBundle getI18nBundle() {
throw new RuntimeException("WebappDaoFactory.getI18nBundle() not implemented.");
}
}

View file

@ -14,6 +14,7 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle;
import stubs.javax.servlet.ServletContextStub;
/**
* An implementation of I18n for unit tests. Construct a new instance and it
@ -45,6 +46,7 @@ public class I18nStub extends I18n {
/** Make it private, so they will use the setup() method. */
private I18nStub() {
super(new ServletContextStub());
// Nothing to initialize.
}

View file

@ -510,8 +510,7 @@ public class HttpServletRequestStub implements HttpServletRequest {
@Override
public Locale getLocale() {
throw new RuntimeException(
"HttpServletRequestStub.getLocale() not implemented.");
return Locale.ENGLISH;
}
@Override