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);
}
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);
}
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);
}
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);
}
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");
}
}
Aggregations