我继承了Junit测试的负载,但是这些测试(除了大多数不工作之外)是实际单元测试和集成测试(需要外部系统,db等)的混合.
所以我试图想出一种方法来实际将它们分开,这样我就可以很好地快速运行单元测试,然后进行集成测试.
选项是......
将它们拆分为单独的目录.
移至Junit4(从v3开始)并注释类以将它们分开.
使用文件命名约定来告诉类是什么,即AdapterATest和AdapterAIntergrationTest.
3存在Eclipse可以选择"在所选项目/包或文件夹中运行所有测试"的问题.因此,只需运行集成测试就很难了.
2:冒着开发人员可能开始在单元测试类中编写集成测试的风险,它只会变得混乱.
1:似乎是最好的解决方案,但我的直觉说必须有一个更好的解决方案.
所以这就是我的问题,你如何分解集成测试和适当的单元测试?
我有以下定义......
<bean id="fsi" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
<property name="objectDefinitionSource">
<sec:filter-invocation-definition-source >
<sec:intercept-url pattern="/secure/css/**" access="ROLE_TIER0"/>
<sec:intercept-url pattern="/secure/images/**" access="ROLE_TIER0"/>
<sec:intercept-url pattern="/**" access="ROLE_TIER0"/>
</sec:filter-invocation-definition-source>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
我想拥有这个网址的资源......
"/不安全/**"
打开所有呼叫,即没有安全性.
我试过添加......
<sec:intercept-url pattern="/nonsecure/**" access="permitAll" />
Run Code Online (Sandbox Code Playgroud)
但这会导致Websphere抛出错误
Unsupported configuration attributes: [permitAll]
Run Code Online (Sandbox Code Playgroud)
谁能告诉我如何从安全性中排除这个URL?
我有一些调用的代码..
x = getClass().getClassLoader();
Run Code Online (Sandbox Code Playgroud)
这会返回null.
当我从Eclipse启动相同的代码而不是命令行时,它返回一个类加载器.
我可以破解代码来做到这一点......
if (getClass().getClassLoader() == null)
{
x = ClassLoader.getSystemClassLoader().getSystemResourceAsStream( loadedPropFileName );
}
Run Code Online (Sandbox Code Playgroud)
两者都使用相同的JVM进行编译和运行.(我99.99%肯定).
任何人都有任何想法为什么第一个将为类加载器返回null?
编辑:
我的问题是"任何人都有任何想法为什么同一个类在从Eclipse启动时返回null,从命令行加载时是类加载器."
感谢Bootstap加载器必须在Eclipse中加载类的建议.我不知道为什么会这样.
我收到以下错误...
Unsupported configuration attributes: [permitAll]
Run Code Online (Sandbox Code Playgroud)
添加....
<sec:intercept-url pattern="/nonsecure/**" access="permitAll" />
Run Code Online (Sandbox Code Playgroud)
我在使用Spring 2.5的Websphere上.
有人可以帮忙吗?
杰夫波特
我有一大堆XML文件和一个XSD.
我想简单地转换成POJO并将它们插入到数据库中.数据库架构在我的控制之下,所以它可以是我喜欢的.
我看了很多api,但想要另一种意见最有效.
是否休眠有一些API来创建POJO的从XSD,然后读取XML到这些的POJO,然后将数据插入到数据库?
或者春天有任何功能可以帮助解决这个问题吗?
我想我只是你的意见后,只是柜面有一个API我已经错过了,会做帮助做我想做的.
谢谢Jeff Porter
我这样做时会出现以下错误
mvn clean deploy -DperformRelease=true
Run Code Online (Sandbox Code Playgroud)
[错误]退出代码:1 - .java:3:包javax.inject不存在
[错误] import javax.inject.Named;
[错误] ^
[错误] TransactionServiceExternalImpl.java:5:找不到符号
[错误]符号:class命名为
[ERROR] @Named("transactionServiceExternal")
[ERROR] ^
[ERROR] java.lang.ClassCastException:com.sun. tools.javadoc.ClassDocImpl无法强制转换为com.sun.javadoc.AnnotationTypeDoc
POM就是这个......
<groupId>com.xxx</groupId>
<artifactId>ts-impl/artifactId>
<version>2.4.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
只有一节课......
import javax.inject.Named;
@Named("transactionServiceExternal")
public class TransactionServiceExternalImpl
{
}
Run Code Online (Sandbox Code Playgroud)
我得到了错误
但不是......
有人有主意吗?
备注:Apache Maven 3.0.4(r1232337; 2012-01-17 08:44:56 + 0000)
我现在知道原因是Maven Javadoc插件已经从2.9.1变为2.10.这就是问题的原因.
我可以看到这个警告......
[警告] org.apache.maven.plugins的'build.plugins.plugin.version':缺少maven-javadoc-plugin.[警告] org.apache.maven.plugins的'build.plugins.plugin.version':缺少maven-deploy-plugin.
通过在我的pom中设置以下内容....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我可以将版本修复回上一版本.
我将向Maven …
我有一个maven项目,给出以下两个错误
无法安装JAX-RS(REST Web服务)2.0:尚未满足一个或多个约束.
JAX-RS(REST Web服务)2.0需要Java 1.7或更高版本.
我安装了JDK 1.6(我无法更改)
项目方面没有勾选JAX-RS.
项目方面有java 1.6设置.
项目方面有动态Web项目2.4集.
我有以下插件
声纳3.2.0 MercurialEclipse 2.10 EclEmma 2.2.1
pom.xml就是这个......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pcmsgroup.v21.esi</groupId>
<artifactId>customerservice-war</artifactId>
<version>2.0.0-SNAPSHOT</version>
</project>
Run Code Online (Sandbox Code Playgroud)
web.xml是
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Customer Service</display-name>
</web-app>
Run Code Online (Sandbox Code Playgroud)
清理或"更新Maven项目"没有任何区别.
注意:这是在eclipse-jee-kepler-SR1-win32-x86_64中.注意:版本eclipse-jee-kepler-win32-x86_64不会给出错误.
注意:新工作区不会更改错误.
注意:我正在使用JDK.1.6.0_43
我在".log"文件中看到的与此相关的唯一错误是..
!ENTRY org.eclipse.osgi 2 1 2013-10-16 15:07:58.816!MESSAGE NLS未使用的消息:JaxrsProjectConfigurator_The_project_does_not_contain_required_facets in:org.eclipse.m2e.wtp.jaxrs.internal.messages
添加方面,不要让我应用它,因为它说我需要Java 1.7
JSR339(JSR339)声明"API将广泛使用注释,并将需要J2SE 6.0或更高版本"
有任何想法吗?
如果我使用这个命令,我可以上传到 Nexus ...
mvn deploy:deploy-file -Dfile=target/common-2.0.0.jar -DgroupId=com.test -DartifactId=test-common -Dversion=2.0.0 -Dpackaging=jar -DrepositoryId=TEST-REPO -Durl=https://nexus.xxx.xxxx.net/content/repositories/test
Run Code Online (Sandbox Code Playgroud)
如果我使用这个命令
mvn deploy -DskipTests -DrepositoryId=TEST-REPO -DaltReleaseDeploymentRepository=releases::default::https://nexus.xxxx.xxxx.net/repository/test/
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息...
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ common ---
[INFO] Using alternate deployment repository releases::default::https://nexus.xxx.xxx.net/repository/test/
Uploading to releases: https://nexus.xxx.xxx.net/repository/test/com/test/common/2.0.0/common-2.0.0.jar
Uploading to releases: https://nexus.xxx.xxx.net/repository/test/com/test/common/2.0.0/common-2.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2019-05-16T14:55:35+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project common:
Failed to deploy artifacts: Could not transfer artifact
com.test:common:jar:2.0.0 from/to releases (https://nexus.xxx.xxx.net/repository/test/): …
Run Code Online (Sandbox Code Playgroud) 是否有适合Eclipse的插件允许与StarTeam集成?
我想念曾经与CVS/SVN有过的"紧密"整合.
我可以找到Atlassian的最新API.
https://docs.atlassian.com/atlassian-confluence/REST/5.5.3/#d2e120
我可以看到我应该可以通过调用"/ content/{id}"PUT更新页面.
但是当我尝试PUT时,我只是从服务器获得了500回.如果我尝试这样一个简单的例子......
尝试更新页面的示例代码.
String json =
" { "+
" \"body\":{ "+
" \"view\":{ "+
" \"value\":\"<p>main updated</p>\", "+
" } "+
" } "+
" } ";
Client client = Client.create();
WebResource webResource = client.resource("http://x.x.x.x/rest/api/content/8226411?os_username=j.p@p.com&os_password=xxx");
webResource.setProperty("Content-Type", "application/json");
ClientResponse response = webResource.accept("application/json").put(ClientResponse.class, json);
System.out.println("Output from Server .... statusCode ["+response.getStatus()+"]");
System.out.println(response.getEntity(String.class));
Run Code Online (Sandbox Code Playgroud)
我仍然得到500错误.
Output from Server .... statusCode [500]
{"statusCode":500,"message":"javax.ws.rs.WebApplicationException: null"}
Run Code Online (Sandbox Code Playgroud)
有人可以给我一些建议.
以下是Confluence日志文件中的堆栈跟踪...
2014-07-02 10:15:57,856 WARN [http-bio-80-exec-15274] [atlassian.confluence.cache.TransactionalCacheFactory] warning Transactional cache update outside transaction. All updates to this cache …
Run Code Online (Sandbox Code Playgroud)