paulsp 02/05/25 07:30:33
Modified: src/java/org/apache/jetspeed/services/profiler
JetspeedProfilerService.java
src/java/org/apache/jetspeed/test TestBasicSanity.java
Log:
o Profiler.makeDynamicURI() now includes the user on the URL then the username exists
and the user is logged in.
o Add test for "Logged in user" in TestBasicSanity
Revision Changes Path
1.30 +3 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
Index: JetspeedProfilerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- JetspeedProfilerService.java 20 May 2002 13:05:05 -0000 1.29
+++ JetspeedProfilerService.java 25 May 2002 14:30:33 -0000 1.30
@@ -134,7 +134,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
- * @version $Id: JetspeedProfilerService.java,v 1.29 2002/05/20 13:05:05 ggolden
Exp $
+ * @version $Id: JetspeedProfilerService.java,v 1.30 2002/05/25 14:30:33 paulsp Exp
$
*/
public class JetspeedProfilerService extends TurbineBaseService
@@ -736,7 +736,8 @@
User user = locator.getUser();
if (null != user)
{
- uri.addPathInfo(Profiler.PARAM_USER, user.getUserName());
+ if ((user.getUserName() != null) && (user.hasLoggedIn()))
+ uri.addPathInfo(Profiler.PARAM_USER, user.getUserName());
}
else
{
1.3 +67 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/test/TestBasicSanity.java
Index: TestBasicSanity.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/test/TestBasicSanity.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestBasicSanity.java 13 Apr 2002 08:24:44 -0000 1.2
+++ TestBasicSanity.java 25 May 2002 14:30:33 -0000 1.3
@@ -92,17 +92,21 @@
/**
*
* @author <a href="[EMAIL PROTECTED]">Paul Spencer</a>
- * @version $Id: TestBasicSanity.java,v 1.2 2002/04/13 08:24:44 paulsp Exp $
+ * @version $Id: TestBasicSanity.java,v 1.3 2002/05/25 14:30:33 paulsp Exp $
*/
public class TestBasicSanity extends ServletTestCase
{
private static String TEST_ANON_USER_NAME = "";
private static String TEST_CONTEXT = null;
+ private static String TEST_DEFAULT_PAGE = "default";
private static String TEST_HOST = "localhost";
private static String TEST_SERVLET = "/portal";
private static String TEST_GROUP = "apache";
private static String TEST_PAGE = "news";
+ private static String TEST_USER = "turbine";
+ private static String TEST_USER_PASSWORD ="turbine";
+
private RunData rundata = null;
/**
@@ -322,6 +326,7 @@
assertTrue("Verify the 'anonymous' is set",
profileLocator.getAnonymous());
assertNull("Verify the group is null", profileLocator.getGroup());
assertNull("Verify the role is null", profileLocator.getRole());
+ assertEquals("Verify the page name", profileLocator.getName(),
TEST_PAGE + ".psml");
} else
{
assertTrue( "profile does not implement ProfileLocator", false);
@@ -334,6 +339,67 @@
}
public void endPageURL(WebResponse theResponse)
+ {
+ System.out.println("text length = " + theResponse.getText().length());
+// System.out.println("text length = " + theResponse.getText());
+ }
+ /**
+ * Test: PageURL
+ * With the page URL "/page/apache"
+ * 1) A page is generated
+ * 2) The user is anonymous
+ * 3) Group is set to "apache"
+ * 4) Role is not set
+ */
+ public void beginUserPageUrl(WebRequest theRequest)
+ {
+ System.out.println("URL = " + theRequest.getURL());
+ theRequest.setURL(TEST_HOST, TEST_CONTEXT, TEST_SERVLET
+ , "/page/" + TEST_DEFAULT_PAGE
,"action=JLoginUser&username=turbine&password=turbine");
+ System.out.println("post set URL = " + theRequest.getURL());
+ }
+
+ /**
+ * Test the PageURL
+ *
+ * @throws Exception
+ */
+ public void testUserPageUrl() throws Exception
+ {
+ // Create the RunData object to be used during testing.
+ rundata = RunDataFactory.getRunData ( request, response, config );
+ assertNotNull( "Got rundata", rundata);
+
+ TurbineTestUtilities.setupRunData(rundata);
+
+ // Verify we have a profile
+ Profile profile = Profiler.getProfile(rundata);
+ assertNotNull( "Got profile from Profiler", profile);
+
+ // Verify the profile location information in the profile
+ if (profile instanceof ProfileLocator)
+ {
+ ProfileLocator profileLocator = (ProfileLocator) profile;
+ // FIXME: Need to verify 'anonymous' and page name
+ assertTrue("Verify the 'anonymous' is not",
!profileLocator.getAnonymous());
+ assertNull("Verify the group is null", profileLocator.getGroup());
+ assertNull("Verify the role is null", profileLocator.getRole());
+ assertNotNull("Verify the user is not null", profileLocator.getUser());
+ assertTrue("Verify the user is logged in",
profileLocator.getUser().hasLoggedIn());
+ assertEquals("Verify the user's username",
profileLocator.getUser().getUserName(),TEST_USER);
+ assertEquals("Verify the page name", profileLocator.getName(),
TEST_DEFAULT_PAGE + ".psml");
+ } else
+ {
+ assertTrue( "profile does not implement ProfileLocator", false);
+ }
+ TurbineTestUtilities.generatePage(rundata);
+ TurbineTestUtilities.outputPage(rundata);
+
+ // Return the used RunData to the factory for recycling.
+ RunDataFactory.putRunData(rundata);
+ }
+
+ public void endUserPageURL(WebResponse theResponse)
{
System.out.println("text length = " + theResponse.getText().length());
// System.out.println("text length = " + theResponse.getText());
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>