You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am playing around with the framework and trying to retrieve a record (see test case below), but it is failing with something to do with the Transformers:
at com.lyncode.xoai.xml.XSLPipeline.process(XSLPipeline.java:36)
at com.lyncode.xoai.serviceprovider.parsers.RecordParser.parse(RecordParser.java:67)
at com.lyncode.xoai.serviceprovider.parsers.GetRecordParser.parse(GetRecordParser.java:65)
at com.lyncode.xoai.serviceprovider.handler.GetRecordHandler.handle(GetRecordHandler.java:45)
at com.lyncode.xoai.serviceprovider.ServiceProvider.getRecord(ServiceProvider.java:61)
What is missing in the example? This is definitely that would be tackled in #13 .
Note that I've also tried without the context.withTransformer(t). withTransformer the code will reach the exception cycle with two transformers in the list, the one supplied and a null.
public class RemoteRepoTest {
ServiceProvider underTest;
@Before
public void before() throws TransformerConfigurationException, TransformerFactoryConfigurationError{
Context context = new Context().withBaseUrl("http://www.rcaap.pt/oai");
Transformer t = TransformerFactory.newInstance().newTransformer();
context.withTransformer(t);
HttpOAIClient client = new HttpOAIClient(context);
context.withOAIClient(client);
underTest = new ServiceProvider(context);
}
@Test
public void remoteRepoTest() throws Exception {
Identify identify = underTest.identify();
assertEquals(identify.getRepositoryName(), "RCAAP - Repositório Científico de Acesso Aberto de Portugal");
}
@Test
public void getRecord() throws Exception {
GetRecordParameters parameters = new GetRecordParameters().withIdentifier("oai:digituma.uma.pt:10400.13/9").withMetadataFormatPrefix("oai_dc");
Record record = underTest.getRecord(parameters);
record.getAbouts();
}
}
The text was updated successfully, but these errors were encountered:
Following up on this, I advanced a bit, changing the @before (essentially adding the withMetadataTransformer to the context:
@Before
public void before() throws TransformerConfigurationException, TransformerFactoryConfigurationError{
Transformer t = TransformerFactory.newInstance().newTransformer();
Context context = new Context().withBaseUrl("http://www.rcaap.pt/oai").
withMetadataTransformer("oai_dc", t);
HttpOAIClient client = new HttpOAIClient(context);
context.withOAIClient(client);
underTest = new ServiceProvider(context);
}
The exception is now the one below - basically the MetadataParser breaks at "reader.next(elementName(localPart(equalTo("metadata"))));" since it cannot find an element called metadata.
java.util.NoSuchElementException
at org.codehaus.stax2.ri.Stax2EventReaderImpl.throwEndOfInput(Stax2EventReaderImpl.java:453)
at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:242)
at com.lyncode.xml.XmlReader.next(XmlReader.java:132)
at com.lyncode.xoai.serviceprovider.parsers.MetadataParser.parse(MetadataParser.java:39)
at com.lyncode.xoai.serviceprovider.parsers.RecordParser.parse(RecordParser.java:67)
at com.lyncode.xoai.serviceprovider.parsers.GetRecordParser.parse(GetRecordParser.java:65)
at com.lyncode.xoai.serviceprovider.handler.GetRecordHandler.handle(GetRecordHandler.java:45)
at com.lyncode.xoai.serviceprovider.ServiceProvider.getRecord(ServiceProvider.java:61)
It seems the code is trying to find the metadata element twice, because in the RecordParser.parse that preceeds this code the contents of the metadata tag are already being populated in a content String:
I am playing around with the framework and trying to retrieve a record (see test case below), but it is failing with something to do with the Transformers:
What is missing in the example? This is definitely that would be tackled in #13 .
Note that I've also tried without the context.withTransformer(t). withTransformer the code will reach the exception cycle with two transformers in the list, the one supplied and a null.
The text was updated successfully, but these errors were encountered: