You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2018/10/25 14:32:47 UTC
svn commit: r1844833 - in
/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer:
BaseUnit4Test.java BaseUnitTest.java Container.java ECMContainer.java
YAAFIContainer.java
Author: painter
Date: Thu Oct 25 14:32:46 2018
New Revision: 1844833
URL: http://svn.apache.org/viewvc?rev=1844833&view=rev
Log:
More javadoc love
Modified:
turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java
turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java
turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java
turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java?rev=1844833&r1=1844832&r2=1844833&view=diff
==============================================================================
--- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java (original)
+++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java Thu Oct 25 14:32:46 2018
@@ -56,17 +56,17 @@ import org.mockito.stubbing.Answer;
*/
public class BaseUnit4Test
{
- public static final String CONTAINER_ECM="CONTAINER_ECM";
- public static final String CONTAINER_YAAFI="CONTAINER_YAAFI";
+ public static final String CONTAINER_ECM = "CONTAINER_ECM";
+ public static final String CONTAINER_YAAFI = "CONTAINER_YAAFI";
/** Key used in the context for defining the application root */
- public static String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
+ public static final String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
/** Pick the default container to be YAAFI **/
public static String containerType = CONTAINER_YAAFI;
/** Use INFO for ConsoleLogger */
- public static int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
+ public static final int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
/** Container for the components */
private Container container;
@@ -83,9 +83,17 @@ public class BaseUnit4Test
/** Set the log level (only works for YAAFI container) */
private int logLevel = defaultLogLevel;
+ /** Hash map to store attributes for the test **/
+ public Map<String,Object> attributes = new HashMap<String,Object>();
+
+ /** set the Max inactive interval **/
+ public int maxInactiveInterval = 0;
+
/**
* Gets the configuration file name for the container should use for this test. By default it
* is src/test/TestComponentConfig.
+ *
+ * @param configurationFileName the location of the config file
*/
protected void setConfigurationFileName(String configurationFileName)
{
@@ -95,6 +103,8 @@ public class BaseUnit4Test
/**
* Override the role file name for the container should use for this test. By default it is
* src/test/TestRoleConfig.
+ *
+ * @param roleFileName location of the role file
*/
protected void setRoleFileName(String roleFileName)
{
@@ -102,7 +112,10 @@ public class BaseUnit4Test
}
/**
- * Set the console logger level,
+ * Set the console logger level
+ *
+ * @see org.apache.avalon.framework.logger.ConsoleLogger for debugging levels
+ * @param logLevel set valid logging level
*/
protected void setLogLevel(int logLevel) {
this.logLevel = logLevel;
@@ -159,9 +172,12 @@ public class BaseUnit4Test
}
/**
- * Returns an instance of the named component. Starts the container if it hasn't been started.
+ * Returns an instance of the named component.
+ * This method will also start the container if it
+ * has not been started already
*
* @param roleName Name of the role the component fills.
+ * @return instance of the component
* @throws ComponentException generic exception
*/
protected Object lookup(String roleName) throws ComponentException
@@ -192,9 +208,12 @@ public class BaseUnit4Test
}
}
- public Map<String,Object> attributes = new HashMap<String,Object>();
- public int maxInactiveInterval = 0;
+ /**
+ * Get a mock requestion
+ *
+ * @return HttpServletRequest a mock servlet request
+ */
protected HttpServletRequest getMockRequest()
{
HttpServletRequest request = mock(HttpServletRequest.class);
@@ -253,13 +272,13 @@ public class BaseUnit4Test
when(request.getPathInfo()).thenReturn("damn");
when(request.getServletPath()).thenReturn("damn2");
when(request.getContextPath()).thenReturn("wow");
- when(request.getContentType()).thenReturn("html/text");
+ when(request.getContentType()).thenReturn("text/html");
when(request.getCharacterEncoding()).thenReturn("US-ASCII");
when(request.getServerPort()).thenReturn(8080);
when(request.getLocale()).thenReturn(Locale.US);
- when(request.getHeader("Content-type")).thenReturn("html/text");
+ when(request.getHeader("Content-type")).thenReturn("text/html");
when(request.getHeader("Accept-Language")).thenReturn("en-US");
Vector<String> v = new Vector<String>();
Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java?rev=1844833&r1=1844832&r2=1844833&view=diff
==============================================================================
--- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java (original)
+++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnitTest.java Thu Oct 25 14:32:46 2018
@@ -41,28 +41,33 @@ public class BaseUnitTest extends TestCa
public static final String CONTAINER_YAAFI="CONTAINER_YAAFI";
/** Key used in the context for defining the application root */
- public static String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
+ public static final String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
/** Pick the default container to be Yaafi **/
- public static String containerType = CONTAINER_YAAFI;
+ public static final String containerType = CONTAINER_YAAFI;
/** Use INFO for ConsoleLogger */
- public static int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
+ public static final int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
/** Container for the components */
private Container container;
+
/** Setup our default configurationFileName */
private String configurationFileName = "src/test/TestComponentConfig.xml";
+
/** Setup our default roleFileName */
private String roleFileName = "src/test/TestRoleConfig.xml";
+
/** Setup our default parameterFileName */
private String parameterFileName = null;
+
/** Set the log level (only works for YAAFI container) */
private int logLevel = defaultLogLevel;
/**
* Gets the configuration file name for the container should use for this test. By default it
* is src/test/TestComponentConfig.
+ * @param configurationFileName the location of the config file
*/
protected void setConfigurationFileName(String configurationFileName)
{
@@ -72,6 +77,8 @@ public class BaseUnitTest extends TestCa
/**
* Override the role file name for the container should use for this test. By default it is
* src/test/TestRoleConfig.
+ *
+ * @param roleFileName location of the role file
*/
protected void setRoleFileName(String roleFileName)
{
@@ -79,7 +86,10 @@ public class BaseUnitTest extends TestCa
}
/**
- * Set the console logger level,
+ * Set the console logger level
+ *
+ * @see org.apache.avalon.framework.logger.ConsoleLogger for debugging levels
+ * @param logLevel set valid logging level
*/
protected void setLogLevel(int logLevel) {
this.logLevel = logLevel;
@@ -138,10 +148,13 @@ public class BaseUnitTest extends TestCa
}
/**
- * Returns an instance of the named component. Starts the container if it hasn't been started.
- *
- * @param roleName Name of the role the component fills.
- * @throws ComponentException generic exception
+ * Returns an instance of the named component.
+ * This method will also start the container if it
+ * has not been started already
+ *
+ * @param roleName Name of the role the component fills.
+ * @return instance of the component
+ * @throws ComponentException generic exception
*/
protected Object lookup(String roleName) throws ComponentException
{
@@ -160,6 +173,10 @@ public class BaseUnitTest extends TestCa
/**
* Helper method for converting to and from Merlin Unit TestCase.
+ *
+ * @param roleName the role name to resolve
+ * @return the component matching the role
+ * @throws ComponentException generic exception
*/
protected Object resolve(String roleName) throws ComponentException
{
Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java?rev=1844833&r1=1844832&r2=1844833&view=diff
==============================================================================
--- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java (original)
+++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/Container.java Thu Oct 25 14:32:46 2018
@@ -26,7 +26,7 @@ import org.apache.avalon.framework.compo
/**
* This is a simple interface around the ECM and Yaafi containers
*
- * @author <a href="mailto:epugh at opensourceconnections.com">Eric Pugh</a>
+ * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
*/
public interface Container extends Initializable, Disposable
{
Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java?rev=1844833&r1=1844832&r2=1844833&view=diff
==============================================================================
--- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java (original)
+++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java Thu Oct 25 14:32:46 2018
@@ -145,10 +145,11 @@ public class ECMContainer extends Abstra
{
return this.manager.lookup(roleName);
}
+
/**
* Releases the component
*
- * @param component
+ * @param component instance of the component to release
*/
public void release(Component component)
{
Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java?rev=1844833&r1=1844832&r2=1844833&view=diff
==============================================================================
--- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java (original)
+++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java Thu Oct 25 14:32:46 2018
@@ -157,7 +157,7 @@ public class YAAFIContainer extends Abst
* Releases the component implementing the Component interface. This
* interface is deprecated but still around in Fulcrum
*
- * @param component
+ * @param component instance of the component to release
*/
public void release(Component component)
{