Created
June 12, 2014 09:33
-
-
Save mmalmeida/064eeab85eae79b5035e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package at.almeida.tests; | |
| import static org.junit.Assert.assertEquals; | |
| import javax.xml.transform.Transformer; | |
| import javax.xml.transform.TransformerConfigurationException; | |
| import javax.xml.transform.TransformerFactory; | |
| import javax.xml.transform.TransformerFactoryConfigurationError; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| import com.google.common.util.concurrent.CycleDetectingLockFactory.WithExplicitOrdering; | |
| import com.lyncode.xoai.model.oaipmh.Identify; | |
| import com.lyncode.xoai.model.oaipmh.MetadataFormat; | |
| import com.lyncode.xoai.model.oaipmh.Record; | |
| import com.lyncode.xoai.serviceprovider.ServiceProvider; | |
| import com.lyncode.xoai.serviceprovider.client.HttpOAIClient; | |
| import com.lyncode.xoai.serviceprovider.model.Context; | |
| import com.lyncode.xoai.serviceprovider.parameters.GetRecordParameters; | |
| public class RemoteRepoTest { | |
| ServiceProvider underTest; | |
| @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); | |
| 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(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment