diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererAbstract.java b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererAbstract.java new file mode 100644 index 0000000000000000000000000000000000000000..77ea89eeb6416eccb0e417c944479ab7a1bed7ea --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererAbstract.java @@ -0,0 +1,75 @@ +package info.textgrid.middleware; + +import info.textgrid.middleware.oaipmh.ListMetadataFormatsType; +import info.textgrid.middleware.oaipmh.MetadataFormatType; +import info.textgrid.middleware.oaipmh.RequestType; + +/** + * + */ +public abstract class MetadataFormatListDelivererAbstract + implements MetadataFormatListDelivererInterface { + + // + // CLASS + // + + private boolean idExist = true; + + /** + * + */ + public MetadataFormatListDelivererAbstract() { + // + } + + /* + * (non-Javadoc) + * + * @see info.textgrid.middleware.MetadataFormatListDelivererInterface#setMetadataFormatList() + */ + public ListMetadataFormatsType setMetadataFormatList() { + + ListMetadataFormatsType result = new ListMetadataFormatsType(); + + // Add default metadata format (oai_dc). + MetadataFormatType mft = new MetadataFormatType(); + mft.setMetadataPrefix(OAIPMHUtilities.OAIDC_PREFIX); + mft.setMetadataNamespace(OAIPMHUtilities.OAIDC_NAMESPACE); + mft.setSchema(OAIPMHUtilities.OAIDC_SCHEMA_LOCATION); + result.getMetadataFormat().add(mft); + + return result; + } + + /* + * (non-Javadoc) + * + * @see + * info.textgrid.middleware.MetadataFormatListDelivererInterface#requestChecker(info.textgrid. + * middleware.oaipmh.RequestType) + */ + public boolean requestChecker(RequestType request) { + // TODO Auto-generated method stub + return false; + } + + // + // GETTERS & SETTERS + // + + /** + * @return + */ + public boolean isIdExist() { + return this.idExist; + } + + /** + * @param idExist + */ + public void setIdExist(boolean idExist) { + this.idExist = idExist; + } + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererDH.java b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererDH.java new file mode 100644 index 0000000000000000000000000000000000000000..618eebfdfa8446863f1e485155a09cd4a1c9505e --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererDH.java @@ -0,0 +1,74 @@ +package info.textgrid.middleware; + +import java.io.IOException; +import org.elasticsearch.action.get.GetRequest; +import org.elasticsearch.action.get.GetResponse; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.common.Strings; +import org.elasticsearch.search.fetch.subphase.FetchSourceContext; +import info.textgrid.middleware.oaipmh.ListMetadataFormatsType; +import info.textgrid.middleware.oaipmh.MetadataFormatType; + +/** + * + */ +public class MetadataFormatListDelivererDH extends MetadataFormatListDelivererAbstract { + + /** + * + */ + public MetadataFormatListDelivererDH() { + // + } + + /* + * (non-Javadoc) + * + * @see + * info.textgrid.middleware.MetadataFormatListDelivererInterface#setMetadataFormatList(java.lang. + * String) + */ + public ListMetadataFormatsType setMetadataFormatList(String id) { + + String[] includes = new String[] {TGConstants.URI}; + String[] excludes = Strings.EMPTY_ARRAY; + FetchSourceContext fetchSourceContext = new FetchSourceContext(true, includes, excludes); + + ListMetadataFormatsType lmft = new ListMetadataFormatsType(); + MetadataFormatType mft = new MetadataFormatType(); + MetadataFormatType openAireMetadataFormat = new MetadataFormatType(); + + GetRequest getRequest = new GetRequest(OAI_ESClient.getEsIndex(), OAI_ESClient.getEsType(), + id.replace("textgrid:", "")) + .fetchSourceContext(fetchSourceContext); + + GetResponse tgObject = null; + try { + tgObject = OAI_ESClient.getEsClient().get(getRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if (tgObject.isExists()) { + setIdExist(true); + mft.setMetadataPrefix(OAIPMHUtilities.OAIDC_PREFIX); + mft.setMetadataNamespace(OAIPMHUtilities.OAIDC_NAMESPACE); + mft.setSchema(OAIPMHUtilities.OAIDC_SCHEMA_LOCATION); + + openAireMetadataFormat.setMetadataNamespace(OAIPMHUtilities.OPEN_AIRE_NAMESPACE); + openAireMetadataFormat.setMetadataPrefix(TGConstants.METADATA_OPENAIRE_PREFIX); + openAireMetadataFormat.setSchema(OAIPMHUtilities.OPEN_AIRE_SCHEMA_LOCATION); + + lmft.getMetadataFormat().add(mft); + lmft.getMetadataFormat().add(openAireMetadataFormat); + + } else { + setIdExist(false); + lmft = null; + } + + return lmft; + } + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererInterface.java b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..3e373e85dd1a5a88d8789a528e1593220649be84 --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererInterface.java @@ -0,0 +1,28 @@ +package info.textgrid.middleware; + +import info.textgrid.middleware.oaipmh.ListMetadataFormatsType; +import info.textgrid.middleware.oaipmh.RequestType; + +/** + * + */ +public interface MetadataFormatListDelivererInterface { + + /** + * @param id + * @return + */ + public ListMetadataFormatsType setMetadataFormatList(String id); + + /** + * @return + */ + public ListMetadataFormatsType setMetadataFormatList(); + + /** + * @param request + * @return + */ + public boolean requestChecker(RequestType request); + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererTG.java similarity index 60% rename from oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java rename to oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererTG.java index 978700bc296127a902f8cec3b4d9c5b5f201063a..6021f599c4006e4daaa9989624891fa9d4828e41 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDelivererTG.java @@ -8,25 +8,25 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import info.textgrid.middleware.oaipmh.ListMetadataFormatsType; import info.textgrid.middleware.oaipmh.MetadataFormatType; -import info.textgrid.middleware.oaipmh.RequestType; /** * */ -public class MetadataFormatListDeliverer { - - private boolean idExist = true; +public class MetadataFormatListDelivererTG extends MetadataFormatListDelivererAbstract { /** * */ - public MetadataFormatListDeliverer() { + public MetadataFormatListDelivererTG() { // } - /** - * @param id - * @return + /* + * (non-Javadoc) + * + * @see + * info.textgrid.middleware.MetadataFormatListDelivererInterface#setMetadataFormatList(java.lang. + * String) */ public ListMetadataFormatsType setMetadataFormatList(String id) { @@ -37,10 +37,10 @@ public class MetadataFormatListDeliverer { ListMetadataFormatsType lmft = new ListMetadataFormatsType(); MetadataFormatType mft = new MetadataFormatType(); MetadataFormatType openAireMetadataFormat = new MetadataFormatType(); - - GetRequest getRequest = new GetRequest(OAI_ESClient.getEsIndex(), OAI_ESClient.getEsType(), id.replace("textgrid:", "")) - .fetchSourceContext(fetchSourceContext); - + + GetRequest getRequest = new GetRequest(OAI_ESClient.getEsIndex(), OAI_ESClient.getEsType(), + id.replace("textgrid:", "")).fetchSourceContext(fetchSourceContext); + GetResponse tgObject = null; try { tgObject = OAI_ESClient.getEsClient().get(getRequest, RequestOptions.DEFAULT); @@ -54,14 +54,14 @@ public class MetadataFormatListDeliverer { mft.setMetadataPrefix(OAIPMHUtilities.OAIDC_PREFIX); mft.setMetadataNamespace(OAIPMHUtilities.OAIDC_NAMESPACE); mft.setSchema(OAIPMHUtilities.OAIDC_SCHEMA_LOCATION); - + openAireMetadataFormat.setMetadataNamespace(OAIPMHUtilities.OPEN_AIRE_NAMESPACE); openAireMetadataFormat.setMetadataPrefix(TGConstants.METADATA_OPENAIRE_PREFIX); openAireMetadataFormat.setSchema(OAIPMHUtilities.OPEN_AIRE_SCHEMA_LOCATION); - + lmft.getMetadataFormat().add(mft); lmft.getMetadataFormat().add(openAireMetadataFormat); - + } else { setIdExist(false); lmft = null; @@ -70,67 +70,37 @@ public class MetadataFormatListDeliverer { return lmft; } - /** - * @return + /* + * (non-Javadoc) + * + * @see info.textgrid.middleware.MetadataFormatListDelivererInterface#setMetadataFormatList() */ - public ListMetadataFormatsType setMetadataFormatListWithoutId() { + public ListMetadataFormatsType setMetadataFormatList() { - ListMetadataFormatsType lmft = new ListMetadataFormatsType(); - MetadataFormatType mft = new MetadataFormatType(); - MetadataFormatType mftIdiomMets = new MetadataFormatType(); - MetadataFormatType openAireMetadataFormat = new MetadataFormatType(); + ListMetadataFormatsType result = new ListMetadataFormatsType(); + // Add default metadata format (oai_dc). + MetadataFormatType mft = new MetadataFormatType(); mft.setMetadataPrefix(OAIPMHUtilities.OAIDC_PREFIX); mft.setMetadataNamespace(OAIPMHUtilities.OAIDC_NAMESPACE); mft.setSchema(OAIPMHUtilities.OAIDC_SCHEMA_LOCATION); - lmft.getMetadataFormat().add(mft); + result.getMetadataFormat().add(mft); + // Add metadata format for IDIOM. + MetadataFormatType mftIdiomMets = new MetadataFormatType(); mftIdiomMets.setMetadataPrefix(TGConstants.METADATA_IDIOM_PREFIX); mftIdiomMets.setMetadataNamespace(OAIPMHUtilities.METS_NAMESPACE); mftIdiomMets.setSchema(OAIPMHUtilities.METS_SCHEMA_LOCATION); - - openAireMetadataFormat.setMetadataNamespace(OAIPMHUtilities.OPEN_AIRE_NAMESPACE); - openAireMetadataFormat.setMetadataPrefix(TGConstants.METADATA_OPENAIRE_PREFIX); - openAireMetadataFormat.setSchema(OAIPMHUtilities.OPEN_AIRE_SCHEMA_LOCATION); - - lmft.getMetadataFormat().add(mftIdiomMets); - lmft.getMetadataFormat().add(openAireMetadataFormat); + result.getMetadataFormat().add(mftIdiomMets); - return lmft; - } - - /** - * @param request - * @return - */ - public boolean requestChecker(RequestType request) { - - boolean requestCheck = true; - - if (request.getFrom() != null - || request.getMetadataPrefix() != null - || request.getResumptionToken() != null) { - requestCheck = false; - } else if (request.getSet() != null || - request.getUntil() != null) { - requestCheck = false; - } + // Add metadata format for OPEN AIRE. + MetadataFormatType mftOpenAire = new MetadataFormatType(); + mftOpenAire.setMetadataNamespace(OAIPMHUtilities.OPEN_AIRE_NAMESPACE); + mftOpenAire.setMetadataPrefix(TGConstants.METADATA_OPENAIRE_PREFIX); + mftOpenAire.setSchema(OAIPMHUtilities.OPEN_AIRE_SCHEMA_LOCATION); + result.getMetadataFormat().add(mftOpenAire); - return requestCheck; - } - - /** - * @return - */ - public boolean isIdExist() { - return this.idExist; - } - - /** - * @param idExist - */ - public void setIdExist(boolean idExist) { - this.idExist = idExist; + return result; } } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java index 1fe528d9d5f6c97fc1a6122bcaa79d5a08fb6306..05cb95e9c4d36d7e8d6af1bd4b0f0ebb034a6308 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java @@ -61,7 +61,7 @@ public class OAIPMHImpl implements OAIPMHProducer { private IdentifierListDelivererDC identifierListDC; private IdentifierListDelivererIDIOM identifierListIDIOM; - private MetadataFormatListDeliverer metadataFormatList; + private MetadataFormatListDelivererInterface metadataFormatList; private SetDeliverer setList; // ** @@ -90,7 +90,7 @@ public class OAIPMHImpl implements OAIPMHProducer { RecordListDelivererDC recordListDC, // 4 RecordListDelivererIDIOM recordListIDIOM, // 5 OpenAireRecordList openAireRecordList, // 6 - MetadataFormatListDeliverer metadataFormatList, // 7 + MetadataFormatListDelivererInterface metadataFormatList, // 7 SetDeliverer setList, // 8 IdentifierListDelivererDC identifierList, // 9 IdentifierListDelivererIDIOM identifierListIDIOM, // 10 @@ -427,7 +427,7 @@ public class OAIPMHImpl implements OAIPMHProducer { if (this.metadataFormatList.requestChecker(request)) { if (id.isEmpty()) { - listMF = this.metadataFormatList.setMetadataFormatListWithoutId(); + listMF = this.metadataFormatList.setMetadataFormatList(); } else { listMF = this.metadataFormatList.setMetadataFormatList(request.getIdentifier()); } diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDARIAHTest.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDARIAHTest.java deleted file mode 100644 index dd2293d0b58919e2db4e6625eb7a25c47a194d05..0000000000000000000000000000000000000000 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhDARIAHTest.java +++ /dev/null @@ -1,189 +0,0 @@ -package info.textgrid.middleware; - -import java.text.ParseException; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import info.textgrid.middleware.oaipmh.DeletedRecordType; -import info.textgrid.middleware.oaipmh.GranularityType; -import info.textgrid.middleware.common.TextGridMimetypes; - -/** - * - */ -@Ignore -public class OaiPmhDARIAHTest { - - public static OAI_ESClient oaiEsClient; - - private static RecordDelivererDC record; - private static RecordListDelivererDC recordList; - private static IdentifierListDelivererDC identifierList; - private static MetadataFormatListDeliverer metadataFormatList = new MetadataFormatListDeliverer(); - private static SetDeliverer setListDARIAH = new SetDeliverer(false, true); - - private static OpenAireRecord openAireRecord; - private static OpenAireRecordList openAireRecordList; - private static OpenAireIdentifierList openAireIdentifierList; - - - private DeletedRecordType deletedRecordType = DeletedRecordType.NO; - private GranularityType granularityType = GranularityType.YYYY_MM_DD_THH_MM_SS_Z; - private RepIdentification rep = new RepIdentification("DARIAH-DE Repository", - "https://trep.de.dariah.eu", this.deletedRecordType, "2011-06-11T02:32:40Z", - this.granularityType, "2.0", "funk@sub.uni-goettingen.de"); - - /** - * FIXME: it should not be necessary to put idiom record variables for a DARIAH test case - */ - private static RecordDelivererIDIOM recordIDIOM; - private static RecordListDelivererIDIOM recordListIDIOM; - private static IdentifierListDelivererIDIOM identifierListIDIOM = - new IdentifierListDelivererIDIOM(true, false); - - - private OAIPMHImpl request = new OAIPMHImpl( - this.rep, OaiPmhDARIAHTest.record, OaiPmhDARIAHTest.recordIDIOM, OaiPmhDARIAHTest.openAireRecord, OaiPmhDARIAHTest.recordList, - OaiPmhDARIAHTest.recordListIDIOM, OaiPmhDARIAHTest.openAireRecordList, OaiPmhDARIAHTest.metadataFormatList, - OaiPmhDARIAHTest.setListDARIAH, OaiPmhDARIAHTest.identifierList, OaiPmhDARIAHTest.identifierListIDIOM, OaiPmhDARIAHTest.openAireIdentifierList); - - OAIPMHUtilities settings = new OAIPMHUtilities(); - - /** - * @throws Exception - */ - @BeforeClass - public static void setUp() throws Exception { - int[] ports = new int[] {9202}; - oaiEsClient = new OAI_ESClient("localhost", ports, 100); - OAI_ESClient.setEsIndex("dariah-public"); - OAI_ESClient.setEsType("metadata"); - - record = new RecordDelivererDC(false, true); - record.setOaiEsClient(oaiEsClient); - record.setWorkFields(DARIAHConstants.DARIAHFields); - } - - /** - * @throws ParseException - */ - @Test - public void testGetRequestIdentify() throws ParseException { - System.out.println("Test for the verb \"Identify\" with succesfull response"); - String r = this.request.getRequest("Identify", "", "", "", "", "", ""); - System.out.println(r); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - public void testGetRequestGetRecordDariah() throws ParseException { - - OaiPmhDARIAHTest.record.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); - OaiPmhDARIAHTest.record.setCoverage(DARIAHConstants.COVERAGE_LIST); - OaiPmhDARIAHTest.record.setCreator(DARIAHConstants.CREATOR_LIST); - OaiPmhDARIAHTest.record.setDates(DARIAHConstants.DATE_LIST); - OaiPmhDARIAHTest.record.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); - OaiPmhDARIAHTest.record.setFormats(DARIAHConstants.FORMAT_LIST); - OaiPmhDARIAHTest.record.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); - OaiPmhDARIAHTest.record.setLanguages(DARIAHConstants.LANGUAGE_LIST); - OaiPmhDARIAHTest.record.setPublishers(DARIAHConstants.PUBLISHER_LIST); - OaiPmhDARIAHTest.record.setRelations(DARIAHConstants.RELATIONS_LIST); - OaiPmhDARIAHTest.record.setRights(DARIAHConstants.RIGHTS_LIST); - OaiPmhDARIAHTest.record.setSources(DARIAHConstants.SOURCE_LIST); - OaiPmhDARIAHTest.record.setSubjects(DARIAHConstants.SUBJECT_LIST); - OaiPmhDARIAHTest.record.setTitles(DARIAHConstants.TITLE_LIST); - OaiPmhDARIAHTest.record.setTypes(DARIAHConstants.TYPE_LIST); - OaiPmhDARIAHTest.record.setFields(DARIAHConstants.DARIAHFields); - OaiPmhDARIAHTest.record.setFormatField(DARIAHConstants.FORMAT); - OaiPmhDARIAHTest.record.setFormatToFilter("metadata"); - OaiPmhDARIAHTest.record.setDateOfObjectCreation(DARIAHConstants.MODIFIED_FIELD); - OaiPmhDARIAHTest.record.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhDARIAHTest.record.setIdentifierField("administrativeMetadata.dcterms:identifier"); - - System.out.println("Test for the verb \"GetRecord\" for DARIAH with succesfull response"); - String p = this.request.getRequest("GetRecord", "hdl:21.T11991/0000-0005-E1AA-D", "oai_dc", "", - "", "", ""); - System.out.println(p); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - public void testListRecordsDariah() throws ParseException { - - OaiPmhDARIAHTest.recordList.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); - OaiPmhDARIAHTest.recordList.setCoverage(DARIAHConstants.COVERAGE_LIST); - OaiPmhDARIAHTest.recordList.setCreators(DARIAHConstants.CREATOR_LIST); - OaiPmhDARIAHTest.recordList.setDates(DARIAHConstants.DATE_LIST); - OaiPmhDARIAHTest.recordList.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); - OaiPmhDARIAHTest.recordList.setFormats(DARIAHConstants.FORMAT_LIST); - OaiPmhDARIAHTest.recordList.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); - OaiPmhDARIAHTest.recordList.setLanguages(DARIAHConstants.LANGUAGE_LIST); - OaiPmhDARIAHTest.recordList.setPublishers(DARIAHConstants.PUBLISHER_LIST); - OaiPmhDARIAHTest.recordList.setRelations(DARIAHConstants.RELATIONS_LIST); - OaiPmhDARIAHTest.recordList.setRights(DARIAHConstants.RIGHTS_LIST); - OaiPmhDARIAHTest.recordList.setSources(DARIAHConstants.SOURCE_LIST); - OaiPmhDARIAHTest.recordList.setSubjects(DARIAHConstants.SUBJECT_LIST); - OaiPmhDARIAHTest.recordList.setTitles(DARIAHConstants.TITLE_LIST); - OaiPmhDARIAHTest.recordList.setTypes(DARIAHConstants.TYPE_LIST); - OaiPmhDARIAHTest.recordList.setFormatField(DARIAHConstants.FORMAT); - OaiPmhDARIAHTest.recordList.setDateOfObjectCreation(DARIAHConstants.CREATED); - OaiPmhDARIAHTest.recordList.setFieldForRange(DARIAHConstants.MODIFIED_FIELD); - OaiPmhDARIAHTest.recordList.setDateOfObjectCreation(DARIAHConstants.RANGE_FIELD); - OaiPmhDARIAHTest.recordList.setIdentifierField(DARIAHConstants.IDENTIFIER); - OaiPmhDARIAHTest.recordList.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); - OaiPmhDARIAHTest.recordList.setModifiedField(DARIAHConstants.MODIFIED_FIELD); - OaiPmhDARIAHTest.recordList - .setRelationToFurtherMetadataObject("descriptiveMetadata.dc:relation"); - OaiPmhDARIAHTest.recordList.setSearchResponseSize("100"); - - String r = this.request.getRequest("ListRecords", "", "oai_dc", "21.T11991/0000-0003-718E-E", - "", "", ""); - System.out.println(r); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - public void testListSetsDARIAH() throws ParseException { - - OaiPmhDARIAHTest.setListDARIAH.setFormatField(DARIAHConstants.FORMAT); - OaiPmhDARIAHTest.setListDARIAH.setFormatToFilter(DARIAHConstants.COLLECTION_MIMETYPE); - OaiPmhDARIAHTest.setListDARIAH.setIdentifierField(DARIAHConstants.IDENTIFIER); - OaiPmhDARIAHTest.setListDARIAH - .setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhDARIAHTest.setListDARIAH.setIdentifierField("administrativeMetadata.dcterms:identifier"); - OaiPmhDARIAHTest.setListDARIAH.setSpecField("descriptiveMetadata.dc:title"); - OaiPmhDARIAHTest.setListDARIAH.setSpecFieldPrefix(DARIAHConstants.COLLECTIONREGISTRY_PREFIX); - String r = this.request.getRequest("ListSets", "", "", "", "", "", ""); - System.out.println(r); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - public void testListIdentifiersDARIAH() throws ParseException { - - OaiPmhDARIAHTest.identifierList.setFieldForRange(DARIAHConstants.RANGE_FIELD); - OaiPmhDARIAHTest.identifierList.setIdentifierListFields(DARIAHConstants.IDENTIFIER_LIST_FIELDS); - OaiPmhDARIAHTest.identifierList - .setDateOfObjectCreation("administrativeMetadata.dcterms:modified"); - OaiPmhDARIAHTest.identifierList - .setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhDARIAHTest.identifierList.setIdentifierField("administrativeMetadata.dcterms:identifier"); - OaiPmhDARIAHTest.identifierList.setSearchResponseSize("100"); - String r = this.request.getRequest("ListIdentifiers", "", "oai_dc", "", "", "", ""); - System.out.println(r); - System.out.println("-----------------------------------\n"); - } - -} diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestDH.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestDH.java new file mode 100644 index 0000000000000000000000000000000000000000..908ef148a92fa71af0ae29acc0a00ddd1c5d016a --- /dev/null +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestDH.java @@ -0,0 +1,189 @@ +package info.textgrid.middleware; + +import java.text.ParseException; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import info.textgrid.middleware.oaipmh.DeletedRecordType; +import info.textgrid.middleware.oaipmh.GranularityType; +import info.textgrid.middleware.common.TextGridMimetypes; + +/** + * + */ +@Ignore +public class OaiPmhTestDH { + + public static OAI_ESClient oaiEsClient; + + private static RecordDelivererDC record; + private static RecordListDelivererDC recordList; + private static IdentifierListDelivererDC identifierList; + private static MetadataFormatListDelivererInterface metadataFormatList = new MetadataFormatListDelivererDH(); + private static SetDeliverer setListDARIAH = new SetDeliverer(false, true); + + private static OpenAireRecord openAireRecord; + private static OpenAireRecordList openAireRecordList; + private static OpenAireIdentifierList openAireIdentifierList; + + + private DeletedRecordType deletedRecordType = DeletedRecordType.NO; + private GranularityType granularityType = GranularityType.YYYY_MM_DD_THH_MM_SS_Z; + private RepIdentification rep = new RepIdentification("DARIAH-DE Repository", + "https://trep.de.dariah.eu", this.deletedRecordType, "2011-06-11T02:32:40Z", + this.granularityType, "2.0", "funk@sub.uni-goettingen.de"); + + /** + * FIXME: it should not be necessary to put idiom record variables for a DARIAH test case + */ + private static RecordDelivererIDIOM recordIDIOM; + private static RecordListDelivererIDIOM recordListIDIOM; + private static IdentifierListDelivererIDIOM identifierListIDIOM = + new IdentifierListDelivererIDIOM(true, false); + + + private OAIPMHImpl request = new OAIPMHImpl( + this.rep, OaiPmhTestDH.record, OaiPmhTestDH.recordIDIOM, OaiPmhTestDH.openAireRecord, OaiPmhTestDH.recordList, + OaiPmhTestDH.recordListIDIOM, OaiPmhTestDH.openAireRecordList, OaiPmhTestDH.metadataFormatList, + OaiPmhTestDH.setListDARIAH, OaiPmhTestDH.identifierList, OaiPmhTestDH.identifierListIDIOM, OaiPmhTestDH.openAireIdentifierList); + + OAIPMHUtilities settings = new OAIPMHUtilities(); + + /** + * @throws Exception + */ + @BeforeClass + public static void setUp() throws Exception { + int[] ports = new int[] {9202}; + oaiEsClient = new OAI_ESClient("localhost", ports, 100); + OAI_ESClient.setEsIndex("dariah-public"); + OAI_ESClient.setEsType("metadata"); + + record = new RecordDelivererDC(false, true); + record.setOaiEsClient(oaiEsClient); + record.setWorkFields(DARIAHConstants.DARIAHFields); + } + + /** + * @throws ParseException + */ + @Test + public void testGetRequestIdentify() throws ParseException { + System.out.println("Test for the verb \"Identify\" with succesfull response"); + String r = this.request.getRequest("Identify", "", "", "", "", "", ""); + System.out.println(r); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + public void testGetRequestGetRecordDariah() throws ParseException { + + OaiPmhTestDH.record.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); + OaiPmhTestDH.record.setCoverage(DARIAHConstants.COVERAGE_LIST); + OaiPmhTestDH.record.setCreator(DARIAHConstants.CREATOR_LIST); + OaiPmhTestDH.record.setDates(DARIAHConstants.DATE_LIST); + OaiPmhTestDH.record.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); + OaiPmhTestDH.record.setFormats(DARIAHConstants.FORMAT_LIST); + OaiPmhTestDH.record.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); + OaiPmhTestDH.record.setLanguages(DARIAHConstants.LANGUAGE_LIST); + OaiPmhTestDH.record.setPublishers(DARIAHConstants.PUBLISHER_LIST); + OaiPmhTestDH.record.setRelations(DARIAHConstants.RELATIONS_LIST); + OaiPmhTestDH.record.setRights(DARIAHConstants.RIGHTS_LIST); + OaiPmhTestDH.record.setSources(DARIAHConstants.SOURCE_LIST); + OaiPmhTestDH.record.setSubjects(DARIAHConstants.SUBJECT_LIST); + OaiPmhTestDH.record.setTitles(DARIAHConstants.TITLE_LIST); + OaiPmhTestDH.record.setTypes(DARIAHConstants.TYPE_LIST); + OaiPmhTestDH.record.setFields(DARIAHConstants.DARIAHFields); + OaiPmhTestDH.record.setFormatField(DARIAHConstants.FORMAT); + OaiPmhTestDH.record.setFormatToFilter("metadata"); + OaiPmhTestDH.record.setDateOfObjectCreation(DARIAHConstants.MODIFIED_FIELD); + OaiPmhTestDH.record.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestDH.record.setIdentifierField("administrativeMetadata.dcterms:identifier"); + + System.out.println("Test for the verb \"GetRecord\" for DARIAH with succesfull response"); + String p = this.request.getRequest("GetRecord", "hdl:21.T11991/0000-0005-E1AA-D", "oai_dc", "", + "", "", ""); + System.out.println(p); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + public void testListRecordsDariah() throws ParseException { + + OaiPmhTestDH.recordList.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); + OaiPmhTestDH.recordList.setCoverage(DARIAHConstants.COVERAGE_LIST); + OaiPmhTestDH.recordList.setCreators(DARIAHConstants.CREATOR_LIST); + OaiPmhTestDH.recordList.setDates(DARIAHConstants.DATE_LIST); + OaiPmhTestDH.recordList.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); + OaiPmhTestDH.recordList.setFormats(DARIAHConstants.FORMAT_LIST); + OaiPmhTestDH.recordList.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); + OaiPmhTestDH.recordList.setLanguages(DARIAHConstants.LANGUAGE_LIST); + OaiPmhTestDH.recordList.setPublishers(DARIAHConstants.PUBLISHER_LIST); + OaiPmhTestDH.recordList.setRelations(DARIAHConstants.RELATIONS_LIST); + OaiPmhTestDH.recordList.setRights(DARIAHConstants.RIGHTS_LIST); + OaiPmhTestDH.recordList.setSources(DARIAHConstants.SOURCE_LIST); + OaiPmhTestDH.recordList.setSubjects(DARIAHConstants.SUBJECT_LIST); + OaiPmhTestDH.recordList.setTitles(DARIAHConstants.TITLE_LIST); + OaiPmhTestDH.recordList.setTypes(DARIAHConstants.TYPE_LIST); + OaiPmhTestDH.recordList.setFormatField(DARIAHConstants.FORMAT); + OaiPmhTestDH.recordList.setDateOfObjectCreation(DARIAHConstants.CREATED); + OaiPmhTestDH.recordList.setFieldForRange(DARIAHConstants.MODIFIED_FIELD); + OaiPmhTestDH.recordList.setDateOfObjectCreation(DARIAHConstants.RANGE_FIELD); + OaiPmhTestDH.recordList.setIdentifierField(DARIAHConstants.IDENTIFIER); + OaiPmhTestDH.recordList.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); + OaiPmhTestDH.recordList.setModifiedField(DARIAHConstants.MODIFIED_FIELD); + OaiPmhTestDH.recordList + .setRelationToFurtherMetadataObject("descriptiveMetadata.dc:relation"); + OaiPmhTestDH.recordList.setSearchResponseSize("100"); + + String r = this.request.getRequest("ListRecords", "", "oai_dc", "21.T11991/0000-0003-718E-E", + "", "", ""); + System.out.println(r); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + public void testListSetsDARIAH() throws ParseException { + + OaiPmhTestDH.setListDARIAH.setFormatField(DARIAHConstants.FORMAT); + OaiPmhTestDH.setListDARIAH.setFormatToFilter(DARIAHConstants.COLLECTION_MIMETYPE); + OaiPmhTestDH.setListDARIAH.setIdentifierField(DARIAHConstants.IDENTIFIER); + OaiPmhTestDH.setListDARIAH + .setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestDH.setListDARIAH.setIdentifierField("administrativeMetadata.dcterms:identifier"); + OaiPmhTestDH.setListDARIAH.setSpecField("descriptiveMetadata.dc:title"); + OaiPmhTestDH.setListDARIAH.setSpecFieldPrefix(DARIAHConstants.COLLECTIONREGISTRY_PREFIX); + String r = this.request.getRequest("ListSets", "", "", "", "", "", ""); + System.out.println(r); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + public void testListIdentifiersDARIAH() throws ParseException { + + OaiPmhTestDH.identifierList.setFieldForRange(DARIAHConstants.RANGE_FIELD); + OaiPmhTestDH.identifierList.setIdentifierListFields(DARIAHConstants.IDENTIFIER_LIST_FIELDS); + OaiPmhTestDH.identifierList + .setDateOfObjectCreation("administrativeMetadata.dcterms:modified"); + OaiPmhTestDH.identifierList + .setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestDH.identifierList.setIdentifierField("administrativeMetadata.dcterms:identifier"); + OaiPmhTestDH.identifierList.setSearchResponseSize("100"); + String r = this.request.getRequest("ListIdentifiers", "", "oai_dc", "", "", "", ""); + System.out.println(r); + System.out.println("-----------------------------------\n"); + } + +} diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestTG.java similarity index 74% rename from oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java rename to oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestTG.java index 683b3b2940822ba1fe7d165418e6f47e4da27400..6bf7ef278adbfc192e4d0dacd385a7ef416b94a7 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTestTG.java @@ -21,7 +21,7 @@ import info.textgrid.middleware.common.TextGridMimetypes; * @author Stefan E. Funk, SUB Göttingen */ -public class OaiPmhTest { +public class OaiPmhTestTG { // ** // STATICS @@ -49,11 +49,11 @@ public class OaiPmhTest { private GranularityType bla2 = GranularityType.YYYY_MM_DD_THH_MM_SS_Z; private RepIdentification rep = new RepIdentification("TextGrid-Repository", "www.textgridrep.de", this.bla, "2011-06-11T02:32:40Z", this.bla2, "2.0", "textgrid-support@gwdg.de"); - private MetadataFormatListDeliverer metadataFormatList = new MetadataFormatListDeliverer(); + private MetadataFormatListDelivererInterface metadataFormatList = new MetadataFormatListDelivererTG(); private OAIPMHImpl request = new OAIPMHImpl( - this.rep, OaiPmhTest.record, OaiPmhTest.recordIDIOM, OaiPmhTest.openAireRecord, OaiPmhTest.recordList, - OaiPmhTest.recordListIDIOM, OaiPmhTest.openAireRecordList, this.metadataFormatList, - OaiPmhTest.setListTextGrid, OaiPmhTest.identifierList, OaiPmhTest.identifierListIDIOM, OaiPmhTest.openAireIdentifierList); + this.rep, OaiPmhTestTG.record, OaiPmhTestTG.recordIDIOM, OaiPmhTestTG.openAireRecord, OaiPmhTestTG.recordList, + OaiPmhTestTG.recordListIDIOM, OaiPmhTestTG.openAireRecordList, this.metadataFormatList, + OaiPmhTestTG.setListTextGrid, OaiPmhTestTG.identifierList, OaiPmhTestTG.identifierListIDIOM, OaiPmhTestTG.openAireIdentifierList); OAIPMHUtilities settings = new OAIPMHUtilities(); /** @@ -305,12 +305,12 @@ public class OaiPmhTest { @Test @Ignore public void testListIdentifierSetsDC() throws ParseException { - OaiPmhTest.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - OaiPmhTest.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - OaiPmhTest.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - OaiPmhTest.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhTest.identifierList.setIdentifierField("textgridUri"); - OaiPmhTest.identifierList.setSearchResponseSize("100"); + OaiPmhTestTG.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + OaiPmhTestTG.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + OaiPmhTestTG.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTestTG.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestTG.identifierList.setIdentifierField("textgridUri"); + OaiPmhTestTG.identifierList.setSearchResponseSize("100"); System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); String p = this.request.getRequest("ListIdentifiers", "", "oai_dc", "", "2000-02-05", "", "junk"); System.out.println(p); @@ -323,12 +323,12 @@ public class OaiPmhTest { @Test @Ignore public void testListIdentifierWithResumptionTokenDC() throws ParseException { - OaiPmhTest.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - OaiPmhTest.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - OaiPmhTest.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - OaiPmhTest.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhTest.identifierList.setIdentifierField("textgridUri"); - OaiPmhTest.identifierList.setSearchResponseSize("100"); + OaiPmhTestTG.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + OaiPmhTestTG.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + OaiPmhTestTG.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTestTG.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestTG.identifierList.setIdentifierField("textgridUri"); + OaiPmhTestTG.identifierList.setSearchResponseSize("100"); System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); String p = this.request.getRequest("ListIdentifiers", "", "oai_dc", "", "", "", ""); System.out.println(p); @@ -399,30 +399,30 @@ public class OaiPmhTest { @Test @Ignore public void testListRecordSets() throws ParseException { - OaiPmhTest.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); - OaiPmhTest.recordList.setCoverage(TGConstants.COVERAGE_LIST); - OaiPmhTest.recordList.setCreators(TGConstants.CREATOR_LIST); - OaiPmhTest.recordList.setDates(TGConstants.DATE_LIST); - OaiPmhTest.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); - OaiPmhTest.recordList.setFormats(TGConstants.FORMAT_LIST); - OaiPmhTest.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); - OaiPmhTest.recordList.setLanguages(TGConstants.LANGUAGE_LIST); - OaiPmhTest.recordList.setPublishers(TGConstants.PUBLISHER_LIST); - OaiPmhTest.recordList.setRelations(TGConstants.RELATIONS_LIST); - OaiPmhTest.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); - OaiPmhTest.recordList.setRights(TGConstants.RIGHTS_LIST); - OaiPmhTest.recordList.setSources(TGConstants.SOURCE_LIST); - OaiPmhTest.recordList.setSubjects(TGConstants.SUBJECT_LIST); - OaiPmhTest.recordList.setTitles(TGConstants.TITLE_LIST); - OaiPmhTest.recordList.setTypes(TGConstants.TYPE_LIST); - OaiPmhTest.recordList.setFormatField(TGConstants.FORMAT); - OaiPmhTest.recordList.setFormatToFilter(TextGridMimetypes.EDITION); - OaiPmhTest.recordList.setDateOfObjectCreation(TGConstants.CREATED); - OaiPmhTest.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - OaiPmhTest.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhTest.recordList.setFieldForRange(TGConstants.CREATED); - OaiPmhTest.recordList.setModifiedField(TGConstants.MODIFIED_FIELD); - OaiPmhTest.recordList.setIdentifierField("textgridUri"); + OaiPmhTestTG.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); + OaiPmhTestTG.recordList.setCoverage(TGConstants.COVERAGE_LIST); + OaiPmhTestTG.recordList.setCreators(TGConstants.CREATOR_LIST); + OaiPmhTestTG.recordList.setDates(TGConstants.DATE_LIST); + OaiPmhTestTG.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); + OaiPmhTestTG.recordList.setFormats(TGConstants.FORMAT_LIST); + OaiPmhTestTG.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); + OaiPmhTestTG.recordList.setLanguages(TGConstants.LANGUAGE_LIST); + OaiPmhTestTG.recordList.setPublishers(TGConstants.PUBLISHER_LIST); + OaiPmhTestTG.recordList.setRelations(TGConstants.RELATIONS_LIST); + OaiPmhTestTG.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + OaiPmhTestTG.recordList.setRights(TGConstants.RIGHTS_LIST); + OaiPmhTestTG.recordList.setSources(TGConstants.SOURCE_LIST); + OaiPmhTestTG.recordList.setSubjects(TGConstants.SUBJECT_LIST); + OaiPmhTestTG.recordList.setTitles(TGConstants.TITLE_LIST); + OaiPmhTestTG.recordList.setTypes(TGConstants.TYPE_LIST); + OaiPmhTestTG.recordList.setFormatField(TGConstants.FORMAT); + OaiPmhTestTG.recordList.setFormatToFilter(TextGridMimetypes.EDITION); + OaiPmhTestTG.recordList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTestTG.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + OaiPmhTestTG.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestTG.recordList.setFieldForRange(TGConstants.CREATED); + OaiPmhTestTG.recordList.setModifiedField(TGConstants.MODIFIED_FIELD); + OaiPmhTestTG.recordList.setIdentifierField("textgridUri"); System.out.println("Test for the verb \"ListRecords\" with sets with succesfull response"); //String p = this.request.getRequest("ListRecords", "", "oai_dc", "project:TGPR-f89ad029-4eb2-ae5c-6028-5db876513128", "", "", ""); @@ -483,31 +483,31 @@ public class OaiPmhTest { @Ignore public void testListRecords2() throws ParseException { System.out.println("HU"); - OaiPmhTest.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); - OaiPmhTest.recordList.setCoverage(TGConstants.COVERAGE_LIST); - OaiPmhTest.recordList.setCreators(TGConstants.CREATOR_LIST); - OaiPmhTest.recordList.setDates(TGConstants.DATE_LIST); - OaiPmhTest.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); - OaiPmhTest.recordList.setFormats(TGConstants.FORMAT_LIST); - OaiPmhTest.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); - OaiPmhTest.recordList.setLanguages(TGConstants.LANGUAGE_LIST); - OaiPmhTest.recordList.setPublishers(TGConstants.PUBLISHER_LIST); - OaiPmhTest.recordList.setRelations(TGConstants.RELATIONS_LIST); - OaiPmhTest.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); - OaiPmhTest.recordList.setRights(TGConstants.RIGHTS_LIST); - OaiPmhTest.recordList.setSources(TGConstants.SOURCE_LIST); - OaiPmhTest.recordList.setSubjects(TGConstants.SUBJECT_LIST); - OaiPmhTest.recordList.setTitles(TGConstants.TITLE_LIST); - OaiPmhTest.recordList.setTypes(TGConstants.TYPE_LIST); - OaiPmhTest.recordList.setFormatField(TGConstants.FORMAT); - OaiPmhTest.recordList.setFormatToFilter(TextGridMimetypes.EDITION); - OaiPmhTest.recordList.setDateOfObjectCreation(TGConstants.CREATED); - OaiPmhTest.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - OaiPmhTest.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - OaiPmhTest.recordList.setFieldForRange(TGConstants.CREATED); - OaiPmhTest.recordList.setModifiedField(TGConstants.CREATED); - OaiPmhTest.recordList.setIdentifierField(TGConstants.URI); - OaiPmhTest.recordList.setSearchResponseSize("100"); + OaiPmhTestTG.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); + OaiPmhTestTG.recordList.setCoverage(TGConstants.COVERAGE_LIST); + OaiPmhTestTG.recordList.setCreators(TGConstants.CREATOR_LIST); + OaiPmhTestTG.recordList.setDates(TGConstants.DATE_LIST); + OaiPmhTestTG.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); + OaiPmhTestTG.recordList.setFormats(TGConstants.FORMAT_LIST); + OaiPmhTestTG.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); + OaiPmhTestTG.recordList.setLanguages(TGConstants.LANGUAGE_LIST); + OaiPmhTestTG.recordList.setPublishers(TGConstants.PUBLISHER_LIST); + OaiPmhTestTG.recordList.setRelations(TGConstants.RELATIONS_LIST); + OaiPmhTestTG.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + OaiPmhTestTG.recordList.setRights(TGConstants.RIGHTS_LIST); + OaiPmhTestTG.recordList.setSources(TGConstants.SOURCE_LIST); + OaiPmhTestTG.recordList.setSubjects(TGConstants.SUBJECT_LIST); + OaiPmhTestTG.recordList.setTitles(TGConstants.TITLE_LIST); + OaiPmhTestTG.recordList.setTypes(TGConstants.TYPE_LIST); + OaiPmhTestTG.recordList.setFormatField(TGConstants.FORMAT); + OaiPmhTestTG.recordList.setFormatToFilter(TextGridMimetypes.EDITION); + OaiPmhTestTG.recordList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTestTG.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + OaiPmhTestTG.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTestTG.recordList.setFieldForRange(TGConstants.CREATED); + OaiPmhTestTG.recordList.setModifiedField(TGConstants.CREATED); + OaiPmhTestTG.recordList.setIdentifierField(TGConstants.URI); + OaiPmhTestTG.recordList.setSearchResponseSize("100"); String r = this.request.getRequest("ListRecords", "", "oai_dc", "", "", "", ""); System.out.println(r); System.out.println("-----------------------------------\n"); @@ -541,10 +541,10 @@ public class OaiPmhTest { @Test @Ignore public void testListSetsTG() throws ParseException { - OaiPmhTest.setListTextGrid.setFormatField("format"); - OaiPmhTest.setListTextGrid.setFormatToFilter(TextGridMimetypes.EDITION); - OaiPmhTest.setListTextGrid.setIdentifierField("textgridUri"); - OaiPmhTest.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); + OaiPmhTestTG.setListTextGrid.setFormatField("format"); + OaiPmhTestTG.setListTextGrid.setFormatToFilter(TextGridMimetypes.EDITION); + OaiPmhTestTG.setListTextGrid.setIdentifierField("textgridUri"); + OaiPmhTestTG.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); String r = this.request.getRequest("ListSets", "", "", "", "", "", ""); System.out.println(r); System.out.println("-----------------------------------\n"); @@ -556,10 +556,10 @@ public class OaiPmhTest { @Test @Ignore public void testListSetsDH() throws ParseException { - OaiPmhTest.setListTextGrid.setFormatField("format"); - OaiPmhTest.setListTextGrid.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); - OaiPmhTest.setListTextGrid.setIdentifierField("textgridUri"); - OaiPmhTest.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); + OaiPmhTestTG.setListTextGrid.setFormatField("format"); + OaiPmhTestTG.setListTextGrid.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); + OaiPmhTestTG.setListTextGrid.setIdentifierField("textgridUri"); + OaiPmhTestTG.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); String r = this.request.getRequest("ListSets", "", "", "", "", "", ""); System.out.println(r); System.out.println("-----------------------------------\n"); @@ -571,12 +571,12 @@ public class OaiPmhTest { @Test @Ignore public void testEmptyRequest() throws ParseException { - OaiPmhTest.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - OaiPmhTest.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - OaiPmhTest.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - OaiPmhTest.identifierList.setIdentifierField("textgridUri"); - OaiPmhTest.identifierList.setRepositoryObjectURIPrefix("textgrid:"); - OaiPmhTest.identifierList.setSearchResponseSize("100"); + OaiPmhTestTG.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + OaiPmhTestTG.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + OaiPmhTestTG.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTestTG.identifierList.setIdentifierField("textgridUri"); + OaiPmhTestTG.identifierList.setRepositoryObjectURIPrefix("textgrid:"); + OaiPmhTestTG.identifierList.setSearchResponseSize("100"); String r = this.request.getRequest("", "", "", "", "", "", ""); System.out.println(r); System.out.println("-----------------------------------\n");