Skip to content
Snippets Groups Projects
Commit adc4c417 authored by Jonathan Cooper's avatar Jonathan Cooper
Browse files

Merge branch 'EIDCAPPSUP-6886-OGL-licence' into 'develop'

Additional OGL licence url added in Solr indexing

Some OGL metadata records were not being indexed correctly. These records were not appearing in the correct Licence search facet. Needed to add another URL that is a valid OGL url. 

EIDCAPPSUP-6886-OGL-licence

See merge request !34
parents 365d8f5a cc192337
Branches
Tags 2.1.23 2.1.24
1 merge request!34Additional OGL licence url added in Solr indexing
Pipeline #
......@@ -24,6 +24,7 @@ public class SolrIndexGeminiDocumentGenerator implements IndexGenerator<GeminiDo
private static final String OGL_URL = "http://www.nationalarchives.gov.uk/doc/open-government-licence";
private static final String CEH_OGL_URL = "http://eidc.ceh.ac.uk/administration-folder/tools/ceh-standard-licence-texts/cehOGL";
private static final String OTHER_OGL_URL = "http://eidc.ceh.ac.uk/administration-folder/tools/ceh-standard-licence-texts/open-government-licence";
private static final String OTHER_OGL_URL_1 = "http://eidc.ceh.ac.uk/administration-folder/tools/ceh-standard-licence-texts/OGLnonceh";
public static final String IMP_CAMMP_ISSUES_URL = "http://vocabs.ceh.ac.uk/imp/ci/";
public static final String IMP_DATA_TYPE_URL = "http://vocabs.ceh.ac.uk/imp/dt/";
public static final String IMP_SCALE_URL = "http://vocabs.ceh.ac.uk/imp/scale/";
......@@ -78,6 +79,7 @@ public class SolrIndexGeminiDocumentGenerator implements IndexGenerator<GeminiDo
.anyMatch(k -> {
String uri = k.getUri();
return uri.startsWith(OTHER_OGL_URL)
|| uri.startsWith(OTHER_OGL_URL_1)
|| uri.startsWith(CEH_OGL_URL)
|| uri.startsWith(OGL_URL);
});
......
......@@ -102,6 +102,28 @@ public class SolrIndexGeminiDocumentGeneratorTest {
assertEquals("Expected isOgl to be true", "IS OGL", index.getLicence());
}
@Test
public void checkThatIsOglTrueIsTransferredToIndexForOtherFormatOfUrlForAnother(){
//Given
GeminiDocument document = mock(GeminiDocument.class);
when(document.getUseConstraints()).thenReturn(Arrays.asList(
ResourceConstraint.builder()
.uri("http://eidc.ceh.ac.uk/administration-folder/tools/ceh-standard-licence-texts/OGLnonceh/plain")
.build(),
ResourceConstraint.builder()
.value("More use limitations")
.build()
));
when(document.getId()).thenReturn("123");
when(codeLookupService.lookup("licence.isOgl", true)).thenReturn("IS OGL");
//When
SolrIndex index = generator.generateIndex(document);
//Then
assertEquals("Expected isOgl to be true", "IS OGL", index.getLicence());
}
@Test
public void checkThatIsNationalArchivesOglTrueIsTransferredToIndex(){
//Given
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment