Search in sources :

Example 1 with DefaultXdmXdsTransformer

use of org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testGetDocId_SubmitObjectsRequest.

/**
     * Test the getDocId(SubmitObjectsRequest) method.
     */
public void testGetDocId_SubmitObjectsRequest() {
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    QName qname = null;
    String output = null;
    SubmitObjectsRequest input = null;
    ExternalIdentifierType eit = null;
    RegistryObjectListType registryObject = null;
    RegistryPackageType registryPackageType = null;
    ExtrinsicObjectType extrinsicObjectType = null;
    List<ExternalIdentifierType> externalIdentifiers = null;
    JAXBElement<ExtrinsicObjectType> jaxbExtrinsicObject = null;
    JAXBElement<RegistryPackageType> jaxbRegistryPackageTypeObject = null;
    List<JAXBElement<? extends IdentifiableType>> identifiableList = null;
    registryObject = new RegistryObjectListType();
    identifiableList = registryObject.getIdentifiable();
    eit = new ExternalIdentifierType();
    eit.setIdentificationScheme("urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab");
    eit.setValue("eitValue");
    extrinsicObjectType = new ExtrinsicObjectType();
    externalIdentifiers = extrinsicObjectType.getExternalIdentifier();
    externalIdentifiers.add(eit);
    qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "ExtrinsicObject");
    jaxbExtrinsicObject = new JAXBElement<ExtrinsicObjectType>(qname, ExtrinsicObjectType.class, extrinsicObjectType);
    registryPackageType = new RegistryPackageType();
    qname = new QName("urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0", "RegistryPackage");
    jaxbRegistryPackageTypeObject = new JAXBElement<RegistryPackageType>(qname, RegistryPackageType.class, registryPackageType);
    identifiableList.add(jaxbRegistryPackageTypeObject);
    identifiableList.add(jaxbExtrinsicObject);
    input = new SubmitObjectsRequest();
    input.setRegistryObjectList(registryObject);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", "eitValue", output);
    registryObject = new RegistryObjectListType();
    input = new SubmitObjectsRequest();
    input.setRegistryObjectList(registryObject);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", null, output);
}
Also used : RegistryObjectListType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType) IdentifiableType(oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType) QName(javax.xml.namespace.QName) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) ExternalIdentifierType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType) JAXBElement(javax.xml.bind.JAXBElement) SubmitObjectsRequest(oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest) DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer)

Example 2 with DefaultXdmXdsTransformer

use of org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testGetSubmissionSetDirspec.

/**
     * Test the getSubmissionSetDirspec method.
     */
public void testGetSubmissionSetDirspec() {
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    String input = null;
    String output = null;
    input = "123";
    output = transformer.getSubmissionSetDirspec(input);
    assertEquals("Output does not match expected", "", output);
    input = "123\\456";
    output = transformer.getSubmissionSetDirspec(input);
    assertEquals("Output does not match expected", "123", output);
    input = "123\\456\\789";
    output = transformer.getSubmissionSetDirspec(input);
    assertEquals("Output does not match expected", "123/456", output);
    input = "";
    output = transformer.getSubmissionSetDirspec(input);
    assertEquals("Output does not match expected", "", output);
    input = null;
    output = transformer.getSubmissionSetDirspec(input);
    assertEquals("Output does not match expected", null, output);
}
Also used : DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer)

Example 3 with DefaultXdmXdsTransformer

use of org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testMatchName.

/**
     * Test the matchName method.
     */
public void testMatchName() {
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    String zname = null;
    String subsetDirspec = null;
    String subsetFilespec = null;
    boolean output = false;
    zname = "SUBSETDIRSPEC\\FILE\\SPEC";
    subsetDirspec = "SUBSETDIRSPEC";
    subsetFilespec = "FILE/SPEC";
    output = transformer.matchName(zname, subsetDirspec, subsetFilespec);
    assertEquals("Output does not match expected", true, output);
    zname = "SUBSETDIRSPEC/FILE/SPEC";
    subsetDirspec = "SUBSETDIRSPEC";
    subsetFilespec = "FILE/SPEC";
    output = transformer.matchName(zname, subsetDirspec, subsetFilespec);
    assertEquals("Output does not match expected", true, output);
    zname = "ZNAME";
    subsetDirspec = "SUBSETDIRSPEC";
    subsetFilespec = "FILE/SPEC";
    output = transformer.matchName(zname, subsetDirspec, subsetFilespec);
    assertEquals("Output does not match expected", false, output);
}
Also used : DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer)

Example 4 with DefaultXdmXdsTransformer

use of org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testGetDocId_ExtrinsicObjectType.

/**
     * Test the getDocId(ExtrinsicObjectType) method.
     */
public void testGetDocId_ExtrinsicObjectType() {
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    String output = null;
    ExtrinsicObjectType input = null;
    ExternalIdentifierType eit = null;
    List<ExternalIdentifierType> externalIdentifiers = null;
    eit = new ExternalIdentifierType();
    eit.setIdentificationScheme("urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab");
    eit.setValue("eitValue");
    input = new ExtrinsicObjectType();
    externalIdentifiers = input.getExternalIdentifier();
    externalIdentifiers.add(eit);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", "eitValue", output);
    eit = new ExternalIdentifierType();
    eit.setIdentificationScheme("urn:uuid:incorrecd-uuid");
    eit.setValue("eitValue");
    input = new ExtrinsicObjectType();
    externalIdentifiers = input.getExternalIdentifier();
    externalIdentifiers.add(eit);
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", null, output);
    input = new ExtrinsicObjectType();
    externalIdentifiers = input.getExternalIdentifier();
    output = transformer.getDocId(input);
    assertEquals("Output does not match expected", null, output);
}
Also used : DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer) ExtrinsicObjectType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType) ExternalIdentifierType(oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType)

Example 5 with DefaultXdmXdsTransformer

use of org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer in project nhin-d by DirectProject.

the class DefaultXdmXdsTransformerTest method testGetXDMRequest_DataHandler.

/**
     * Test the getXDMRequest method.
     */
public void testGetXDMRequest_DataHandler() {
    LOGGER.info("Begin testGetXDMRequest_DataHandler");
    DefaultXdmXdsTransformer transformer = new DefaultXdmXdsTransformer();
    DataHandler input = getSampleXdmAsDataHandler();
    ProvideAndRegisterDocumentSetRequestType output = null;
    try {
        output = transformer.transform(input);
        assertTrue("Output is null", output != null);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Exception thrown");
    }
}
Also used : DefaultXdmXdsTransformer(org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer) DataHandler(javax.activation.DataHandler) ProvideAndRegisterDocumentSetRequestType(ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType)

Aggregations

DefaultXdmXdsTransformer (org.nhindirect.xd.transform.impl.DefaultXdmXdsTransformer)6 ProvideAndRegisterDocumentSetRequestType (ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType)2 ExternalIdentifierType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType)2 ExtrinsicObjectType (oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType)2 File (java.io.File)1 DataHandler (javax.activation.DataHandler)1 JAXBElement (javax.xml.bind.JAXBElement)1 QName (javax.xml.namespace.QName)1 SubmitObjectsRequest (oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest)1 IdentifiableType (oasis.names.tc.ebxml_regrep.xsd.rim._3.IdentifiableType)1 RegistryObjectListType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType)1 RegistryPackageType (oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType)1