Search in sources :

Example 86 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project geotoolkit by Geomatys.

the class SmlXMLBindingTest method DataSourceMarshalingTest.

@Test
public void DataSourceMarshalingTest() throws Exception {
    final SystemType system = new SystemType();
    final List<DataComponentPropertyType> fields = new ArrayList<>();
    fields.add(DataComponentPropertyType.LATITUDE_FIELD);
    fields.add(DataComponentPropertyType.LONGITUDE_FIELD);
    fields.add(DataComponentPropertyType.TIME_FIELD);
    final DataRecordType posRecord = new DataRecordType(null, fields);
    final DataBlockDefinitionType definition = new DataBlockDefinitionType(null, Arrays.asList(posRecord), TextBlockType.DEFAULT_ENCODING);
    final DataDefinition dataDefinition = new DataDefinition(definition);
    final org.geotoolkit.sml.xml.v101.Values trajValues = new org.geotoolkit.sml.xml.v101.Values();
    trajValues.setAny("test");
    final DataSourceType datasource = new DataSourceType(dataDefinition, trajValues, null);
    final Position pos = new Position(null, datasource);
    system.setPosition(pos);
    DataSourceType expds = (DataSourceType) pos.getAbstractProcess();
    DataSourceType resds = (DataSourceType) system.getPosition().getAbstractProcess();
    assertEquals(expds.getDataDefinition(), resds.getDataDefinition());
    assertEquals(expds, resds);
    assertEquals(pos.getAbstractProcess(), system.getPosition().getAbstractProcess());
    assertEquals(pos.getPosition(), system.getPosition().getPosition());
    assertEquals(pos, system.getPosition());
    final SensorML sml = new SensorML("1.0.1", Arrays.asList(new SensorML.Member(system)));
    Marshaller m = SensorMLMarshallerPool.getInstance().acquireMarshaller();
    ObjectFactory factory = new ObjectFactory();
    // m.marshal(factory.createPosition(pos), System.out);
    // m.marshal(factory.createSystem(system), System.out);
    // m.marshal(sml, System.out);
    SensorMLMarshallerPool.getInstance().recycle(m);
}
Also used : DataRecordType(org.geotoolkit.swe.xml.v101.DataRecordType) Marshaller(javax.xml.bind.Marshaller) Position(org.geotoolkit.sml.xml.v101.Position) ArrayList(java.util.ArrayList) SystemType(org.geotoolkit.sml.xml.v101.SystemType) DataDefinition(org.geotoolkit.sml.xml.v101.DataDefinition) SensorML(org.geotoolkit.sml.xml.v101.SensorML) DataBlockDefinitionType(org.geotoolkit.swe.xml.v101.DataBlockDefinitionType) ObjectFactory(org.geotoolkit.sml.xml.v101.ObjectFactory) DataSourceType(org.geotoolkit.sml.xml.v101.DataSourceType) DataComponentPropertyType(org.geotoolkit.swe.xml.v101.DataComponentPropertyType)

Example 87 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project ARLAS-server by gisaia.

the class XmlGetRecordsMessageBodyWriter method writeTo.

@Override
public void writeTo(GetRecordsResponseType getRecordsResponseType, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> multivaluedMap, OutputStream outputStream) throws IOException, WebApplicationException {
    ObjectFactory cswFactory = new ObjectFactory();
    JAXB.marshal(cswFactory.createGetRecordsResponse(getRecordsResponseType), outputStream);
}
Also used : ObjectFactory(net.opengis.cat.csw._3.ObjectFactory)

Example 88 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project struts by apache.

the class DispatcherTest method testInterceptorDestroy.

public void testInterceptorDestroy() throws Exception {
    Mock mockInterceptor = new Mock(Interceptor.class);
    mockInterceptor.matchAndReturn("hashCode", 0);
    mockInterceptor.expect("destroy");
    InterceptorMapping interceptorMapping = new InterceptorMapping("test", (Interceptor) mockInterceptor.proxy());
    InterceptorStackConfig isc = new InterceptorStackConfig.Builder("test").addInterceptor(interceptorMapping).build();
    PackageConfig packageConfig = new PackageConfig.Builder("test").addInterceptorStackConfig(isc).build();
    Map<String, PackageConfig> packageConfigs = new HashMap<String, PackageConfig>();
    packageConfigs.put("test", packageConfig);
    Mock mockContainer = new Mock(Container.class);
    mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
    String reloadConfigs = container.getInstance(String.class, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD);
    mockContainer.expectAndReturn("getInstance", C.args(C.eq(String.class), C.eq(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD)), reloadConfigs);
    Mock mockConfiguration = new Mock(Configuration.class);
    mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);
    mockConfiguration.matchAndReturn("getContainer", mockContainer.proxy());
    mockConfiguration.expect("destroy");
    ConfigurationManager configurationManager = new ConfigurationManager(Container.DEFAULT_NAME);
    configurationManager.setConfiguration((Configuration) mockConfiguration.proxy());
    Dispatcher dispatcher = new MockDispatcher(new MockServletContext(), new HashMap<String, String>(), configurationManager);
    dispatcher.init();
    dispatcher.cleanup();
    mockInterceptor.verify();
    mockContainer.verify();
    mockConfiguration.verify();
}
Also used : HashMap(java.util.HashMap) Mock(com.mockobjects.dynamic.Mock) PackageConfig(com.opensymphony.xwork2.config.entities.PackageConfig) MockServletContext(org.springframework.mock.web.MockServletContext) InterceptorStackConfig(com.opensymphony.xwork2.config.entities.InterceptorStackConfig) ObjectFactory(com.opensymphony.xwork2.ObjectFactory) InterceptorMapping(com.opensymphony.xwork2.config.entities.InterceptorMapping) ConfigurationManager(com.opensymphony.xwork2.config.ConfigurationManager)

Example 89 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project struts by apache.

the class ServletActionRedirectResultTest method testBuildResultWithParameter.

public void testBuildResultWithParameter() throws Exception {
    ResultConfig resultConfig = new ResultConfig.Builder("", ServletActionRedirectResult.class.getName()).addParam("actionName", "someActionName").addParam("namespace", "someNamespace").addParam("encode", "true").addParam("parse", "true").addParam("location", "someLocation").addParam("prependServletContext", "true").addParam("method", "someMethod").addParam("param1", "value 1").addParam("param2", "value 2").addParam("param3", "value 3").addParam("anchor", "fragment").build();
    ObjectFactory factory = container.getInstance(ObjectFactory.class);
    ServletActionRedirectResult result = (ServletActionRedirectResult) factory.buildResult(resultConfig, ActionContext.getContext().getContextMap());
    assertNotNull(result);
}
Also used : ResultConfig(com.opensymphony.xwork2.config.entities.ResultConfig) ObjectFactory(com.opensymphony.xwork2.ObjectFactory)

Example 90 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project struts by apache.

the class SpringObjectFactoryTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    sac = new StaticApplicationContext();
    loadConfigurationProviders(new StubConfigurationProvider() {

        @Override
        public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException {
            // No registered beans during initialization; They will be registered in each test, runtime.
            props.setProperty("applicationContextPath", "com/opensymphony/xwork2/spring/emptyContext-spring.xml");
            builder.factory(TextProvider.class, DummyTextProvider.class);
            builder.factory(ObjectFactory.class, SpringObjectFactory.class);
        }
    });
    objectFactory = (SpringObjectFactory) container.getInstance(ObjectFactory.class);
    objectFactory.setApplicationContext(sac);
    objectFactory.setAlwaysRespectAutowireStrategy(false);
}
Also used : ContainerBuilder(com.opensymphony.xwork2.inject.ContainerBuilder) DummyTextProvider(com.opensymphony.xwork2.mock.DummyTextProvider) ObjectFactory(com.opensymphony.xwork2.ObjectFactory) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) StubConfigurationProvider(com.opensymphony.xwork2.test.StubConfigurationProvider) LocatableProperties(com.opensymphony.xwork2.util.location.LocatableProperties) ConfigurationException(com.opensymphony.xwork2.config.ConfigurationException) DummyTextProvider(com.opensymphony.xwork2.mock.DummyTextProvider) TextProvider(com.opensymphony.xwork2.TextProvider)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)32 ArrayList (java.util.ArrayList)26 Test (org.junit.Test)26 Marshaller (javax.xml.bind.Marshaller)23 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)19 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 ObjectFactory (no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory)16 JAXBContext (javax.xml.bind.JAXBContext)15 QName (javax.xml.namespace.QName)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 ObjectFactory (com.opensymphony.xwork2.ObjectFactory)12 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ObjectFactory (slash.navigation.kml.binding22.ObjectFactory)12 BigInteger (java.math.BigInteger)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11