use of net.opengis.gml._3.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);
}
use of net.opengis.gml._3.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);
}
use of net.opengis.gml._3.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();
}
use of net.opengis.gml._3.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);
}
use of net.opengis.gml._3.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);
}
Aggregations