Author: mageshbk(a)jboss.com
Date: 2009-05-13 20:24:26 -0400 (Wed, 13 May 2009)
New Revision: 13368
Added:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/apps/httpHeader-portlet.war
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java
Removed:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml
Log:
[JBEPP-81] - Added test case
Copied:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/apps/httpHeader-portlet.war
(from rev 13367,
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/httpHeader-portlet.war)
===================================================================
(Binary files differ)
Modified: branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml 2009-05-14
00:07:28 UTC (rev 13367)
+++ branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml 2009-05-14
00:24:26 UTC (rev 13368)
@@ -100,6 +100,8 @@
<target name="copyApps">
<echo message="Copying userInterceptor portlet into the
${portal.instance} server" />
<copy file="apps/userDetail-portlet.war"
tofile="${jboss.home}/server/${portal.instance}/deploy/userDetail-portlet.war"
/>
+ <echo message="Copying httpHeader portlet into the ${portal.instance}
server" />
+ <copy file="apps/httpHeader-portlet.war"
tofile="${jboss.home}/server/${portal.instance}/deploy/httpHeader-portlet.war"
/>
</target>
<target name="clean">
Copied:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core
(from rev 13367,
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core)
Deleted:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java 2009-05-14
00:07:28 UTC (rev 13367)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java 2009-05-14
00:24:26 UTC (rev 13368)
@@ -1,78 +0,0 @@
-package org.jboss.portal.test.selenium.core;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mageshbk@jboss.com">Magesh Kumar B</a>
- */
-@Test(groups = { "portlet_http_header" }, enabled = true, description =
"Checking http headers and cookies of portlet responses.")
-public class HttpHeaderTestCase extends JBossPortalSeleniumTestCase
-{
- @Test(enabled = true, description = "Checking http headers of portlet
responses.")
- public void testHttpHeaders()
- {
- try
- {
- HttpURLConnection connection;
- Map<String,List<String>> headers;
- connection = (HttpURLConnection)new
URL("http://localhost:8080/portal/portal/HttpHeaderPortal/default/HttpHeaderPortletWindow2?action=1").openConnection();
- headers = connection.getHeaderFields();
- //System.out.println(headers);
- List<String> others1 = headers.get("Foo");
- List<String> others2 = headers.get("Foo2");
- List<String> others3 = headers.get("partialRefresh");
- List<String> others4 = headers.get("Expires");
- List<String> others5 = headers.get("Pragma");
- List<String> others6 = headers.get("Cache-Control");
-
- Assert.assertTrue(others1 == null, "Expected no Foo as it is set in
processAction!");
- Assert.assertTrue(others2.size() == 2, "Expected 2 Foo2!");
- Assert.assertTrue(others3.size() == 1, "Expected 1 partialRefresh!");
- Assert.assertTrue(others4.size() == 1, "Expected 1 Expires!");
- Assert.assertTrue(others5.size() == 1, "Expected 1 Pragma!");
- Assert.assertTrue(others6.size() == 1, "Expected 1 Cache-Control!");
-
- Assert.assertTrue(others2.get(0).equals("BarView2")
- && others2.get(1).equals("BarView1"), "Foo2 not
found!");
- Assert.assertTrue(others3.get(0).equals("true"), "partialRefresh
not found!");
- Assert.assertTrue(others4.get(0).equals("0"), "Expires not
found!");
- Assert.assertTrue(others5.get(0).equals("no-cache"), "Pragma not
found!");
- Assert.assertTrue(others6.get(0).equals("private, no-store, no-cache,
must-revalidate, post-check=0, pre-check=0, max-age=0, s-maxage=0"),
- "Cache-Control not
found!");
- connection.disconnect();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- @Test(enabled = true, description = "Checking cookies of portlet
responses.")
- public void testHttpCookies()
- {
- logoutIfPossible();
- login("admin", "admin");
- selenium.open("portal/HttpHeaderPortal");
- selenium.waitForPageToLoad(PAGE_LOAD);
- String cookie = selenium.getCookie();
- // This is set in doView()
- Assert.assertTrue(cookie.indexOf("MyIdea=1.1") >= 0,"Custom
Cookie set in doView not found!");
-
- selenium.click("link=doAction");
- selenium.waitForPageToLoad(PAGE_LOAD);
- cookie = selenium.getCookie();
- // Cookie order is unknown, but all cookies are set properly.
- // Sometimes it is set multiple times too...
- Assert.assertTrue(cookie.indexOf("MyIdea=1.1") >= 0
- && cookie.indexOf("MyIdea2=2.0") >= 0,"Custom
Cookies set in processAction not found!");
- logout();
- }
-}
Copied:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java
(from rev 13367,
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java)
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java
(rev 0)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/core/HttpHeaderTestCase.java 2009-05-14
00:24:26 UTC (rev 13368)
@@ -0,0 +1,78 @@
+package org.jboss.portal.test.selenium.core;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:mageshbk@jboss.com">Magesh Kumar B</a>
+ */
+@Test(groups = { "portlet_http_header" }, enabled = true, description =
"Checking http headers and cookies of portlet responses.")
+public class HttpHeaderTestCase extends JBossPortalSeleniumTestCase
+{
+ @Test(enabled = true, description = "Checking http headers of portlet
responses.")
+ public void testHttpHeaders()
+ {
+ try
+ {
+ HttpURLConnection connection;
+ Map<String,List<String>> headers;
+ connection = (HttpURLConnection)new
URL("http://localhost:8080/portal/portal/HttpHeaderPortal/default/HttpHeaderPortletWindow2?action=1").openConnection();
+ headers = connection.getHeaderFields();
+ //System.out.println(headers);
+ List<String> others1 = headers.get("Foo");
+ List<String> others2 = headers.get("Foo2");
+ List<String> others3 = headers.get("partialRefresh");
+ List<String> others4 = headers.get("Expires");
+ List<String> others5 = headers.get("Pragma");
+ List<String> others6 = headers.get("Cache-Control");
+
+ Assert.assertTrue(others1 == null, "Expected no Foo as it is set in
processAction!");
+ Assert.assertTrue(others2.size() == 2, "Expected 2 Foo2!");
+ Assert.assertTrue(others3.size() == 1, "Expected 1 partialRefresh!");
+ Assert.assertTrue(others4.size() == 1, "Expected 1 Expires!");
+ Assert.assertTrue(others5.size() == 1, "Expected 1 Pragma!");
+ Assert.assertTrue(others6.size() == 1, "Expected 1 Cache-Control!");
+
+ Assert.assertTrue(others2.get(0).equals("BarView2")
+ && others2.get(1).equals("BarView1"), "Foo2 not
found!");
+ Assert.assertTrue(others3.get(0).equals("true"), "partialRefresh
not found!");
+ Assert.assertTrue(others4.get(0).equals("0"), "Expires not
found!");
+ Assert.assertTrue(others5.get(0).equals("no-cache"), "Pragma not
found!");
+ Assert.assertTrue(others6.get(0).equals("private, no-store, no-cache,
must-revalidate, post-check=0, pre-check=0, max-age=0, s-maxage=0"),
+ "Cache-Control not
found!");
+ connection.disconnect();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Test(enabled = true, description = "Checking cookies of portlet
responses.")
+ public void testHttpCookies()
+ {
+ logoutIfPossible();
+ login("admin", "admin");
+ selenium.open("portal/HttpHeaderPortal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ String cookie = selenium.getCookie();
+ // This is set in doView()
+ Assert.assertTrue(cookie.indexOf("MyIdea=1.1") >= 0,"Custom
Cookie set in doView not found!");
+
+ selenium.click("link=doAction");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ cookie = selenium.getCookie();
+ // Cookie order is unknown, but all cookies are set properly.
+ // Sometimes it is set multiple times too...
+ Assert.assertTrue(cookie.indexOf("MyIdea=1.1") >= 0
+ && cookie.indexOf("MyIdea2=2.0") >= 0,"Custom
Cookies set in processAction not found!");
+ logout();
+ }
+}
Modified: branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml 2009-05-14
00:07:28 UTC (rev 13367)
+++ branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml 2009-05-14
00:24:26 UTC (rev 13368)
@@ -118,6 +118,12 @@
<class
name="org.jboss.portal.test.selenium.cms.CMSArchiveUploadTestCase"></class></classes>
</test>
+ <test name="org.jboss.portal.test.selenium.core.HttpHeaderTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.core.HttpHeaderTestCase"></class></classes>
+ </test>
+
<listeners>
<!-- <listener
class-name="org.testng.reporters.JUnitXMLReporter"></listener> -->
<listener
class-name="org.jboss.portal.test.selenium.JBossSeleniumTestListener"/>