当前位置 —论文写论文— 范文

关于数据库论文范文素材,与文献综述内容相关论文格式模板

本论文是一篇关于数据库论文格式模板,关于文献综述内容相关毕业论文的格式范文。免费优秀的关于数据库及管理系统及档案管理方面论文范文资料,适合数据库论文写作的大学硕士及本科毕业论文开题报告范文和学术职称论文参考文献下载。

47;simpleAction"),

}

protectedvoidtearDown()throwsException{

super.tearDown(),

mockControl.reset(),

}

//4.InjectthemockintotheAction

publicvoidpreActionExecuteOccured(Actionaction){

((SimpleAction)action).setService(serviceMock),

}

publicvoidtestSuccess(){

//3.Setmockexpectations

serviceMock.serveAction(),

mockControl.setReturnValue(true),

mockControl.replay(),

//5.Proceedwithtestandverifications

actionPerform(),

verifyForward("success"),

verifyNoActionErrors(),

mockControl.verify(),

}

publicvoidtestFailure(){

//detailsskipped

}

}

四种可能的多重性关系存在于行为和它们所依赖的服务之间:

1,每个行为依赖一个服务.

2,每个行为依赖多个服务.

3,多个行为依赖一个服务.

4,多个行为依赖多个服务.

我这里介绍的解决方案有灵活性,相对不费力地支持所有四种方案.因为模拟创造,期望计划,和模拟注射能完全在个人试验组中执行.

你能避免使用听者界面,以便模拟注射在StrutsActionPreExecuteNotifier内执行吗它似乎使试验课执行变得甚至更简单.然而,与初期的OOP解决方案相似,写多重方面来创建不同的模拟,制定不同的模拟期望将会证明是必然.使模拟创造和在由于听者方法成为可能的个人试验组中的计划局部化变得更加方便.

AOP的力量

有人可能会提出一个好的OOP解决方案来解决我们的整合问题.然而,它很可能要求对Struts和StrutsTestCase有深入的理解,还要有很大的努力.存在于两个试验框架之间的整合间隙是在它的执行以前获得使用Struts行为事例的权利的难点.在确定基本原因之后,AOP解决方案自然地从问题描绘出现.代替用传统OOP要求更复杂解决方案,AOP允许我们更紧密把我们解决方案映射到有问题的空间.AOP的魅力在于它的连接处点样式.它让你穿透媒介物,例如ActionServlet和RequestProcessor,直接到达问题的中心.忙于横切关注的省时间的方式给开发者表现的力量去设计直觉的和更简单的解决方案.AOP是一填充由传统OOP留下的洞的有功效的编程方法.当正确适用于正确的类型的问题的时候,它改进代码组件性,导致更干净,更容易理解的代码.有希望地,这文章不仅帮你单位试验你的Struts的应用,也给你对一些AOP给予的重要利益的新的评价.

作者Bio

WalterJia是加拿大温哥华的一个专门从事企业应用程序开发的独立顾问.当用一个实际的方法来帮助客户建设品质软件,避开不必要的成本时,他总是能给出最好的解决方案.

外文原稿

UnittestStrutsapplicationswithmockobjectsandAOP

HowAOPplementsOOPtobridgetheintegrationgap

ByWalterJia,JavaWorld.,11/09/06

Test-drivendevelopmentimprovessoftwarequalitywhilereducingdevelopmentefforts.Asthefoundationofanoverallteststrategy,unittestsmustbeprehensive,easytosetup,andquicktoexecute.However,thedependencyontheexecutionenvironmentandoncodeoutsidetheclassundertestplicatesourabilitytoachievethesegoals.Deployingtheapplicationinacontainersignificantlyslowsdownthecode-and-testcycle.Furthermore,theneedtocollaboratewithotherclassesusuallyleadstomoreplextestsetupsandslowertestruns.

Integratingtwopopulartestframeworks,StrutsTestCaseandEasyMock,tounit-testStrutsapplicationsleadstoeasiertestsetupsandfastertestruns.However,thesetwoframeworksleaveagapthatpreventsanidealintegration.Inthisarticle,Iexaminebothanobject-orientedsolutionandanaspect-orientedsolutiontothisproblem.Theparisonalsodemonstrateshowaspect-orientedprogramming(AOP)plementsobject-orientedprogramming(OOP)bysimplifyingthesolutiontoaseeminglydifficultproblem.

Theintegrationneed

Non-trivialStrutsapplicationsexhibitbothexecutionenvironmentandclassdependenciesbecauseStrutsactionsexecuteinaservletcontainerandtypicallycallotherclassestoprocesstherequests.Themockobjecttestingapproachhelpsremovetheunwanteddependencies.TheStrutsTestCasetestingframeworkprovidesamockimplementationoftheservletcontainerwiththeMockStrutsTestCaseclassthatextendsthebaseJUnittestcase.Itfacilitatesout-containertestingthatspeedsupunittestingcycles.EasyMock,anothertestingframework,makesiteasytodynamicallymockthecollaboratingclasses.Themockssubstituterealclasseswithsimplerimplementationsandaddverificationlogictosupportunittesting.

Clearly,itisadvantageoustobinethetwoframeworkssothatStrutsapplicationscanbetestedintrueisolation.Ideally,youwanttoimplementsuchaunittestwiththefollowingsteps:

SetupMockStrutsTestCasesothatitsimulatestheservletcontainer.

MocktheclassthattheactiondependsonusingEasyMock.

Setmockexpectations.

Injectthemockintotheactionundertest.

Proceedwiththetestandverifications.

Step4performsdependencyinjectionthatsteerstheStrutsactionundertestawayfromitsrealcollaboratortointeractwiththemockedone.ToinjectthemockgeneratedbyEasyMockintoactions,youneedaccesstoactioninstancesinthetestclasses.Unfortunately,thispresentsanobstacle,asaccessisnoteasilyobtainedfromMockStrutsTestCase.

TheOOPsolution

HowcanyouaccesstheactioninstancesfromMockStrutsTestCaseLet'slookattherelationshipsbetweenMockStrutsTestCaseandthecontrollerponentsofStruts.

Figure1highlightsthekeyrelationshipsthatcouldpotentiallyleadtoasolution.

Figure1.RelationshipsthatcouldleadtoanOOPsolution.

MockStrutsTestCasehasapublicgettermethodforretrievingActionServlet.

ActionServlethasaprotectedgettermethodforRequestProcessor.

RequestProcessorstorestheactioninstancesasaprotectedmember.

CanyousubclassbothActionServletandRequestProcessortoprovideMockStrutsTestCasetheaccesstotheactionsThere

1 2 3 4 5 6

关于数据库论文范文素材,与文献综述内容相关论文格式模板参考文献资料:

骨科论文怎么写

快速写论文

编写操作系统

如何写论文提要

如何用word写论文

写论文吧

论文不会写怎么办

如何写化学论文

初中生怎样写议论文

写一篇议论文600字

文献综述内容(4)WORD版本 下载地址