Month: May 2009

对数据库操作进行单元测试

抄自Rod Johnson’s ‘Expert+One-on-One+J2EE+Design+And+Development’ 1.Mock一个DAO接口,测试时不去真正地访问数据库 2.但有时我们的确想测试一下真正的数据库操作,这是可以理解的,但要注意保证测试的可重复性。一般来说,可以这样:    a.应在测试目标操作前插入一些初始数据以供测试    b.测试目标方法    c.测试目标方法之后应清空之前插入的初始数据

测试J2EE程序面临的主要问题[Rod Johnson]

Testing enterprise applications poses many challenges:      Enterprise applications usually depend on resources such as databases, which will need to be considered in any testing strategy.      Testing web applications can be difficult. They don’t expose simple Java interfaces that we can test, and unit testing is complicated by the dependence of web tier components …

测试J2EE程序面临的主要问题[Rod Johnson] Read More »

What ‘Expert One-on-One J2EE Design’ Covers?

What this Book Covers This book covers:       How to make key J2EE architectural choices, such as whether to use EJB and where to implement business logic       J2EE web technologies, and effective use of the Model-View-Controller (MVC) architectural pattern in web applications       How to use EJB 2.0 effectively, including the implications of the …

What ‘Expert One-on-One J2EE Design’ Covers? Read More »

Spring 2.5中 的 UrlFilenameViewController 确实有bug

正如 http://hi.baidu.com/pmzcn/blog/item/aeab6e63c58762600d33fa21.html所说,spring 2.5中,这个类在解析路径时会把context path带进去! 我的解决办法是,自己做一个UrlFilenameViewController类,在这个类中照抄spring 2.0 UrlFilenameViewController的代码(如果下不到源代码,反编译一下也可以,我就是通过反编译搞到代码的)

MessageFormat with ”

MessageFormat.format("Hi, {0} {1}", "朱", "元璋"); //Hi, 朱 元璋 MessageFormat.format("Hi, ‘{0}’ {1}", "朱", "元璋"); //Hi, {0} 元璋 MessageFormat.format("Hi’, {0} {1}", "朱", "元璋"); //Hi, {0} {1} MessageFormat.format("Hi, {0} {1}", "’朱’", "元璋"); //Hi, ‘朱’ 元璋

learn java5 annotation

Java Annotation Facility:     1.a syntax for declaring annotation types     2.a syntax for annotating declarations     3.APIs for reading annotations     4.a class file representation for annotations     5.an annotation processing tool         @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Test { }     Annotation Declaration     1.Annotation type declarations are similar to normal interface declarations    …

learn java5 annotation Read More »

Java Security Architecture Notes

1.Two aspects     a. Secure the Java platform itself, such as bytecode verification, class loading protection     b. Provide services and tools for java applications, such as cryptography, authentication.     2.Secure the Java platform     2.1 Old Mechanism(JAVA 1): Sandbox         Forget about it     2.2.New Mechanism(Since JAVA 2)         Think about it in a …

Java Security Architecture Notes Read More »