Automation integration in Java

zhaozj2021-02-16  55

Automation integration in Java

Javayangjoke 2004.06.28

Overview

Projects are inseparable from the beginning to the end to re-repeat various steps to achieve unit testing, integration testing, especially n-layer web applications, below I continued to integrate in Java web program development.

1, Ant (http://ant.apache.org/)

Ant is an open source project in Apache, is a fairly simple build tool.

l installation

N to http://ant.apache.org/bindownload.cgi download

n Decompress the downloaded file, set the environment variable in the operating system (ANT_HOME = $ {Ant_Home})

n and add path = path in PATH; Ant_Home / Bin

l

n Write a build.xml file (see below).

N Run Ant -f Build.xml in the CMD window

A simple build.xml file

<-! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ ->

2, xdoclet (http: / /XDoclet.sourceForge.Net/xdoclet/index.html) XDoclet is also an open source project in SourceForge, which is mainly used in generating a description file, which includes a number of streaming frame configuration files. You can directly write the relevant description information of the file directly, or you can first put various types of configuration information in one file, and finally generate by xdoclet. You can also use it to customize the ANT function when used.

A simple example

Java:

Package com.Alt.gzcx.action;

import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; / ** * @ Web.Servlet * name = "filedownloadaction" * display-name = "file download action" * description = "file download action" * load-on-startup = "1" * * @ web.servlet-mapping * URL-PATTERN = "file / filedownloadaction" * /

public class FileDownloadAction extends HttpServlet {public void init (ServletConfig config) throws ServletException {} public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {}}

< Taskdef name = "ejbdoclet" classname = "xdoclet.modules.eb.ejbdoclettask" classpathref = "class.path" />

< Replace Dir = "$ {Web.Web-Inf.dir} / classes">

--------------------- ---------------------------- | | | Running WebDoclet | < / echo> | | -------------------------------- ----------------- > False>

"2.3" destdir = "$ {web.Web-infm}"> ant -f xdoclet.xml can be generated.

转载请注明原文地址:https://www.9cbs.com/read-19371.html

New Post(0)