use of oasis.names.tc.ebxml_regrep.xsd.rim._3.ExternalIdentifierType in project ddf by codice.
the class IdentificationPluginTest method testOtherExtIds.
//test ext IDs are not set to other items
@Test
public void testOtherExtIds() throws Exception {
//unmarshal metacard.metadata and confirm both origin and local ext id are set to metacard.getId()
String xml = convert("/registry-extra-extid.xml");
sampleData.setAttribute(Metacard.METADATA, xml);
CreateRequest result = identificationPlugin.process(new CreateRequestImpl(sampleData));
Metacard testMetacard = result.getMetacards().get(0);
String metadata = testMetacard.getMetadata();
InputStream inputStream = new ByteArrayInputStream(metadata.getBytes(Charsets.UTF_8));
JAXBElement<RegistryObjectType> registryObjectTypeJAXBElement = parser.unmarshal(configurator, JAXBElement.class, inputStream);
RegistryObjectType registryObjectType = registryObjectTypeJAXBElement.getValue();
List<ExternalIdentifierType> extIdList = registryObjectType.getExternalIdentifier();
for (ExternalIdentifierType singleExtId : extIdList) {
if (singleExtId.getId().equals(RegistryConstants.REGISTRY_MCARD_ID_LOCAL)) {
assertThat(singleExtId.getValue(), is(testMetacard.getId()));
} else if (singleExtId.getId().equals(RegistryConstants.REGISTRY_MCARD_ID_ORIGIN)) {
assertThat(singleExtId.getValue(), is(testMetacard.getId()));
}
}
}
Aggregations