Search in sources :

Example 21 with XmlParser

use of org.codice.ddf.parser.xml.XmlParser in project ddf by codice.

the class IdentityNodeInitializationTest method setUp.

@Before
public void setUp() throws Exception {
    parser = spy(new XmlParser());
    identityNodeInitialization = spy(new IdentityNodeInitialization());
    registryTransformer = spy(new RegistryTransformer());
    metacardMarshaller = spy(new MetacardMarshaller(parser));
    registryTransformer.setParser(parser);
    registryTransformer.setRegistryMetacardType(new RegistryObjectMetacardType());
    identityNodeInitialization.setRegistryTransformer(registryTransformer);
    identityNodeInitialization.setMetacardMarshaller(metacardMarshaller);
    identityNodeInitialization.setFederationAdminService(federationAdminService);
    identityNodeInitialization.setExecutorService(executorService);
    System.setProperty(SystemInfo.SITE_NAME, TEST_SITE_NAME);
    System.setProperty(SystemInfo.VERSION, TEST_VERSION);
    testMetacard = getTestMetacard();
    testMetacard.setAttribute(new AttributeImpl(Metacard.METADATA, ""));
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) RegistryTransformer(org.codice.ddf.registry.transformer.RegistryTransformer) MetacardMarshaller(org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller) AttributeImpl(ddf.catalog.data.impl.AttributeImpl) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) Before(org.junit.Before)

Example 22 with XmlParser

use of org.codice.ddf.parser.xml.XmlParser in project ddf by codice.

the class IdentificationPluginTest method setUp.

@Before
public void setUp() {
    UuidGenerator uuidGenerator = mock(UuidGenerator.class);
    when(uuidGenerator.generateUuid()).thenReturn(UUID.randomUUID().toString());
    parser = new XmlParser();
    identificationPlugin = new IdentificationPlugin(uuidGenerator);
    identificationPlugin.setMetacardMarshaller(new MetacardMarshaller(parser));
    identificationPlugin.setRegistryIdPostIngestPlugin(new RegistryIdPostIngestPlugin());
    setParser(parser);
    sampleData = new MetacardImpl();
    sampleData.setId("testNewMetacardId");
    sampleData.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, "testNewRegistryId");
    sampleData.setAttribute(Metacard.MODIFIED, new Date().from(Instant.now()));
    Set<String> tags = new HashSet<>();
    tags.add("registry");
    sampleData.setTags(tags);
    System.setProperty(RegistryConstants.REGISTRY_ID_PROPERTY, "systemRegistryId");
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) UuidGenerator(org.codice.ddf.platform.util.uuidgenerator.UuidGenerator) MetacardMarshaller(org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Date(java.util.Date) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 23 with XmlParser

use of org.codice.ddf.parser.xml.XmlParser in project ddf by codice.

the class RegistryTransformerTest method setUp.

@Before
public void setUp() {
    registryTransformer = new RegistryTransformer();
    parser = new XmlParser();
    metacardTypes = new ArrayList<>();
    metacardTypes.addAll(Arrays.asList(new RegistryObjectMetacardType(), new TopicAttributes(), new MediaAttributes(), new ContactAttributes(), new CoreAttributes(), new DateTimeAttributes()));
    metacardType = new MetacardTypeImpl("registryMetacard", metacardTypes);
    registryTransformer.setParser(parser);
    registryTransformer.setRegistryMetacardType(metacardType);
    System.setProperty(RegistryConstants.REGISTRY_ID_PROPERTY, "identityRegistryId");
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) ContactAttributes(ddf.catalog.data.impl.types.ContactAttributes) DateTimeAttributes(ddf.catalog.data.impl.types.DateTimeAttributes) CoreAttributes(ddf.catalog.data.impl.types.CoreAttributes) MediaAttributes(ddf.catalog.data.impl.types.MediaAttributes) MetacardTypeImpl(ddf.catalog.data.impl.MetacardTypeImpl) RegistryObjectMetacardType(org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType) TopicAttributes(ddf.catalog.data.impl.types.TopicAttributes) Before(org.junit.Before)

Example 24 with XmlParser

use of org.codice.ddf.parser.xml.XmlParser in project ddf by codice.

the class SlotTypeHelperTest method setUpOnce.

@BeforeClass
public static void setUpOnce() throws Exception {
    parser = new XmlParser();
    configurator = parser.configureParser(Arrays.asList(RegistryObjectType.class.getPackage().getName(), EbrimConstants.OGC_FACTORY.getClass().getPackage().getName(), EbrimConstants.GML_FACTORY.getClass().getPackage().getName()), SlotTypeHelper.class.getClassLoader());
    registryObject = getRegistryObjectFromResource("/registry-package-slots-only.xml");
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) BeforeClass(org.junit.BeforeClass)

Example 25 with XmlParser

use of org.codice.ddf.parser.xml.XmlParser in project ddf by codice.

the class RegistryPackageTypeHelperTest method setUpOnce.

@BeforeClass
public static void setUpOnce() throws Exception {
    parser = new XmlParser();
    configurator = parser.configureParser(Arrays.asList(RegistryObjectType.class.getPackage().getName(), EbrimConstants.OGC_FACTORY.getClass().getPackage().getName(), EbrimConstants.GML_FACTORY.getClass().getPackage().getName()), RegistryPackageTypeHelperTest.class.getClassLoader());
    registryObject = getRegistryObjectFromResource("/csw-full-registry-package.xml");
    rptHelper = new RegistryPackageTypeHelper((RegistryPackageType) registryObject);
}
Also used : XmlParser(org.codice.ddf.parser.xml.XmlParser) RegistryPackageType(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryPackageType) BeforeClass(org.junit.BeforeClass)

Aggregations

XmlParser (org.codice.ddf.parser.xml.XmlParser)32 Test (org.junit.Test)16 Before (org.junit.Before)14 ReceivedToken (org.apache.cxf.sts.request.ReceivedToken)9 TokenValidatorParameters (org.apache.cxf.sts.token.validator.TokenValidatorParameters)9 SecurityLogger (ddf.security.audit.SecurityLogger)7 JAXBContext (javax.xml.bind.JAXBContext)7 TokenValidatorResponse (org.apache.cxf.sts.token.validator.TokenValidatorResponse)7 File (java.io.File)5 HashSet (java.util.HashSet)5 RegistryObjectMetacardType (org.codice.ddf.registry.common.metacard.RegistryObjectMetacardType)5 MetacardMarshaller (org.codice.ddf.registry.schemabindings.helper.MetacardMarshaller)5 MetacardMarshaller (ddf.catalog.transformer.api.MetacardMarshaller)4 MetacardMarshallerImpl (ddf.catalog.transformer.xml.MetacardMarshallerImpl)4 PrintWriterProviderImpl (ddf.catalog.transformer.xml.PrintWriterProviderImpl)4 ArrayList (java.util.ArrayList)4 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)3 XmlMetacardTransformer (ddf.catalog.transformer.xml.XmlMetacardTransformer)3 StringWriter (java.io.StringWriter)3 Writer (java.io.Writer)3