You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(151) |
Sep
(21) |
Oct
(6) |
Nov
(70) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(47) |
Feb
(66) |
Mar
(23) |
Apr
(115) |
May
(24) |
Jun
(53) |
Jul
(10) |
Aug
(279) |
Sep
(84) |
Oct
(149) |
Nov
(138) |
Dec
(52) |
2003 |
Jan
(22) |
Feb
(20) |
Mar
(29) |
Apr
(106) |
May
(170) |
Jun
(122) |
Jul
(70) |
Aug
(64) |
Sep
(27) |
Oct
(71) |
Nov
(49) |
Dec
(9) |
2004 |
Jan
(7) |
Feb
(38) |
Mar
(3) |
Apr
(9) |
May
(22) |
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(15) |
Dec
(2) |
2005 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(28) |
Jun
(3) |
Jul
(11) |
Aug
(5) |
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2006 |
Jan
(8) |
Feb
(3) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Steve F. <sm...@us...> - 2002-02-23 19:20:52
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv15614 Modified Files: build.xml Log Message: Changed version number Clear class files before compiling Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- build.xml 23 Feb 2002 18:50:34 -0000 1.18 +++ build.xml 23 Feb 2002 19:20:49 -0000 1.19 @@ -46,7 +46,7 @@ <target name="project-properties"> <property name="project.fullname" value="Mock Objects"/> - <property name="project.version" value="0.02"/> + <property name="project.version" value="0.03"/> <property name="project.name" value="mockobjects"/> <!-- Miscellaneous settings --> @@ -210,10 +210,8 @@ </target> <target name="compile" - depends="call-me-first, copy-java-files" + depends="call-me-first, clear-class-files, copy-java-files" description="Compile all the java files for included libraries" > - - <mkdir dir="${out.classes.dir}" /> <javac destdir="${out.classes.dir}" debug="${debug}" |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:38
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/j2ee/common/com/mockobjects/servlet Added Files: MockJspWriter.java MockPageContext.java MockServletConfig.java MockServletContext.java Removed Files: MockHttpServletRequest.java MockHttpServletResponse.java MockHttpSession.java Log Message: Reworked build structure for j2ee libraries. --- NEW FILE: MockJspWriter.java --- package com.mockobjects.servlet; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import junit.framework.*; import junit.textui.*; import java.util.*; import java.io.*; import java.net.*; import com.mockobjects.*; public class MockJspWriter extends JspWriter{ private ExpectationValue expectedData = new ExpectationValue("data"); private StringWriter stringWriter = new StringWriter(); private PrintWriter printWriter = new PrintWriter(stringWriter); public MockJspWriter(){ super(0, true); } public void setExpectedData(String data){ expectedData.setExpected(data); } public void newLine(){ } public void flush() { } public void print(double d){ } public void println(){ } public void close(){ } public void print(int i){ } public void print(long l){ } public void print(float f){ } public void println(char c){ } public void clear(){ } public void print(boolean b){ } public void print(String s){ printWriter.print(s); } public void println(String s){ printWriter.print(s); } public void print(char c){ } public void write(char[] c, int i1, int i2) { } public void println(char[] c){ } public void println(boolean b){ } public void clearBuffer(){ } public void print(Object o){ } public void println(long l){ } public void println(int i){ } public void print(char[] c){ } public void println(float f){ } public void println(double d){ } public int getRemaining(){ return -1; } public void println(Object o){ } public void verify(){ printWriter.flush(); expectedData.setActual(stringWriter.toString()); expectedData.verify(); } } --- NEW FILE: MockPageContext.java --- package com.mockobjects.servlet; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public class MockPageContext extends PageContext{ private JspWriter jspWriter; private ServletRequest request; private HttpSession httpSession; private ServletContext servletContext; public void release(){ } public JspWriter getOut(){ return jspWriter; } public void setJspWriter(JspWriter jspWriter){ this.jspWriter = jspWriter; } public void handlePageException(Exception e){ } public ServletContext getServletContext(){ return servletContext; } public void setServletContext(ServletContext servletContext){ this.servletContext = servletContext; } public int getAttributesScope(String s){ return -1; } public void include(String s){ } public void removeAttribute(String s, int i){ } public Enumeration getAttributeNamesInScope(int i){ return null; } public void forward(String s){ } public Object getPage(){ return null; } public void handlePageException(Throwable t){ } public void setRequest(ServletRequest servletRequest){ this.request = servletRequest; } public ServletRequest getRequest(){ return request; } public ServletResponse getResponse(){ return null; } public void removeAttribute(String s){ } public Object getAttribute(String s, int i){ return null; } public ServletConfig getServletConfig(){ return null; } public void initialize(Servlet servlet, ServletRequest servletRequest, ServletResponse servletResponse, String s, boolean b, int i, boolean b2){ } public Object findAttribute(String s) { return null; } public HttpSession getSession() { return httpSession; } public void setSession(HttpSession httpSession) { this.httpSession = httpSession; } public void setAttribute(String s, Object o){ } public void setAttribute(String s, Object o, int i) { } public Object getAttribute(String s) { return null; } public Exception getException() { return null; } public void verify(){ } } --- NEW FILE: MockServletConfig.java --- package com.mockobjects.servlet; import javax.servlet.*; import junit.framework.*; import junit.textui.*; import java.util.*; import java.io.*; import java.net.*; import com.mockobjects.*; /** * @version $Revision: 1.1 $ */ public class MockServletConfig extends MockObject implements ServletConfig { private Dictionary myParameters = new Hashtable(); private ServletContext servletContext; public String getInitParameter(String paramName) { return (String)myParameters.get(paramName); } public void setInitParameter(String paramName, String paramValue) { myParameters.put(paramName, paramValue); } public java.util.Enumeration getInitParameterNames() { return myParameters.keys(); } public void setupAddInitParameter(String paramName, String value) { myParameters.put(paramName, value); } public void setupNoParameters() { myParameters = new Hashtable(); } public void setServletContext(ServletContext servletContext){ this.servletContext = servletContext; } public ServletContext getServletContext(){ return servletContext; } public String getServletName(){ return null; } } --- NEW FILE: MockServletContext.java --- package com.mockobjects.servlet; import java.io.*; import java.net.*; import java.util.*; import javax.servlet.*; import com.mockobjects.*; public class MockServletContext extends MockObject implements ServletContext{ private HashMap attributes = new HashMap(); private Set resourcePaths; private List realPaths = new ArrayList(); private URL resource; private HashMap initParameters = new HashMap(); private ExpectationValue expectedLogValue = new ExpectationValue("log"); private ExpectationValue expectedLogThrowable = new ExpectationValue("log throwable"); private ExpectationValue requestDispatcherURI = new ExpectationValue("RequestDispatcher URI"); private RequestDispatcher requestDispatcher; public Enumeration getServlets(){ return null; } public void log(String string){ expectedLogValue.setActual(string); } public void setExpectedLog(String string){ expectedLogValue.setExpected(string); } public void setupGetResource(URL resource){ this.resource = resource; } public URL getResource(String string){ return resource; } public void setupGetResourcePaths(Set resourcePaths){ this.resourcePaths = resourcePaths; } public Set getResourcePaths(String string){ return resourcePaths; } public ServletContext getContext(String string){ return null; } public int getMinorVersion(){ return -1; } public void removeAttribute(String string){ } public void log(String string, Throwable t){ log(string); expectedLogThrowable.setActual(t); } public void setExpectedLogThrowable(Throwable throwable){ expectedLogThrowable.setExpected(throwable); } public void addRealPath(String realPath){ this.realPaths.add(realPath); } public String getRealPath(String string){ return realPaths.remove(0).toString(); } public Enumeration getServletNames(){ return null; } public Servlet getServlet(String string){ return null; } public void log(Exception exception, String string){ } public String getServerInfo(){ return null; } public void setExpectedRequestDispatcherURI(String uri){ this.requestDispatcherURI.setExpected(uri); } public void setupGetRequestDispatcher( RequestDispatcher requestDispatcher){ this.requestDispatcher = requestDispatcher; } public RequestDispatcher getRequestDispatcher(String uri){ requestDispatcherURI.setActual(uri); return requestDispatcher; } public int getMajorVersion(){ return -1; } public Set getResourcePaths(){ return null; } public void setAttribute(String string, Object object){ attributes.put(string, object); } public String getMimeType(String string){ return null; } public RequestDispatcher getNamedDispatcher(String string){ return null; } public String getInitParameter(String paramName){ return (String)initParameters.get(paramName); } public void setInitParameter(String paramName, String paramValue){ initParameters.put(paramName,paramValue); } public Object getAttribute(String string){ return attributes.get(string); } public Enumeration getAttributeNames(){ return null; } public String getServletContextName() { return null; } public InputStream getResourceAsStream(String string){ return null; } public Enumeration getInitParameterNames(){ return null; } } --- MockHttpServletRequest.java DELETED --- --- MockHttpServletResponse.java DELETED --- --- MockHttpSession.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:38
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/j2ee/1.2/com/mockobjects/servlet Added Files: MockHttpServletRequest.java MockHttpServletResponse.java MockHttpSession.java Log Message: Reworked build structure for j2ee libraries. --- NEW FILE: MockHttpServletRequest.java --- package com.mockobjects.servlet; import java.util.*; import javax.servlet.http.*; import com.mockobjects.*; public class MockHttpServletRequest implements HttpServletRequest { private Dictionary myParameters = new Hashtable(); private String myPathInfo; public MockHttpServletRequest() { super(); } /** * @deprecated */ public void addActualParameter(String paramName, String[] values) { setupAddParameter(paramName, values); } /** * @deprecated */ public void addActualParameter(String paramName, String value) { setupAddParameter(paramName, value); } public Object getAttribute(String arg1) { return null; } public java.util.Enumeration getAttributeNames() { return null; } public String getAuthType() { return null; } public String getCharacterEncoding() { return null; } public int getContentLength() { return 0; } public String getContentType() { return null; } public java.lang.String getContextPath() { return null; } public javax.servlet.http.Cookie[] getCookies() { return null; } public long getDateHeader(String arg1) { return 0; } public String getHeader(String arg1) { return null; } public java.util.Enumeration getHeaderNames() { return null; } public java.util.Enumeration getHeaders(java.lang.String arg1) { return null; } public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException { return null; } public int getIntHeader(String arg1) { return 0; } public java.util.Locale getLocale() { return null; } public java.util.Enumeration getLocales() { return null; } public String getMethod() { return null; } public String getParameter(String paramName) { String[] values = getParameterValues(paramName); return (values == null ? null : values[0]); } public java.util.Enumeration getParameterNames() { return myParameters.keys(); } public String[] getParameterValues(String key) { return (String[]) myParameters.get(key); } public String getPathInfo() { return myPathInfo; } public String getPathTranslated() { return null; } public String getProtocol() { return null; } public String getQueryString() { return null; } public java.io.BufferedReader getReader() throws java.io.IOException { return null; } public String getRealPath(String arg1) { return null; } public String getRemoteAddr() { return null; } public String getRemoteHost() { return null; } public String getRemoteUser() { return null; } public javax.servlet.RequestDispatcher getRequestDispatcher( java.lang.String arg1) { return null; } public String getRequestedSessionId() { return null; } public String getRequestURI() { return null; } public String getScheme() { return null; } public String getServerName() { return null; } public int getServerPort() { return 0; } public String getServletPath() { return null; } public javax.servlet.http.HttpSession getSession() { return null; } public javax.servlet.http.HttpSession getSession(boolean arg1) { return null; } public java.security.Principal getUserPrincipal() { return null; } public boolean isRequestedSessionIdFromCookie() { return false; } public boolean isRequestedSessionIdFromUrl() { return false; } public boolean isRequestedSessionIdFromURL() { return false; } public boolean isRequestedSessionIdValid() { return false; } public boolean isSecure() { return false; } public boolean isUserInRole(java.lang.String arg1) { return false; } public void removeAttribute(java.lang.String arg1) { } public void setAttribute(String arg1, Object arg2) { } /** * @deprecated */ public void setNoActualParameters() { setupNoParameters(); } public void setupAddParameter(String paramName, String[] values) { myParameters.put(paramName, values); } public void setupAddParameter(String paramName, String value) { setupAddParameter(paramName, new String[] { value }); } public void setupNoParameters() { myParameters = new Hashtable(); } public void setupPathInfo(String pathInfo) { myPathInfo = pathInfo; } } --- NEW FILE: MockHttpServletResponse.java --- package com.mockobjects.servlet; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import junit.framework.Assert; import com.mockobjects.*; public class MockHttpServletResponse extends MockObject implements HttpServletResponse, Verifiable { private ExpectationList myContentTypes = new ExpectationList("MockHttpServletResponse.setContentType"); private ExpectationList myHeaders = new ExpectationList("MockHttpServletResponse.setHeader"); private ExpectationCounter mySetStatusCalls = new ExpectationCounter("MockHttpServletResponse.setStatus"); private ExpectationList myRedirects = new ExpectationList("MockHttpServletResponse.sendRedirect"); private ServletOutputStream myOutputStream = new MockServletOutputStream(); /** * MockHttpServletResponse constructor comment. */ public MockHttpServletResponse() { super(); } public void addCookie(javax.servlet.http.Cookie arg1) { fail("Not implemented"); } /** * addDateHeader method comment. */ public void addDateHeader(java.lang.String arg1, long arg2) { } /** * addHeader method comment. */ public void addHeader(java.lang.String arg1, java.lang.String arg2) { } /** * addIntHeader method comment. */ public void addIntHeader(java.lang.String arg1, int arg2) { } public boolean containsHeader(String arg1) { fail("Not implemented"); return false; } public String encodeRedirectUrl(String arg1) { fail("Not implemented"); return null; } public String encodeRedirectURL(String arg1) { fail("Not implemented"); return null; } public String encodeUrl(String arg1) { fail("Not implemented"); return null; } public String encodeURL(String arg1) { fail("Not implemented"); return null; } /** * flushBuffer method comment. */ public void flushBuffer() throws java.io.IOException { } /** * getBufferSize method comment. */ public int getBufferSize() { return 0; } public String getCharacterEncoding() { fail("Not implemented"); return null; } /** * getLocale method comment. */ public java.util.Locale getLocale() { return null; } public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException { return myOutputStream; } public String getOutputStreamContents() { return ((MockServletOutputStream) myOutputStream).getContents(); } public java.io.PrintWriter getWriter() throws java.io.IOException { return new PrintWriter(myOutputStream, true); } /** * isCommitted method comment. */ public boolean isCommitted() { return false; } /** * reset method comment. */ public void reset() { } public void sendError(int arg1) throws java.io.IOException { fail("Not implemented"); } public void sendError(int arg1, String arg2) throws java.io.IOException { fail("Not implemented"); } public void sendRedirect(String aURL) throws java.io.IOException { myRedirects.addActual(aURL); } /** * setBufferSize method comment. */ public void setBufferSize(int arg1) { } public void setContentLength(int arg1) { fail("Not implemented"); } public void setContentType(String contentType) { myContentTypes.addActual(contentType); } public void setDateHeader(String arg1, long arg2) { fail("Not implemented"); } public void setExpectedContentType(String contentType) { myContentTypes.addExpected(contentType); } public void setExpectedHeader(String key, String value) { myHeaders.addExpected(new MapEntry(key, value)); } public void setExpectedRedirect(String aURL) throws IOException { myRedirects.addExpected(aURL); } public void setExpectedSetStatusCalls(int callCount) { mySetStatusCalls.setExpected(callCount); } public void setHeader(String key, String value) { myHeaders.addActual(new MapEntry(key, value)); } public void setIntHeader(String arg1, int arg2) { Assert.fail("Not implemented"); } /** * setLocale method comment. */ public void setLocale(java.util.Locale arg1) { } public void setStatus(int status) { mySetStatusCalls.inc(); } public void setStatus(int arg1, String arg2) { Assert.fail("Not implemented"); } public void setupOutputStream(ServletOutputStream anOutputStream) { myOutputStream = anOutputStream; } } --- NEW FILE: MockHttpSession.java --- package com.mockobjects.servlet; import java.util.*; import javax.servlet.http.HttpSessionContext; import javax.servlet.http.HttpSession; import com.mockobjects.*; public class MockHttpSession extends MockObject implements HttpSession, Verifiable { public ExpectationSet myAttributes = new ExpectationSet("session attributes"); public MockHttpSession() { super(); } public Object getAttribute(String arg1) { notImplemented(); return null; } public Enumeration getAttributeNames() { return null; } public long getCreationTime() { notImplemented(); return 0; } public String getId() { notImplemented(); return null; } public long getLastAccessedTime() { notImplemented(); return 0; } public int getMaxInactiveInterval() { return 0; } public HttpSessionContext getSessionContext() { return null; } public Object getValue(String arg1) { notImplemented(); return null; } public java.lang.String[] getValueNames() { notImplemented(); return null; } public void invalidate() { } public boolean isNew() { return false; } public void putValue(String arg1, Object arg2) { } public void removeAttribute(String arg1) { } public void removeValue(String arg1) { } public void setAttribute(String aKey, Object aValue) { myAttributes.addActual(new MapEntry(aKey, aValue)); } public void setExpectedAttribute(String aKey, Object aValue) { myAttributes.addExpected(new MapEntry(aKey, aValue)); } public void setMaxInactiveInterval(int arg1) { } public void verify() { myAttributes.verify(); } } |
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/j2ee/1.3/com/mockobjects/servlet Added Files: MockFilterChain.java MockFilterConfig.java MockHttpServletRequest.java MockHttpServletResponse.java MockHttpSession.java Log Message: Reworked build structure for j2ee libraries. --- NEW FILE: MockFilterChain.java --- package com.mockobjects.servlet; import com.mockobjects.*; import javax.servlet.*; import java.io.IOException; public class MockFilterChain extends MockObject implements FilterChain { public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException{ } } --- NEW FILE: MockFilterConfig.java --- package com.mockobjects.servlet; import com.mockobjects.*; import java.util.*; import javax.servlet.*; public class MockFilterConfig extends MockObject implements FilterConfig { private ServletContext servletContext; public String getFilterName(){ return null; } public void setupGetServletContext(ServletContext servletContext){ this.servletContext = servletContext; } public ServletContext getServletContext(){ return servletContext; } public String getInitParameter(String name){ return null; } public Enumeration getInitParameterNames(){ return null; } } --- NEW FILE: MockHttpServletRequest.java --- package com.mockobjects.servlet; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import junit.framework.*; import junit.textui.*; import java.util.*; import java.io.*; import java.net.*; import com.mockobjects.*; /** * @version $Revision: 1.1 $ */ public class MockHttpServletRequest extends MockObject implements HttpServletRequest { private Dictionary myParameters = new Hashtable(); private HttpSession httpSession; private String contentType; private String myPathInfo; private String remoteAddress; private java.security.Principal userPrincipal; private ExpectationSet mySetAttributes = new ExpectationSet(MockHttpServletRequest.class.getName() + ".setAttribute"); public MockHttpServletRequest() { super(); } /** * @deprecated */ public void addActualParameter(String paramName, String[] values) { setupAddParameter(paramName, values); } /** * @deprecated */ public void addActualParameter(String paramName, String value) { setupAddParameter(paramName, value); } public Object getAttribute(String arg1) { return null; } public java.util.Enumeration getAttributeNames() { return null; } public String getAuthType() { return null; } public String getCharacterEncoding() { return null; } public int getContentLength() { return 0; } public String getContentType() { return null; } public void setContentType(String contentType) { this.contentType = contentType; } public java.lang.String getContextPath() { return null; } public javax.servlet.http.Cookie[] getCookies() { return null; } public long getDateHeader(String arg1) { return 0; } public String getHeader(String arg1) { return null; } public java.util.Enumeration getHeaderNames() { return null; } public java.util.Enumeration getHeaders(java.lang.String arg1) { return null; } public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException { return null; } public int getIntHeader(String arg1) { return 0; } public java.util.Locale getLocale() { return null; } public java.util.Enumeration getLocales() { return null; } public String getMethod() { return null; } public String getParameter(String paramName) { String[] values = getParameterValues(paramName); if (values == null) return null; return values[0]; } public java.util.Enumeration getParameterNames() { return myParameters.keys(); } public String[] getParameterValues(String key) { return (String[]) myParameters.get(key); } public String getPathInfo() { return myPathInfo; } public String getPathTranslated() { return null; } public String getProtocol() { return null; } public String getQueryString() { return null; } public java.io.BufferedReader getReader() throws java.io.IOException { return null; } public String getRealPath(String arg1) { return null; } public void setupGetRemoteAddr(String remoteAddress){ this.remoteAddress = remoteAddress; } public String getRemoteAddr() { return remoteAddress; } public String getRemoteHost() { return null; } public String getRemoteUser() { return null; } public javax.servlet.RequestDispatcher getRequestDispatcher( java.lang.String arg1) { return null; } public String getRequestedSessionId() { return null; } public String getRequestURI() { return null; } public String getScheme() { return null; } public String getServerName() { return null; } public int getServerPort() { return 0; } public String getServletPath() { return null; } public HttpSession getSession() { return httpSession; } public void setSession(HttpSession httpSession) { this.httpSession = httpSession; } public HttpSession getSession(boolean arg1) { return null; } public void setupGetUserPrincipal(java.security.Principal userPrincipal){ this.userPrincipal = userPrincipal; } public java.security.Principal getUserPrincipal() { return userPrincipal; } public boolean isRequestedSessionIdFromCookie() { return false; } public boolean isRequestedSessionIdFromUrl() { return false; } public boolean isRequestedSessionIdFromURL() { return false; } public boolean isRequestedSessionIdValid() { return false; } public boolean isSecure() { return false; } public boolean isUserInRole(java.lang.String arg1) { return false; } public void removeAttribute(java.lang.String arg1) { } public void addExpectedSetAttribute(String attributeName, Object attributeValue) { mySetAttributes.addExpected( new MapEntry(attributeName, attributeValue)); } public void setAttribute(String attributeName, Object attributeValue) { mySetAttributes.addActual( new MapEntry(attributeName, attributeValue)); } /** * @deprecated */ public void setNoActualParameters() { setupNoParameters(); } public void setupAddParameter(String paramName, String[] values) { myParameters.put(paramName, values); } public void setupAddParameter(String paramName, String value) { setupAddParameter(paramName, new String[] { value }); } public void setupNoParameters() { myParameters = new Hashtable(); } public void setupPathInfo(String pathInfo) { myPathInfo = pathInfo; } public StringBuffer getRequestURL(){ return null; } public void setCharacterEncoding(String s){ } public Map getParameterMap(){ return null; } } --- NEW FILE: MockHttpServletResponse.java --- package com.mockobjects.servlet; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import junit.framework.Assert; import com.mockobjects.*; public class MockHttpServletResponse extends MockObject implements HttpServletResponse, Verifiable { private ExpectationList myContentTypes = new ExpectationList("MockHttpServletResponse.setContentType"); private ExpectationList myHeaders = new ExpectationList("MockHttpServletResponse.setHeader"); private ExpectationCounter mySetStatusCalls = new ExpectationCounter("MockHttpServletResponse.setStatus"); private ExpectationList myRedirects = new ExpectationList("MockHttpServletResponse.sendRedirect"); private ServletOutputStream myOutputStream = new MockServletOutputStream(); private ExpectationValue myErrorCode = new ExpectationValue("MockHttpServletResponse.sendError"); private ExpectationValue myErrorMessage = new ExpectationValue("MockHttpServletResponse.sendError"); /** * MockHttpServletResponse constructor comment. */ public MockHttpServletResponse() { super(); } public void addCookie(javax.servlet.http.Cookie arg1) { fail("Not implemented"); } /** * addDateHeader method comment. */ public void addDateHeader(java.lang.String arg1, long arg2) { } /** * addHeader method comment. */ public void addHeader(java.lang.String arg1, java.lang.String arg2) { } /** * addIntHeader method comment. */ public void addIntHeader(java.lang.String arg1, int arg2) { } public boolean containsHeader(String arg1) { fail("Not implemented"); return false; } public String encodeRedirectUrl(String arg1) { fail("Not implemented"); return null; } public String encodeRedirectURL(String arg1) { fail("Not implemented"); return null; } public String encodeUrl(String arg1) { fail("Not implemented"); return null; } public String encodeURL(String arg1) { fail("Not implemented"); return null; } /** * flushBuffer method comment. */ public void flushBuffer() throws java.io.IOException { } /** * getBufferSize method comment. */ public int getBufferSize() { return 0; } public String getCharacterEncoding() { fail("Not implemented"); return null; } /** * getLocale method comment. */ public java.util.Locale getLocale() { return null; } public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException { return myOutputStream; } public String getOutputStreamContents() { return ((MockServletOutputStream) myOutputStream).getContents(); } public java.io.PrintWriter getWriter() throws java.io.IOException { return new PrintWriter(myOutputStream, true); } /** * isCommitted method comment. */ public boolean isCommitted() { return false; } /** * reset method comment. */ public void reset() { } public void resetBuffer(){ } public void setExpectedError(int anErrorCode){ myErrorCode.setExpected(anErrorCode); } public void setExpectedError(int anErrorCode, String anErrorMessage){ setExpectedError(anErrorCode); myErrorMessage.setExpected(anErrorMessage); } public void setExpectedErrorNothing(){ myErrorCode.setExpectNothing(); myErrorMessage.setExpectNothing(); } public void sendError(int anErrorCode) throws java.io.IOException { myErrorCode.setActual(anErrorCode); } public void sendError(int anErrorCode, String anErrorMessage) throws IOException { sendError(anErrorCode); myErrorMessage.setActual(anErrorMessage); } public void sendRedirect(String aURL) throws java.io.IOException { myRedirects.addActual(aURL); } /** * setBufferSize method comment. */ public void setBufferSize(int arg1) { } public void setContentLength(int arg1) { fail("Not implemented"); } public void setContentType(String contentType) { myContentTypes.addActual(contentType); } public void setDateHeader(String arg1, long arg2) { fail("Not implemented"); } public void setExpectedContentType(String contentType) { myContentTypes.addExpected(contentType); } public void setExpectedHeader(String key, String value) { myHeaders.addExpected(new MapEntry(key, value)); } public void setExpectedRedirect(String aURL) throws IOException { myRedirects.addExpected(aURL); } public void setExpectedSetStatusCalls(int callCount) { mySetStatusCalls.setExpected(callCount); } public void setHeader(String key, String value) { myHeaders.addActual(new MapEntry(key, value)); } public void setIntHeader(String arg1, int arg2) { Assert.fail("Not implemented"); } /** * setLocale method comment. */ public void setLocale(java.util.Locale arg1) { } public void setStatus(int status) { mySetStatusCalls.inc(); } public void setStatus(int arg1, String arg2) { Assert.fail("Not implemented"); } public void setupOutputStream(ServletOutputStream anOutputStream) { myOutputStream = anOutputStream; } } --- NEW FILE: MockHttpSession.java --- package com.mockobjects.servlet; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import com.mockobjects.*; public class MockHttpSession extends MockObject implements HttpSession, Verifiable { public ExpectationSet myAttributes = new ExpectationSet("session attributes"); public HashMap attributes = new HashMap(); private ServletContext servletContext; public MockHttpSession() { super(); } public Object getAttribute(String arg1) { return attributes.get(arg1); } public Enumeration getAttributeNames() { return null; } public long getCreationTime() { notImplemented(); return 0; } public String getId() { notImplemented(); return null; } public long getLastAccessedTime() { notImplemented(); return 0; } public int getMaxInactiveInterval() { return 0; } public HttpSessionContext getSessionContext() { return null; } public void setupServletContext(ServletContext servletContext){ this.servletContext = servletContext; } public ServletContext getServletContext(){ return servletContext; } public Object getValue(String arg1) { notImplemented(); return null; } public java.lang.String[] getValueNames() { notImplemented(); return null; } public void invalidate() { } public boolean isNew() { return false; } public void putValue(String arg1, Object arg2) { } public void removeAttribute(String arg1) { } public void removeValue(String arg1) { } public void setAttribute(String aKey, Object aValue) { attributes.put(aKey, aValue); myAttributes.addActual(new MapEntry(aKey, aValue)); } public void setExpectedAttribute(String aKey, Object aValue) { myAttributes.addExpected(new MapEntry(aKey, aValue)); } public void setMaxInactiveInterval(int arg1) { } public void verify() { myAttributes.verify(); } } |
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/jms In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/core/com/mockobjects/jms Removed Files: MockConnection.java MockMessage.java MockMessageConsumer.java MockMessageProducer.java MockQueue.java MockQueueConnection.java MockQueueConnectionFactory.java MockQueueReceiver.java MockQueueSender.java MockQueueSession.java MockSession.java MockTemporaryQueue.java MockTextMessage.java Log Message: Reworked build structure for j2ee libraries. --- MockConnection.java DELETED --- --- MockMessage.java DELETED --- --- MockMessageConsumer.java DELETED --- --- MockMessageProducer.java DELETED --- --- MockQueue.java DELETED --- --- MockQueueConnection.java DELETED --- --- MockQueueConnectionFactory.java DELETED --- --- MockQueueReceiver.java DELETED --- --- MockQueueSender.java DELETED --- --- MockQueueSession.java DELETED --- --- MockSession.java DELETED --- --- MockTemporaryQueue.java DELETED --- --- MockTextMessage.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:38
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/j2ee/common/com/mockobjects/jms Modified Files: MockConnection.java MockMessageConsumer.java MockSession.java Added Files: MockMessagePublisher.java MockObjectMessage.java MockTopic.java MockTopicConnection.java MockTopicConnectionFactory.java MockTopicPublisher.java MockTopicSession.java MockTopicSubscriber.java Log Message: Reworked build structure for j2ee libraries. --- NEW FILE: MockMessagePublisher.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockMessagePublisher extends MockObject implements MessageProducer{ public void close() throws JMSException{ notYetImplemented(); } public int getDeliveryMode() throws JMSException{ notYetImplemented(); return -1; } public boolean getDisableMessageID() throws JMSException{ notYetImplemented(); return false; } public boolean getDisableMessageTimestamp() throws JMSException{ notYetImplemented(); return false; } public int getPriority() throws JMSException{ notYetImplemented(); return -1; } public long getTimeToLive() throws JMSException{ notYetImplemented(); return -1; } public void setDeliveryMode(int deliveryMode) throws JMSException{ notYetImplemented(); } public void setDisableMessageID(boolean disableMessageId) throws JMSException{ notYetImplemented(); } public void setDisableMessageTimestamp(boolean disableMessageTimeStamp) throws JMSException{ notYetImplemented(); } public void setPriority(int priority) throws JMSException{ notYetImplemented(); } public void setTimeToLive(long timeToLive) throws JMSException{ notYetImplemented(); } } --- NEW FILE: MockObjectMessage.java --- package com.mockobjects.jms; import java.io.*; import javax.jms.*; public class MockObjectMessage extends MockMessage implements ObjectMessage{ private Serializable objectToReturn; public void setupGetObject(Serializable objectToReturn){ this.objectToReturn = objectToReturn; } public Serializable getObject() throws JMSException{ return objectToReturn; } public void setObject(Serializable serialisable) throws JMSException{ } } --- NEW FILE: MockTopic.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockTopic extends MockObject implements Topic{ public String getTopicName() throws JMSException{ notYetImplemented(); return null; } } --- NEW FILE: MockTopicConnection.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockTopicConnection extends MockConnection implements TopicConnection{ private TopicSession topicSessionToReturn; public void setupCreateTopicSession(TopicSession topicSessionToReturn){ this.topicSessionToReturn = topicSessionToReturn; } public ConnectionConsumer createConnectionConsumer(Topic topic, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException{ notYetImplemented(); return null; } public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException{ notYetImplemented(); return null; } public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException{ return topicSessionToReturn; } } --- NEW FILE: MockTopicConnectionFactory.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockTopicConnectionFactory extends MockObject implements TopicConnectionFactory{ private TopicConnection topicConnectionToReturn; public void setupCreateTopicConnection( TopicConnection topicConnectionToReturn){ this.topicConnectionToReturn = topicConnectionToReturn; } public TopicConnection createTopicConnection() throws JMSException{ return topicConnectionToReturn; } public TopicConnection createTopicConnection(String userName, String password) throws JMSException{ return topicConnectionToReturn; } } --- NEW FILE: MockTopicPublisher.java --- package com.mockobjects.jms; import javax.jms.*; import com.mockobjects.*; public class MockTopicPublisher extends MockMessagePublisher implements TopicPublisher{ private ExpectationValue message = new ExpectationValue("message"); public void setExpectedMessage(Message message){ this.message.setExpected(message); } public Topic getTopic() throws JMSException{ notYetImplemented(); return null; } public void publish(Message message) throws JMSException{ this.message.setActual(message); } public void publish(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException{ this.message.setActual(message); } public void publish(Topic topic, Message message) throws JMSException{ this.message.setActual(message); } public void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException{ this.message.setActual(message); } } --- NEW FILE: MockTopicSession.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockTopicSession extends MockSession implements TopicSession{ private Topic topicToReturn; private ExpectationValue topicName = new ExpectationValue("topicName"); private ExpectationCounter createTopicCalls = new ExpectationCounter("createTopicCalls"); private TopicPublisher topicPublisherToReturn; private TopicSubscriber topicSubscriberToReturn; public void setupCreateTopic(Topic topicToReturn){ this.topicToReturn = topicToReturn; } public void setExpectedTopicName(String topicName){ this.topicName.setExpected(topicName); } public void setupCreateTopicCalls(int createTopicCalls){ this.createTopicCalls.setExpected(createTopicCalls); } public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException{ notYetImplemented(); return null; } public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messsageSelecter, boolean noLocal) throws JMSException{ notYetImplemented(); return null; } public void setupCreatePublisher(TopicPublisher topicPublisherToReturn){ this.topicPublisherToReturn = topicPublisherToReturn; } public TopicPublisher createPublisher(Topic topic) throws JMSException{ return topicPublisherToReturn; } public void setupTopicSubscriber(TopicSubscriber topicSubscriberToReturn){ this.topicSubscriberToReturn = topicSubscriberToReturn; } public TopicSubscriber createSubscriber(Topic topic) throws JMSException{ return topicSubscriberToReturn; } public TopicSubscriber createSubscriber(Topic topic, String messsageSelecter, boolean noLocal) throws JMSException{ return topicSubscriberToReturn; } public TemporaryTopic createTemporaryTopic() throws JMSException{ notYetImplemented(); return null; } public Topic createTopic(String topicName) throws JMSException{ this.topicName.setActual(topicName); this.createTopicCalls.inc(); return topicToReturn; } public void unsubscribe(String topicName) throws JMSException{ notYetImplemented(); } } --- NEW FILE: MockTopicSubscriber.java --- package com.mockobjects.jms; import javax.jms.*; import com.mockobjects.*; public class MockTopicSubscriber extends MockMessageConsumer implements TopicSubscriber{ public boolean getNoLocal() throws JMSException{ notYetImplemented(); return false; } public Topic getTopic() throws JMSException{ notYetImplemented(); return null; } } Index: MockConnection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms/MockConnection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockConnection.java 22 Feb 2002 16:25:05 -0000 1.1 +++ MockConnection.java 23 Feb 2002 18:50:35 -0000 1.2 @@ -77,4 +77,4 @@ throw myException; } } -} \ No newline at end of file +} Index: MockMessageConsumer.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms/MockMessageConsumer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockMessageConsumer.java 22 Feb 2002 16:25:05 -0000 1.1 +++ MockMessageConsumer.java 23 Feb 2002 18:50:35 -0000 1.2 @@ -3,91 +3,97 @@ import com.mockobjects.*; import javax.jms.*; -public abstract class MockMessageConsumer extends MockObject implements MessageConsumer { +public class MockMessageConsumer extends MockObject implements MessageConsumer{ + private Message myMessage; + private boolean myExpiresOnTimeout = false; + private JMSException myException; + protected ExpectationCounter myCloseCalls = + new ExpectationCounter("MockMessageConsumer.close"); + protected ExpectationCounter myReceiveCalls = + new ExpectationCounter("MockMessageConsumer.receive"); + private ExpectationValue messageListener = + new ExpectationValue("messageListener"); - protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockMessageConsumer.close"); - protected ExpectationCounter myReceiveCalls = new ExpectationCounter("MockMessageConsumer.receive"); + public void setExpectedMessageListener(MessageListener messageListener){ + this.messageListener.setExpected(messageListener); + } + + public void close() throws JMSException { + throwExceptionIfAny(); + myCloseCalls.inc(); + } + + public MessageListener getMessageListener() throws JMSException { + notImplemented(); + return null; + } + + public String getMessageSelector() throws JMSException { + notImplemented(); + return null; + } - private Message myMessage; - private boolean myExpiresOnTimeout = false; - private JMSException myException; - - public MockMessageConsumer() { - } - - public void close() throws JMSException { - throwExceptionIfAny(); - myCloseCalls.inc(); - } - - public MessageListener getMessageListener() throws JMSException { - notImplemented(); - return null; - } - - public String getMessageSelector() throws JMSException { - notImplemented(); - return null; - } - - public Message receive() throws JMSException { - throwExceptionIfAny(); - myReceiveCalls.inc(); - if (myExpiresOnTimeout) { - synchronized(this) { - try { - wait(); - } catch (InterruptedException e) { - throw new junit.framework.AssertionFailedError("Thread interrupted"); + public Message receive() throws JMSException { + throwExceptionIfAny(); + myReceiveCalls.inc(); + if (myExpiresOnTimeout) { + synchronized(this) { + try { + wait(); + } catch (InterruptedException e) { + throw new junit.framework.AssertionFailedError( + "Thread interrupted"); + } + } } - } + return myMessage; + } + + public Message receive(long timeout) throws JMSException { + throwExceptionIfAny(); + myReceiveCalls.inc(); + if (myExpiresOnTimeout) { + return null; + } else { + return myMessage; + } + } + + + public Message receiveNoWait() throws JMSException { + throwExceptionIfAny(); + myReceiveCalls.inc(); + return myMessage; } - return myMessage; - } - public Message receive(long timeout) throws JMSException { - throwExceptionIfAny(); - myReceiveCalls.inc(); - if (myExpiresOnTimeout) { - return null; - } else { - return myMessage; - } - } - - public Message receiveNoWait() throws JMSException { - throwExceptionIfAny(); - myReceiveCalls.inc(); - return myMessage; - } - - public void setMessageListener(MessageListener listener) throws JMSException { - notImplemented(); - } - - public void setExpectedCloseCalls(int callCount) { - myCloseCalls.setExpected(callCount); - } - - public void setExpectedReceiveCalls(int callCount) { - myReceiveCalls.setExpected(callCount); - } - - public void setupReceivedMessage(Message message) { - myMessage = message; - } - - public void setupExpiresOnTimeout(boolean expiresOnTimeout) { - myExpiresOnTimeout = expiresOnTimeout; - } - - public void setupThrowException(JMSException e) { - myException = e; - } - - protected void throwExceptionIfAny() throws JMSException { - if (null != myException) { - throw myException; + public void setExpectedCloseCalls(int callCount) { + myCloseCalls.setExpected(callCount); + } + + public void setExpectedReceiveCalls(int callCount) { + myReceiveCalls.setExpected(callCount); + } + + public void setupReceivedMessage(Message message) { + myMessage = message; + } + + public void setupExpiresOnTimeout(boolean expiresOnTimeout) { + myExpiresOnTimeout = expiresOnTimeout; + } + + public void setupThrowException(JMSException e) { + myException = e; + } + + public void setMessageListener(MessageListener messageListener) + throws JMSException{ + this.messageListener.setActual(messageListener); + } + + protected void throwExceptionIfAny() throws JMSException { + if (null != myException) { + throw myException; + } } - } -} \ No newline at end of file +} Index: MockSession.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms/MockSession.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockSession.java 22 Feb 2002 16:25:05 -0000 1.1 +++ MockSession.java 23 Feb 2002 18:50:35 -0000 1.2 @@ -6,109 +6,113 @@ public class MockSession extends MockObject implements Session { - protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockSession.close"); - protected ExpectationCounter myCreateTextMessageCalls = new ExpectationCounter("MockSession.createTextMessage"); + protected ExpectationCounter myCloseCalls = + new ExpectationCounter("MockSession.close"); + protected ExpectationCounter myCreateTextMessageCalls = + new ExpectationCounter("MockSession.createTextMessage"); + + private TextMessage myTextMessage = new MockTextMessage(); + private JMSException myException; + private ObjectMessage objectMessageToReturn; - private TextMessage myTextMessage = new MockTextMessage(); - private JMSException myException; + public void setupCreateObjectMessage(ObjectMessage objectMessageToReturn){ + this.objectMessageToReturn = objectMessageToReturn; + } + + public ObjectMessage createObjectMessage() throws JMSException { + return objectMessageToReturn; + } + + public ObjectMessage createObjectMessage(Serializable object) + throws JMSException { + return objectMessageToReturn; + } + + public void rollback() throws JMSException { + notImplemented(); + } + + public void setupTextMessage(TextMessage textMessage) { + myTextMessage = textMessage; + } + + public BytesMessage createBytesMessage() throws JMSException { + notImplemented(); + return null; + } + + public MapMessage createMapMessage() throws JMSException { + notImplemented(); + return null; + } + + public Message createMessage() throws JMSException { + notImplemented(); + return null; + } + + public boolean getTransacted() throws JMSException { + notImplemented(); + return false; + } + + public void recover() throws JMSException { + notImplemented(); + } + + public void close() throws JMSException { + throwExceptionIfAny(); + myCloseCalls.inc(); + } + + public void commit() throws JMSException { + notImplemented(); + } + + public void setMessageListener(MessageListener listener) + throws JMSException { + notImplemented(); + } + + public void setExpectedCloseCalls(int callCount) { + myCloseCalls.setExpected(callCount); + } + + public void setExpectedCreateTextMessageCalls(int callCount) { + myCreateTextMessageCalls.setExpected(callCount); + } + + public StreamMessage createStreamMessage() throws JMSException { + notImplemented(); + return null; + } + + public TextMessage createTextMessage() throws JMSException { + myCreateTextMessageCalls.inc(); + return myTextMessage; + } + + public TextMessage createTextMessage(String text) throws JMSException { + myTextMessage.setText(text); + return myTextMessage; + } - public MockSession() { - } + public MessageListener getMessageListener() throws JMSException { + notImplemented(); + return null; + } + + public void run() { + notImplemented(); + } + + public void setupThrowException(JMSException e) { + myException = e; + } - public void close() throws JMSException { - throwExceptionIfAny(); - myCloseCalls.inc(); - } - - public void commit() throws JMSException { - notImplemented(); - } - - public BytesMessage createBytesMessage() throws JMSException { - notImplemented(); - return null; - } - - public MapMessage createMapMessage() throws JMSException { - notImplemented(); - return null; - } - - public Message createMessage() throws JMSException { - notImplemented(); - return null; - } - - public ObjectMessage createObjectMessage() throws JMSException { - notImplemented(); - return null; - } - - public ObjectMessage createObjectMessage(Serializable object) throws JMSException { - notImplemented(); - return null; - } - - public StreamMessage createStreamMessage() throws JMSException { - notImplemented(); - return null; - } - - public TextMessage createTextMessage() throws JMSException { - myCreateTextMessageCalls.inc(); - return myTextMessage; - } - - public TextMessage createTextMessage(String text) throws JMSException { - myTextMessage.setText(text); - return myTextMessage; - } - - public MessageListener getMessageListener() throws JMSException { - notImplemented(); - return null; - } - - public boolean getTransacted() throws JMSException { - notImplemented(); - return false; - } - - public void recover() throws JMSException { - notImplemented(); - } - - public void rollback() throws JMSException { - notImplemented(); - } - - public void run() { - notImplemented(); - } - - public void setMessageListener(MessageListener listener) throws JMSException { - notImplemented(); - } - - public void setExpectedCloseCalls(int callCount) { - myCloseCalls.setExpected(callCount); - } - - public void setExpectedCreateTextMessageCalls(int callCount) { - myCreateTextMessageCalls.setExpected(callCount); - } - - public void setupTextMessage(TextMessage textMessage) { - myTextMessage = textMessage; - } - - public void setupThrowException(JMSException e) { - myException = e; - } - - protected void throwExceptionIfAny() throws JMSException { - if (null != myException) { - throw myException; + protected void throwExceptionIfAny() throws JMSException { + if (null != myException) { + throw myException; + } } - } -} \ No newline at end of file +} |
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/core/com/mockobjects/servlet Removed Files: MockHttpServletRequest.java MockHttpServletResponse.java MockHttpSession.java MockRequestDispatcher.java MockServletOutputStream.java Log Message: Reworked build structure for j2ee libraries. --- MockHttpServletRequest.java DELETED --- --- MockHttpServletResponse.java DELETED --- --- MockHttpSession.java DELETED --- --- MockRequestDispatcher.java DELETED --- --- MockServletOutputStream.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:38
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/naming In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/core/com/mockobjects/naming Removed Files: MockContext.java Log Message: Reworked build structure for j2ee libraries. --- MockContext.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:37
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/naming/directory In directory usw-pr-cvs1:/tmp/cvs-serv6563/src/core/com/mockobjects/naming/directory Removed Files: MockAttribute.java MockAttributes.java MockDirContext.java MockNamingEnumeration.java Log Message: Reworked build structure for j2ee libraries. --- MockAttribute.java DELETED --- --- MockAttributes.java DELETED --- --- MockDirContext.java DELETED --- --- MockNamingEnumeration.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-02-23 18:50:37
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv6563 Modified Files: build.xml Log Message: Reworked build structure for j2ee libraries. Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- build.xml 4 Feb 2002 11:32:30 -0000 1.17 +++ build.xml 23 Feb 2002 18:50:34 -0000 1.18 @@ -21,11 +21,14 @@ postfixed. Required for the dist target only. Default is <root>/dist - Depending on what mock implementation you wish to build you'll need to - put associated jars in <root>/lib. For example, if you wish to build - the servlet mock implementation you'll need to put the Servlet API jar - in <root>/lib. If it not there, then the servlet mock implementation will - simply not be built. + To build any of the mocks for the j2ee library, you'll need to copy the + relevant version of + j2ee.jar + to <root>/lib>. The build script will pick this up and include whatever + extra mocks it has available for the given version of j2ee. At present, + we support: + j2ee 1.2 + j2ee 1.3 This script should be started with the following command line : @@ -41,147 +44,102 @@ <property file="${user.home}/build.properties" /> <property file="build.properties" /> - <!-- Generic project properties --> - <property name="project.fullname" value="Mock Objects"/> - <property name="project.version" value="0.02"/> - <property name="project.name" value="mockobjects"/> - - <!-- Miscellaneous settings --> - <property name="year" value="2002"/> - <property name="debug" value="on"/> - <property name="optimize" value="off"/> - <property name="deprecation" value="off"/> - <property name="package.prefix" value="com/mockobjects/"/> - - <!-- - ======================================================================== - Set the properties related to the source tree - ======================================================================== - --> - <!-- Source locations for the build --> - <property name="src.dir" value="src"/> - <property name="src.core.dir" value="${src.dir}/core"/> - <property name="src.examples.dir" value="${src.dir}/examples"/> - <property name="src.extensions.dir" value="${src.dir}/extensions"/> - <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> - <property name="conf.dir" value="conf"/> - <property name="doc.dir" value="doc"/> - <property name="xdoc.dir" value="${doc.dir}/xdocs"/> - <property name="skin.dir" value="${doc.dir}/skins"/> - <property name="lib.dir" value="lib"/> - - <!-- - ======================================================================== - Set the properties related to the build area - ======================================================================== - --> - <!-- Destination locations for the build (relative to the basedir as - specified in the basedir attribute of the project tag) --> - <property name="out.dir" value="out"/> - <property name="out.doc.dir" value="${out.dir}/doc"/> - <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> - <property name="out.classes.dir" value="${out.dir}/classes"/> - <property name="out.site.dir" value="${out.dir}/site"/> - <property name="out.src.dir" value="${out.dir}/src"/> - <property name="out.src.core.dir" value="${out.src.dir}/core"/> - <property name="out.src.examples.dir" value="${out.src.dir}/examples"/> - <property name="out.src.extensions.dir" value="${out.src.dir}/extensions"/> - <property name="out.conf.dir" value="${out.dir}/conf"/> - <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> - <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> - - <!-- - ======================================================================== - Default values for properties not defined in build.properties - ======================================================================== - --> - <property name="dist.dir" value="dist"/> - - <!-- - ======================================================================== - Short names of deliverables - ======================================================================== - --> - - <!-- The project jar --> - <property name="jar.name" value="${project.name}"/> - - <!-- The full sources in a zip file --> - <property name="src.name" value="${project.name}-src"/> - - <!-- The project web site in a zip file (without the Javadoc but - with a link pointing to javadoc : <htdocs>/javadoc/index.html --> - <property name="site.name" value="${project.name}-website"/> - - <!-- The javadoc --> - <property name="javadoc.name" value="${project.name}-javadoc"/> - - <!-- The project zip which contains the jar + doc + samples --> - <property name="dist.name" value="${project.name}-${project.version}"/> - - <!-- - ======================================================================== - Useful file patterns for targets - ======================================================================== - --> - <!-- All source files of the projet. These source files will be copied - to the destination source directory in the prepare task --> - <patternset id="all.src.files"> - - <!-- All java files --> - <include name="**/*.java"/> - - <!-- All doc files --> - <include name="**/package.html"/> - <include name="**/overview.html"/> - - <!-- All conf files (including test files) --> - <include name="**/*.txt"/> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - - </patternset> - - <!-- All non java files in the src directory --> - <patternset id="all.nonjava.files"> - - <!-- All conf files (including test files) --> - <include name="**/*.txt"/> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - - </patternset> - - <!-- - ======================================================================== - Check to see what libraries are available in order to decide what - mock implementation will be built - ======================================================================== - --> - <path id="lib.classpath"> - <fileset dir="${lib.dir}"> - <include name="*.jar"/> - </fileset> - </path> - - <target name="check.availabilities"> - - <available property="servlet.present" - classname="javax.servlet.Servlet" - classpathref="lib.classpath"/> - - <available property="jms.present" - classname="javax.jms.Message" - classpathref="lib.classpath"/> + <target name="project-properties"> + <property name="project.fullname" value="Mock Objects"/> + <property name="project.version" value="0.02"/> + <property name="project.name" value="mockobjects"/> + + <!-- Miscellaneous settings --> + <property name="year" value="2002"/> + <property name="debug" value="on"/> + <property name="optimize" value="off"/> + <property name="deprecation" value="off"/> + </target> + + <target name="source-locations"> + <property name="src.dir" value="src"/> + <property name="src.core.dir" value="${src.dir}/core"/> + <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> + <property name="src.examples.dir" value="${src.dir}/examples"/> + <property name="conf.dir" value="conf"/> + <property name="doc.dir" value="doc"/> + <property name="xdoc.dir" value="${doc.dir}/xdocs"/> + <property name="skin.dir" value="${doc.dir}/skins"/> + <property name="lib.dir" value="lib"/> + </target> + + <target name="build-locations"> + <!-- Destination locations for the build (relative to the basedir as + specified in the basedir attribute of the project tag) --> + <property name="out.dir" value="out"/> + <property name="out.doc.dir" value="${out.dir}/doc"/> + <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> + <property name="out.classes.dir" value="${out.dir}/classes"/> + <property name="out.site.dir" value="${out.dir}/site"/> + <property name="out.src.dir" value="${out.dir}/src"/> + <property name="out.src.examples.dir" value="${out.src.dir}/examples"/> + <property name="out.conf.dir" value="${out.dir}/conf"/> + <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> + <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> + </target> + + <target name="deliverable-names" + depends="project-properties"> + <property name="dist.dir" value="dist"/> + + <property name="jar.base.name" value="mocks"/> + <property name="sources.zip.name" value="${project.name}-src"/> + + <!-- The project web site in a zip file (without the Javadoc but + with a link pointing to javadoc : <htdocs>/javadoc/index.html --> + <property name="site.name" value="${project.name}-website"/> + <property name="javadoc.name" value="${project.name}-javadoc"/> + <property name="project.zip.name" value="${project.name}-${project.version}"/> </target> - <!-- - ======================================================================== - Initialize the build. Must be called by all targets - ======================================================================== - --> - <target name="init" depends="check.availabilities"> + <target name="useful-file-patterns"> + <!-- All conf files (including test files) --> + <patternset id="nonjava.src.files"> + <include name="**/*.txt"/> + <include name="**/*.xml"/> + <include name="**/*.properties"/> + </patternset> + + <patternset id="java.src.files"> + <include name="**/*.java"/> + </patternset> + </target> + + <target name="check-availabilities" + depends="source-locations"> + + <path id="lib.classpath"> + <fileset dir="${lib.dir}"> + <include name="*.jar"/> + </fileset> + </path> + + <available property="jdk.version" value="1.2" classname="java.lang.ThreadLocal" /> + <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> + <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" /> + + <available property="j2ee.version" value="1.2" + classpathref="lib.classpath" classname="javax.servlet.Servlet" /> + <available property="j2ee.version" value="1.3" + classpathref="lib.classpath" classname="javax.servlet.Filter" /> + + <!-- sorry about this. It seems to be the easiest way to set a marker to describe + which j2ee the .jar supports. Later versions of Ant include an 'isset' + condition, which should do the trick --> + <property name="jar.j2ee.name" value="" /> + <available property="jar.j2ee.name" value="_j2ee${j2ee.version}" + classpathref="lib.classpath" classname="javax.servlet.Servlet" /> + </target> + + <target name="call-me-first" + depends="project-properties, useful-file-patterns, check-availabilities"> + <!-- Initialize the build. Must be called by all targets --> <tstamp/> @@ -199,90 +157,112 @@ <filter token="version" value="${project.version}"/> <filter token="year" value="${year}"/> <filter token="today" value="${TODAY}"/> - </target> - <!-- - ======================================================================== - Prepare the output directory by copying the source files into it - ======================================================================== - --> - <target name="prepare" depends="init"> - - <mkdir dir="${out.src.dir}"/> - - <!-- Copy all source files to destination dir. Apply the filters in - order to replace the tokens for the version --> - <copy todir="${out.src.dir}" filtering="on"> - <fileset dir="${src.core.dir}"> - <patternset refid="all.src.files"/> + <target name="_flush-dir"> + <!-- requires flush.dir --> + <delete dir="${flush.dir}" quiet="yes" /> + <mkdir dir="${flush.dir}" /> + </target> + + <target name="_copy-from-j2ee" + if="j2ee.version"> + <!-- requires copy.todir, src.patternset.id --> + + <copy todir="${copy.todir}" + filtering="true" + includeEmptyDirs="false" > + <fileset dir="${src.dir}/j2ee/common"> + <patternset refid="${src.patternset.id}" /> </fileset> - <!--fileset dir="${src.extensions.dir}"> - <patternset refid="all.src.files"/> + <fileset dir="${src.dir}/j2ee/${j2ee.version}"> + <patternset refid="${src.patternset.id}" /> </fileset> - <fileset dir="${src.examples.dir}"> - <patternset refid="all.src.files"/> - </fileset--> </copy> - </target> - <!-- - ======================================================================== - Compiles the source directory - ======================================================================== - --> - <!-- Preparation target for the compile target --> - <target name="prepare-compile" depends="prepare"> - - <mkdir dir="${out.classes.dir}"/> - + <target name="_copy-from-src" + depends="useful-file-patterns, _copy-from-j2ee" > + <!-- requires copy.todir, src.patternset.id --> + + <copy todir="${copy.todir}" + filtering="true" + includeEmptyDirs="false" > + <fileset dir="${src.dir}/core"> + <patternset refid="${src.patternset.id}"/> + </fileset> + </copy> </target> - <!-- Run the java compilation --> - <target name="compile" depends="prepare-compile"> + <target name="clear-class-files" + depends="build-locations"> + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.classes.dir}" /> + </antcall> + </target> + + <target name="copy-java-files" + depends="source-locations, build-locations, check-availabilities"> + <antcall target="_copy-from-src"> + <param name="copy.todir" value="${out.src.dir}" /> + <param name="src.patternset.id" value="java.src.files" /> + </antcall> + </target> + + <target name="compile" + depends="call-me-first, copy-java-files" + description="Compile all the java files for included libraries" > + + <mkdir dir="${out.classes.dir}" /> + + <javac destdir="${out.classes.dir}" + debug="${debug}" + deprecation="${deprecation}" + verbose="true" + optimize="${optimize}" + srcdir="${out.src.dir}"> + <classpath> + <path refid="lib.classpath"/> + <pathelement path="${java.class.path}"/> + </classpath> + </javac> + </target> - <javac - destdir="${out.classes.dir}" - debug="${debug}" - deprecation="${deprecation}" - optimize="${optimize}"> - <src path="${src.core.dir}" /> - <src path="${src.j2ee.dir}" /> - <exclude name="${package.prefix}/servlet/**" unless="servlet.present"/> - <exclude name="${package.prefix}/jms/**" unless="jms.present"/> + <target name="test" + depends="call-me-first, compile" + description="run the junit tests"> + <junit fork="yes" haltonfailure="yes"> <classpath> <path refid="lib.classpath"/> + <pathelement location="${out.classes.dir}"/> <pathelement path="${java.class.path}"/> </classpath> - </javac> - - <!-- Copies non java files that need to be in the classes directory --> - <copy todir="${out.classes.dir}"> - <fileset dir="${src.core.dir}"> - <patternset refid="all.nonjava.files"/> - </fileset> - <fileset dir="${src.examples.dir}"> - <patternset refid="all.nonjava.files"/> - </fileset> - <fileset dir="${src.extensions.dir}"> - <patternset refid="all.nonjava.files"/> - </fileset> - </copy> + <formatter type="plain" usefile="false"/> + <batchtest> + <fileset dir="${out.classes.dir}"> + <include name="**/*Test.class"/> + <include name="**/AllTests.class"/> + </fileset> + </batchtest> + </junit> </target> - <!-- - ======================================================================== - Create the runtime jar file - ======================================================================== - --> - <!-- Preparation target for the jar target --> - <target name="prepare-jar" depends="compile"> + <target name="copy-nonjava-files" + depends="source-locations, build-locations, check-availabilities, call-me-first"> + <antcall target="_copy-from-src"> + <param name="copy.todir" value="${out.classes.dir}" /> + <param name="src.patternset.id" value="nonjava.src.files" /> + </antcall> + </target> - <mkdir dir="${out.conf.dir}"/> + <target name="prepare-jar" + depends="copy-nonjava-files"> + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.conf.dir}" /> + </antcall> <!-- Copy the manifest in order to replace the version token filter --> <copy todir="${out.conf.dir}" filtering="on"> @@ -290,43 +270,38 @@ <include name="manifest"/> </fileset> </copy> + </target> + <target name="make-jar-name" + depends="deliverable-names, check-availabilities"> + <property name="jar.name" + value="${jar.base.name}${project.version}_jdk${jdk.version}${jar.j2ee.name}" /> </target> - <!-- Generate the jar file --> - <target name="jar" depends="prepare-jar" - description="generate the framework runtime jar"> + <target name="jar" + depends="compile, test, prepare-jar, make-jar-name" + description="Generate a mockobjects jar"> + <property name="jar.file.name" value="${out.dir}/${jar.name}.jar" /> - <jar jarfile="${out.dir}/${jar.name}.jar" - manifest="${out.conf.dir}/manifest"> + <echo message="jar file: ${jar.file.name}" /> + <jar jarfile="${jar.file.name}" + manifest="${out.conf.dir}/manifest"> <fileset dir="${out.classes.dir}"/> - </jar> - </target> - <!-- - ======================================================================== - Generate the javadoc - ======================================================================== - --> - <!-- Preparation target for the javadoc target --> - <target name="prepare-javadoc" depends="prepare"> - - <mkdir dir="${out.javadoc.dir}"/> - - <uptodate property="javadoc.notrequired" - targetfile="${out.javadoc.dir}/packages.html"> - - <srcfiles dir="${out.src.dir}" includes="**/*.java"/> - </uptodate> - + <target name="prepare-javadoc" + depends="build-locations, copy-java-files" > + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.javadoc.dir}" /> + </antcall> </target> - <!-- Generate the javadoc for the current Servlet API --> - <target name="javadoc" depends="prepare-javadoc" - unless="javadoc.notrequired"> + <target name="javadoc" + depends="call-me-first, deliverable-names, prepare-javadoc" + unless="javadoc.notrequired" + description="Generate the javadoc for the current version" > <javadoc sourcepath="${out.src.dir}" @@ -344,47 +319,52 @@ <path refid="lib.classpath"/> <pathelement path="${java.class.path}"/> </classpath> - </javadoc> + </target> + <target name="zip-javadoc-for-website" + depends="javadoc" > <!-- Create a gzip file of the javadoc. This is for putting to the project web site. It needs to be unzipped in the root document - of the web site. This needs to be done for each Servlet API - javadoc. This file is not intended to be redistributed as part + of the web site. This file is not intended to be redistributed as part of the end-user redistributable. It is simply to help create the web site --> - <tar tarfile="${out.dir}/${javadoc.name}.tar" basedir="${out.javadoc.dir}"/> <gzip zipfile="${out.dir}/${javadoc.name}.tar.gz" src="${out.dir}/${javadoc.name}.tar"/> <delete file="${out.dir}/${javadoc.name}.tar"/> - </target> - <!-- - ======================================================================== - Generate the full documentation, i.e. web site + javadoc - ======================================================================== - --> - <target name="prepare-doc" depends="javadoc"> - - <mkdir dir="${out.xdoc.doc.dir}"/> - <mkdir dir="${out.doc.dir}"/> - <mkdir dir="${out.doc.dir}/images"/> + <target name="_prepare-xdoc"> + <!-- requires prepare.xdoc.dir, book.xml.file --> + <mkdir dir="${prepare.xdoc.dir}"/> <!-- Copy doc-book.xml to book.xml for defining the local - documentation web site and replacing token filters (year) --> - <copy file="${xdoc.dir}/doc-book.xml" - tofile="${out.xdoc.doc.dir}/book.xml" filtering="on"/> + documentation web site and replacing token filters (year) --> + <copy file="${xdoc.dir}/${book.xml.file}" + filtering="on" + tofile="${prepare.xdoc.dir}/book.xml"/> <!-- Copy all remaining files from ${xdoc.dir} to ${out.xdoc.doc.dir} --> - <copy todir="${out.xdoc.doc.dir}" filtering="on"> + <copy todir="${prepare.xdoc.dir}" filtering="on"> <fileset dir="${xdoc.dir}"> <exclude name="*-book.xml"/> </fileset> </copy> + </target> + + <target name="prepare-doc" + depends="javadoc"> + + <mkdir dir="${out.doc.dir}"/> + <mkdir dir="${out.doc.dir}/images"/> + + <antcall target="_prepare-xdoc" > + <param name="prepare.xdoc.dir" value="${out.xdoc.doc.dir}" /> + <param name="book.xml.file" value="doc-book.xml" /> + </antcall> <!-- Copy the images --> <copy todir="${out.doc.dir}/images"> @@ -408,12 +388,11 @@ </target> - <!-- Generate the documentation --> - <target name="doc" depends="prepare-doc" - unless="stylebook.doc.notrequired" - description="generate the documentation"> + <target name="doc" + depends="prepare-doc" + unless="stylebook.doc.notrequired" + description="Generate the documentation website"> - <!-- Generate the documentation web site --> <stylebook book="${out.xdoc.doc.dir}/book.xml" skinDirectory="${skin.dir}/jakarta.apache.org" targetDirectory="${out.doc.dir}"> @@ -421,9 +400,7 @@ <classpath> <pathelement path="${java.class.path}"/> </classpath> - </stylebook> - </target> <!-- @@ -431,24 +408,16 @@ Generate the web site ======================================================================== --> - <target name="prepare-site" depends="init"> + <target name="prepare-site" + depends="build-locations, deliverable-names, call-me-first"> - <mkdir dir="${out.xdoc.site.dir}"/> <mkdir dir="${out.site.dir}"/> <mkdir dir="${out.site.dir}/images"/> - <!-- Copy site-book.xml to book.xml for defining the web site content - and replacing token filters (year) --> - <copy file="${xdoc.dir}/site-book.xml" - tofile="${out.xdoc.site.dir}/book.xml" filtering="on"/> - - <!-- Copy all remaining files from ${xdoc.dir} to - ${out.xdoc.site.dir} --> - <copy todir="${out.xdoc.site.dir}" filtering="on"> - <fileset dir="${xdoc.dir}"> - <exclude name="*-book.xml"/> - </fileset> - </copy> + <antcall target="_prepare-xdoc" > + <param name="prepare.xdoc.dir" value="${out.xdoc.site.dir}" /> + <param name="book.xml.file" value="site-book.xml" /> + </antcall> <!-- Copy the images --> <copy todir="${out.site.dir}/images"> @@ -482,9 +451,10 @@ </target> <!-- Generate the web site --> - <target name="site" depends="prepare-site" - unless="stylebook.site.notrequired" - description="generate the web site"> + <target name="site" + depends="build-locations, deliverable-names, prepare-site, zip-javadoc-for-website" + unless="stylebook.site.notrequired" + description="Generate the web site"> <stylebook book="${out.xdoc.site.dir}/book.xml" skinDirectory="${skin.dir}/jakarta.apache.org" @@ -504,42 +474,9 @@ </target> - <!-- - ======================================================================== - Run the unit tests - ======================================================================== - --> - <target name="test" depends="compile" - description="run the unit tests"> - - <junit fork="yes" haltonfailure="yes"> - - <classpath> - <path refid="lib.classpath"/> - <pathelement location="${out.classes.dir}"/> - <pathelement path="${java.class.path}"/> - </classpath> - - <formatter type="plain" usefile="false"/> - - <batchtest> - <fileset dir="${out.classes.dir}"> - <include name="**/*Test.class"/> - <include name="**/test/AllTests.class"/> - </fileset> - </batchtest> - - </junit> - - </target> - - <!-- - ======================================================================== - Remove all build generated files - ======================================================================== - --> - <target name="clean" depends="init" - description="clean up all generated files"> + <target name="clean" + depends="call-me-first" + description="clean up all generated files"> <delete> <fileset dir="."> @@ -554,25 +491,22 @@ <!-- Remove the out directory --> <delete dir="${out.dir}"/> - </target> - <!-- - ======================================================================== - Create the distributables - ======================================================================== - --> - <target name="prepare-dist" depends="jar,doc"> + <target name="prepare-dist" + depends="jar,doc"> <mkdir dir="${dist.dir}"/> </target> - <target name="ZipJavaSources" depends="prepare"> - <zip zipfile="${out.dir}/${src.name}.zip" + <target name="zip-java-sources" + depends="build-locations, deliverable-names"> + <zip zipfile="${out.dir}/${sources.zip.name}.zip" basedir="${out.src.dir}" /> </target> - <target name="dist" depends="prepare-dist, ZipJavaSources" - description="generate the distributables"> + <target name="dist" + depends="call-me-first, make-jar-name, prepare-dist, zip-java-sources" + description="Generate the distributables"> <zip zipfile="${dist.dir}/${dist.name}.zip"> <zipfileset dir="${out.dir}" prefix="lib"> @@ -591,7 +525,7 @@ Do it all ======================================================================== --> - <target name="all" depends="clean,jar,doc,test,site,dist" + <target name="all" depends="clean, test, jar, doc, site, dist" description="do it all (clean, jar, doc, test, site)"> </target> @@ -605,8 +539,10 @@ ======================================================================== --> - <target name="deploy-site" depends="clean,site" if="username" - description="deploy the web site to SourceForge (see target for details)"> + <target name="deploy-site" + depends="clean, site" + if="username" + description="Deploy the web site to SourceForge (see target for details)"> <property name="deploy.homepage" value="/home/groups/m/mo/mockobjects/htdocs"/> <property name="deploy.host" value="mockobjects.sourceforge.net"/> @@ -616,7 +552,8 @@ <arg value="${username}@${deploy.host}:${deploy.homepage}"/> </exec> - <exec dir="." executable="ssh"> + <exec dir="." + executable="ssh"> <arg line="-l ${username} ${deploy.host} 'cd ${deploy.homepage};gunzip ${site.name}.tar.gz;tar xvf ${site.name}.tar;rm ${site.name}.tar'"/> </exec> @@ -628,7 +565,7 @@ JRefactory jar need to be place in ${ANT_HOME}/lib. ======================================================================== --> - <target name="format" depends="init" + <target name="format" depends="call-me-first" description="reformats all java code"> <taskdef name="pretty" classname="org.acm.seguin.ant.Pretty"/> |
From: Steve F. <sm...@us...> - 2002-02-23 18:44:35
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv5038/servlet Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 18:44:27
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv4979/mockobjects Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 18:44:19
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com In directory usw-pr-cvs1:/tmp/cvs-serv4929/com Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 18:44:08
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv4849/servlet Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com/mockobjects/servlet added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 18:43:59
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv4720/mockobjects Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com/mockobjects added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 18:43:43
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com In directory usw-pr-cvs1:/tmp/cvs-serv4647/com Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.2/com added to the repository |
From: Steve F. <sm...@us...> - 2002-02-23 17:00:32
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv10801 Modified Files: Tag: j2ee_versioning build.xml Log Message: More work on build script Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -u -r1.17.2.1 -r1.17.2.2 --- build.xml 23 Feb 2002 00:53:52 -0000 1.17.2.1 +++ build.xml 23 Feb 2002 17:00:28 -0000 1.17.2.2 @@ -44,7 +44,7 @@ <property file="${user.home}/build.properties" /> <property file="build.properties" /> - <target name="project.properties"> + <target name="project-properties"> <property name="project.fullname" value="Mock Objects"/> <property name="project.version" value="0.02"/> <property name="project.name" value="mockobjects"/> @@ -56,7 +56,7 @@ <property name="deprecation" value="off"/> </target> - <target name="source.locations"> + <target name="source-locations"> <property name="src.dir" value="src"/> <property name="src.core.dir" value="${src.dir}/core"/> <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> @@ -68,7 +68,7 @@ <property name="lib.dir" value="lib"/> </target> - <target name="build.locations"> + <target name="build-locations"> <!-- Destination locations for the build (relative to the basedir as specified in the basedir attribute of the project tag) --> <property name="out.dir" value="out"/> @@ -83,32 +83,36 @@ <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> </target> - <target name="deliverable.names" - depends="project.properties"> + <target name="deliverable-names" + depends="project-properties"> <property name="dist.dir" value="dist"/> - <property name="jar.name" value="${project.name}"/> + <property name="jar.base.name" value="mocks"/> <property name="sources.zip.name" value="${project.name}-src"/> <!-- The project web site in a zip file (without the Javadoc but with a link pointing to javadoc : <htdocs>/javadoc/index.html --> - <property name="website.zip.name" value="${project.name}-website"/> + <property name="site.name" value="${project.name}-website"/> <property name="javadoc.name" value="${project.name}-javadoc"/> <property name="project.zip.name" value="${project.name}-${project.version}"/> </target> - <target name="useful.file.patterns"> + <target name="useful-file-patterns"> <!-- All conf files (including test files) --> <patternset id="nonjava.src.files"> <include name="**/*.txt"/> <include name="**/*.xml"/> <include name="**/*.properties"/> </patternset> + + <patternset id="java.src.files"> + <include name="**/*.java"/> + </patternset> </target> - <target name="check.availabilities" - depends="source.locations"> + <target name="check-availabilities" + depends="source-locations"> <path id="lib.classpath"> <fileset dir="${lib.dir}"> @@ -120,22 +124,22 @@ <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" /> - <available property="j2ee" classpathref="lib.classpath" classname="javax.servlet.Servlet" /> <available property="j2ee.version" value="1.2" classpathref="lib.classpath" classname="javax.servlet.Servlet" /> <available property="j2ee.version" value="1.3" classpathref="lib.classpath" classname="javax.servlet.Filter" /> - <patternset id="all.java.files"> - <include name="core/**/*.java"/> - <include name="j2ee/common/**/*.java" if="j2ee"/> - <include name="j2ee/${j2ee.version}/**/*.java" if="j2ee"/> - </patternset> + <!-- sorry about this. It seems to be the easiest way to set a marker to describe + which j2ee the .jar supports. Later versions of Ant include an 'isset' + condition, which should do the trick --> + <property name="jar.j2ee.name" value="" /> + <available property="jar.j2ee.name" value="_j2ee${j2ee.version}" + classpathref="lib.classpath" classname="javax.servlet.Servlet" /> </target> - <!-- Initialize the build. Must be called by all targets --> - <target name="call.me.first" - depends="project.properties, useful.file.patterns, check.availabilities"> + <target name="call-me-first" + depends="project-properties, useful-file-patterns, check-availabilities"> + <!-- Initialize the build. Must be called by all targets --> <tstamp/> @@ -155,25 +159,68 @@ <filter token="today" value="${TODAY}"/> </target> - <target name="clear.old.class.files" - depends="build.locations"> - <delete dir="${out.classes.dir}" quiet="true" /> - <mkdir dir="${out.classes.dir}"/> + <target name="_flush-dir"> + <!-- requires flush.dir --> + <delete dir="${flush.dir}" quiet="yes" /> + <mkdir dir="${flush.dir}" /> + </target> + + <target name="_copy-from-j2ee" + if="j2ee.version"> + <!-- requires copy.todir, src.patternset.id --> + + <copy todir="${copy.todir}" + filtering="true" + includeEmptyDirs="false" > + <fileset dir="${src.dir}/j2ee/common"> + <patternset refid="${src.patternset.id}" /> + </fileset> + <fileset dir="${src.dir}/j2ee/${j2ee.version}"> + <patternset refid="${src.patternset.id}" /> + </fileset> + </copy> + </target> + + <target name="_copy-from-src" + depends="useful-file-patterns, _copy-from-j2ee" > + <!-- requires copy.todir, src.patternset.id --> + + <copy todir="${copy.todir}" + filtering="true" + includeEmptyDirs="false" > + <fileset dir="${src.dir}/core"> + <patternset refid="${src.patternset.id}"/> + </fileset> + </copy> + </target> + + <target name="clear-class-files" + depends="build-locations"> + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.classes.dir}" /> + </antcall> + </target> + + <target name="copy-java-files" + depends="source-locations, build-locations, check-availabilities"> + <antcall target="_copy-from-src"> + <param name="copy.todir" value="${out.src.dir}" /> + <param name="src.patternset.id" value="java.src.files" /> + </antcall> </target> <target name="compile" - depends="call.me.first, clear.old.class.files" + depends="call-me-first, copy-java-files" description="Compile all the java files for included libraries" > + <mkdir dir="${out.classes.dir}" /> + <javac destdir="${out.classes.dir}" debug="${debug}" deprecation="${deprecation}" verbose="true" optimize="${optimize}" - srcdir="${src.dir}"> - - <patternset refid="all.java.files" /> - + srcdir="${out.src.dir}"> <classpath> <path refid="lib.classpath"/> <pathelement path="${java.class.path}"/> @@ -181,33 +228,41 @@ </javac> </target> - <target name="copy.nonjava.j2ee.files" - depends="check.availabilities, call.me.first" - if="j2ee"> - <copy todir="${out.classes.dir}"> - <fileset dir="${src.dir}/j2ee/common"> - <patternset refid="nonjava.src.files" /> - </fileset> - <fileset dir="${src.dir}/j2ee/${j2ee.version}"> - <patternset refid="nonjava.src.files" /> - </fileset> - </copy> + <target name="test" + depends="call-me-first, compile" + description="run the junit tests"> + + <junit fork="yes" haltonfailure="yes"> + <classpath> + <path refid="lib.classpath"/> + <pathelement location="${out.classes.dir}"/> + <pathelement path="${java.class.path}"/> + </classpath> + + <formatter type="plain" usefile="false"/> + + <batchtest> + <fileset dir="${out.classes.dir}"> + <include name="**/*Test.class"/> + <include name="**/AllTests.class"/> + </fileset> + </batchtest> + </junit> </target> - <target name="copy.nonjava.files" - depends="check.availabilities, call.me.first, copy.nonjava.j2ee.files" > - <copy todir="${out.classes.dir}" - includeEmptyDirs="false" > - <fileset dir="${src.dir}/core"> - <patternset refid="nonjava.src.files"/> - </fileset> - </copy> + <target name="copy-nonjava-files" + depends="source-locations, build-locations, check-availabilities, call-me-first"> + <antcall target="_copy-from-src"> + <param name="copy.todir" value="${out.classes.dir}" /> + <param name="src.patternset.id" value="nonjava.src.files" /> + </antcall> </target> - <target name="prepare.jar" - depends="compile, copy.nonjava.files"> - <delete dir="${out.conf.dir}" quiet="yes" /> - <mkdir dir="${out.conf.dir}"/> + <target name="prepare-jar" + depends="copy-nonjava-files"> + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.conf.dir}" /> + </antcall> <!-- Copy the manifest in order to replace the version token filter --> <copy todir="${out.conf.dir}" filtering="on"> @@ -217,37 +272,36 @@ </copy> </target> + <target name="make-jar-name" + depends="deliverable-names, check-availabilities"> + <property name="jar.name" + value="${jar.base.name}${project.version}_jdk${jdk.version}${jar.j2ee.name}" /> + </target> + <target name="jar" - depends="deliverable.names, prepare.jar" + depends="compile, test, prepare-jar, make-jar-name" description="Generate a mockobjects jar"> + <property name="jar.file.name" value="${out.dir}/${jar.name}.jar" /> - <jar jarfile="${out.dir}/${jar.name}.jar" + <echo message="jar file: ${jar.file.name}" /> + + <jar jarfile="${jar.file.name}" manifest="${out.conf.dir}/manifest"> <fileset dir="${out.classes.dir}"/> </jar> </target> - <!-- - ======================================================================== - Generate the javadoc - ======================================================================== - --> - <!-- Preparation target for the javadoc target --> - <target name="prepare-javadoc" > - - <mkdir dir="${out.javadoc.dir}"/> - - <uptodate property="javadoc.notrequired" - targetfile="${out.javadoc.dir}/packages.html"> - - <srcfiles dir="${out.src.dir}" includes="**/*.java"/> - </uptodate> - + <target name="prepare-javadoc" + depends="build-locations, copy-java-files" > + <antcall target="_flush-dir"> + <param name="flush.dir" value="${out.javadoc.dir}" /> + </antcall> </target> - <!-- Generate the javadoc for the current Servlet API --> - <target name="javadoc" depends="prepare-javadoc" - unless="javadoc.notrequired"> + <target name="javadoc" + depends="call-me-first, deliverable-names, prepare-javadoc" + unless="javadoc.notrequired" + description="Generate the javadoc for the current version" > <javadoc sourcepath="${out.src.dir}" @@ -265,47 +319,52 @@ <path refid="lib.classpath"/> <pathelement path="${java.class.path}"/> </classpath> - </javadoc> + </target> + <target name="zip-javadoc-for-website" + depends="javadoc" > <!-- Create a gzip file of the javadoc. This is for putting to the project web site. It needs to be unzipped in the root document - of the web site. This needs to be done for each Servlet API - javadoc. This file is not intended to be redistributed as part + of the web site. This file is not intended to be redistributed as part of the end-user redistributable. It is simply to help create the web site --> - <tar tarfile="${out.dir}/${javadoc.name}.tar" basedir="${out.javadoc.dir}"/> <gzip zipfile="${out.dir}/${javadoc.name}.tar.gz" src="${out.dir}/${javadoc.name}.tar"/> <delete file="${out.dir}/${javadoc.name}.tar"/> - </target> - <!-- - ======================================================================== - Generate the full documentation, i.e. web site + javadoc - ======================================================================== - --> - <target name="prepare-doc" depends="javadoc"> - - <mkdir dir="${out.xdoc.doc.dir}"/> - <mkdir dir="${out.doc.dir}"/> - <mkdir dir="${out.doc.dir}/images"/> + <target name="_prepare-xdoc"> + <!-- requires prepare.xdoc.dir, book.xml.file --> + <mkdir dir="${prepare.xdoc.dir}"/> <!-- Copy doc-book.xml to book.xml for defining the local - documentation web site and replacing token filters (year) --> - <copy file="${xdoc.dir}/doc-book.xml" - tofile="${out.xdoc.doc.dir}/book.xml" filtering="on"/> + documentation web site and replacing token filters (year) --> + <copy file="${xdoc.dir}/${book.xml.file}" + filtering="on" + tofile="${prepare.xdoc.dir}/book.xml"/> <!-- Copy all remaining files from ${xdoc.dir} to ${out.xdoc.doc.dir} --> - <copy todir="${out.xdoc.doc.dir}" filtering="on"> + <copy todir="${prepare.xdoc.dir}" filtering="on"> <fileset dir="${xdoc.dir}"> <exclude name="*-book.xml"/> </fileset> </copy> + </target> + + <target name="prepare-doc" + depends="javadoc"> + + <mkdir dir="${out.doc.dir}"/> + <mkdir dir="${out.doc.dir}/images"/> + + <antcall target="_prepare-xdoc" > + <param name="prepare.xdoc.dir" value="${out.xdoc.doc.dir}" /> + <param name="book.xml.file" value="doc-book.xml" /> + </antcall> <!-- Copy the images --> <copy todir="${out.doc.dir}/images"> @@ -329,12 +388,11 @@ </target> - <!-- Generate the documentation --> - <target name="doc" depends="prepare-doc" - unless="stylebook.doc.notrequired" - description="generate the documentation"> + <target name="doc" + depends="prepare-doc" + unless="stylebook.doc.notrequired" + description="Generate the documentation website"> - <!-- Generate the documentation web site --> <stylebook book="${out.xdoc.doc.dir}/book.xml" skinDirectory="${skin.dir}/jakarta.apache.org" targetDirectory="${out.doc.dir}"> @@ -342,9 +400,7 @@ <classpath> <pathelement path="${java.class.path}"/> </classpath> - </stylebook> - </target> <!-- @@ -352,24 +408,16 @@ Generate the web site ======================================================================== --> - <target name="prepare-site" depends="call.me.first"> + <target name="prepare-site" + depends="build-locations, deliverable-names, call-me-first"> - <mkdir dir="${out.xdoc.site.dir}"/> <mkdir dir="${out.site.dir}"/> <mkdir dir="${out.site.dir}/images"/> - <!-- Copy site-book.xml to book.xml for defining the web site content - and replacing token filters (year) --> - <copy file="${xdoc.dir}/site-book.xml" - tofile="${out.xdoc.site.dir}/book.xml" filtering="on"/> - - <!-- Copy all remaining files from ${xdoc.dir} to - ${out.xdoc.site.dir} --> - <copy todir="${out.xdoc.site.dir}" filtering="on"> - <fileset dir="${xdoc.dir}"> - <exclude name="*-book.xml"/> - </fileset> - </copy> + <antcall target="_prepare-xdoc" > + <param name="prepare.xdoc.dir" value="${out.xdoc.site.dir}" /> + <param name="book.xml.file" value="site-book.xml" /> + </antcall> <!-- Copy the images --> <copy todir="${out.site.dir}/images"> @@ -403,9 +451,10 @@ </target> <!-- Generate the web site --> - <target name="site" depends="prepare-site" - unless="stylebook.site.notrequired" - description="generate the web site"> + <target name="site" + depends="build-locations, deliverable-names, prepare-site, zip-javadoc-for-website" + unless="stylebook.site.notrequired" + description="Generate the web site"> <stylebook book="${out.xdoc.site.dir}/book.xml" skinDirectory="${skin.dir}/jakarta.apache.org" @@ -425,42 +474,9 @@ </target> - <!-- - ======================================================================== - Run the unit tests - ======================================================================== - --> - <target name="test" depends="compile" - description="run the unit tests"> - - <junit fork="yes" haltonfailure="yes"> - - <classpath> - <path refid="lib.classpath"/> - <pathelement location="${out.classes.dir}"/> - <pathelement path="${java.class.path}"/> - </classpath> - - <formatter type="plain" usefile="false"/> - - <batchtest> - <fileset dir="${out.classes.dir}"> - <include name="**/*Test.class"/> - <include name="**/test/AllTests.class"/> - </fileset> - </batchtest> - - </junit> - - </target> - - <!-- - ======================================================================== - Remove all build generated files - ======================================================================== - --> - <target name="clean" depends="call.me.first" - description="clean up all generated files"> + <target name="clean" + depends="call-me-first" + description="clean up all generated files"> <delete> <fileset dir="."> @@ -475,25 +491,22 @@ <!-- Remove the out directory --> <delete dir="${out.dir}"/> - </target> - <!-- - ======================================================================== - Create the distributables - ======================================================================== - --> - <target name="prepare-dist" depends="jar,doc"> + <target name="prepare-dist" + depends="jar,doc"> <mkdir dir="${dist.dir}"/> </target> - <target name="ZipJavaSources" > - <zip zipfile="${out.dir}/${src.name}.zip" + <target name="zip-java-sources" + depends="build-locations, deliverable-names"> + <zip zipfile="${out.dir}/${sources.zip.name}.zip" basedir="${out.src.dir}" /> </target> - <target name="dist" depends="prepare-dist, ZipJavaSources" - description="generate the distributables"> + <target name="dist" + depends="call-me-first, make-jar-name, prepare-dist, zip-java-sources" + description="Generate the distributables"> <zip zipfile="${dist.dir}/${dist.name}.zip"> <zipfileset dir="${out.dir}" prefix="lib"> @@ -512,7 +525,7 @@ Do it all ======================================================================== --> - <target name="all" depends="clean,jar,doc,test,site,dist" + <target name="all" depends="clean, test, jar, doc, site, dist" description="do it all (clean, jar, doc, test, site)"> </target> @@ -526,8 +539,10 @@ ======================================================================== --> - <target name="deploy-site" depends="clean,site" if="username" - description="deploy the web site to SourceForge (see target for details)"> + <target name="deploy-site" + depends="clean, site" + if="username" + description="Deploy the web site to SourceForge (see target for details)"> <property name="deploy.homepage" value="/home/groups/m/mo/mockobjects/htdocs"/> <property name="deploy.host" value="mockobjects.sourceforge.net"/> @@ -537,7 +552,8 @@ <arg value="${username}@${deploy.host}:${deploy.homepage}"/> </exec> - <exec dir="." executable="ssh"> + <exec dir="." + executable="ssh"> <arg line="-l ${username} ${deploy.host} 'cd ${deploy.homepage};gunzip ${site.name}.tar.gz;tar xvf ${site.name}.tar;rm ${site.name}.tar'"/> </exec> @@ -549,7 +565,7 @@ JRefactory jar need to be place in ${ANT_HOME}/lib. ======================================================================== --> - <target name="format" depends="call.me.first" + <target name="format" depends="call-me-first" description="reformats all java code"> <taskdef name="pretty" classname="org.acm.seguin.ant.Pretty"/> |
From: Steve F. <sm...@us...> - 2002-02-23 00:53:55
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv17725 Modified Files: Tag: j2ee_versioning build.xml Log Message: First cut at version that handles j2ee libraries Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -r1.17 -r1.17.2.1 --- build.xml 4 Feb 2002 11:32:30 -0000 1.17 +++ build.xml 23 Feb 2002 00:53:52 -0000 1.17.2.1 @@ -21,11 +21,14 @@ postfixed. Required for the dist target only. Default is <root>/dist - Depending on what mock implementation you wish to build you'll need to - put associated jars in <root>/lib. For example, if you wish to build - the servlet mock implementation you'll need to put the Servlet API jar - in <root>/lib. If it not there, then the servlet mock implementation will - simply not be built. + To build any of the mocks for the j2ee library, you'll need to copy the + relevant version of + j2ee.jar + to <root>/lib>. The build script will pick this up and include whatever + extra mocks it has available for the given version of j2ee. At present, + we support: + j2ee 1.2 + j2ee 1.3 This script should be started with the following command line : @@ -41,147 +44,98 @@ <property file="${user.home}/build.properties" /> <property file="build.properties" /> - <!-- Generic project properties --> - <property name="project.fullname" value="Mock Objects"/> - <property name="project.version" value="0.02"/> - <property name="project.name" value="mockobjects"/> - - <!-- Miscellaneous settings --> - <property name="year" value="2002"/> - <property name="debug" value="on"/> - <property name="optimize" value="off"/> - <property name="deprecation" value="off"/> - <property name="package.prefix" value="com/mockobjects/"/> - - <!-- - ======================================================================== - Set the properties related to the source tree - ======================================================================== - --> - <!-- Source locations for the build --> - <property name="src.dir" value="src"/> - <property name="src.core.dir" value="${src.dir}/core"/> - <property name="src.examples.dir" value="${src.dir}/examples"/> - <property name="src.extensions.dir" value="${src.dir}/extensions"/> - <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> - <property name="conf.dir" value="conf"/> - <property name="doc.dir" value="doc"/> - <property name="xdoc.dir" value="${doc.dir}/xdocs"/> - <property name="skin.dir" value="${doc.dir}/skins"/> - <property name="lib.dir" value="lib"/> - - <!-- - ======================================================================== - Set the properties related to the build area - ======================================================================== - --> - <!-- Destination locations for the build (relative to the basedir as - specified in the basedir attribute of the project tag) --> - <property name="out.dir" value="out"/> - <property name="out.doc.dir" value="${out.dir}/doc"/> - <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> - <property name="out.classes.dir" value="${out.dir}/classes"/> - <property name="out.site.dir" value="${out.dir}/site"/> - <property name="out.src.dir" value="${out.dir}/src"/> - <property name="out.src.core.dir" value="${out.src.dir}/core"/> - <property name="out.src.examples.dir" value="${out.src.dir}/examples"/> - <property name="out.src.extensions.dir" value="${out.src.dir}/extensions"/> - <property name="out.conf.dir" value="${out.dir}/conf"/> - <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> - <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> - - <!-- - ======================================================================== - Default values for properties not defined in build.properties - ======================================================================== - --> - <property name="dist.dir" value="dist"/> - - <!-- - ======================================================================== - Short names of deliverables - ======================================================================== - --> - - <!-- The project jar --> - <property name="jar.name" value="${project.name}"/> - - <!-- The full sources in a zip file --> - <property name="src.name" value="${project.name}-src"/> - - <!-- The project web site in a zip file (without the Javadoc but - with a link pointing to javadoc : <htdocs>/javadoc/index.html --> - <property name="site.name" value="${project.name}-website"/> - - <!-- The javadoc --> - <property name="javadoc.name" value="${project.name}-javadoc"/> - - <!-- The project zip which contains the jar + doc + samples --> - <property name="dist.name" value="${project.name}-${project.version}"/> - - <!-- - ======================================================================== - Useful file patterns for targets - ======================================================================== - --> - <!-- All source files of the projet. These source files will be copied - to the destination source directory in the prepare task --> - <patternset id="all.src.files"> - - <!-- All java files --> - <include name="**/*.java"/> - - <!-- All doc files --> - <include name="**/package.html"/> - <include name="**/overview.html"/> - - <!-- All conf files (including test files) --> - <include name="**/*.txt"/> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - - </patternset> - - <!-- All non java files in the src directory --> - <patternset id="all.nonjava.files"> - - <!-- All conf files (including test files) --> - <include name="**/*.txt"/> - <include name="**/*.xml"/> - <include name="**/*.properties"/> - - </patternset> - - <!-- - ======================================================================== - Check to see what libraries are available in order to decide what - mock implementation will be built - ======================================================================== - --> - <path id="lib.classpath"> - <fileset dir="${lib.dir}"> - <include name="*.jar"/> - </fileset> - </path> - - <target name="check.availabilities"> - - <available property="servlet.present" - classname="javax.servlet.Servlet" - classpathref="lib.classpath"/> - - <available property="jms.present" - classname="javax.jms.Message" - classpathref="lib.classpath"/> + <target name="project.properties"> + <property name="project.fullname" value="Mock Objects"/> + <property name="project.version" value="0.02"/> + <property name="project.name" value="mockobjects"/> + + <!-- Miscellaneous settings --> + <property name="year" value="2002"/> + <property name="debug" value="on"/> + <property name="optimize" value="off"/> + <property name="deprecation" value="off"/> + </target> + + <target name="source.locations"> + <property name="src.dir" value="src"/> + <property name="src.core.dir" value="${src.dir}/core"/> + <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> + <property name="src.examples.dir" value="${src.dir}/examples"/> + <property name="conf.dir" value="conf"/> + <property name="doc.dir" value="doc"/> + <property name="xdoc.dir" value="${doc.dir}/xdocs"/> + <property name="skin.dir" value="${doc.dir}/skins"/> + <property name="lib.dir" value="lib"/> + </target> + + <target name="build.locations"> + <!-- Destination locations for the build (relative to the basedir as + specified in the basedir attribute of the project tag) --> + <property name="out.dir" value="out"/> + <property name="out.doc.dir" value="${out.dir}/doc"/> + <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> + <property name="out.classes.dir" value="${out.dir}/classes"/> + <property name="out.site.dir" value="${out.dir}/site"/> + <property name="out.src.dir" value="${out.dir}/src"/> + <property name="out.src.examples.dir" value="${out.src.dir}/examples"/> + <property name="out.conf.dir" value="${out.dir}/conf"/> + <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> + <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> + </target> + + <target name="deliverable.names" + depends="project.properties"> + <property name="dist.dir" value="dist"/> + + <property name="jar.name" value="${project.name}"/> + <property name="sources.zip.name" value="${project.name}-src"/> + + <!-- The project web site in a zip file (without the Javadoc but + with a link pointing to javadoc : <htdocs>/javadoc/index.html --> + <property name="website.zip.name" value="${project.name}-website"/> + <property name="javadoc.name" value="${project.name}-javadoc"/> + <property name="project.zip.name" value="${project.name}-${project.version}"/> </target> - <!-- - ======================================================================== - Initialize the build. Must be called by all targets - ======================================================================== - --> - <target name="init" depends="check.availabilities"> + <target name="useful.file.patterns"> + <!-- All conf files (including test files) --> + <patternset id="nonjava.src.files"> + <include name="**/*.txt"/> + <include name="**/*.xml"/> + <include name="**/*.properties"/> + </patternset> + </target> + + <target name="check.availabilities" + depends="source.locations"> + + <path id="lib.classpath"> + <fileset dir="${lib.dir}"> + <include name="*.jar"/> + </fileset> + </path> + + <available property="jdk.version" value="1.2" classname="java.lang.ThreadLocal" /> + <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> + <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" /> + + <available property="j2ee" classpathref="lib.classpath" classname="javax.servlet.Servlet" /> + <available property="j2ee.version" value="1.2" + classpathref="lib.classpath" classname="javax.servlet.Servlet" /> + <available property="j2ee.version" value="1.3" + classpathref="lib.classpath" classname="javax.servlet.Filter" /> + + <patternset id="all.java.files"> + <include name="core/**/*.java"/> + <include name="j2ee/common/**/*.java" if="j2ee"/> + <include name="j2ee/${j2ee.version}/**/*.java" if="j2ee"/> + </patternset> + </target> + + <!-- Initialize the build. Must be called by all targets --> + <target name="call.me.first" + depends="project.properties, useful.file.patterns, check.availabilities"> <tstamp/> @@ -199,89 +153,60 @@ <filter token="version" value="${project.version}"/> <filter token="year" value="${year}"/> <filter token="today" value="${TODAY}"/> - - </target> - - <!-- - ======================================================================== - Prepare the output directory by copying the source files into it - ======================================================================== - --> - <target name="prepare" depends="init"> - - <mkdir dir="${out.src.dir}"/> - - <!-- Copy all source files to destination dir. Apply the filters in - order to replace the tokens for the version --> - <copy todir="${out.src.dir}" filtering="on"> - <fileset dir="${src.core.dir}"> - <patternset refid="all.src.files"/> - </fileset> - <!--fileset dir="${src.extensions.dir}"> - <patternset refid="all.src.files"/> - </fileset> - <fileset dir="${src.examples.dir}"> - <patternset refid="all.src.files"/> - </fileset--> - </copy> - </target> - <!-- - ======================================================================== - Compiles the source directory - ======================================================================== - --> - <!-- Preparation target for the compile target --> - <target name="prepare-compile" depends="prepare"> - + <target name="clear.old.class.files" + depends="build.locations"> + <delete dir="${out.classes.dir}" quiet="true" /> <mkdir dir="${out.classes.dir}"/> - </target> - <!-- Run the java compilation --> - <target name="compile" depends="prepare-compile"> + <target name="compile" + depends="call.me.first, clear.old.class.files" + description="Compile all the java files for included libraries" > + + <javac destdir="${out.classes.dir}" + debug="${debug}" + deprecation="${deprecation}" + verbose="true" + optimize="${optimize}" + srcdir="${src.dir}"> - <javac - destdir="${out.classes.dir}" - debug="${debug}" - deprecation="${deprecation}" - optimize="${optimize}"> - <src path="${src.core.dir}" /> - <src path="${src.j2ee.dir}" /> - <exclude name="${package.prefix}/servlet/**" unless="servlet.present"/> - <exclude name="${package.prefix}/jms/**" unless="jms.present"/> + <patternset refid="all.java.files" /> <classpath> <path refid="lib.classpath"/> <pathelement path="${java.class.path}"/> </classpath> - </javac> + </target> - <!-- Copies non java files that need to be in the classes directory --> + <target name="copy.nonjava.j2ee.files" + depends="check.availabilities, call.me.first" + if="j2ee"> <copy todir="${out.classes.dir}"> - <fileset dir="${src.core.dir}"> - <patternset refid="all.nonjava.files"/> - </fileset> - <fileset dir="${src.examples.dir}"> - <patternset refid="all.nonjava.files"/> - </fileset> - <fileset dir="${src.extensions.dir}"> - <patternset refid="all.nonjava.files"/> + <fileset dir="${src.dir}/j2ee/common"> + <patternset refid="nonjava.src.files" /> </fileset> + <fileset dir="${src.dir}/j2ee/${j2ee.version}"> + <patternset refid="nonjava.src.files" /> + </fileset> </copy> - </target> - <!-- - ======================================================================== - Create the runtime jar file - ======================================================================== - --> - <!-- Preparation target for the jar target --> - <target name="prepare-jar" depends="compile"> + <target name="copy.nonjava.files" + depends="check.availabilities, call.me.first, copy.nonjava.j2ee.files" > + <copy todir="${out.classes.dir}" + includeEmptyDirs="false" > + <fileset dir="${src.dir}/core"> + <patternset refid="nonjava.src.files"/> + </fileset> + </copy> + </target> + <target name="prepare.jar" + depends="compile, copy.nonjava.files"> + <delete dir="${out.conf.dir}" quiet="yes" /> <mkdir dir="${out.conf.dir}"/> <!-- Copy the manifest in order to replace the version token filter --> @@ -290,20 +215,16 @@ <include name="manifest"/> </fileset> </copy> - </target> - <!-- Generate the jar file --> - <target name="jar" depends="prepare-jar" - description="generate the framework runtime jar"> + <target name="jar" + depends="deliverable.names, prepare.jar" + description="Generate a mockobjects jar"> <jar jarfile="${out.dir}/${jar.name}.jar" - manifest="${out.conf.dir}/manifest"> - + manifest="${out.conf.dir}/manifest"> <fileset dir="${out.classes.dir}"/> - </jar> - </target> <!-- @@ -312,7 +233,7 @@ ======================================================================== --> <!-- Preparation target for the javadoc target --> - <target name="prepare-javadoc" depends="prepare"> + <target name="prepare-javadoc" > <mkdir dir="${out.javadoc.dir}"/> @@ -431,7 +352,7 @@ Generate the web site ======================================================================== --> - <target name="prepare-site" depends="init"> + <target name="prepare-site" depends="call.me.first"> <mkdir dir="${out.xdoc.site.dir}"/> <mkdir dir="${out.site.dir}"/> @@ -538,7 +459,7 @@ Remove all build generated files ======================================================================== --> - <target name="clean" depends="init" + <target name="clean" depends="call.me.first" description="clean up all generated files"> <delete> @@ -566,7 +487,7 @@ <mkdir dir="${dist.dir}"/> </target> - <target name="ZipJavaSources" depends="prepare"> + <target name="ZipJavaSources" > <zip zipfile="${out.dir}/${src.name}.zip" basedir="${out.src.dir}" /> </target> @@ -628,7 +549,7 @@ JRefactory jar need to be place in ${ANT_HOME}/lib. ======================================================================== --> - <target name="format" depends="init" + <target name="format" depends="call.me.first" description="reformats all java code"> <taskdef name="pretty" classname="org.acm.seguin.ant.Pretty"/> |
From: Steve F. <sm...@us...> - 2002-02-22 16:38:04
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv12400/servlet Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet added to the repository |
From: Steve F. <sm...@us...> - 2002-02-22 16:38:04
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms In directory usw-pr-cvs1:/tmp/cvs-serv11696/jms Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms added to the repository |
From: Steve F. <sm...@us...> - 2002-02-22 16:38:03
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/naming In directory usw-pr-cvs1:/tmp/cvs-serv11900/naming Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/naming added to the repository |
From: Steve F. <sm...@us...> - 2002-02-22 16:38:02
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/naming/directory In directory usw-pr-cvs1:/tmp/cvs-serv12111/directory Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/naming/directory added to the repository |
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/naming/directory In directory usw-pr-cvs1:/tmp/cvs-serv13797/com/mockobjects/naming/directory Added Files: MockAttribute.java MockAttributes.java MockDirContext.java MockNamingEnumeration.java Log Message: Setup files common to all j2ee versions --- NEW FILE: MockAttribute.java --- package com.mockobjects.naming.directory; import com.mockobjects.*; import javax.naming.directory.*; import javax.naming.*; public class MockAttribute extends MockObject implements Attribute{ private Object myObjectToReturn; public NamingEnumeration getAll() throws NamingException{ notImplemented(); return null; } public void setupGet(Object aObjectToReturn){ this.myObjectToReturn = aObjectToReturn; } public Object get() throws NamingException{ return myObjectToReturn; } public int size(){ notImplemented(); return 0; } public String getID(){ notImplemented(); return null; } public boolean contains(Object object){ notImplemented(); return false; } public boolean add(Object object){ notImplemented(); return false; } public boolean remove(Object object){ notImplemented(); return false; } public void clear(){ notImplemented(); } public DirContext getAttributeSyntaxDefinition() throws NamingException{ notImplemented(); return null; } public DirContext getAttributeDefinition() throws NamingException{ notImplemented(); return null; } public Object clone(){ notImplemented(); return null; } public boolean isOrdered(){ notImplemented(); return false; } public Object get(int index) throws NamingException{ notImplemented(); return null; } public Object remove(int index){ notImplemented(); return null; } public void add(int index, Object object){ notImplemented(); } public Object set(int index, Object object){ notImplemented(); return null; } public String toString(){ if(myObjectToReturn==null){ return "null"; }else{ return myObjectToReturn.toString(); } } } --- NEW FILE: MockAttributes.java --- package com.mockobjects.naming.directory; import javax.naming.directory.Attributes; import javax.naming.directory.Attribute; import javax.naming.NamingEnumeration; import com.mockobjects.*; import java.util.*; public class MockAttributes extends MockObject implements Attributes{ private List myAttributes = new ArrayList(); public boolean isCaseIgnored(){ notImplemented(); return false; } public int size(){ notImplemented(); return 0; } public void setupAddGet(Attribute attribute){ myAttributes.add(attribute); } public Attribute get(String name){ return (Attribute)myAttributes.remove(0); } public NamingEnumeration getAll(){ notImplemented(); return null; } public NamingEnumeration getIDs(){ notImplemented(); return null; } public Attribute put(String name, Object object){ notImplemented(); return null; } public Attribute put(Attribute attribute){ notImplemented(); return null; } public Attribute remove(String attributeName){ notImplemented(); return null; } public Object clone(){ notImplemented(); return null; } public String toString(){ return myAttributes.toString(); } } --- NEW FILE: MockDirContext.java --- package com.mockobjects.naming.directory; import javax.naming.*; import javax.naming.directory.*; import com.mockobjects.*; import com.mockobjects.naming.*; public class MockDirContext extends MockContext implements DirContext{ private Attributes myAttributeToReturn; private ExpectationValue myName = new ExpectationValue("myName"); private ExpectationValue mySearchName = new ExpectationValue("mySearchName"); private ExpectationValue myAttributes = new ExpectationValue("myAttributes"); private ExpectationValue myModificationOperation = new ExpectationValue("myModificationOperation"); private ExpectationValue myFilter = new ExpectationValue("myFilter"); private ExpectationValue mySearchControls = new ExpectationValue("mySearchControls"); private NamingEnumeration myResults; private ExpectationCounter myAttributesCallCount = new ExpectationCounter("getAttributes"); public void setupAttributes(Attributes anAttributeToReturn){ this.myAttributeToReturn = anAttributeToReturn; } public void setExpectedGetAttributesName(Object aName){ this.myName.setExpected(aName); } public void setExpectedGetAttributesCount(int callCount){ this.myAttributesCallCount.setExpected(callCount); } public Attributes getAttributes(Name aName) throws NamingException{ return getAttributes(aName.toString()); } public Attributes getAttributes(String aName) throws NamingException{ return getAttributes(aName, null); } public Attributes getAttributes(Name aName, String[] attrIds) throws NamingException{ return getAttributes(aName.toString(), attrIds); } public Attributes getAttributes(String aName, String[] attrIds) throws NamingException{ this.myName.setActual(aName); this.myAttributesCallCount.inc(); return myAttributeToReturn; } public void setExpectedModifyAttributes(String aName, int aModificationOperation, Attributes attributes){ this.myName.setExpected(aName); this.myModificationOperation.setExpected(aModificationOperation); this.myAttributes.setExpected(attributes); } public void modifyAttributes(Name aName, int aModificationOperation, Attributes attributes) throws NamingException{ modifyAttributes(aName.toString(), aModificationOperation, attributes); } public void modifyAttributes(String aName, int aModificationOperation, Attributes attributes) throws NamingException{ this.myName.setActual(aName); this.myModificationOperation.setActual(aModificationOperation); this.myAttributes.setActual(attributes); } public void modifyAttributes(Name aName, ModificationItem[] mods) throws NamingException{ notImplemented(); } public void modifyAttributes(String aName, ModificationItem[] mods) throws NamingException{ notImplemented(); } public void bind(Name aName, Object object, Attributes attributes) throws NamingException{ notImplemented(); } public void bind(String aName, Object object, Attributes attributes) throws NamingException{ notImplemented(); } public void rebind(Name aName, Object object, Attributes attributes) throws NamingException{ notImplemented(); } public void rebind(String aName, Object object, Attributes attributes) throws NamingException{ notImplemented(); } public DirContext createSubcontext(Name aName, Attributes attributes) throws NamingException{ notImplemented(); return null; } public DirContext createSubcontext(String aName, Attributes attributes) throws NamingException{ notImplemented(); return null; } public DirContext getSchema(Name aName) throws NamingException{ notImplemented(); return null; } public DirContext getSchema(String aName) throws NamingException{ notImplemented(); return null; } public DirContext getSchemaClassDefinition(Name aName) throws NamingException{ notImplemented(); return null; } public DirContext getSchemaClassDefinition(String aName) throws NamingException{ notImplemented(); return null; } public NamingEnumeration search(Name aName, Attributes attributes, String[] anAttributeToReturn) throws NamingException{ return myResults; } public NamingEnumeration search(String aName, Attributes attributes, String[] anAttributeToReturn) throws NamingException{ return myResults; } public NamingEnumeration search(Name aName, Attributes attributes) throws NamingException{ return myResults; } public NamingEnumeration search(String aName, Attributes attributes) throws NamingException{ return myResults; } public NamingEnumeration search(Name aName, String aFilter, SearchControls cons) throws NamingException{ return myResults; } public void setExpectedSearch(String aSearchName, String aFilter, SearchControls searchControls){ this.mySearchName.setExpected(aSearchName); this.myFilter.setExpected(aFilter); this.mySearchControls.setExpected(searchControls); } public void setupSearchResult(NamingEnumeration results){ this.myResults = results; } public NamingEnumeration search(String aSearchName, String aFilter, SearchControls searchControls) throws NamingException{ this.mySearchName.setActual(aSearchName); this.myFilter.setActual(aFilter); this.mySearchControls.setActual(searchControls); return myResults; } public NamingEnumeration search(Name aName, String aFilter, Object[] filterArgs, SearchControls cons) throws NamingException{ return myResults; } public NamingEnumeration search(String aName, String aFilter, Object[] filterArgs, SearchControls cons) throws NamingException{ return myResults; } } --- NEW FILE: MockNamingEnumeration.java --- package com.mockobjects.naming.directory; import com.mockobjects.*; import javax.naming.*; import javax.naming.directory.*; import java.util.*; public class MockNamingEnumeration extends MockObject implements NamingEnumeration{ private List mySearchResults = new ArrayList(); private boolean hasMore = true; public void setupAddSearchResult(Object object){ mySearchResults.add(object); } public Object next() throws NamingException{ return mySearchResults.remove(0); } public boolean hasMore() throws NamingException{ return mySearchResults.size()>0; } public void close() throws NamingException{ } public boolean hasMoreElements(){ return mySearchResults.size()>0; } public Object nextElement(){ return mySearchResults.remove(0); } } |
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms In directory usw-pr-cvs1:/tmp/cvs-serv13797/com/mockobjects/jms Added Files: MockConnection.java MockMessage.java MockMessageConsumer.java MockMessageProducer.java MockQueue.java MockQueueConnection.java MockQueueConnectionFactory.java MockQueueReceiver.java MockQueueSender.java MockQueueSession.java MockSession.java MockTemporaryQueue.java MockTextMessage.java Log Message: Setup files common to all j2ee versions --- NEW FILE: MockConnection.java --- package com.mockobjects.jms; import javax.jms.Connection; import javax.jms.ConnectionMetaData; import javax.jms.ExceptionListener; import javax.jms.JMSException; import com.mockobjects.ExpectationCounter; import com.mockobjects.MockObject; public class MockConnection extends MockObject implements Connection { protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockConnection.close"); protected ExpectationCounter myStartCalls = new ExpectationCounter("MockConnection.start"); protected ExpectationCounter myStopCalls = new ExpectationCounter("MockConnection.stop"); private JMSException myException; public MockConnection() { } public void close() throws JMSException { myCloseCalls.inc(); throwExceptionIfAny(); } public String getClientID() throws JMSException { notImplemented(); return null; } public ExceptionListener getExceptionListener() throws JMSException { notImplemented(); return null; } public ConnectionMetaData getMetaData() throws JMSException { notImplemented(); return null; } public void setClientID(String clientID) throws JMSException { notImplemented(); } public void setExceptionListener(ExceptionListener listener) throws JMSException { //does nothing } public void start() throws JMSException { myStartCalls.inc(); throwExceptionIfAny(); } public void stop() throws JMSException { myStopCalls.inc(); throwExceptionIfAny(); } public void setExpectedCloseCalls(int callCount) { myCloseCalls.setExpected(callCount); } public void setExpectedStartCalls(int callCount) { myStartCalls.setExpected(callCount); } public void setExpectedStopCalls(int callCount) { myStopCalls.setExpected(callCount); } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockMessage.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public abstract class MockMessage extends MockObject implements Message { protected ExpectationValue myJMSReplyTo = new ExpectationValue("MockMessage.setJMSReplyTo"); protected ExpectationCounter mySetJMSCorrelationIDCalls = new ExpectationCounter("MockMessage.setJMSCorrelationID"); private JMSException myException; /** * Used for both messageID and correlationID */ private String myJMSMessageID; public MockMessage() { } public void acknowledge() throws JMSException { notImplemented(); } public void clearBody() { notImplemented(); } public void clearProperties() { notImplemented(); } public boolean getBooleanProperty(String name) { notImplemented(); return false; } public byte getByteProperty(String name) { notImplemented(); return 0; } public double getDoubleProperty(String name) { notImplemented(); return 0; } public float getFloatProperty(String name) { notImplemented(); return 0; } public int getIntProperty(String name) { notImplemented(); return 0; } public String getJMSCorrelationID() { return myJMSMessageID; } public byte[] getJMSCorrelationIDAsBytes() { notImplemented(); return null; } public int getJMSDeliveryMode() { notImplemented(); return 0; } public Destination getJMSDestination() { notImplemented(); return null; } public long getJMSExpiration() { notImplemented(); return 0; } public String getJMSMessageID() { return myJMSMessageID; } public int getJMSPriority() { notImplemented(); return 0; } public boolean getJMSRedelivered() { notImplemented(); return false; } public Destination getJMSReplyTo() { notImplemented(); return null; } public long getJMSTimestamp() { notImplemented(); return 0; } public String getJMSType() { notImplemented(); return null; } public long getLongProperty(String name) { notImplemented(); return 0; } public Object getObjectProperty(String name) { notImplemented(); return null; } public java.util.Enumeration getPropertyNames() { notImplemented(); return null; } public short getShortProperty(String name) { notImplemented(); return 0; } public String getStringProperty(String name) { notImplemented(); return null; } public boolean propertyExists(String name) { notImplemented(); return false; } public void setBooleanProperty(String name, boolean value) { notImplemented(); } public void setByteProperty(String name, byte value) { notImplemented(); } public void setDoubleProperty(String name, double value) { notImplemented(); } public void setFloatProperty(String name, float value) { notImplemented(); } public void setIntProperty(String name, int value) { notImplemented(); } public void setJMSCorrelationID(String jmsCorrelationID) { mySetJMSCorrelationIDCalls.inc(); } public void setJMSCorrelationIDAsBytes(byte[] correlationID) { notImplemented(); } public void setJMSDeliveryMode(int deliveryMode) { notImplemented(); } public void setJMSDestination(Destination destination) { notImplemented(); } public void setJMSExpiration(long expiration) { notImplemented(); } public void setJMSMessageID(String id) { notImplemented(); } public void setJMSPriority(int priority) { notImplemented(); } public void setJMSRedelivered(boolean redelivered) { notImplemented(); } public void setJMSReplyTo(Destination replyTo) throws JMSException { throwExceptionIfAny(); myJMSReplyTo.setActual(replyTo); } public void setJMSTimestamp(long timestamp) { notImplemented(); } public void setJMSType(String type) { notImplemented(); } public void setLongProperty(String name, long value) { notImplemented(); } public void setObjectProperty(String name, Object value) { notImplemented(); } public void setShortProperty(String name, short value) { notImplemented(); } public void setStringProperty(String name, String value) { notImplemented(); } public void setExpectedJMSReplyTo(Destination expectedJMSReplyTo) { myJMSReplyTo.setExpected(expectedJMSReplyTo); } public void setExpectedSetJMSCorrelationIDCalls(int callCount) { mySetJMSCorrelationIDCalls.setExpected(callCount); } public void setupJMSMessageID(String jmsMessageID) { myJMSMessageID = jmsMessageID; } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockMessageConsumer.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public abstract class MockMessageConsumer extends MockObject implements MessageConsumer { protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockMessageConsumer.close"); protected ExpectationCounter myReceiveCalls = new ExpectationCounter("MockMessageConsumer.receive"); private Message myMessage; private boolean myExpiresOnTimeout = false; private JMSException myException; public MockMessageConsumer() { } public void close() throws JMSException { throwExceptionIfAny(); myCloseCalls.inc(); } public MessageListener getMessageListener() throws JMSException { notImplemented(); return null; } public String getMessageSelector() throws JMSException { notImplemented(); return null; } public Message receive() throws JMSException { throwExceptionIfAny(); myReceiveCalls.inc(); if (myExpiresOnTimeout) { synchronized(this) { try { wait(); } catch (InterruptedException e) { throw new junit.framework.AssertionFailedError("Thread interrupted"); } } } return myMessage; } public Message receive(long timeout) throws JMSException { throwExceptionIfAny(); myReceiveCalls.inc(); if (myExpiresOnTimeout) { return null; } else { return myMessage; } } public Message receiveNoWait() throws JMSException { throwExceptionIfAny(); myReceiveCalls.inc(); return myMessage; } public void setMessageListener(MessageListener listener) throws JMSException { notImplemented(); } public void setExpectedCloseCalls(int callCount) { myCloseCalls.setExpected(callCount); } public void setExpectedReceiveCalls(int callCount) { myReceiveCalls.setExpected(callCount); } public void setupReceivedMessage(Message message) { myMessage = message; } public void setupExpiresOnTimeout(boolean expiresOnTimeout) { myExpiresOnTimeout = expiresOnTimeout; } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockMessageProducer.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public abstract class MockMessageProducer extends MockObject implements MessageProducer { protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockMessageConsumer.close"); private JMSException myException; public MockMessageProducer() { } public void close() throws JMSException { myCloseCalls.inc(); } public int getDeliveryMode() throws JMSException { notImplemented(); return 0; } public boolean getDisableMessageID() throws JMSException { notImplemented(); return false; } public boolean getDisableMessageTimestamp() throws JMSException { notImplemented(); return false; } public int getPriority() throws JMSException { notImplemented(); return 0; } public long getTimeToLive() throws JMSException { notImplemented(); return 0l; } public void setDeliveryMode(int deliveryMode) throws JMSException { notImplemented(); } public void setDisableMessageID(boolean value) throws JMSException { notImplemented(); } public void setDisableMessageTimestamp(boolean value) throws JMSException { notImplemented(); } public void setPriority(int defaultPriority) throws JMSException { notImplemented(); } public void setTimeToLive(long timeToLive) throws JMSException { notImplemented(); } public void setExpectedCloseCalls(int callCount) { myCloseCalls.setExpected(callCount); } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockQueue.java --- package com.mockobjects.jms; import javax.jms.JMSException; import javax.jms.Queue; import com.mockobjects.MockObject; public class MockQueue extends MockObject implements Queue { private JMSException myException; private String myName; public MockQueue(String name) { myName = name; } public String getQueueName() throws JMSException { throwExceptionIfAny(); return myName; } public boolean equals(Object object) { if (!(object instanceof Queue)) return false; try { return myName.equals(((Queue) object).getQueueName()); } catch (JMSException e) { throw new junit.framework.AssertionFailedError( "JMSException caught while getting actual queue name"); } } public int hashCode() { return myName.hashCode(); } public String toString() { return this.getClass().getName() + ", " + myName; } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockQueueConnection.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockQueueConnection extends MockConnection implements QueueConnection { private QueueSession myQueueSession; public MockQueueConnection() { } public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int mexMessages) throws JMSException { notImplemented(); return null; } public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException { throwExceptionIfAny(); return myQueueSession; } public void setupQueueSession(QueueSession queueSession) { myQueueSession = queueSession; } } --- NEW FILE: MockQueueConnectionFactory.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockQueueConnectionFactory extends MockObject implements QueueConnectionFactory { protected ExpectationValue myUserName = new ExpectationValue("MockQueueConnectionFactory.createQueueConnection"); protected ExpectationValue myPassword = new ExpectationValue("MockQueueConnectionFactory.createQueueConnection"); private JMSException myException; private QueueConnection myQueueConnection; public MockQueueConnectionFactory() { } public QueueConnection createQueueConnection() throws JMSException { throwExceptionIfAny(); return myQueueConnection; } public QueueConnection createQueueConnection(String userName, String password) throws JMSException { throwExceptionIfAny(); myUserName.setActual(userName); myPassword.setActual(password); return myQueueConnection; } public void setExpectedUserName(String userName) { myUserName.setExpected(userName); } public void setExpectedPassword(String password) { myPassword.setExpected(password); } public void setupQueueConnection(QueueConnection queueConnection) { myQueueConnection = queueConnection; } public void setupThrowException(JMSException e) { myException = e; } private void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockQueueReceiver.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockQueueReceiver extends MockMessageConsumer implements QueueReceiver { public MockQueueReceiver() { } public Queue getQueue() { notImplemented(); return null; } } --- NEW FILE: MockQueueSender.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockQueueSender extends MockMessageProducer implements QueueSender { protected ExpectationCounter mySendCalls = new ExpectationCounter("MockQueueSender.send"); public MockQueueSender() { } public Queue getQueue() throws JMSException { notImplemented(); return null; } public void send(Message message) throws JMSException { mySendCalls.inc(); throwExceptionIfAny(); } public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { notImplemented(); } public void send(Queue queue, Message message) throws JMSException { notImplemented(); } public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException { notImplemented(); } public void setExpectedSendCalls(int callCount) { mySendCalls.setExpected(callCount); } } --- NEW FILE: MockQueueSession.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockQueueSession extends MockSession implements QueueSession { protected ExpectationValue mySendingQueue = new ExpectationValue("MockQueueSession.createSender"); protected ExpectationValue myReceivingQueue = new ExpectationValue("MockQueueSession.createReceiver"); private QueueReceiver myReceiver; private QueueSender mySender; private TemporaryQueue myTemporaryQueue; public MockQueueSession() { } public QueueBrowser createBrowser(Queue queue) throws JMSException { notImplemented(); return null; } public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException { notImplemented(); return null; } public Queue createQueue(String queueName) throws JMSException { throwExceptionIfAny(); return new MockQueue(queueName); } public QueueReceiver createReceiver(Queue queue) throws JMSException { throwExceptionIfAny(); myReceivingQueue.setActual(queue); return myReceiver; } public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException { myReceivingQueue.setActual(queue); throwExceptionIfAny(); return myReceiver; } public QueueSender createSender(Queue queue) throws JMSException { mySendingQueue.setActual(queue); throwExceptionIfAny(); return mySender; } public TemporaryQueue createTemporaryQueue() throws JMSException { throwExceptionIfAny(); return myTemporaryQueue; } public void setExpectedSendingQueue(Queue queue) { mySendingQueue.setExpected(queue); } public void setExpectedReceivingQueue(Queue queue) { myReceivingQueue.setExpected(queue); } public void setupReceiver(QueueReceiver receiver) { myReceiver = receiver; } public void setupSender(QueueSender sender) { mySender = sender; } public void setupTemporaryQueue(MockTemporaryQueue temporaryQueue) { myTemporaryQueue = temporaryQueue; } } --- NEW FILE: MockSession.java --- package com.mockobjects.jms; import com.mockobjects.*; import java.io.Serializable; import javax.jms.*; public class MockSession extends MockObject implements Session { protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockSession.close"); protected ExpectationCounter myCreateTextMessageCalls = new ExpectationCounter("MockSession.createTextMessage"); private TextMessage myTextMessage = new MockTextMessage(); private JMSException myException; public MockSession() { } public void close() throws JMSException { throwExceptionIfAny(); myCloseCalls.inc(); } public void commit() throws JMSException { notImplemented(); } public BytesMessage createBytesMessage() throws JMSException { notImplemented(); return null; } public MapMessage createMapMessage() throws JMSException { notImplemented(); return null; } public Message createMessage() throws JMSException { notImplemented(); return null; } public ObjectMessage createObjectMessage() throws JMSException { notImplemented(); return null; } public ObjectMessage createObjectMessage(Serializable object) throws JMSException { notImplemented(); return null; } public StreamMessage createStreamMessage() throws JMSException { notImplemented(); return null; } public TextMessage createTextMessage() throws JMSException { myCreateTextMessageCalls.inc(); return myTextMessage; } public TextMessage createTextMessage(String text) throws JMSException { myTextMessage.setText(text); return myTextMessage; } public MessageListener getMessageListener() throws JMSException { notImplemented(); return null; } public boolean getTransacted() throws JMSException { notImplemented(); return false; } public void recover() throws JMSException { notImplemented(); } public void rollback() throws JMSException { notImplemented(); } public void run() { notImplemented(); } public void setMessageListener(MessageListener listener) throws JMSException { notImplemented(); } public void setExpectedCloseCalls(int callCount) { myCloseCalls.setExpected(callCount); } public void setExpectedCreateTextMessageCalls(int callCount) { myCreateTextMessageCalls.setExpected(callCount); } public void setupTextMessage(TextMessage textMessage) { myTextMessage = textMessage; } public void setupThrowException(JMSException e) { myException = e; } protected void throwExceptionIfAny() throws JMSException { if (null != myException) { throw myException; } } } --- NEW FILE: MockTemporaryQueue.java --- package com.mockobjects.jms; import javax.jms.JMSException; import javax.jms.TemporaryQueue; import com.mockobjects.ExpectationCounter; public class MockTemporaryQueue extends MockQueue implements TemporaryQueue { protected ExpectationCounter myDeleteCalls = new ExpectationCounter("MockTemporaryQueue.delete"); public MockTemporaryQueue() { super("TemporaryQueue"); } public void delete() throws JMSException { myDeleteCalls.inc(); throwExceptionIfAny(); } public void setExpectedDeleteCalls(int callCount) { myDeleteCalls.setExpected(callCount); } } --- NEW FILE: MockTextMessage.java --- package com.mockobjects.jms; import com.mockobjects.*; import javax.jms.*; public class MockTextMessage extends MockMessage implements TextMessage { protected ExpectationValue myExpectedText = new ExpectationValue("MockTextMessage.setText"); private String myText; public MockTextMessage() { } public MockTextMessage(String text) { myText = text; } public void setText(String text) { myExpectedText.setActual(text); } public String getText() { return myText; } public void setExpectedText(String text) { myExpectedText.setExpected(text); } } |
From: Steve F. <sm...@us...> - 2002-02-22 16:25:08
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv13797/com/mockobjects/servlet Added Files: MockHttpServletRequest.java MockHttpServletResponse.java MockHttpSession.java MockRequestDispatcher.java MockServletOutputStream.java Log Message: Setup files common to all j2ee versions --- NEW FILE: MockHttpServletRequest.java --- package com.mockobjects.servlet; import java.util.*; import javax.servlet.http.*; import com.mockobjects.*; public class MockHttpServletRequest implements HttpServletRequest { private Dictionary myParameters = new Hashtable(); private String myPathInfo; public MockHttpServletRequest() { super(); } /** * @deprecated */ public void addActualParameter(String paramName, String[] values) { setupAddParameter(paramName, values); } /** * @deprecated */ public void addActualParameter(String paramName, String value) { setupAddParameter(paramName, value); } /** * getAttribute method comment. */ public Object getAttribute(String arg1) { return null; } /** * getAttributeNames method comment. */ public java.util.Enumeration getAttributeNames() { return null; } /** * getAuthType method comment. */ public String getAuthType() { return null; } /** * getCharacterEncoding method comment. */ public String getCharacterEncoding() { return null; } /** * getContentLength method comment. */ public int getContentLength() { return 0; } /** * getContentType method comment. */ public String getContentType() { return null; } /** * getContextPath method comment. */ public java.lang.String getContextPath() { return null; } /** * getCookies method comment. */ public javax.servlet.http.Cookie[] getCookies() { return null; } /** * getDateHeader method comment. */ public long getDateHeader(String arg1) { return 0; } /** * getHeader method comment. */ public String getHeader(String arg1) { return null; } /** * getHeaderNames method comment. */ public java.util.Enumeration getHeaderNames() { return null; } /** * getHeaders method comment. */ public java.util.Enumeration getHeaders(java.lang.String arg1) { return null; } /** * getInputStream method comment. */ public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException { return null; } /** * getIntHeader method comment. */ public int getIntHeader(String arg1) { return 0; } /** * getLocale method comment. */ public java.util.Locale getLocale() { return null; } /** * getLocales method comment. */ public java.util.Enumeration getLocales() { return null; } /** * getMethod method comment. */ public String getMethod() { return null; } public String getParameter(String paramName) { String[] values = getParameterValues(paramName); return (values == null ? null : values[0]); } public java.util.Enumeration getParameterNames() { return myParameters.keys(); } public String[] getParameterValues(String key) { return (String[]) myParameters.get(key); } public String getPathInfo() { return myPathInfo; } /** * getPathTranslated method comment. */ public String getPathTranslated() { return null; } /** * getProtocol method comment. */ public String getProtocol() { return null; } /** * getQueryString method comment. */ public String getQueryString() { return null; } /** * getReader method comment. */ public java.io.BufferedReader getReader() throws java.io.IOException { return null; } /** * getRealPath method comment. */ public String getRealPath(String arg1) { return null; } /** * getRemoteAddr method comment. */ public String getRemoteAddr() { return null; } /** * getRemoteHost method comment. */ public String getRemoteHost() { return null; } /** * getRemoteUser method comment. */ public String getRemoteUser() { return null; } /** * getRequestDispatcher method comment. */ public javax.servlet.RequestDispatcher getRequestDispatcher( java.lang.String arg1) { return null; } /** * getRequestedSessionId method comment. */ public String getRequestedSessionId() { return null; } /** * getRequestURI method comment. */ public String getRequestURI() { return null; } /** * getScheme method comment. */ public String getScheme() { return null; } /** * getServerName method comment. */ public String getServerName() { return null; } /** * getServerPort method comment. */ public int getServerPort() { return 0; } /** * getServletPath method comment. */ public String getServletPath() { return null; } /** * getSession method comment. */ public javax.servlet.http.HttpSession getSession() { return null; } /** * getSession method comment. */ public javax.servlet.http.HttpSession getSession(boolean arg1) { return null; } /** * getUserPrincipal method comment. */ public java.security.Principal getUserPrincipal() { return null; } /** * isRequestedSessionIdFromCookie method comment. */ public boolean isRequestedSessionIdFromCookie() { return false; } /** * isRequestedSessionIdFromUrl method comment. */ public boolean isRequestedSessionIdFromUrl() { return false; } /** * isRequestedSessionIdFromURL method comment. */ public boolean isRequestedSessionIdFromURL() { return false; } /** * isRequestedSessionIdValid method comment. */ public boolean isRequestedSessionIdValid() { return false; } /** * isSecure method comment. */ public boolean isSecure() { return false; } /** * isUserInRole method comment. */ public boolean isUserInRole(java.lang.String arg1) { return false; } /** * removeAttribute method comment. */ public void removeAttribute(java.lang.String arg1) { } /** * setAttribute method comment. */ public void setAttribute(String arg1, Object arg2) { } /** * @deprecated */ public void setNoActualParameters() { setupNoParameters(); } public void setupAddParameter(String paramName, String[] values) { myParameters.put(paramName, values); } public void setupAddParameter(String paramName, String value) { setupAddParameter(paramName, new String[] { value }); } public void setupNoParameters() { myParameters = new Hashtable(); } public void setupPathInfo(String pathInfo) { myPathInfo = pathInfo; } } --- NEW FILE: MockHttpServletResponse.java --- package com.mockobjects.servlet; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import junit.framework.Assert; import com.mockobjects.*; public class MockHttpServletResponse extends MockObject implements HttpServletResponse, Verifiable { private ExpectationList myContentTypes = new ExpectationList("MockHttpServletResponse.setContentType"); private ExpectationList myHeaders = new ExpectationList("MockHttpServletResponse.setHeader"); private ExpectationCounter mySetStatusCalls = new ExpectationCounter("MockHttpServletResponse.setStatus"); private ExpectationList myRedirects = new ExpectationList("MockHttpServletResponse.sendRedirect"); private ServletOutputStream myOutputStream = new MockServletOutputStream(); /** * MockHttpServletResponse constructor comment. */ public MockHttpServletResponse() { super(); } public void addCookie(javax.servlet.http.Cookie arg1) { fail("Not implemented"); } /** * addDateHeader method comment. */ public void addDateHeader(java.lang.String arg1, long arg2) { } /** * addHeader method comment. */ public void addHeader(java.lang.String arg1, java.lang.String arg2) { } /** * addIntHeader method comment. */ public void addIntHeader(java.lang.String arg1, int arg2) { } public boolean containsHeader(String arg1) { fail("Not implemented"); return false; } public String encodeRedirectUrl(String arg1) { fail("Not implemented"); return null; } public String encodeRedirectURL(String arg1) { fail("Not implemented"); return null; } public String encodeUrl(String arg1) { fail("Not implemented"); return null; } public String encodeURL(String arg1) { fail("Not implemented"); return null; } /** * flushBuffer method comment. */ public void flushBuffer() throws java.io.IOException { } /** * getBufferSize method comment. */ public int getBufferSize() { return 0; } public String getCharacterEncoding() { fail("Not implemented"); return null; } /** * getLocale method comment. */ public java.util.Locale getLocale() { return null; } public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException { return myOutputStream; } public String getOutputStreamContents() { return ((MockServletOutputStream) myOutputStream).getContents(); } public java.io.PrintWriter getWriter() throws java.io.IOException { return new PrintWriter(myOutputStream, true); } /** * isCommitted method comment. */ public boolean isCommitted() { return false; } /** * reset method comment. */ public void reset() { } public void sendError(int arg1) throws java.io.IOException { fail("Not implemented"); } public void sendError(int arg1, String arg2) throws java.io.IOException { fail("Not implemented"); } public void sendRedirect(String aURL) throws java.io.IOException { myRedirects.addActual(aURL); } /** * setBufferSize method comment. */ public void setBufferSize(int arg1) { } public void setContentLength(int arg1) { fail("Not implemented"); } public void setContentType(String contentType) { myContentTypes.addActual(contentType); } public void setDateHeader(String arg1, long arg2) { fail("Not implemented"); } public void setExpectedContentType(String contentType) { myContentTypes.addExpected(contentType); } public void setExpectedHeader(String key, String value) { myHeaders.addExpected(new MapEntry(key, value)); } public void setExpectedRedirect(String aURL) throws IOException { myRedirects.addExpected(aURL); } public void setExpectedSetStatusCalls(int callCount) { mySetStatusCalls.setExpected(callCount); } public void setHeader(String key, String value) { myHeaders.addActual(new MapEntry(key, value)); } public void setIntHeader(String arg1, int arg2) { Assert.fail("Not implemented"); } /** * setLocale method comment. */ public void setLocale(java.util.Locale arg1) { } public void setStatus(int status) { mySetStatusCalls.inc(); } public void setStatus(int arg1, String arg2) { Assert.fail("Not implemented"); } public void setupOutputStream(ServletOutputStream anOutputStream) { myOutputStream = anOutputStream; } } --- NEW FILE: MockHttpSession.java --- package com.mockobjects.servlet; import java.util.*; import javax.servlet.http.HttpSessionContext; import javax.servlet.http.HttpSession; import com.mockobjects.*; public class MockHttpSession extends MockObject implements HttpSession, Verifiable { public ExpectationSet myAttributes = new ExpectationSet("session attributes"); public MockHttpSession() { super(); } public Object getAttribute(String arg1) { notImplemented(); return null; } public Enumeration getAttributeNames() { return null; } public long getCreationTime() { notImplemented(); return 0; } public String getId() { notImplemented(); return null; } public long getLastAccessedTime() { notImplemented(); return 0; } public int getMaxInactiveInterval() { return 0; } public HttpSessionContext getSessionContext() { return null; } public Object getValue(String arg1) { notImplemented(); return null; } public java.lang.String[] getValueNames() { notImplemented(); return null; } public void invalidate() { } public boolean isNew() { return false; } public void putValue(String arg1, Object arg2) { } public void removeAttribute(String arg1) { } public void removeValue(String arg1) { } public void setAttribute(String aKey, Object aValue) { myAttributes.addActual(new MapEntry(aKey, aValue)); } public void setExpectedAttribute(String aKey, Object aValue) { myAttributes.addExpected(new MapEntry(aKey, aValue)); } public void setMaxInactiveInterval(int arg1) { } public void verify() { myAttributes.verify(); } } --- NEW FILE: MockRequestDispatcher.java --- package com.mockobjects.servlet; import java.io.IOException; import javax.servlet.*; public class MockRequestDispatcher implements RequestDispatcher { /** * MockRequestDispatcher constructor comment. */ public MockRequestDispatcher() { super(); } public void forward(ServletRequest arg1, ServletResponse arg2) throws ServletException, IOException { } public void include(ServletRequest arg1, ServletResponse arg2) throws ServletException, IOException { } } --- NEW FILE: MockServletOutputStream.java --- package com.mockobjects.servlet; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.servlet.ServletOutputStream; import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationValue; public class MockServletOutputStream extends ServletOutputStream { private ExpectationValue myWriteCalled = new ExpectationValue("MockServletOutputStream.write()"); private boolean myThrowException = false; private ExpectationCounter myCloseCallCount = new ExpectationCounter("MockServletOutputstream.close()"); private ByteArrayOutputStream myBuffer; public MockServletOutputStream() { super(); setupClearContents(); } public void setExpectedCloseCalls(int closeCall) { myCloseCallCount.setExpected(closeCall); } public void setExpectingWriteCalls(boolean expectingWriteCall) { myWriteCalled.setExpected(expectingWriteCall); } public void setThrowIOException(boolean throwException) { myThrowException = throwException; } public void close() throws IOException { myCloseCallCount.inc(); } public String toString() { return getContents(); } public void write(int b) throws IOException { myWriteCalled.setActual(true); if (myThrowException) throw new IOException("Test IOException generated by request"); myBuffer.write(b); } public void setupClearContents () { myBuffer = new ByteArrayOutputStream(); } public String getContents() { return myBuffer.toString(); } public void verify() { myWriteCalled.verify(); myCloseCallCount.verify(); } } |