以下是实现代码:
JAXBContext jc = JAXBContext.newInstance("cn.capitek.stat.fuse.predeal.config.ftp");
Unmarshaller u = jc.createUnmarshaller();
InputStream in = CCommonFunc.getInputStream("META-INF/conf-test/ftp.xml");
JAXBElement<?> reportconfigElement = (JAXBElement<?>)u.unmarshal(in);
in.close();
//测试对象类型
Object obj = reportconfigElement.getValue();
System.out.println(obj.getClass());
System.out.println(obj.equals(new FtpConfigType()));
List<FtpType> ftpArray=((FtpConfigType)reportconfigElement.getValue()).getFtp();
System.out.println("============="+ftpArray.size());
使用spring osgi test进行单元测试
引用
java.lang.ClassCastException: cn.capitek.stat.fuse.predeal.config.ftp.FtpConfigType
at cn.capitek.stat.fuse.predeal.service.collector.impl.FtpFileCollectorsManager.getFtpList(FtpFileCollectorsManager.java:156)
at cn.capitek.stat.fuse.predeal.service.collector.impl.FtpFileCollectorsManager.startCollectors(FtpFileCollectorsManager.java:95)
at test.cn.capitek.stat.fuse.predeal.service.collector.impl.TestFtpFileCollectorsManager.testGetFile(TestFtpFileCollectorsManager.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at org.springframework.osgi.test.AbstractOsgiTests.osgiRunTest(AbstractOsgiTests.java:553)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:193)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:178)
at org.springframework.osgi.test.internal.support.OsgiJUnitTestAdapter.osgiRunTest(OsgiJUnitTestAdapter.java:76)
at org.springframework.osgi.test.internal.support.OsgiJUnitService$1.protect(OsgiJUnitService.java:101)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at org.springframework.osgi.test.internal.support.OsgiJUnitService.runTest(OsgiJUnitService.java:98)
at org.springframework.osgi.test.internal.support.OsgiJUnitService.executeTest(OsgiJUnitService.java:71)
at org.springframework.osgi.test.internal.support.OsgiJUnitService.runTest(OsgiJUnitService.java:45)
at org.springframework.osgi.test.JUnitTestActivator.executeTest(JUnitTestActivator.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.osgi.test.AbstractOsgiTests.invokeOSGiTestExecution(AbstractOsgiTests.java:397)
at org.springframework.osgi.test.AbstractOsgiTests.runBare(AbstractOsgiTests.java:206)
at org.springframework.osgi.test.AbstractOsgiTests$1.protect(AbstractOsgiTests.java:184)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at org.springframework.osgi.test.AbstractOsgiTests.run(AbstractOsgiTests.java:181)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
直接junit测试该段代码没有问题,个人猜测又是可恶的classloader导致的。
分享到:
相关推荐
osg简单的mfc框架,提供给osg初学者参考,还有别的方法,以及自己写的一些比较复杂完整的代码。有空上传
可配合OSG3.4.0与osgEarth2.8使用的64位geos3.5.1库(VS2013编译)
OSG读取模型插件的单独使用 OSG读取模型插件的单独使用
OsgEarth2.8 vs2013 Qt5.4 环境下:osgearth2.8 加载谷歌影像和高程,初级教程,
可配合OSG3.4.0与osgEarth2.8使用的64位gdal2.2.2库(VS2013编译)。
然后重新基于所需版本的Qt及osg库编译出osgQt库,包内包含 头文件/lib库/DLL动态链接库,编译器使用的是vs2017,这是 x64 版本的开发库,由于VS2015/VS2017/VS2019是二进制兼容的,所以理论上在三个环境下都可以使用...
对OSG引擎整体总结, 对架构会有整体的认识.
集成OCC、Gmsh和OSG的测试程序,包含解析Gmsh中Mesh数据并传输给OSG的部分。赚个辛苦费嘿嘿,不想花钱的友友也可以私信我,我看到消息之后可以免费提供代码。
... 【Debug版本提示缺少找不...使用的编译器是vs2019版本,由于VS2015/VS2017/VS2019之间二进制版本兼容,所以,理论上开发库可同时用于VS2015/VS2017/VS2019下的开发,我也在VS2015上测试了下32位的库,可以正常使用。
注意环境变量: OSG_FILE_PATH为osg数据所在文件夹, REL_LIB_PATH为vcpkg下的bin位置, DBG_LIB_PATH为vcpkg的installed下debug/bin, ...osgEarth中使用的tms文件可以用osgEarth源码包中其它示例替换
Qt加载Osg的老方式是使用osg3.4以及以前的某些版本中提供的osgQt项目加载osg,不过这种方式,在3.6等新版本中不再支持,更改起来比较麻烦,由于osg::GraphicsContext类不再提供osg::GraphicsContext::...
osg2.9资料,osg2.9资料,osg2.9资料osg2.8资料osg2.8资料osg2.8资料osg2.8资料osg2.8资料osg2.8资料
openSceneGraph(简称OSG)使用OpenGL技术开发,是一套基于C++平台的应用程序接口(API)。
osgEarth2.8 可以配合osg3.4(https://download.csdn.net/download/geopeeker/10348957)使用(64位,VS2013编译)
Qt5+OSG3.4+GUI完美整合,将osg::viewer转为Qt的widget,可随意使用。
使用vs2017和cmake编译osg3.6.3;编译osg3.1;并使用osgearth
内含OSGEarth-2.8.chm、osgEarth手册.pdf、OSG_EARTH用户引导.pdf、OpenSceneGraphReferenceDocs-3.4.0.chm等学习资料,新手高手均使用的可靠资料啊。
首先通过将OSG视景窗口嵌入 MFC框架下,并在OSG核心类cOSG中响应海洋场景的生成;其次在模型节点中通过添加和移除节点,动态实现船舶模型的加载和转换,然后通过天空盒中阳光在海面产生的不同光照效果,利用着色器,...
Osg中使用的思路:1、用osg的fbx插件读取fbx到osg模型 2、解构得到的osg模型,将模型分解成一个个的关键帧(osgAnimation::KeyFrame), 3、重组关键帧得到需要的动画 3.1 重组关键帧时,要确定新动画在原动画的...
osgEarth是基于三维引擎osg开发的三维数字地球引擎库,在osg基础上实现了瓦片调度插件,可选的四叉树调度插件,更多的地理数据加载插件(包括GDAL,ogr...此版本为2.10.2,使用vs2019编译,里面也包含osg最新版本编译包