Search in sources :

Example 1 with SubmitObjectsRequest

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest in project ipf by oehf.

the class Ebrs30MarshalingTest method verifyExtraMetadataWithJaxbBinding.

@Test
public void verifyExtraMetadataWithJaxbBinding() throws Exception {
    var file = new File(getClass().getClassLoader().getResource("SubmitObjectsRequest_ebrs3_extra_metadata.xml").toURI());
    var unmarshaller = context.createUnmarshaller();
    unmarshaller.setListener(new XdsJaxbDataBinding().getUnmarshallerListener());
    var unmarshalled = unmarshaller.unmarshal(file);
    var original = (SubmitObjectsRequest) unmarshalled;
    int numberOfSlotsInFirstDoc = new EbXMLSubmitObjectsRequest30(original).getExtrinsicObjects().get(0).getSlots().size();
    var marshaller = context.createMarshaller();
    marshaller.setListener(new XdsJaxbDataBinding().getMarshallerListener());
    StringWriter writer = new StringWriter();
    marshaller.marshal(original, writer);
    var unmarshalledSecond = (SubmitObjectsRequest) unmarshaller.unmarshal(new StringReader(writer.toString()));
    int numberOfSlotsInSecondDoc = new EbXMLSubmitObjectsRequest30(unmarshalledSecond).getExtrinsicObjects().get(0).getSlots().size();
    assertEquals(numberOfSlotsInFirstDoc, numberOfSlotsInSecondDoc, "Number of slots after Marshalling and Unmarsshalling does not match");
}
Also used : StringWriter(java.io.StringWriter) XdsJaxbDataBinding(org.openehealth.ipf.commons.ihe.xds.core.XdsJaxbDataBinding) EbXMLSubmitObjectsRequest30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLSubmitObjectsRequest30) StringReader(java.io.StringReader) File(java.io.File) SubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest) Test(org.junit.jupiter.api.Test)

Example 2 with SubmitObjectsRequest

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest in project ipf by oehf.

the class CxfFeatureTest method testFeatureEndpointWithPolicy.

@Disabled("fails with java 9")
@Test
public void testFeatureEndpointWithPolicy() {
    var bf = new SpringBusFactory();
    var bus = bf.createBus("feature-test-resources/client-context.xml");
    SpringBusFactory.setDefaultBus(bus);
    SpringBusFactory.setThreadDefaultBus(bus);
    var client = getClient("feature-test-resources/iti42-with-policy.wsdl", "http://localhost:" + getPort() + "/xds-iti42");
    var requestContext = ((BindingProvider) client).getRequestContext();
    // STSClient stsClient = (STSClient) requestContext.get(SecurityConstants.STS_CLIENT);
    var stsClient = (STSClient) requestContext.get("ws-security.sts.client");
    stsClient.setWsdlLocation("http://localhost:" + getPort() + "/X509?wsdl");
    try {
        client.documentRegistryRegisterDocumentSetB(new SubmitObjectsRequest());
    } catch (SOAPFaultException ex) {
        // ex.printStackTrace();
        fail();
    } finally {
        SpringBusFactory.setThreadDefaultBus(null);
        SpringBusFactory.setDefaultBus(null);
    }
}
Also used : STSClient(org.apache.cxf.ws.security.trust.STSClient) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) BindingProvider(javax.xml.ws.BindingProvider) SubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 3 with SubmitObjectsRequest

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest in project ipf by oehf.

the class XdsSubmitAuditStrategy30 method enrichAuditDatasetFromRequest.

@Override
public XdsSubmitAuditDataset enrichAuditDatasetFromRequest(XdsSubmitAuditDataset auditDataset, Object pojo, Map<String, Object> parameters) {
    if (pojo instanceof SubmitObjectsRequest) {
        var submitObjectsRequest = (SubmitObjectsRequest) pojo;
        EbXMLSubmitObjectsRequest ebXML = new EbXMLSubmitObjectsRequest30(submitObjectsRequest);
        enrichDatasetFromSubmitObjectsRequest(auditDataset, ebXML);
    }
    return auditDataset;
}
Also used : EbXMLSubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLSubmitObjectsRequest) EbXMLSubmitObjectsRequest30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLSubmitObjectsRequest30) SubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest) EbXMLSubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLSubmitObjectsRequest)

