Search in sources :

Example 1 with ExpiringResponse

use of com.ibm.lsid.ExpiringResponse in project cdmlib by cybertaxonomy.

the class AuthorityControllerTest method setUp.

@Before
public void setUp() {
    try {
        lsid = new LSID("urn:lsid:example.org:taxonconcept:1");
    } catch (MalformedLSIDException e) {
    }
    try {
        lsidAuthority = new LSIDAuthority("fred.org");
    } catch (MalformedLSIDException e) {
    }
    authorityService = org.easymock.classextension.EasyMock.createMock(LSIDAuthorityService.class);
    authorityController = new AuthorityController();
    source = new Object();
    expiringResponse = new ExpiringResponse(source, null);
}
Also used : LSID(eu.etaxonomy.cdm.model.common.LSID) LSIDAuthorityService(eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService) MalformedLSIDException(com.ibm.lsid.MalformedLSIDException) TestedObject(org.unitils.inject.annotation.TestedObject) LSIDAuthority(eu.etaxonomy.cdm.model.common.LSIDAuthority) ExpiringResponse(com.ibm.lsid.ExpiringResponse) Before(org.junit.Before)

Example 2 with ExpiringResponse

use of com.ibm.lsid.ExpiringResponse in project cdmlib by cybertaxonomy.

the class LsidAuthorityServiceImpl method getAuthorityWSDL.

@Override
public ExpiringResponse getAuthorityWSDL() throws LSIDServerException {
    LSID lsid = null;
    LSIDWSDLWrapper wsdl = lsidWSDLWrapperFactory.getLSIDWSDLWrapper(lsid);
    try {
        wsdl.setAuthorityLocation(new HTTPLocation("AuthorityServiceHTTP", "HTTPPort", lsidDomain, lsidPort, null));
        // lsidWSDLWrapperFactory.setAuthorityLocation(new SOAPLocation("AuthorityServiceSOAP", "SOAPPort", "http://" + lsidDomain	+ ":" + lsidPort + "/authority/soap/"), wsdl);
        return new ExpiringResponse(wsdl.getWSDLSource(), getExpiration());
    } catch (LSIDException e) {
        throw new LSIDServerException(e, e.getErrorCode(), "LSIDAuthorityServiceImpl Error in getAuthorityWSDL");
    } catch (WSDLException e) {
        throw new LSIDServerException(e, LSIDServerException.INTERNAL_PROCESSING_ERROR, "LSIDAuthorityServiceImpl Error in getAuthorityWSDL");
    }
}
Also used : LSID(eu.etaxonomy.cdm.model.common.LSID) LSIDException(com.ibm.lsid.LSIDException) WSDLException(javax.wsdl.WSDLException) LSIDWSDLWrapper(eu.etaxonomy.cdm.api.service.lsid.LSIDWSDLWrapper) LSIDServerException(com.ibm.lsid.server.LSIDServerException) HTTPLocation(com.ibm.lsid.wsdl.HTTPLocation) ExpiringResponse(com.ibm.lsid.ExpiringResponse)

Example 3 with ExpiringResponse

use of com.ibm.lsid.ExpiringResponse in project cdmlib by cybertaxonomy.

the class LSIDAuthorityServiceTest method testGetAuthorityWSDL.

@Test
public void testGetAuthorityWSDL() throws Exception {
    ExpiringResponse expiringResponse = lsidAuthorityService.getAuthorityWSDL();
    String resource = "/eu/etaxonomy/cdm/api/service/lsid/LSIDAuthorityServiceTest.testGetAuthorityWSDL-result.wsdl";
    String result = transformSourceToString((Source) expiringResponse.getValue());
    assertXMLEqual("getAuthorityWSDL should return an xml source equal to the test resource", new InputStreamReader(this.getClass().getResourceAsStream(resource)), new StringReader(result));
}
Also used : InputStreamReader(java.io.InputStreamReader) StringReader(java.io.StringReader) ExpiringResponse(com.ibm.lsid.ExpiringResponse) CdmIntegrationTest(eu.etaxonomy.cdm.test.integration.CdmIntegrationTest) Test(org.junit.Test)

Example 4 with ExpiringResponse

use of com.ibm.lsid.ExpiringResponse in project cdmlib by cybertaxonomy.

the class LSIDAuthorityServiceTest method testGetAvailableServicesWithKnownLSID.

/**
 * Unfortunately, the ordering of the services switches round between linux and windows.
 * This is why we ignore this test failure.
 *
 * @throws Exception
 */
@Test
@Ignore
public void testGetAvailableServicesWithKnownLSID() throws Exception {
    ExpiringResponse expiringResponse = lsidAuthorityService.getAvailableServices(knownLsid);
    String resource = "/eu/etaxonomy/cdm/api/service/lsid/LSIDAuthorityServiceTest.testGetAvailableServicesWithKnownLSID-result.wsdl";
    String result = transformSourceToString((Source) expiringResponse.getValue());
    assertXMLEqual("getAvailableServices should return an xml source equal to the test resource", new InputStreamReader(this.getClass().getResourceAsStream(resource)), new StringReader(result));
}
Also used : InputStreamReader(java.io.InputStreamReader) StringReader(java.io.StringReader) ExpiringResponse(com.ibm.lsid.ExpiringResponse) Ignore(org.junit.Ignore) CdmIntegrationTest(eu.etaxonomy.cdm.test.integration.CdmIntegrationTest) Test(org.junit.Test)

Aggregations

ExpiringResponse (com.ibm.lsid.ExpiringResponse)4 LSID (eu.etaxonomy.cdm.model.common.LSID)2 CdmIntegrationTest (eu.etaxonomy.cdm.test.integration.CdmIntegrationTest)2 InputStreamReader (java.io.InputStreamReader)2 StringReader (java.io.StringReader)2 Test (org.junit.Test)2 LSIDException (com.ibm.lsid.LSIDException)1 MalformedLSIDException (com.ibm.lsid.MalformedLSIDException)1 LSIDServerException (com.ibm.lsid.server.LSIDServerException)1 HTTPLocation (com.ibm.lsid.wsdl.HTTPLocation)1 LSIDAuthorityService (eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService)1 LSIDWSDLWrapper (eu.etaxonomy.cdm.api.service.lsid.LSIDWSDLWrapper)1 LSIDAuthority (eu.etaxonomy.cdm.model.common.LSIDAuthority)1 WSDLException (javax.wsdl.WSDLException)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1 TestedObject (org.unitils.inject.annotation.TestedObject)1