Example 4 with SubmitObjectsRequest

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest in project ipf by oehf.

the class Ebrs30MarshalingTest method testFromRealEbXML.

@Test
public void testFromRealEbXML() throws Exception {
    var file = new File(getClass().getClassLoader().getResource("SubmitObjectsRequest_ebrs30.xml").toURI());
    var unmarshaller = context.createUnmarshaller();
    var unmarshalled = unmarshaller.unmarshal(file);
    var original = (SubmitObjectsRequest) unmarshalled;
    var transformer = new RegisterDocumentSetTransformer(factory);
    var result = transformer.fromEbXML(new EbXMLSubmitObjectsRequest30(original));
    var documentEntry = result.getDocumentEntries().get(0);
    assertEquals("Document01", documentEntry.getEntryUuid());
    assertEquals(DocumentEntryType.STABLE, documentEntry.getType());
    assertEquals("Gerald Smitty", documentEntry.getAuthors().get(0).getAuthorPerson().getId().getId());
    var submissionSet = result.getSubmissionSet();
    assertEquals("SubmissionSet01", submissionSet.getEntryUuid());
    assertEquals(1, submissionSet.getAuthors().size());
    assertEquals("Sherry Dopplemeyer", submissionSet.getAuthors().get(0).getAuthorPerson().getId().getId());
    assertEquals(result.getAssociations().get(0).getAssociationType(), AssociationType.HAS_MEMBER);
    assertEquals(result.getAssociations().get(1).getAssociationType(), AssociationType.IS_SNAPSHOT_OF);
}
Also used : RegisterDocumentSetTransformer(org.openehealth.ipf.commons.ihe.xds.core.transform.requests.RegisterDocumentSetTransformer) EbXMLSubmitObjectsRequest30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLSubmitObjectsRequest30) File(java.io.File) SubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest) Test(org.junit.jupiter.api.Test)

Example 5 with SubmitObjectsRequest

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest in project ipf by oehf.

the class Ebrs30MarshalingTest method setUp.

@BeforeEach
public void setUp() throws JAXBException {
    factory = new EbXMLFactory30();
    objectLibrary = factory.createObjectLibrary();
    context = JAXBContext.newInstance("org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs");
    request = new SubmitObjectsRequest();
    var objListElement = new RegistryObjectListType();
    request.setRegistryObjectList(objListElement);
    var objList = objListElement.getIdentifiable();
    docEntry = factory.createExtrinsic("Document01", objectLibrary);
    docEntry.setObjectType(DocumentEntryType.STABLE.getUuid());
    objList.add(new ObjectFactory().createExtrinsicObject(((EbXMLExtrinsicObject30) docEntry).getInternal()));
}
Also used : EbXMLFactory30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30) RegistryObjectListType(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryObjectListType) ObjectFactory(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ObjectFactory) SubmitObjectsRequest(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest) EbXMLExtrinsicObject30(org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLExtrinsicObject30) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SubmitObjectsRequest (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest)6 Test (org.junit.jupiter.api.Test)4 EbXMLSubmitObjectsRequest30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLSubmitObjectsRequest30)3 File (java.io.File)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 BindingProvider (javax.xml.ws.BindingProvider)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 STSClient (org.apache.cxf.ws.security.trust.STSClient)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Disabled (org.junit.jupiter.api.Disabled)1 JaxWsRequestClientFactory (org.openehealth.ipf.commons.ihe.ws.JaxWsRequestClientFactory)1 XdsJaxbDataBinding (org.openehealth.ipf.commons.ihe.xds.core.XdsJaxbDataBinding)1 EbXMLSubmitObjectsRequest (org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLSubmitObjectsRequest)1 EbXMLExtrinsicObject30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLExtrinsicObject30)1 EbXMLFactory30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30)1 ObjectFactory (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ObjectFactory)1 RegistryObjectListType (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryObjectListType)1 RegisterDocumentSetTransformer (org.openehealth.ipf.commons.ihe.xds.core.transform.requests.RegisterDocumentSetTransformer)1