JBoss Portal SVN: r13487 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium: sso and 1 other directory.
by portal-commits@lists.jboss.org
Author: mposolda(a)redhat.com
Date: 2009-06-23 10:45:50 -0400 (Tue, 23 Jun 2009)
New Revision: 13487
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/JOSSOSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/SSOSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveDisabledTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithExampleTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithJMXConsoleTestCase.java
Log:
Assert messages added to PortalBookstoreSampleTestCase and all SSO test classes.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -62,7 +62,7 @@
private final String DETAIL_PORTLET_ADD_LINK = getLoc(casePfx+"detail.lnk.add", "BookDetailPortlet_AddBookLink");
// BookShowCartPortlet
- private final String SHOWCART_PORTLET_CLEAR_CART_LINK = getLoc(casePfx+"showcart.lnk.clear", "link=Clear Cart");
+ private final String SHOWCART_PORTLET_CLEAR_CART_LINK = getLoc(casePfx+"showcart.lnk.clear", "link=Clear Cart");
private final String SHOWCART_PORTLET_HEADER = getLoc(casePfx+"showcart.header", "BookShowCartPortlet_header");
private final String SHOWCART_PORTLET_TABLE = getLoc(casePfx+"showcart.table", "BookShowCartPortlet_cardTable");
private final String SHOWCART_PORTLET_TABLE_TR_PREFIX = getLoc(casePfx+"showcart.table.tr.pref", "//tr[@id='BookShowCartPortlet_cardTable_");
@@ -72,7 +72,7 @@
private final String SHOWCART_PORTLET_EMPTY_CARD = getMess(casePfx+"showcart.header.card.empty", "Your cart is empty.");
private final String SHOWCART_PORTLET_CARD_ITEMS_PREFIX = getMess(casePfx+"showcart.header.card.pref", "Your shopping cart contains ");
- private final String SHOWCART_PORTLET_CARD_ITEMS_SUFFIX = getMess(casePfx+"showcart.header.card.pref", " items.");
+ private final String SHOWCART_PORTLET_CARD_ITEMS_SUFFIX = getMess(casePfx+"showcart.header.card.suf", " items.");
// BookCashierPortlet
private final String CASHIER_PORTLET_AMOUNT = getLoc(casePfx+"cashier.amount", "BookCashierPortlet_amount");
@@ -112,16 +112,16 @@
*/
@Test(enabled = true)
public void testBookstorePortletShowCatalog() {
- Assert.assertTrue(selenium.isTextPresent(CATALOG_PORTLET_TITLE));
+ Assert.assertTrue(selenium.isTextPresent(CATALOG_PORTLET_TITLE), "Catalog portlet has invalid title. Title should be: 'Portal Bookstore sample'.");
// Book Catalog portlet is minimized, so the "normalize portlet" icon is presented.
- Assert.assertEquals(selenium.getAttribute(CATALOG_PORTLET_FIRST_ICON), PORTLET_MODE_NORMAL);
- Assert.assertFalse(selenium.isTextPresent(CATALOG_PORTLET_CHOOSE));
+ Assert.assertEquals(selenium.getAttribute(CATALOG_PORTLET_FIRST_ICON), PORTLET_MODE_NORMAL, "Link for normalize Catalog portlet is missing. The cause maybe that catalog portlet is not in minimized state.");
+ Assert.assertFalse(selenium.isTextPresent(CATALOG_PORTLET_CHOOSE), "Sign 'Please choose from our selections' is on Catalog portlet. But Catalog portlet should be in minimized state!");
// Click to "Start Shopping" and verify that portlet is shown in normal state and so "minimize portlet" icon is presented.
- Assert.assertTrue(selenium.isElementPresent(BOOKSTORE_PORTLET_START_SHOPPING_LINK));
+ Assert.assertTrue(selenium.isElementPresent(BOOKSTORE_PORTLET_START_SHOPPING_LINK), "Link 'Start shopping' is missing in Bookstore portlet.");
clickAndWait(BOOKSTORE_PORTLET_START_SHOPPING_LINK);
- Assert.assertEquals(selenium.getAttribute(CATALOG_PORTLET_FIRST_ICON), PORTLET_MODE_MINIMIZED);
- Assert.assertTrue(selenium.isTextPresent(CATALOG_PORTLET_CHOOSE));
+ Assert.assertEquals(selenium.getAttribute(CATALOG_PORTLET_FIRST_ICON), PORTLET_MODE_MINIMIZED, "Link for minimize Catalog portlet is missing. The cause maybe that catalog portlet is not in normal state.");
+ Assert.assertTrue(selenium.isTextPresent(CATALOG_PORTLET_CHOOSE), "Sign 'Please choose from our selections' is missing on Catalog portlet.");
}
/**
@@ -131,14 +131,14 @@
@Test(enabled = true)
public void testBookstorePortletShowBookDetail() {
// No detail of any book is shown
- Assert.assertFalse(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1004_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertFalse(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1004_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Picture with book (book with id 1004) is presented in Book Detail portlet. But it should't be there.");
// Click to the detail link in Bookstore portlet
- Assert.assertTrue(selenium.isElementPresent(BOOKSTORE_PORTLET_BOOK_DETAIL_LINK));
+ Assert.assertTrue(selenium.isElementPresent(BOOKSTORE_PORTLET_BOOK_DETAIL_LINK), "Link for book detail is missing in Bookstore portlet.");
clickAndWait(BOOKSTORE_PORTLET_BOOK_DETAIL_LINK);
// Assert that book is shown in BookDetail portlet.
- Assert.assertEquals(BOOK_1004_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1004_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1004_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1004_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1004 is not shown in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1004_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1004 is not shown in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1004_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Picture of book (book with id 1004) is missing in BookDetailPortlet.");
}
/**
@@ -148,23 +148,23 @@
@Test(enabled = true, dependsOnMethods={ "testBookstorePortletShowCatalog" })
public void testBookCatalogPortletShowBookDetail() {
// assert that book with id 1000 is shown in BookDetailPortlet while click to it in BookCatalogPortlet
- Assert.assertTrue(selenium.isElementPresent(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX));
+ Assert.assertTrue(selenium.isElementPresent(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX), "Book with id 1000 is not shown in BookCatalogPortlet.");
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX);
- Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1000_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1000_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1000 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1000_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1000 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1000_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Picture of book (book with id 1000) is missing in BookDetailPortlet.");
// assert that book with id 1001 is shown in BookDetailPortlet while click to it in BookCatalogPortlet
- Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX));
+ Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX), "Book with id 1001 is not shown in BookCatalogPortlet.");
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX);
- Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1001_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1001_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1001 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1001_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1001 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1001_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Picture of book (book with id 1001) is missing in BookDetailPortlet.");
// assert that book with id 1007 is shown in BookDetailPortlet while click to it in BookCatalogPortlet
- Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1007" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX));
+ Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1007" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX), "Book with id 1007 is not shown in BookCatalogPortlet.");
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1007" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX);
- Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1007_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1007_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1007 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1007_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1007 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1007_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Picture of book (book with id 1007) is missing in BookDetailPortlet.");
}
/**
@@ -174,14 +174,14 @@
@Test(enabled = true, dependsOnMethods={ "testBookstorePortletShowCatalog" })
public void testBookCatalogPortletAddBook() {
// Card is empty in BookShowCartPortlet
- Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertFalse(selenium.isElementPresent(SHOWCART_PORTLET_TABLE));
+ Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER), "Card shoud be empty but it's not.");
+ Assert.assertFalse(selenium.isElementPresent(SHOWCART_PORTLET_TABLE), "Card should be empty, but table with books is present in BookShowCartPortlet, which shouldn't be.");
// Book is added in BookCatalogPortlet and it should be shown in BookShowCartPortlet
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
- Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "1 item.", selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX));
- Assert.assertEquals(4, countTableRows((SHOWCART_PORTLET_TABLE)));
+ Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "1 item.", selenium.getText(SHOWCART_PORTLET_HEADER), "1 item is expected on Card.");
+ Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 item of book with id 1001 is expected on Card.");
+ Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX), "Invalid title of book with 1001 is on BookShowCartPortlet.");
+ Assert.assertEquals(4, countTableRows((SHOWCART_PORTLET_TABLE)), "Table with books in BookShowCartPortlet should have 4 rows.");
// Add more books
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
@@ -191,15 +191,15 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1005" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1007" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
// Test that books are added
- Assert.assertEquals(7, countTableRows(SHOWCART_PORTLET_TABLE));
- Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "8" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals("2", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("4", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1007" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX));
- Assert.assertEquals(BOOK_1005_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX));
- Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1007" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX));
+ Assert.assertEquals(7, countTableRows(SHOWCART_PORTLET_TABLE), "Table with books in BookShowCartPortlet should have 7 rows.");
+ Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "8" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER), "8 items is expected on Card.");
+ Assert.assertEquals("2", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "2 items of book with id 1000 is expected on Card.");
+ Assert.assertEquals("4", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "4 items of book with id 1001 is expected on Card.");
+ Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 item of book with id 1005 is expected on Card.");
+ Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1007" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 item of book with id 1007 is expected on Card.");
+ Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX), "Invalid title of book with 1000 is on BookShowCartPortlet.");
+ Assert.assertEquals(BOOK_1005_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX), "Invalid title of book with 1005 is on BookShowCartPortlet.");
+ Assert.assertEquals(BOOK_1007_TITLE, selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1007" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX), "Invalid title of book with 1007 is on BookShowCartPortlet.");
}
/**
@@ -223,11 +223,11 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_DETAIL_SUFFIX);
clickAndWait(DETAIL_PORTLET_ADD_LINK);
// Test that books are added
- Assert.assertEquals(6, countTableRows((SHOWCART_PORTLET_TABLE)));
- Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "6" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals("2", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("3", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1004" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX));
+ Assert.assertEquals(6, countTableRows((SHOWCART_PORTLET_TABLE)), "Table with books in BookShowCartPortlet should have 6 rows.");
+ Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "6" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER), "6 items is expected on Card.");
+ Assert.assertEquals("2", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "2 items of book with id 1000 is expected on Card.");
+ Assert.assertEquals("3", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "3 items of book with id 1001 is expected on Card.");
+ Assert.assertEquals("1", selenium.getText(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1004" + SHOWCART_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 item of book with id 1004 is expected on Card.");
}
/**
@@ -243,19 +243,19 @@
// Click to detail links in BookShowCartPortlet and test that books are shown in BookDetailPortlet
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX);
- Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1000_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1000_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1000_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1000 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1000_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1000 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1000_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Image of book with id 1000 is missing in BookDetailPortlet.");
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1001" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX);
- Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1001_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1001_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1001_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1001 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1001_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1001 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1001_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Image of book with id 1001 is missing in BookDetailPortlet.");
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX);
- Assert.assertEquals(BOOK_1005_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE));
- Assert.assertEquals(BOOK_1005_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR));
- Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1005_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX));
+ Assert.assertEquals(BOOK_1005_TITLE, selenium.getText(DETAIL_PORTLET_BOOK_TITLE), "Title of book with id 1005 is invalid in BookDetailPortlet.");
+ Assert.assertEquals(BOOK_1005_AUTHOR, selenium.getText(DETAIL_PORTLET_BOOK_AUTHOR), "Author of book with id 1005 is invalid in BookDetailPortlet.");
+ Assert.assertTrue(selenium.isElementPresent(DETAIL_PORTLET_IMAGE_PREFIX + BOOK_1005_IMAGE + DETAIL_PORTLET_IMAGE_SUFFIX), "Image of book with id 1005 is missing in BookDetailPortlet.");
}
/**
@@ -269,26 +269,26 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1005" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
// verify 1
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "149.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 149.93.");
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "149.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but total amount should be 149.93.");
// Add books from details portlet
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX);
clickAndWait(DETAIL_PORTLET_ADD_LINK);
clickAndWait(DETAIL_PORTLET_ADD_LINK);
// verify 2
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "229.91"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 229.91.");
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "229.91"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but total amount should be 229.91.");
// Remove some books
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
// verify 3
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "124.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 124.93.");
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "124.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but total amount should be 124.93.");
// Clear card
clickAndWait(SHOWCART_PORTLET_CLEAR_CART_LINK);
// verify 4
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "0.0"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 0.0");
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "0.0"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but total amount should be 0.0");
}
/**
@@ -304,20 +304,20 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "5" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "214.83"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 214.83.");
- Assert.assertEquals("3", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("4", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("9", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "214.83"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but total amount should be 214.83.");
+ Assert.assertEquals("3", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "3 books with id 1000 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("4", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "4 books with id 1001 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("9", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "9 books with id 1004 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
// Fill the name and number in BookCashierPortlet and submit
selenium.type(CASHIER_PORTLET_INPUT_NAME, "Joseph Carry");
selenium.type(CASHIER_PORTLET_INPUT_NUMBER, "1111 2222 3333");
clickAndWait(CASHIER_PORTLET_SUBMIT);
// check BookShowCartPortlet and BookReceivePortlet
- Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Joseph Carry.", selenium.getText(RECEIPT_PORTLET_HEADER));
- Assert.assertEquals("1", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("3", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("7", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
+ Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER), "Sign about empty card should be in BookShowCartPortlet when order was submitted.");
+ Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Joseph Carry.", selenium.getText(RECEIPT_PORTLET_HEADER), "Successfull message about the shopping is not correctly displayed in BookReceiptPortlet.");
+ Assert.assertEquals("1", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 book with id 1000 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("3", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "3 books with id 1001 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("7", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "7 books with id 1004 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
// Test second successfull shopping
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
@@ -325,15 +325,15 @@
selenium.type(CASHIER_PORTLET_INPUT_NAME, "Martin Carry");
selenium.type(CASHIER_PORTLET_INPUT_NUMBER, "1111 2222 3333");
clickAndWait(CASHIER_PORTLET_SUBMIT);
- Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Martin Carry.", selenium.getText(RECEIPT_PORTLET_HEADER));
- Assert.assertEquals("0", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("2", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
+ Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER), "Sign about empty card should be in BookShowCartPortlet when order was submitted.");
+ Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Martin Carry.", selenium.getText(RECEIPT_PORTLET_HEADER), "Successfull message about the shopping is not correctly displayed in BookReceiptPortlet.");
+ Assert.assertEquals("0", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "0 books with id 1000 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("2", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "2 books with id 1001 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
}
/**
- * Test the SendReceiptEvent event and exceptionMessage public render parameters. The oreder of all books is submit in Cashier portlet but the error message
- * is shown in BookReceivePortlet.
+ * Test the SendReceiptEvent event and exceptionMessage public render parameters. The order of books is submited in Cashier portlet but the error message
+ * is shown in BookReceiptPortlet.
*/
@Test(enabled = true, dependsOnMethods={ "testBookCashierPortletSubmitSuccessfull" })
public void testBookCashierPortletSubmitFailure() {
@@ -344,18 +344,18 @@
selenium.type(CASHIER_PORTLET_INPUT_NUMBER, "1111 2222 3333");
clickAndWait(CASHIER_PORTLET_SUBMIT);
// Check that order exception occured and order was not performed
- Assert.assertEquals(RECEIPT_PORTLET_FAILURE, selenium.getText(RECEIPT_PORTLET_HEADER));
- Assert.assertTrue(selenium.isTextPresent(RECEIPT_PORTLET_FAILURE_MESSAGE));
- Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "2" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER));
+ Assert.assertEquals(RECEIPT_PORTLET_FAILURE, selenium.getText(RECEIPT_PORTLET_HEADER), "Failure about unsuccessfull order submit should be shown in BookReceiptPortlet.");
+ Assert.assertTrue(selenium.isTextPresent(RECEIPT_PORTLET_FAILURE_MESSAGE), "Failure about unsuccessfull order submit should be shown in BookReceiptPortlet.");
+ Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "2" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER), "2 items totally should be present on BookShowCart Portlet.");
// Remove the item and it should be fine after it
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
- Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "1 item.", selenium.getText(SHOWCART_PORTLET_HEADER));
+ Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "1 item.", selenium.getText(SHOWCART_PORTLET_HEADER), "1 item totally should be present on BookShowCart Portlet.");
clickAndWait(CASHIER_PORTLET_SUBMIT);
// verify success
- Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Martin Carry.", selenium.getText(RECEIPT_PORTLET_HEADER));
- Assert.assertEquals("0", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
- Assert.assertEquals("1", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
+ Assert.assertEquals(SHOWCART_PORTLET_EMPTY_CARD, selenium.getText(SHOWCART_PORTLET_HEADER), "Sign about empty card should be in BookShowCartPortlet when order was submitted.");
+ Assert.assertEquals(RECEIPT_PORTLET_SUCCESS + "Martin Carry.", selenium.getText(RECEIPT_PORTLET_HEADER), "Successfull message about the shopping is not correctly displayed in BookReceiptPortlet.");
+ Assert.assertEquals("0", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "0 books with id 1000 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
+ Assert.assertEquals("1", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX), "1 book with id 1001 are expected in Book catalog. But there are " + selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX) + " books.");
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -56,23 +56,23 @@
/**
* This method tests couple of bad login attempts with usage of CAS.
- * After clicks to "Login" link from portal, the user is redirected to CAS login screen and then he tries to login with credentials:
+ * After click to "Login" link from portal, the user is redirected to CAS login screen and then he tries to login with credentials:
* "admin:adminadmin" , "cyril:cyril", "cyril:password"
*/
@Test(enabled = true)
public void badLoginsToCAS() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_ADMIN_USERNAME, "adminadmin");
- Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH), "Message about invalid credentials should be shown.");
tryToLogin(PORTAL_CYRIL_USERNAME, "cyril");
- Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH), "Message about invalid credentials should be shown.");
tryToLogin(PORTAL_CYRIL_USERNAME, "password");
- Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(CAS_INVALID_AUTH), "Message about invalid credentials should be shown.");
}
/**
* This method tests good login attempt with usage of CAS.
- * After clicks to "Login" link from portal, the user is redirected to CAS login screen and then he tries to login with credentials:
+ * After click to "Login" link from portal, the user is redirected to CAS login screen and then he tries to login with credentials:
* "user:user". He is logged in and then he goes to some page. He tries the admin portal, but he ends with 403 error. Then he is logged out. After
* logging out, he should be redirected to default portal page.
*/
@@ -80,19 +80,19 @@
public void loginAsUserAndLoggedOut() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_USER_USERNAME, PORTAL_USER_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME), "Message about 'Logged in as:' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE), "CAS page should not be shown after successfull login.");
// click to dashboard as user.
clickAndWait(LINK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be shown.");
// try to go to "admin" portal. This must end with 403 error, because user doesn't have permission to go to this portal.
openAndWait(ADR_PORTAL_ADMIN);
- Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT));
+ Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT), "Forbidden message should be shown while trying to go to 'admin' portal.");
// go to default portal and logout
openAndWait(ADR_PORTAL_DEFAULT);
clickAndWait(LINK_LOGOUT);
- Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE));
- Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL));
+ Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE), "CAS page should be shown after logout from JBoss Portal.");
+ Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL), "Logout successfull message should be shown on CAS page.");
}
/**
@@ -103,20 +103,20 @@
public void loginAsUserWhileGoingToAuthURL() {
// 403 error after trying to go to admin portal as user
openAndWait(ADR_PORTAL_ADMIN);
- Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE));
+ Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE), "CAS page should be shown while trying to access admin portal.");
tryToLogin(PORTAL_USER_USERNAME, PORTAL_USER_PASSWORD);
- Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT));
+ Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT), "Forbidden message should be shown while trying to go to 'admin' portal.");
// going to default portal. Everythink should be ok.
openAndWait(ADR_PORTAL_DEFAULT);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME), "Message about 'Logged in as:' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE), "CAS page should not be shown after successfull login.");
// click to dashboard as user.
clickAndWait(LINK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be shown.");
// logout (redirected to CAS page)
clickAndWait(LINK_LOGOUT);
- Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE));
- Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL));
+ Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE), "CAS page should be shown after logout from JBoss Portal.");
+ Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL), "Logout successfull message should be shown on CAS page.");
}
/**
@@ -129,29 +129,29 @@
loginToPortalAsAdmin();
createRole(PORTAL_CYRIL_ROLE, PORTAL_CYRIL_ROLE);
createUser(PORTAL_CYRIL_USERNAME, PORTAL_CYRIL_PASSWORD, PORTAL_CYRIL_MAIL, PORTAL_CYRIL_ROLE);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: admin' should be shown. But it's not here.");
logoutIfPossible();
- Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL));
+ Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL), "Logout successfull message should be shown on CAS page.");
}
/**
* This method tests good login attempt with usage of CAS.
* After clicks to "Login" link from portal the user is redirected to CAS login screen and then he tries to login with credentials:
- * "cyril:cyril", which is bad and then "cyril:password" which is good. Then cyril tries to do some dashboard stuff and then logges out.
+ * "cyril:cyril", which is bad and then "cyril:password" which is good. Then cyril tries to do some dashboard operations and then logges out.
*/
@Test(enabled = true, dependsOnMethods = { "loginAsAdminAndCreateNewRoleAndUser" })
public void loginAsCyrilAndPlayWithDashboard() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_CYRIL_USERNAME, PORTAL_CYRIL_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_CYRIL_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_CYRIL_USERNAME), "Message about 'Logged in as: cyril' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE), "CAS page should not be shown after successfull login.");
// TODO: uncomment this after fixing the CMS bug with Access denied
// Assert.assertFalse(selenium.isTextPresent("Access Denied"));
waitFor(3000);
clickAndWait(LINK_WEATHER);
- Assert.assertTrue(selenium.isElementPresent(LINK_COPY_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_COPY_DASHBOARD), "Link 'copy to dashboard' should be shown.");
clickAndWait(LINK_COPY_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be shown.");
logoutIfPossible();
}
@@ -163,7 +163,7 @@
loginToPortalAsAdmin();
deleteRole(PORTAL_CYRIL_ROLE);
deleteUser(PORTAL_CYRIL_USERNAME, PORTAL_CYRIL_MAIL);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: admin' should be shown. But it's not here.");
logoutIfPossible();
}
@@ -173,9 +173,9 @@
private void loginToPortalAsAdmin() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_ADMIN_USERNAME, PORTAL_ADMIN_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE));
- Assert.assertTrue(selenium.isElementPresent(LINK_ADMIN));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: admin' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(CAS_IMAGE), "CAS page should not be shown after successfull login.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_ADMIN), "Link to admin portal should be shown when admin is logged to JBoss Portal.");
}
/**
@@ -185,8 +185,8 @@
private void openPortalAndClickToLogin() {
openAndWait(ADR_PORTAL);
clickAndWait(LINK_LOGIN);
- Assert.assertTrue(selenium.isTextPresent(CAS_LOGIN_MESSAGE));
- Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(CAS_LOGIN_MESSAGE), "CAS page should be shown after click to 'login' link in JBoss Portal.");
+ Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE), "CAS page should be shown after click to 'login' link in JBoss Portal.");
}
/**
@@ -211,8 +211,8 @@
if (selenium.isElementPresent(LINK_LOGOUT)) {
selenium.click(LINK_LOGOUT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE));
- Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL));
+ Assert.assertTrue(selenium.isElementPresent(CAS_IMAGE), "CAS page should be shown after logout from JBoss Portal.");
+ Assert.assertTrue(selenium.isTextPresent(CAS_LOGOUT_SUCCESSFULL), "Logout successfull message should be shown on CAS page.");
}
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/JOSSOSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/JOSSOSeleniumTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/JOSSOSeleniumTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -1,9 +1,5 @@
package org.jboss.portal.test.selenium.sso;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import org.jboss.portal.test.selenium.cms.CMSFileTestCase;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -76,12 +72,12 @@
public void badLoginsToJOSSO() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_ADMIN_USERNAME, "adminadmin");
- Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH), "Message about invalid credentials should be shown.");
tryToLogin(PORTAL_JOSEPH_USERNAME, "joseph");
- Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH), "Message about invalid credentials should be shown.");
// Joseph is not created right now, so authentication can't be good
tryToLogin(PORTAL_JOSEPH_USERNAME, PORTAL_JOSEPH_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH));
+ Assert.assertTrue(selenium.isTextPresent(JOSSO_INVALID_AUTH), "Message about invalid credentials should be shown.");
}
/**
@@ -94,19 +90,19 @@
public void loginAsUserAndLoggedOut() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_USER_USERNAME, PORTAL_USER_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME), "Message about 'Logged in as: user' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull login.");
// click to dashboard as user.
clickAndWait(LINK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be shown.");
// try to go to "admin" portal. This must end with 403 error, because user doesn't have permission to go to this portal.
openAndWait(ADR_PORTAL_ADMIN);
- Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT));
+ Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT), "Forbidden message should be shown while trying to go to 'admin' portal.");
// go to default portal and logout
openAndWait(ADR_PORTAL_DEFAULT);
clickAndWait(LINK_LOGOUT);
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
- Assert.assertTrue(selenium.isElementPresent(LINK_LOGIN));
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull logout.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_LOGIN), "Link 'login' should be shown on JBoss Portal while user logges out.");
}
/**
@@ -117,20 +113,20 @@
public void loginAsUserWhileGoingToAuthURL() {
// 403 error after trying to go to admin portal as user
openAndWait(ADR_PORTAL_ADMIN);
- Assert.assertTrue(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertTrue(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull login.");
tryToLogin(PORTAL_USER_USERNAME, PORTAL_USER_PASSWORD);
- Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT));
+ Assert.assertEquals(PORTAL_FORBIDDEN_MESS, selenium.getText(FORBIDDEN_ELEMENT), "Forbidden message should be shown while trying to go to 'admin' portal.");
// going to default portal. Everythink should be ok.
openAndWait(ADR_PORTAL_DEFAULT);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_USER_USERNAME), "Message about 'Logged in as: user' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull login.");
// click to dashboard as user.
- clickAndWait(LINK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ clickAndWait(LINK_DASHBOARD);
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be shown.");
// logout
clickAndWait(LINK_LOGOUT);
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
- Assert.assertTrue(selenium.isElementPresent(LINK_LOGIN));
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull logout.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_LOGIN), "Link 'login' should be shown on JBoss Portal while user logges out.");
}
/**
@@ -143,9 +139,9 @@
loginToPortalAsAdmin();
createRole(PORTAL_JOSEPH_ROLE, PORTAL_JOSEPH_ROLE);
createUser(PORTAL_JOSEPH_USERNAME, PORTAL_JOSEPH_PASSWORD, PORTAL_JOSEPH_MAIL, PORTAL_JOSEPH_ROLE);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: joseph' should be shown. But it's not here.");
logout();
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull logout.");
}
/**
@@ -157,15 +153,15 @@
public void loginAsJosephAndPlayWithDashboard() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_JOSEPH_USERNAME, PORTAL_JOSEPH_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_JOSEPH_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_JOSEPH_USERNAME), "Message about 'Logged in as: joseph' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull login.");
// TODO: uncomment this after fixing the CMS bug with Access denied
// Assert.assertFalse(selenium.isTextPresent("Access Denied"));
waitFor(3000);
clickAndWait(LINK_WEATHER);
- Assert.assertTrue(selenium.isElementPresent(LINK_COPY_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_COPY_DASHBOARD), "Link 'copy dashboard' should be present.");
clickAndWait(LINK_COPY_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD));
+ Assert.assertTrue(selenium.isElementPresent(LINK_CONFIGURE_DASHBOARD), "Link 'configure dashboard' should be present.");
logout();
}
@@ -177,9 +173,9 @@
loginToPortalAsAdmin();
deleteRole(PORTAL_JOSEPH_ROLE);
deleteUser(PORTAL_JOSEPH_USERNAME, PORTAL_JOSEPH_MAIL);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: admin' should be shown. But it's not here.");
logout();
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull logout.");
}
/**
@@ -192,19 +188,19 @@
loginToPortalAsAdmin();
// Go to session test and put some attribute to portlet scope
openAndWait(ADR_PORTAL_SESSION_TEST);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_NO_SESSION));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_NO_SESSION), "Sign 'No session' should be in session test, but it isn't.");
selenium.type(SES_INP_NAM, "scope1");
selenium.type(SES_INP_VAL, "scopeval1");
selenium.click(SES_SUB_PSCOPE);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_ID));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_ID), "Sign about session should be in session test, but it isn't. Session should be present.");
// waiting 90 seconds until session timeout occurs
waitFor(SESSION_TIMEOUT_WAITING);
// Session is invalidated but user is automatically logged in without need of coming to JOSSO console
openAndWait(ADR_PORTAL_SESSION_TEST);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_NO_SESSION));
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_SESSION_TEST_NO_SESSION), "Sign 'No session' should be in session test, but it isn't.");
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message about 'Logged in as: admin' should be still here after session timeout. But it's not here.");
}
/**
@@ -230,7 +226,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals("newFile", selenium.getText("link=newFile"));
+ Assert.assertEquals("newFile", selenium.getText("link=newFile"), "newFile should be created and shown in CMS directory.");
}
/**
@@ -253,10 +249,10 @@
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals("text/plain", selenium.getText("link=text/plain"));
+ Assert.assertEquals("text/plain", selenium.getText("link=text/plain"), "Link text/plain should be here.");
selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals("file2copy", selenium.getText("link=file2copy"));
+ Assert.assertEquals("file2copy", selenium.getText("link=file2copy"), "File file2copy should be here.");
int row = findTableRow(TBL_CMS_FILE, "file2copy", 0) + 1;
@@ -270,12 +266,12 @@
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"), "Link 'file2copy' should be her but it isn't.");
selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"), "Link file2copy should be here but it isn't.");
}
/**
@@ -284,9 +280,9 @@
private void loginToPortalAsAdmin() {
openPortalAndClickToLogin();
tryToLogin(PORTAL_ADMIN_USERNAME, PORTAL_ADMIN_PASSWORD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
- Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE));
- Assert.assertTrue(selenium.isElementPresent(LINK_ADMIN));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should be shown. But it's not here.");
+ Assert.assertFalse(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should not be shown after successfull login to JBoss Portal.");
+ Assert.assertTrue(selenium.isElementPresent(LINK_ADMIN), "Link 'admin' should be present when user is logged as admin.");
}
/**
@@ -296,7 +292,7 @@
private void openPortalAndClickToLogin() {
openAndWait(ADR_PORTAL);
clickAndWait(LINK_LOGIN);
- Assert.assertTrue(selenium.isElementPresent(JOSSO_IMAGE));
+ Assert.assertTrue(selenium.isElementPresent(JOSSO_IMAGE), "JOSSO page should be shown after click to 'login' link on JBoss Portal.");
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/SSOSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/SSOSeleniumTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/SSOSeleniumTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -5,6 +5,13 @@
import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
import org.testng.Assert;
+/**
+ * The class is used for inheritance by other SSO test cases (CASSeleniumTestCase, JOSSOSeleniumTestCase, ...) It contains helper methods
+ * for manipulation with users and roles (creating new user, creating role, delete user, etc.) nad other stuff which is
+ * shared by all SSO test cases.
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
class SSOSeleniumTestCase extends JBossPortalSeleniumTestCase {
/** prefix for locator properties */
@@ -60,7 +67,7 @@
Assert.assertTrue(selenium.isElementPresent(LNK_ROLE_CREATE), "Button for role creating has wrong id or doesn't exist.");
//Assert.assertEquals(selenium.getText(LNK_ROLE_CREATE), "Create role", "Button for role creating has wrong label.");
- selenium.click(LNK_ROLE_CREATE);
+ selenium.click(LNK_ROLE_CREATE);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Role"), "Label for role name not present or incorrect.");
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveDisabledTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveDisabledTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveDisabledTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -28,26 +28,26 @@
public void loginInExampleAndCheckPortalNotLogged() {
// going to portal. 'logged in as: admin' page is not shown
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should not be shown in JBoss Portal. Admin shouldn't be logged in, but it seems that he is logged.");
// login to example app
logIntoExampleApp(EXAMPLE_ADMIN_USERNAME, EXAMPLE_ADMIN_PASSWORD);
- Assert.assertTrue("false".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)));
+ Assert.assertTrue("false".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)), "User 'admin' shouldn't be in role 'Authorized' but it seems that he is in this role.");
// going to portal. 'logged in as:' page is not shown, because user still not logged in portal. Only to example app
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE));
- Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE), "'Logged in as' sign is shown which is bad. User shouldn't be logged to JBoss Portal but it seems that he is logged in.");
+ Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN), "Link 'login' should be present in JBoss Portal.");
// login to portal
login(PORTAL_ADMIN_USERNAME, PORTAL_ADMIN_PASSWORD);
clickAndWait(LNK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LNK_ADMIN));
+ Assert.assertTrue(selenium.isElementPresent(LNK_ADMIN), "Link 'admin' should be in the portal page while user 'admin' is logged.");
// logout from portal
logout();
// Going to example app. User is still logged in even if not logged in the portal.
openAndWait(ADR_EXAMPLE);
- Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
- Assert.assertTrue(EXAMPLE_ADMIN_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)));
+ Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "User should be still logged to example application but it seems that he is not logged.");
+ Assert.assertTrue(EXAMPLE_ADMIN_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)), "User 'admin' should be logged to example application but it seems that he is not logged.");
}
/**
@@ -64,24 +64,24 @@
// Going to example app. User is not logged in even if logged in the portal.
openAndWait(ADR_EXAMPLE);
- Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
+ Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "Nobody should be logged in TomcatSSOValveExampleApp but it seems that user is logged in.");
// login to example app as user
logIntoExampleApp(EXAMPLE_USER_USERNAME, EXAMPLE_USER_PASSWORD);
- Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
- Assert.assertTrue(EXAMPLE_USER_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)));
+ Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "User 'user' should be logged in example app, but it seems that he is not logged.");
+ Assert.assertTrue(EXAMPLE_USER_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)), "User 'user' should be logged in example app, but it seems that he is not logged.");
// Check portal. 'admin' is still logged in. Not user.
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "User 'admin' should be logged in JBoss Portal, but it seems that he is not logged.");
// go to example and logout
openAndWait(ADR_EXAMPLE);
- Assert.assertTrue(EXAMPLE_USER_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)));
+ Assert.assertTrue(EXAMPLE_USER_USERNAME.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)), "User 'user' should be logged in example app, but it seems that he is not logged.");
clickAndWait(EXAMPLE_LOGOUT);
- Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
+ Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "Nobody should be logged in TomcatSSOValveExampleApp but it seems that user is logged in.");
// Check portal. 'admin' is still logged in.
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "User 'admin' should be logged in JBoss Portal, but it seems that he is not logged.");
}
/**
@@ -92,25 +92,25 @@
public void loginToJMXConsoleAndCheckPortal() {
// going to portal. 'logged in as: admin' page is not shown
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "admin should not be logged in JBoss Portal but it seems that he is logged in.");
// login to jmx console
loginToJMXConsole(JMX_ADMIN_USERNAME, JMX_ADMIN_PASSWORD);
// going to portal. 'logged in as:' page is not shown, because user still not logged in portal. Only to example app
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE));
- Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE), "Nobody should be logged in JBoss Portal but it seems that user is logged in.");
+ Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN), "Nobody should be logged in JBoss Portal but it seems that user is logged in.");
// login to portal
login(PORTAL_ADMIN_USERNAME, PORTAL_ADMIN_PASSWORD);
clickAndWait(LNK_DASHBOARD);
- Assert.assertTrue(selenium.isElementPresent(LNK_ADMIN));
+ Assert.assertTrue(selenium.isElementPresent(LNK_ADMIN), "Link 'admin' should be in the portal page while user 'admin' is logged.");
// logout from portal
logout();
// Going to example app. User is still logged in even if not logged in the portal.
openAndWait(ADR_JMX_CONSOLE);
- Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE));
- Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW));
+ Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE), "User should be logged to JMX console but it seems that he is not logged.");
+ Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW), "User should be logged to JMX console but it seems that he is not logged.");
}
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -3,10 +3,17 @@
import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
import org.testng.Assert;
+/**
+ *
+ * Helper class which is used for inheritance by other TomcatSSOValve test classes. This class contains constants and some basic functions like login
+ * to JMX console via selenium, login to TomcatSSOValveExampleApp etc.
+ *
+ * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
+ */
class TomcatSSOValveTestCase extends JBossPortalSeleniumTestCase {
/** prefix for locator properties */
- public String casePfx = "sso.tomcat.";
+ public String casePfx = "sso.tomcatvalve.";
protected final String ADR_PORTAL = getLoc(casePfx+"adr.portal","/portal");
protected final String ADR_EXAMPLE = getLoc(casePfx+"adr.example","/TomcatSSOValveExampleApp");
@@ -45,7 +52,7 @@
protected final String EXAMPLE_TITLE_OUTPUT = getMess(casePfx+"example.title.output", "Tomcat SSO valve example servlet");
protected final String LOGGED_IN_AS_MESSAGE = getMess(casePfx+"logged.in.mess", "Logged in as: ");
protected final String JMX_AGENT_VIEW = getMess(casePfx+"jmx.agnview", "JMX Agent View");
- protected final String PORTAL_FORBIDDEN_MESS = getMess(casePfx + "forbidden.mess", "HTTP Status 403 -");
+ protected final String PORTAL_FORBIDDEN_MESS = getMess(casePfx + "forbidden.mess", "HTTP Status 403 -");
/**
* Login to jmx-console web application with usage of selenium framework.
@@ -56,8 +63,8 @@
protected void loginToJMXConsole(String user, String password) {
// TODO: this probably doesn't work in IE. So disable test while working with IE.
openAndWait("http://" + user + ":" + password + "@localhost:8080" + ADR_JMX_CONSOLE);
- Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE));
- Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW));
+ Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE), "User should be logged to JMX console but it seems that he is not logged.");
+ Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW), "User should be logged to JMX console but it seems that he is not logged.");
}
/**
@@ -71,8 +78,8 @@
selenium.type(EXAMPLE_INP_USERNAME, username);
selenium.type(EXAMPLE_INP_PASSWORD, password);
clickAndWait(EXAMPLE_LOGIN);
- Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
- Assert.assertTrue(username.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)));
+ Assert.assertTrue(EXAMPLE_TITLE_OUTPUT.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "User should be logged to TomcatSSOValveExampleApp but it seems that he is not logged.");
+ Assert.assertTrue(username.equals(selenium.getText(EXAMPLE_LOGGED_USER_OUTPUT)), "User should be logged to TomcatSSOValveExampleApp but it seems that he is not logged.");
}
/**
@@ -84,7 +91,7 @@
if (selenium.isElementPresent(EXAMPLE_LOGOUT)) {
selenium.click(EXAMPLE_LOGOUT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
+ Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "User should be logged out from TomcatSSOValveExampleApp.");
}
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithExampleTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithExampleTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithExampleTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -29,20 +29,20 @@
public void loginInExampleAndCheckPortalUnauthorized() {
// going to portal. 'logged in as: admin' page is not shown
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should not be shown in JBoss Portal. Admin shouldn't be logged in, but it seems that he is logged.");
// login to example app
logIntoExampleApp(EXAMPLE_ADMIN_USERNAME, EXAMPLE_ADMIN_PASSWORD);
// user should not be in Authorized role
- Assert.assertTrue("false".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)));
+ Assert.assertTrue("false".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)), "User 'admin' shouldn't be in role 'Authorized' but it seems that he is in this role.");
// going to portal. 'logged in as: admin' page is shown
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "User 'admin' should be logged in JBoss Portal.");
// The error 403 - forbidden should be thrown by portal when user clicks to some link on the page
clickAndWait(LNK_DASHBOARD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS), "Page 403 - forbidden should be shown but it seems that it isn't.");
}
/**
@@ -55,23 +55,23 @@
public void loginInExampleAndCheckPortalAuthorized() {
// going to portal. 'logged in as: admin' page is not shown
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should not be shown in JBoss Portal. Admin shouldn't be logged in, but it seems that he is logged.");
// login to example app
logIntoExampleApp(EXAMPLE_ADMIN2_USERNAME, EXAMPLE_ADMIN2_PASSWORD);
// user should be in Authorized role
- Assert.assertTrue("true".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)));
+ Assert.assertTrue("true".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)), "User 'admin2' should be in role 'Authorized' but it seems that he isn't.");
// going to portal. 'logged in as: admin' is shown
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + EXAMPLE_ADMIN2_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + EXAMPLE_ADMIN2_USERNAME), "User 'admin2' should be logged in JBoss Portal.");
clickAndWait(LNK_ADMIN);
- Assert.assertTrue(selenium.isElementPresent(LNK_WSRP));
+ Assert.assertTrue(selenium.isElementPresent(LNK_WSRP), "Link to 'wsrp' page should be shown on admin portal. But this link is not here.");
// logout from portal and check if logout from example app
clickAndWait(LNK_LOGOUT);
openAndWait(ADR_EXAMPLE);
- Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)));
+ Assert.assertTrue(EXAMPLE_LOGIN_FORM.equals(selenium.getText(EXAMPLE_TITLE_ELEMENT)), "User should not be logged in TomcatSSOValveExampleApp, but it seems that he is still logged.");
}
/**
@@ -84,12 +84,12 @@
// open example app and chek if login and check Authorized role. Then logout
selenium.open(ADR_EXAMPLE);
- Assert.assertTrue("true".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)));
+ Assert.assertTrue("true".equals(selenium.getText(EXAMPLE_AUTHORIZED_ROLE_OUTPUT)), "User 'admin' should be in 'Authorized' role but it seems that he isn't.");
clickAndWait(EXAMPLE_LOGOUT);
// Check if logout from portal
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN));
+ Assert.assertTrue(selenium.isElementPresent(LNK_LOGIN), "Nobody should be logged in JBoss Portal but it seems that user is still logged in.");
}
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithJMXConsoleTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithJMXConsoleTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveWithJMXConsoleTestCase.java 2009-06-23 14:45:50 UTC (rev 13487)
@@ -29,18 +29,18 @@
@Test(enabled = true)
public void loginInPortalAndCheckConsole() {
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should not be shown in JBoss Portal. Admin shouldn't be logged in, but it seems that he is logged.");
login(PORTAL_ADMIN_USERNAME, PORTAL_ADMIN_PASSWORD);
openAndWait("http://localhost:8080" + ADR_JMX_CONSOLE);
- Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE));
- Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW));
+ Assert.assertTrue(selenium.isElementPresent(JMX_IMAGE), "User should be logged to JMX console but it seems that he is not logged.");
+ Assert.assertTrue(selenium.getText(JMX_TITLE_ELEMENT).contains(JMX_AGENT_VIEW), "User should be logged to JMX console but it seems that he is not logged.");
// logout from portal and login as user
logout();
login(PORTAL_USER_USERNAME, PORTAL_USER_PASSWORD);
openAndWait("http://localhost:8080" + ADR_JMX_CONSOLE);
// user is not authorized to see JMX console
- Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS), "Page 403 - forbidden should be shown but it seems that it isn't.");
}
/**
@@ -49,14 +49,14 @@
@Test(enabled = true)
public void loginInConsoleAndCheckPortal() {
openAndWait(ADR_PORTAL);
- Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertFalse(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should not be shown in JBoss Portal. Admin shouldn't be logged in, but it seems that he is logged.");
// TODO: this probably doesn't work in IE. So disable test while working with IE.
loginToJMXConsole(JMX_ADMIN_USERNAME, JMX_ADMIN_PASSWORD);
openAndWait(ADR_PORTAL);
- Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME));
+ Assert.assertTrue(selenium.isTextPresent(LOGGED_IN_AS_MESSAGE + PORTAL_ADMIN_USERNAME), "Message 'Logged in as: admin' should be shown in JBoss Portal. Admin should be logged in, but it seems that he is not logged.");
// The error 403 - forbidden should be thrown by portal when user clicks to some link on the page
clickAndWait(LNK_DASHBOARD);
- Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS));
+ Assert.assertTrue(selenium.isTextPresent(PORTAL_FORBIDDEN_MESS), "Page 403 - forbidden should be shown but it seems that it isn't.");
}
}
14 years, 11 months
JBoss Portal SVN: r13486 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-23 10:25:50 -0400 (Tue, 23 Jun 2009)
New Revision: 13486
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
[JBPORTAL-2418] - selenium; window name without portlet testcase
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-06-23 10:54:52 UTC (rev 13485)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-06-23 14:25:50 UTC (rev 13486)
@@ -10,441 +10,501 @@
*
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-@Test(groups = {"cms_dashboard"}, enabled = true, description = "Dashboard issues test case.")
+@Test(groups = { "cms_dashboard" }, enabled = true, description = "Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
/** prefix for locator properties = dash. */
- public String casePfx = "dash.";
-
- private final String MSG_WINDOW_NAME_VALID = getMess(casePfx+"msg.window.name.valid","is an invalid window name");
- private final String MSG_PAGE_RENAME_VALID = getMess(casePfx+"msg.page.rename.valid","is an invalid portal object name");
- private final String MSG_PAGE_NAME_VALID = getMess(casePfx+"msg.page.name.valid","is an invalid page name");
-
- private final String DIV_PORTET_EDITOR_TITLE = getLoc(casePfx + "div.portlet.editor.title", "portlet-editor-title");
- private final String HAND_R1 = getLoc(casePfx + "hand.r1", "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div");
- private final String HAND_L1 = getLoc(casePfx + "hand.l1", "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div");
- private final String SPAN_R1 = getLoc(casePfx + "span.r1", "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
- private final String DIV_REG_A = getLoc(casePfx + "div.reg.a", "//div[@id='regionA']");
- private final String DIV_REG_B = getLoc(casePfx + "div.reg.b", "//div[@id='regionB']");
- private final String SPAN_L2 = getLoc(casePfx + "span.l2", "//html/body/div[2]/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr/td[2]/div/div/span");
- private final String SPAN_L1 = getLoc(casePfx + "span.l1", "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
- private final String MSG_POWER = getMess(casePfx + "msg.power", "Powered by JBoss");
- private final String LNK_POR_WEA_EDIT = getLoc(casePfx + "lnk.por.wea.edit",
- "//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
- private final String SUB_LAYOUT_UPDATE = getLoc(casePfx + "sub.layout.update", "//input[contains(@name,'dashboardLayoutForm:j_id12')]");
- private final String SUB_PAGE_RENAME = getLoc(casePfx + "sub.page.rename", "//form[contains(@id,'renameForm')]/input[@type='submit']");
- private final String INP_PAGE_RENAME = getLoc(casePfx + "inp.page.rename", "//input[contains(@id,'renameForm:newName')]");
- private final String INP_WINDOW_NAME = getLoc(casePfx + "inp.window.name", "//input[contains(@id,'windowForm:windowName')]");
- private final String LINK_WEATHER_PORTLET = getLoc(casePfx + "link.weather.portlet", "link=*WeatherPortlet*");
- private final String LINK_PORTL3 = getLoc(casePfx + "link.portl3", "link=*WSRP admin portlet*");
- private final String LINK_PORTL2 = getLoc(casePfx + "link.portl2", "link=*Who's online portlet*");
- private final String LINK_PORTL1 = getLoc(casePfx + "link.portl1", "link=*Welcome portlet*");
- private final String OPT_PORTL2 = getLoc(casePfx + "opt.portl2", "IdentityUserPortletWindow");
- private final String OPT_PORTL1 = getLoc(casePfx + "opt.portl1", "JSPPortletWindow");
- private final String SEL_CONTENT_TYPE = getLoc(casePfx + "sel.content.type", "//select[contains(@id,'contentTypesForm:instanceId')]");
- private final String SUB_DEL_FROM_CENTER_REGION = getLoc(casePfx + "sub.del.from.center.region", "//input[contains(@id,'layoutForm:l_center')]");
- private final String SUB_DOWN_CENTER_REGION = getLoc(casePfx + "sub.down.center.region", "//input[contains(@id,'layoutForm:d_center')]");
- private final String SUB_UP_CENTER_REGION = getLoc(casePfx + "sub.up.center.region", "//input[contains(@id,'layoutForm:u_center')]");
- private final String SEL_CENTER_REGION = getLoc(casePfx + "sel.center.region", "//select[contains(@id,'layoutForm:selectMany_center')]");
- private final String SUB_ADDCENTER = getLoc(casePfx + "sub.addcenter", "//input[contains(@id,'layoutForm:a_center')]");
- private final String SUB_ADDLEFT = getLoc(casePfx + "sub.addleft", "//input[contains(@id,'layoutForm:a_left')]");
- private final String LNK_CONFIGURE_DASHBOARD = getLoc(casePfx + "lnk.configure.dashboard", "link=Configure dashboard");
- private final String LNK_DASHBOARD = getLoc(casePfx + "lnk.dashboard", "link=Dashboard");
- private final String SEL_PAGE = getLoc(casePfx + "sel.page", "//select[contains(@id,'pageNameSelector')]");
- private final String INP_PAGENAME = getLoc(casePfx + "inp.pagename", "//input[contains(@id,':pageName')]");
- private final String SUB_CREATEPAGE = getLoc(casePfx + "sub.createpage", "//form[contains(@id,'j_id3')]/input[@type='submit']");
- private final String SEL_LAYOUT = getLoc(casePfx + "sel.layout", "//select[contains(@id,'dashboardLayoutForm:layoutSelector')]");
- private final String SEL_THEME = getLoc(casePfx + "sel.theme", "//select[contains(@id,'dashboardThemeForm:themeSelector')]");
- private final String SUB_THEMESEL = getLoc(casePfx + "sub.themesel", "//form[contains(@id,'dashboardThemeForm')]/input[@type='submit']");
+ public String casePfx = "dash.";
- @BeforeMethod(groups = {"log"})
- protected void loginBeforeTest() {
- logoutIfPossible();
- login("admin", "admin");
- }
-/*
- @AfterMethod(groups = {"log"})
- protected void logoutAfterTest() {
- System.out.println("vilko");
- }
-*/
- /**
- * Simple drag and drop test processed on "user" dashboard. The greetings
- * portlet is moved from left to right column and the cms portlet is moved
- * from the right to left corner. The names of Greetings and User profile
- * portlets are then used for final assertion. The Greetings portlet message
- * must be at the top right corner and the "user profile" message should be
- * in the top left corner.
- */
- @Test(enabled = true)
- public void testDragAndDrop() {
- logout();
- login("user", "user");
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ private final String MSG_WINDOW_NAME_VALID = getMess(casePfx
+ + "msg.window.name.valid", "is an invalid window name");
+ private final String MSG_PAGE_RENAME_VALID = getMess(casePfx
+ + "msg.page.rename.valid", "is an invalid portal object name");
+ private final String MSG_PAGE_NAME_VALID = getMess(casePfx
+ + "msg.page.name.valid", "is an invalid page name");
- Assert.assertEquals(selenium.getText(SPAN_L1), "Greetings !");
- Assert.assertEquals(selenium.getText(SPAN_L2), "User profile");
+ private final String DIV_PORTET_EDITOR_TITLE = getLoc(casePfx
+ + "div.portlet.editor.title", "portlet-editor-title");
+ private final String HAND_R1 = getLoc(casePfx + "hand.r1",
+ "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div");
+ private final String HAND_L1 = getLoc(
+ casePfx + "hand.l1",
+ "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div");
+ private final String SPAN_R1 = getLoc(
+ casePfx + "span.r1",
+ "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String DIV_REG_A = getLoc(casePfx + "div.reg.a",
+ "//div[@id='regionA']");
+ private final String DIV_REG_B = getLoc(casePfx + "div.reg.b",
+ "//div[@id='regionB']");
+ private final String SPAN_L2 = getLoc(
+ casePfx + "span.l2",
+ "//html/body/div[2]/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String SPAN_L1 = getLoc(
+ casePfx + "span.l1",
+ "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String MSG_POWER = getMess(casePfx + "msg.power",
+ "Powered by JBoss");
+ private final String LNK_POR_WEA_EDIT = getLoc(
+ casePfx + "lnk.por.wea.edit",
+ "//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
+ private final String SUB_LAYOUT_UPDATE = getLoc(casePfx
+ + "sub.layout.update",
+ "//input[contains(@name,'dashboardLayoutForm:j_id12')]");
+ private final String SUB_PAGE_RENAME = getLoc(casePfx + "sub.page.rename",
+ "//form[contains(@id,'renameForm')]/input[@type='submit']");
+ private final String INP_PAGE_RENAME = getLoc(casePfx + "inp.page.rename",
+ "//input[contains(@id,'renameForm:newName')]");
+ private final String INP_WINDOW_NAME = getLoc(casePfx + "inp.window.name",
+ "//input[contains(@id,'windowForm:windowName')]");
+ private final String LINK_WEATHER_PORTLET = getLoc(casePfx
+ + "link.weather.portlet", "link=*WeatherPortlet*");
+ private final String LINK_PORTL3 = getLoc(casePfx + "link.portl3",
+ "link=*WSRP admin portlet*");
+ private final String LINK_PORTL2 = getLoc(casePfx + "link.portl2",
+ "link=*Who's online portlet*");
+ private final String LINK_PORTL1 = getLoc(casePfx + "link.portl1",
+ "link=*Welcome portlet*");
+ private final String OPT_PORTL2 = getLoc(casePfx + "opt.portl2",
+ "IdentityUserPortletWindow");
+ private final String OPT_PORTL1 = getLoc(casePfx + "opt.portl1",
+ "JSPPortletWindow");
+ private final String SEL_CONTENT_TYPE = getLoc(
+ casePfx + "sel.content.type",
+ "//select[contains(@id,'contentTypesForm:instanceId')]");
+ private final String SUB_DEL_FROM_CENTER_REGION = getLoc(casePfx
+ + "sub.del.from.center.region",
+ "//input[contains(@id,'layoutForm:l_center')]");
+ private final String SUB_DOWN_CENTER_REGION = getLoc(casePfx
+ + "sub.down.center.region",
+ "//input[contains(@id,'layoutForm:d_center')]");
+ private final String SUB_UP_CENTER_REGION = getLoc(casePfx
+ + "sub.up.center.region",
+ "//input[contains(@id,'layoutForm:u_center')]");
+ private final String SEL_CENTER_REGION = getLoc(casePfx
+ + "sel.center.region",
+ "//select[contains(@id,'layoutForm:selectMany_center')]");
+ private final String SUB_ADDCENTER = getLoc(casePfx + "sub.addcenter",
+ "//input[contains(@id,'layoutForm:a_center')]");
+ private final String SUB_ADDLEFT = getLoc(casePfx + "sub.addleft",
+ "//input[contains(@id,'layoutForm:a_left')]");
+ private final String LNK_CONFIGURE_DASHBOARD = getLoc(casePfx
+ + "lnk.configure.dashboard", "link=Configure dashboard");
+ private final String LNK_DASHBOARD = getLoc(casePfx + "lnk.dashboard",
+ "link=Dashboard");
+ private final String SEL_PAGE = getLoc(casePfx + "sel.page",
+ "//select[contains(@id,'pageNameSelector')]");
+ private final String INP_PAGENAME = getLoc(casePfx + "inp.pagename",
+ "//input[contains(@id,':pageName')]");
+ private final String SUB_CREATEPAGE = getLoc(casePfx + "sub.createpage",
+ "//form[contains(@id,'j_id3')]/input[@type='submit']");
+ private final String SEL_LAYOUT = getLoc(casePfx + "sel.layout",
+ "//select[contains(@id,'dashboardLayoutForm:layoutSelector')]");
+ private final String SEL_THEME = getLoc(casePfx + "sel.theme",
+ "//select[contains(@id,'dashboardThemeForm:themeSelector')]");
+ private final String SUB_THEMESEL = getLoc(casePfx + "sub.themesel",
+ "//form[contains(@id,'dashboardThemeForm')]/input[@type='submit']");
- selenium.dragAndDropToObject(HAND_L1, DIV_REG_B);
- selenium.dragAndDropToObject(HAND_R1, DIV_REG_A);
+ @BeforeMethod(groups = { "log" })
+ protected void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
- Assert.assertEquals(selenium.getText(SPAN_L1), "User profile");
- Assert.assertEquals(selenium.getText(SPAN_R1), "Greetings !");
+ /*
+ * @AfterMethod(groups = {"log"}) protected void logoutAfterTest() {
+ * System.out.println("vilko"); }
+ */
+ /**
+ * Simple drag and drop test processed on "user" dashboard. The greetings
+ * portlet is moved from left to right column and the cms portlet is moved
+ * from the right to left corner. The names of Greetings and User profile
+ * portlets are then used for final assertion. The Greetings portlet message
+ * must be at the top right corner and the "user profile" message should be
+ * in the top left corner.
+ */
+ @Test(enabled = true)
+ public void testDragAndDrop() {
+ logout();
+ login("user", "user");
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- }
- /**
- * Creates a page. In Dashboard configuration a new page named
- * "DashTestPage" is created. The existence of the link (page) is then
- * asserted on dashboard.s
- */
- @Test(enabled = true)
- public void testCreatePage() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ Assert.assertEquals(selenium.getText(SPAN_L1), "Greetings !");
+ Assert.assertEquals(selenium.getText(SPAN_L2), "User profile");
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.dragAndDropToObject(HAND_L1, DIV_REG_B);
+ selenium.dragAndDropToObject(HAND_R1, DIV_REG_A);
- final String pageName = "DashTestPage";
- selenium.type(INP_PAGENAME, pageName);
+ Assert.assertEquals(selenium.getText(SPAN_L1), "User profile");
+ Assert.assertEquals(selenium.getText(SPAN_R1), "Greetings !");
- clickAndWait(SUB_CREATEPAGE);
+ }
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
- }
+ /**
+ * Creates a page. In Dashboard configuration a new page named
+ * "DashTestPage" is created. The existence of the link (page) is then
+ * asserted on dashboard.s
+ */
+ @Test(enabled = true)
+ public void testCreatePage() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
- /**
- * Renaming of a page on dashboard. firstly a page named "DashToRenamePage"
- * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
- * The page is then renamed to "DashRenamedPage". The existence of the link named by renamed page on the dashboard is then used as a final assertion.
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage"})
- public void testRenamePage() {
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- // firstly create page
+ final String pageName = "DashTestPage";
+ selenium.type(INP_PAGENAME, pageName);
- selenium.click(LNK_DASHBOARD);
- waitFor(AJAX_LOAD);
+ clickAndWait(SUB_CREATEPAGE);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
+ }
- final String pageName = "DashToRenamePage";
- final String pageNameNew = "DashRenamedPage";
- selenium.type(INP_PAGENAME, pageName);
+ /**
+ * Renaming of a page on dashboard. firstly a page named "DashToRenamePage"
+ * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
+ * The page is then renamed to "DashRenamedPage". The existence of the link
+ * named by renamed page on the dashboard is then used as a final assertion.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testRenamePage() {
- clickAndWait(SUB_CREATEPAGE);
+ // firstly create page
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
+ selenium.click(LNK_DASHBOARD);
+ waitFor(AJAX_LOAD);
- // then rename it
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selectIfNotSelected(SEL_PAGE, pageName);
+ final String pageName = "DashToRenamePage";
+ final String pageNameNew = "DashRenamedPage";
+ selenium.type(INP_PAGENAME, pageName);
- selenium.type(INP_PAGE_RENAME, pageNameNew);
- selenium.click(SUB_PAGE_RENAME);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ clickAndWait(SUB_CREATEPAGE);
- selenium.click(LNK_DASHBOARD);
- waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isElementPresent("Link="+pageNameNew));
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
- }
+ // then rename it
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- /**
- * Updating a theme on a page. On a page created in
- * {@link DashboardTestCase#testCreatePage()} a theme is changed to
- * "renaissance". It is asserted that it was not selected before and at the
- * end it is asserted, that the renaissance value is selected.
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage"})
- public void testUpdateTheme() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ selectIfNotSelected(SEL_PAGE, pageName);
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.type(INP_PAGE_RENAME, pageNameNew);
+ selenium.click(SUB_PAGE_RENAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.getSelectedLabel(SEL_THEME).equals("renaissance"), "Previously selected theme other then expected.");
+ selenium.click(LNK_DASHBOARD);
+ waitFor(AJAX_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("Link=" + pageNameNew));
- selenium.select(SEL_THEME, "label=renaissance");
+ }
- selenium.click(SUB_THEMESEL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ /**
+ * Updating a theme on a page. On a page created in
+ * {@link DashboardTestCase#testCreatePage()} a theme is changed to
+ * "renaissance". It is asserted that it was not selected before and at the
+ * end it is asserted, that the renaissance value is selected.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testUpdateTheme() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ Assert.assertFalse(selenium.getSelectedLabel(SEL_THEME).equals(
+ "renaissance"),
+ "Previously selected theme other then expected.");
- Assert.assertEquals(selenium.getSelectedLabel(SEL_THEME), "renaissance", "Previously selected theme other then expected.");
- }
+ selenium.select(SEL_THEME, "label=renaissance");
- /**
- * Updating a layout on a page. On a page created in
- * {@link DashboardTestCase#testCreatePage()} a theme is changed to
- * "generic". It is asserted that it was not selected before and at the end
- * it is asserted, that the renaissance value is selected.
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage"})
- public void testUpdateLayout() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selenium.windowMaximize();
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.click(SUB_THEMESEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.getSelectedLabel(SEL_LAYOUT).equals("generic"), "Previously selected layout other then expected.");
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select(SEL_LAYOUT, "label=generic");
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selenium.click(SUB_LAYOUT_UPDATE);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert
+ .assertEquals(selenium.getSelectedLabel(SEL_THEME),
+ "renaissance",
+ "Previously selected theme other then expected.");
+ }
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ /**
+ * Updating a layout on a page. On a page created in
+ * {@link DashboardTestCase#testCreatePage()} a theme is changed to
+ * "generic". It is asserted that it was not selected before and at the end
+ * it is asserted, that the renaissance value is selected.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testUpdateLayout() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selenium.windowMaximize();
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ Assert.assertFalse(selenium.getSelectedLabel(SEL_LAYOUT).equals(
+ "generic"), "Previously selected layout other then expected.");
- Assert.assertEquals(selenium.getSelectedLabel(SEL_LAYOUT), "generic", "Previously selected layout other then expected.");
- }
+ selenium.select(SEL_LAYOUT, "label=generic");
- /**
- * Adding a portlet to dashboard. Adding a "Who's online portlet" to
- * dashboard (center). At the end some strings specific for the portlet are
- * asserted to appear on a dashboard.
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage"})
- public void testAddPortlet() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_LAYOUT_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selenium.click(LINK_PORTL2);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitForElement(DIV_PORTET_EDITOR_TITLE);
- selenium.click(SUB_ADDCENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
- waitFor(AJAX_LOAD);
+ Assert.assertEquals(selenium.getSelectedLabel(SEL_LAYOUT), "generic",
+ "Previously selected layout other then expected.");
+ }
- Assert.assertTrue(selenium.isTextPresent("Current users"));
- Assert.assertTrue(selenium.isTextPresent("Among them: * logged-in"));
- Assert.assertTrue(selenium.isTextPresent("[admin]"));
- }
+ /**
+ * Adding a portlet to dashboard. Adding a "Who's online portlet" to
+ * dashboard (center). At the end some strings specific for the portlet are
+ * asserted to appear on a dashboard.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testAddPortlet() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- /**
- * Moving with portlets on a dashboard. Firstly a page called "DashMovePage"
- * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
- * Then two portlets ("Welcome portlet", "Who's online portlet" in that
- * order) are added to the page the same way as in
- * {@link DashboardTestCase#testAddPortlet()}. Their positions are swapped
- * at the end and the ordering of strings on a dashboard page is used for
- * assertion.
- *
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage", "testAddPortlet"})
- public void testMovePortlet() {
- final String pageName = "DashMovePage";
-
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.click(LINK_PORTL2);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitForElement(DIV_PORTET_EDITOR_TITLE);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INP_PAGENAME, pageName);
- selenium.click(SUB_CREATEPAGE);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
- selectIfNotSelected(SEL_PAGE, pageName);
- selenium.click(LINK_PORTL1);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUB_ADDCENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Current users"));
+ Assert.assertTrue(selenium.isTextPresent("Among them: * logged-in"));
+ Assert.assertTrue(selenium.isTextPresent("[admin]"));
+ }
- selectIfNotSelected(SEL_PAGE, pageName);
- selenium.click(LINK_PORTL2);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUB_ADDCENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ /**
+ * Moving with portlets on a dashboard. Firstly a page called "DashMovePage"
+ * is created the same way as in {@link DashboardTestCase#testCreatePage()}.
+ * Then two portlets ("Welcome portlet", "Who's online portlet" in that
+ * order) are added to the page the same way as in
+ * {@link DashboardTestCase#testAddPortlet()}. Their positions are swapped
+ * at the end and the ordering of strings on a dashboard page is used for
+ * assertion.
+ *
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage",
+ "testAddPortlet" })
+ public void testMovePortlet() {
+ final String pageName = "DashMovePage";
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
- Assert.assertFalse(assertTextOrder("Current;Greetings"));
- Assert.assertTrue(assertTextOrder("Greetings;Current"));
-
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selectIfNotSelected(SEL_PAGE, pageName);
+ selenium.type(INP_PAGENAME, pageName);
+ selenium.click(SUB_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.addSelection(SEL_CENTER_REGION, OPT_PORTL2);
- selenium.click(SUB_UP_CENTER_REGION);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selectIfNotSelected(SEL_PAGE, pageName);
+ selenium.click(LINK_PORTL1);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(assertTextOrder("Current;Greetings"));
- Assert.assertFalse(assertTextOrder("Greetings;Current"));
+ selectIfNotSelected(SEL_PAGE, pageName);
+ selenium.click(LINK_PORTL2);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- }
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- /**
- * Reordering of portlets. After the portlets are moved in
- * {@link DashboardTestCase#testMovePortlet()}, they are swaped to the
- * previous position (reordered again) with this test. The ordering of
- * strings on a dashboard page is used for assertion.
- */
- @Test(enabled = true, dependsOnMethods = {"testCreatePage", "testMovePortlet"})
- public void testReorder() {
- final String pageName = "DashMovePage";
+ Assert.assertFalse(assertTextOrder("Current;Greetings"));
+ Assert.assertTrue(assertTextOrder("Greetings;Current"));
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selectIfNotSelected(SEL_PAGE, pageName);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selectIfNotSelected(SEL_PAGE, pageName);
- selenium.addSelection(SEL_CENTER_REGION, OPT_PORTL1);
- selenium.click(SUB_UP_CENTER_REGION);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.addSelection(SEL_CENTER_REGION, OPT_PORTL2);
+ selenium.click(SUB_UP_CENTER_REGION);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(assertTextOrder("Current;Greetings"));
- Assert.assertTrue(assertTextOrder("Greetings;Current"));
- }
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- /**
- * Deleting of a portlet. Portlet added in
- * {@link DashboardTestCase#testAddPortlet()} is used in this test. The
- * portlet is deleted and it is asserted that string specific for this
- * portlet are not appearing on the dashboard anymore.
- */
- @Test(enabled = true, dependsOnMethods = {"testAddPortlet"})
- public void testDeletePortlet() {
+ Assert.assertTrue(assertTextOrder("Current;Greetings"));
+ Assert.assertFalse(assertTextOrder("Greetings;Current"));
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ }
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ /**
+ * Reordering of portlets. After the portlets are moved in
+ * {@link DashboardTestCase#testMovePortlet()}, they are swaped to the
+ * previous position (reordered again) with this test. The ordering of
+ * strings on a dashboard page is used for assertion.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage",
+ "testMovePortlet" })
+ public void testReorder() {
+ final String pageName = "DashMovePage";
- selenium.addSelection(SEL_CENTER_REGION, "label=CurrentUsersPortletWindow");
- selenium.click(SUB_DEL_FROM_CENTER_REGION);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selectIfNotSelected(SEL_PAGE, pageName);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.addSelection(SEL_CENTER_REGION, OPT_PORTL1);
+ selenium.click(SUB_UP_CENTER_REGION);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("Current users"));
- Assert.assertFalse(selenium.isTextPresent("Whose 1 is logged-in:"));
- Assert.assertFalse(selenium.isTextPresent("[admin]"));
- }
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- /**
- * Adding of google portlet. Same as
- * {@link DashboardTestCase#testAddPortlet()} but added portlet is of type
- * "widget/google" (content type selector). "Band Culinaria" google portlet
- * is used in this test.
- */
- @Test(enabled = false, dependsOnMethods = {"testCreatePage"})
- public void testAddGooglePortlet() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selenium.select(SEL_CONTENT_TYPE, "label=widget/google");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Band Culinaria");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUB_ADDCENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=DashTestPage");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(assertTextOrder("Current;Greetings"));
+ Assert.assertTrue(assertTextOrder("Greetings;Current"));
+ }
- Assert.assertTrue(selenium.isTextPresent("Band Culinaria"));
- Assert.assertTrue(selenium.isTextPresent("Gadgets powered by Google"));
- }
-
- /**
+ /**
+ * Deleting of a portlet. Portlet added in
+ * {@link DashboardTestCase#testAddPortlet()} is used in this test. The
+ * portlet is deleted and it is asserted that string specific for this
+ * portlet are not appearing on the dashboard anymore.
+ */
+ @Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
+ public void testDeletePortlet() {
+
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+
+ selenium.addSelection(SEL_CENTER_REGION,
+ "label=CurrentUsersPortletWindow");
+ selenium.click(SUB_DEL_FROM_CENTER_REGION);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("Current users"));
+ Assert.assertFalse(selenium.isTextPresent("Whose 1 is logged-in:"));
+ Assert.assertFalse(selenium.isTextPresent("[admin]"));
+ }
+
+ /**
+ * Adding of google portlet. Same as
+ * {@link DashboardTestCase#testAddPortlet()} but added portlet is of type
+ * "widget/google" (content type selector). "Band Culinaria" google portlet
+ * is used in this test.
+ */
+ @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ public void testAddGooglePortlet() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.select(SEL_CONTENT_TYPE, "label=widget/google");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Band Culinaria");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Band Culinaria"));
+ Assert.assertTrue(selenium.isTextPresent("Gadgets powered by Google"));
+ }
+
+ /**
* Testing input validation for page creation. Test navigates to configure
* dashboard interface and tries to create a new page on the dashboard with
* the XSS string. The XSS string is inputed into the create page input and
* after submitting it is asserted that the error message is present.
*/
- @Test(enabled = true)
- public void testXssCreatePage() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ @Test(enabled = true)
+ public void testXssCreatePage() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INP_PAGENAME, XSS_STR1);
- clickAndWait(SUB_CREATEPAGE);
-
- Assert.assertTrue(selenium.isTextPresent(MSG_PAGE_NAME_VALID),"Message \""+MSG_PAGE_NAME_VALID+"\" not found.");
- }
-
- /**
+ selenium.type(INP_PAGENAME, XSS_STR1);
+ clickAndWait(SUB_CREATEPAGE);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_PAGE_NAME_VALID),
+ "Message \"" + MSG_PAGE_NAME_VALID + "\" not found.");
+ }
+
+ /**
* Testing input validation for page renaming. Test navigates to configure
* dashboard interface and tries to rename a page on the dashboard with the
* XSS string. Firstly new page named "DashXSSToRenamePage" is created. Then
@@ -452,42 +512,43 @@
* After submitting it is asserted that the validation error message is
* present on the screen
*/
- @Test(enabled = true)
- public void testXssRenamePage() {
- selenium.click(LNK_DASHBOARD);
- waitFor(AJAX_LOAD);
+ @Test(enabled = true)
+ public void testXssRenamePage() {
+ selenium.click(LNK_DASHBOARD);
+ waitFor(AJAX_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- final String pageName = "DashXSSToRenamePage";
-
- selenium.type(INP_PAGENAME, pageName);
+ final String pageName = "DashXSSToRenamePage";
- clickAndWait(SUB_CREATEPAGE);
+ selenium.type(INP_PAGENAME, pageName);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
+ clickAndWait(SUB_CREATEPAGE);
- // then rename it
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
- selectIfNotSelected(SEL_PAGE, pageName);
+ // then rename it
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type(INP_PAGE_RENAME, XSS_STR1);
- selenium.click(SUB_PAGE_RENAME);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertTrue(selenium.isTextPresent(MSG_PAGE_RENAME_VALID),"Message: \""+MSG_PAGE_RENAME_VALID+"\" not found");
- }
-
- /**
+ selectIfNotSelected(SEL_PAGE, pageName);
+
+ selenium.type(INP_PAGE_RENAME, XSS_STR1);
+ selenium.click(SUB_PAGE_RENAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(MSG_PAGE_RENAME_VALID),
+ "Message: \"" + MSG_PAGE_RENAME_VALID + "\" not found");
+ }
+
+ /**
* Testing input validation for window creation. Test navigates to configure
* dashboard interface and select previously selected "DashTestPage" page.
* Then it clicks on the portlet link defined in property file as
@@ -496,123 +557,151 @@
* the particular submit) it is asserted that the validation error message
* is present on the screen.
*/
- @Test(enabled = true, dependsOnMethods = {"testCreatePage"})
- public void testXssWindowName() {
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testXssWindowName() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- waitFor(AJAX_LOAD);
-
- selectIfNotSelected(SEL_PAGE, "DashTestPage");
- selenium.click(LINK_PORTL3);
- selenium.waitForPageToLoad(PAGE_LOAD);
- waitForElement(DIV_PORTET_EDITOR_TITLE);
- selenium.type(INP_WINDOW_NAME, XSS_STR1);
- selenium.click(SUB_ADDCENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isTextPresent(MSG_WINDOW_NAME_VALID));
- }
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.click(LINK_PORTL3);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ waitForElement(DIV_PORTET_EDITOR_TITLE);
+ selenium.type(INP_WINDOW_NAME, XSS_STR1);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- // http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
- // https://jira.jboss.org/jira/browse/JBPORTAL-2177
- /**
- * Dashboard rename page loses portlet state settings bug testing. From
- * forum reference <a
- * href="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023"
- * >http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023</a>.
- * Jira for this issue already created in <a
- * href="https://jira.jboss.org/jira/browse/JBPORTAL-2177"
- * >https://jira.jboss.org/jira/browse/JBPORTAL-2177</a>.
- *
- * <pre>
- * - in Configure Dashboard, create a new dashboard page; I called mine test1
- * - in the left region, add the Weather portlet
- * - return to the Dashboard, select the new tab/page (test1), you see Miami weather (the default)
- * - EDIT the weather portlet and enter a local zipcode, press OK, you see local weather, so far so good
- * - return to Configure Dashboard, rename the page (test1a)
- * - return to the Dashboard, select the newly renamed tab
- * - now you no longer see the local weather because renaming the page has lost the portlet window-specific settings
- * </pre>
- */
- @Test(enabled = true)
- public void testBugResetPortletSetting() {
- final String pageName = "page1";
- final String pageNameNew = "page1a";
+ Assert.assertTrue(selenium.isTextPresent(MSG_WINDOW_NAME_VALID));
+ }
- // create page
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
- selenium.type(INP_PAGENAME, pageName);
- selenium.click(SUB_CREATEPAGE);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ /**
+ * Test window name input when no portlet is selected. Types XSS string into
+ * window name and without selecting any portlet it clicks on relevant
+ * submit button. Final assert is made - XSS string should not be the value
+ * of window name input.
+ *
+ * @jira(JBPORTAL-2418)
+ */
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testXssNonPortletWindowName() {
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ waitFor(AJAX_LOAD);
- Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.type(INP_WINDOW_NAME, XSS_STR1);
+ selenium.click(SUB_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- // add weather portlet
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.getValue(INP_WINDOW_NAME).equals(XSS_STR1),
+ "XSS string found on the page in window name input.");
+ }
- selectIfNotSelected(SEL_PAGE, pageName);
+ // http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
+ // https://jira.jboss.org/jira/browse/JBPORTAL-2177
+ /**
+ * Dashboard rename page loses portlet state settings bug testing. From
+ * forum reference <a
+ * href="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023"
+ * >http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023</a>.
+ * Jira for this issue already created in <a
+ * href="https://jira.jboss.org/jira/browse/JBPORTAL-2177"
+ * >https://jira.jboss.org/jira/browse/JBPORTAL-2177</a>.
+ *
+ * <pre>
+ * - in Configure Dashboard, create a new dashboard page; I called mine test1
+ * - in the left region, add the Weather portlet
+ * - return to the Dashboard, select the new tab/page (test1), you see Miami weather (the default)
+ * - EDIT the weather portlet and enter a local zipcode, press OK, you see local weather, so far so good
+ * - return to Configure Dashboard, rename the page (test1a)
+ * - return to the Dashboard, select the newly renamed tab
+ * - now you no longer see the local weather because renaming the page has lost the portlet window-specific settings
+ * </pre>
+ */
+ @Test(enabled = true)
+ public void testBugResetPortletSetting() {
+ final String pageName = "page1";
+ final String pageNameNew = "page1a";
- selenium.click(LINK_WEATHER_PORTLET);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(SUB_ADDLEFT);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=" + pageName);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ // create page
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+ selenium.type(INP_PAGENAME, pageName);
+ selenium.click(SUB_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Miami, FL, US"));
+ Assert.assertTrue(selenium.isElementPresent("link=" + pageName));
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- // change the properties
- selenium.click(LNK_POR_WEA_EDIT);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.type("newzip", "41001");
- selenium.click("submit");
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Alexandria"));
+ Assert.assertTrue(selenium.isTextPresent(MSG_POWER));
- // rename portal
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_CONFIGURE_DASHBOARD);
- // selenium.waitForPageToLoad(PAGE_LOAD);
- waitFor(AJAX_LOAD);
+ // add weather portlet
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selectIfNotSelected(SEL_PAGE, pageName);
+ selectIfNotSelected(SEL_PAGE, pageName);
- selenium.type(INP_PAGE_RENAME, pageNameNew);
- selenium.click(SUB_PAGE_RENAME);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_WEATHER_PORTLET);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUB_ADDLEFT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=" + pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- // check the portlet again
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(LNK_DASHBOARD);
- selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=" + pageNameNew);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Miami, FL, US"));
- Assert.assertTrue(selenium.isTextPresent("Alexandria"), "Previously selected portlet settings were changed after renaming of portal page.");
- }
+ // change the properties
+ selenium.click(LNK_POR_WEA_EDIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("newzip", "41001");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Alexandria"));
+
+ // rename portal
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+
+ selectIfNotSelected(SEL_PAGE, pageName);
+
+ selenium.type(INP_PAGE_RENAME, pageNameNew);
+ selenium.click(SUB_PAGE_RENAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // check the portlet again
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=" + pageNameNew);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert
+ .assertTrue(
+ selenium.isTextPresent("Alexandria"),
+ "Previously selected portlet settings were changed after renaming of portal page.");
+ }
}
14 years, 11 months
JBoss Portal SVN: r13485 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-23 06:54:52 -0400 (Tue, 23 Jun 2009)
New Revision: 13485
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
Log:
[selenium] - extract tool fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:47:24 UTC (rev 13484)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:54:52 UTC (rev 13485)
@@ -7,6 +7,8 @@
$mes = "getMes";
$fun = "get";
+$pfx = "prefix.";
+
if ( $mode eq "l" ) {
$fun = $loc;
}
@@ -17,12 +19,16 @@
open (MYFILE, $file);
while (<MYFILE>) {
chomp;
- if ( $_ =~ /^.*String\W*(\w+)\W=\W$fun*.*\"(.*)\"\W*\)\W*;\W*/ ) {
+ if ( $_ =~ /^.*String\W*casePfx\W*=\W*\"(.*)\"\W*;\W*$/ ) {
+ $pfx = $1;
+ }
+
+ if ( $_ =~ /^.*String\W*(\w+)\W=\W$fun*.*\"(.*)\"\W*\)\W*;\W*$/ ) {
$value= $2;
$name =lc($1);
$name =~ s/_/./g;
- print $name."=".$value."\n";
+ print $pfx.$name."=".$value."\n";
}
}
close (MYFILE);
14 years, 11 months
JBoss Portal SVN: r13484 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-23 06:47:24 -0400 (Tue, 23 Jun 2009)
New Revision: 13484
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
Log:
[selenium] - extract tool fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:36:44 UTC (rev 13483)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:47:24 UTC (rev 13484)
@@ -1,11 +1,23 @@
#!/usr/bin/perl -w
+$mode = shift;
$file = shift;
+$loc = "getLoc";
+$mes = "getMes";
+$fun = "get";
+
+if ( $mode eq "l" ) {
+ $fun = $loc;
+}
+elsif ($mode eq "m") {
+ $fun = $mes;
+}
+
open (MYFILE, $file);
while (<MYFILE>) {
chomp;
- if ( $_ =~ /^.*String\W*(\w+)\W=\W*.*\"(.*)\"\W*\)\W*;\W*/ ) {
+ if ( $_ =~ /^.*String\W*(\w+)\W=\W$fun*.*\"(.*)\"\W*\)\W*;\W*/ ) {
$value= $2;
$name =lc($1);
$name =~ s/_/./g;
14 years, 11 months
JBoss Portal SVN: r13483 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-23 06:36:44 -0400 (Tue, 23 Jun 2009)
New Revision: 13483
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
Log:
[selenium] - extract tool fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:25:28 UTC (rev 13482)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:36:44 UTC (rev 13483)
@@ -5,8 +5,12 @@
open (MYFILE, $file);
while (<MYFILE>) {
chomp;
- if ( $_ =~ /^.*String\W*(\w+)\W=\W*\"(.*)\"\W*;/ ) {
- print $1."=".$2."\n";
+ if ( $_ =~ /^.*String\W*(\w+)\W=\W*.*\"(.*)\"\W*\)\W*;\W*/ ) {
+ $value= $2;
+ $name =lc($1);
+ $name =~ s/_/./g;
+
+ print $name."=".$value."\n";
}
}
close (MYFILE);
14 years, 11 months
JBoss Portal SVN: r13482 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests: tools and 1 other directory.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-23 06:25:28 -0400 (Tue, 23 Jun 2009)
New Revision: 13482
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
Log:
[selenium] - refactoring tool
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 10:25:28 UTC (rev 13482)
@@ -0,0 +1,12 @@
+#!/usr/bin/perl -w
+
+$file = shift;
+
+open (MYFILE, $file);
+while (<MYFILE>) {
+ chomp;
+ if ( $_ =~ /^.*String\W*(\w+)\W=\W*\"(.*)\"\W*;/ ) {
+ print $1."=".$2."\n";
+ }
+}
+close (MYFILE);
Property changes on: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
___________________________________________________________________
Name: svn:executable
+ *
14 years, 11 months
JBoss Portal SVN: r13481 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: mposolda(a)redhat.com
Date: 2009-06-23 04:07:15 -0400 (Tue, 23 Jun 2009)
New Revision: 13481
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java
Log:
PortalBookstoreSampleTestCase refactoring.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java 2009-06-23 02:03:19 UTC (rev 13480)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java 2009-06-23 08:07:15 UTC (rev 13481)
@@ -269,26 +269,26 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1005" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
// verify 1
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), 149.93));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "149.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 149.93.");
// Add books from details portlet
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_TITLE_SUFFIX);
clickAndWait(DETAIL_PORTLET_ADD_LINK);
clickAndWait(DETAIL_PORTLET_ADD_LINK);
// verify 2
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), 229.91));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "229.91"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 229.91.");
// Remove some books
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1005" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
clickAndWait(SHOWCART_PORTLET_TABLE_TR_PREFIX + "1000" + SHOWCART_PORTLET_TABLE_TR_REMOVE_SUFFIX);
// verify 3
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), 124.93));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "124.93"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 124.93.");
// Clear card
clickAndWait(SHOWCART_PORTLET_CLEAR_CART_LINK);
// verify 4
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), 0.00));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "0.0"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 0.0");
}
/**
@@ -304,7 +304,7 @@
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
clickAndWait(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_ADD_SUFFIX);
Assert.assertEquals(SHOWCART_PORTLET_CARD_ITEMS_PREFIX + "5" + SHOWCART_PORTLET_CARD_ITEMS_SUFFIX, selenium.getText(SHOWCART_PORTLET_HEADER));
- Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), 214.83));
+ Assert.assertTrue(valueEqualsCurrency(selenium.getText(CASHIER_PORTLET_AMOUNT), "214.83"), "Total currency value text is " + selenium.getText(CASHIER_PORTLET_AMOUNT) + " but should be 214.83.");
Assert.assertEquals("3", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1000" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
Assert.assertEquals("4", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1001" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
Assert.assertEquals("9", selenium.getText(CATALOG_PORTLET_TABLE_TR_PREFFIX + "1004" + CATALOG_PORTLET_TABLE_TR_COUNT_SUFFIX));
@@ -360,26 +360,17 @@
/**
* Test if given currency String equals to given value. For example:
- * Params: ("$39.99", 39.99) - true
- * Params: ("¤ 281,79", 281.79) - true
- * Params: ("¤ 281,79", 18.15) - false
+ * Params: ("$39.99", "39.99") - true
+ * Params: ("¤ 281,79", "281.79") - true
+ * Params: ("¤ 281,79", "18.15") - false
*
* @param currencyString
* @param value
* @return
*/
- private boolean valueEqualsCurrency(String currencyString, double value) {
+ private boolean valueEqualsCurrency(String currencyString, String valueString) {
String s = currencyString.replace(',', '.');
- for (int i=0 ; i<s.length(); i++) {
- if (("0".compareTo(currencyString) < -1) && ((s.compareTo("9") <= 1) || (s.charAt(0) == '9'))) {
- double d = Double.parseDouble(s);
- return d == value;
- }
- else {
- s = s.substring(1);
- }
- }
- return false;
+ return s.contains(valueString);
}
}
14 years, 11 months
JBoss Portal SVN: r13480 - in modules/authorization/trunk: core-components-api/src/main/java/org/jboss/security/authz/components/action and 17 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-06-22 22:03:19 -0400 (Mon, 22 Jun 2009)
New Revision: 13480
Added:
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Delete.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Get.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Head.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Options.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Post.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Put.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Trace.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/resource/
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/resource/HttpResource.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestHttpResource.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/TestEnterprisePolicyFinderModule.java
Removed:
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Delete.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Get.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Head.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Options.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Post.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Put.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Trace.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java
modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java
modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/subject/TestIdentity.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java
Modified:
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Manage.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Operation.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Write.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/URIResource.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Identity.java
modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Roles.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/enforcement/SecurityFilter.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestParameterMatching.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestRoles.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestURLPattern.java
modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliesHierarchialPropagation.java
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java
modules/authorization/trunk/pom.xml
Log:
refactoring
* http profile is broken and needs migration to the new developer framework api
* just backing stuff up
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Manage.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Manage.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Manage.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -21,16 +21,11 @@
*/
package org.jboss.security.authz.components.action;
-import java.util.ArrayList;
-import java.util.List;
-
import org.jboss.security.authz.component.Component;
import org.jboss.security.authz.component.ComponentType;
import org.jboss.security.authz.component.ComponentCategory;
import org.jboss.security.authz.component.ImpliedActions;
-import org.jboss.security.authz.model.Target;
-
/**
* Read represents a "manage" action that can be performed on a Resource
*
@@ -49,17 +44,5 @@
public Manage()
{
this.name = "manage";
- }
-
- @Override
- public List<Target> getTargets()
- {
- List<Target> manageTargets = new ArrayList<Target>();
- Write write = new Write();
-
- manageTargets.addAll(super.getTargets());
- manageTargets.addAll(write.getTargets());
-
- return manageTargets;
- }
+ }
}
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Operation.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Operation.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Operation.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -21,20 +21,9 @@
*/
package org.jboss.security.authz.components.action;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.AttributeExpression;
-import org.jboss.security.authz.model.Target;
-import org.jboss.security.authz.model.Action;
-
import org.jboss.security.authz.component.ComponentMarker;
import org.jboss.security.authz.component.TargetUri;
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
/**
* Represents any Operation that can be performed on a Resource
*
@@ -53,45 +42,5 @@
public String getName()
{
return this.name;
- }
- //-------Policy Generation Services---------------------------------------------------------------------------------------------------------------------
- /**
- * A Target used for Matching this Action within a Policy Definition
- *
- * @return target
- */
- public List<Target> getTargets()
- {
- List<Target> targets = new ArrayList<Target>();
-
- Target target = new Target();
- AttributeExpression expression = new AttributeExpression();
- expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING, this.name);
- expression.setAttribute(attribute);
-
- target.addActionMatch(expression);
- targets.add(target);
-
- return targets;
- }
- //-------Request Context Generation Services-------------------------------------------------------------------------------------------------------------
- /**
- * Creates this Action for the RequestContext
- *
- * @return action
- */
- public Action getAction()
- {
- Action action = new Action();
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING,
- this.name
- );
- action.addAttribute(attribute);
-
- return action;
- }
+ }
}
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Write.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Write.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Write.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -21,16 +21,11 @@
*/
package org.jboss.security.authz.components.action;
-import java.util.List;
-import java.util.ArrayList;
-
import org.jboss.security.authz.component.Component;
import org.jboss.security.authz.component.ComponentType;
import org.jboss.security.authz.component.ComponentCategory;
import org.jboss.security.authz.component.ImpliedActions;
-import org.jboss.security.authz.model.Target;
-
/**
* Read represents a "write" action that can be performed on a Resource
*
@@ -49,17 +44,5 @@
public Write()
{
this.name = "write";
- }
-
- @Override
- public List<Target> getTargets()
- {
- List<Target> writeTargets = new ArrayList<Target>();
- Read read = new Read();
-
- writeTargets.addAll(super.getTargets());
- writeTargets.addAll(read.getTargets());
-
- return writeTargets;
- }
+ }
}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Delete.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Delete.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Delete.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Delete extends Operation
-{
- public Delete()
- {
- this.name = "delete";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Get.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Get.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Get.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Get extends Operation
-{
- public Get()
- {
- this.name = "get";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Head.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Head.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Head.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Head extends Operation
-{
- public Head()
- {
- this.name = "head";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Options.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Options.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Options.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Options extends Operation
-{
- public Options()
- {
- this.name = "options";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Post.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Post.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Post.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Post represents a "POST" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Post extends Operation
-{
- public Post()
- {
- this.name = "post";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Put.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Put.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Put.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Put extends Operation
-{
- public Put()
- {
- this.name = "put";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Trace.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Trace.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Trace.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.action.http;
-
-import org.jboss.security.authz.components.action.Operation;
-
-/**
- * Get represents a "GET" action that can be performed on a Http Servlet
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class Trace extends Operation
-{
- public Trace()
- {
- this.name = "trace";
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,172 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.security.authz.components.resource;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-import java.util.List;
-
-import org.jboss.security.authz.model.AttributeExpression;
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.Resource;
-import org.jboss.security.authz.model.PolicyMetaData;
-import org.jboss.security.authz.model.Target;
-import org.jboss.security.authz.xacml.ExpressionBuilder;
-
-import org.jboss.security.authz.components.action.Operation;
-
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
-/**
- * The HttpResource Policy Component represents a System Resource available via the HTTP Protocol
- *
- * This Component provides an easy to use Developer API for generating commonly used Expressions/Logic related to Http information that must be
- * represented within an Authorization Policy
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class HttpResource extends URIResource implements Cloneable
-{
- /**
- * The HTTP Parameters that are used to access this resource
- */
- private Map<String, String> parameters;
-
- /**
- * Used to apply the Policy based on Http Method being invoked
- */
- private Operation httpMethod;
-
- /**
- *
- */
- public HttpResource()
- {
- this.parameters = new HashMap<String, String>();
- }
-
- public Map<String, String> getParameters()
- {
- if(this.parameters == null)
- {
- this.parameters = new HashMap<String, String>();
- }
- return parameters;
- }
-
-
- public void setParameters(Map<String, String> parameters)
- {
- this.parameters = parameters;
- }
-
- public void addParameter(String name, String value)
- {
- this.getParameters().put(name, value);
- }
-
- public Operation getHttpMethod()
- {
- return this.httpMethod;
- }
-
- public void setHttpMethod(Operation httpMethod)
- {
- this.httpMethod = httpMethod;
- }
- //-------Services for Policy Creation---------------------------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Produces PolicyMeta used to generate a Policy object to be registered with the Policy Server
- *
- * @return the policy meta data
- */
- public PolicyMetaData getPolicyMetaData()
- {
- PolicyMetaData metadata = super.getPolicyMetaData();
-
- if(!this.getParameters().isEmpty())
- {
- Set<String> names = this.parameters.keySet();
- for(String name: names)
- {
- String value = this.parameters.get(name);
-
- AttributeExpression paramExpression = ExpressionBuilder.getInstance().createCustomResourceExpression(name, value);
- paramExpression.setDesignatorMustBePresent(false);
- metadata.getTarget().addResourceMatch(paramExpression);
- }
- }
-
- if(this.httpMethod != null)
- {
- AttributeExpression actionExpression = new AttributeExpression();
-
- actionExpression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ACTION_ID,
- XMLSchemaConstants.DATATYPE_STRING, this.httpMethod.getName());
- actionExpression.setAttribute(attribute);
-
- List<Target> actionTarget = this.httpMethod.getTargets();
- metadata.getTarget().addActionMatch(actionTarget.iterator().next().getActionMatches().iterator().next());
- }
-
- return metadata;
- }
- //---------Services for RequestContext Generation------------------------------------------------------------------------------------------------------------------------------
- /**
- * Represents the Resource that is currently being accessed
- *
- * @return the Resource
- */
- public Resource getResource()
- {
- Resource urlResource = super.getResource();
-
- if(!this.getParameters().isEmpty())
- {
- Set<String> names = this.parameters.keySet();
- for(String name: names)
- {
- String value = this.parameters.get(name);
-
- Attribute customAttribute = new Attribute();
- customAttribute.setUri(name);
- customAttribute.setDatatType(XMLSchemaConstants.DATATYPE_STRING);
- customAttribute.setValue(value);
- urlResource.addAttribute(customAttribute);
- }
- }
-
- return urlResource;
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public Object clone() throws CloneNotSupportedException
- {
- return super.clone();
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-
-}
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/URIResource.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/URIResource.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/URIResource.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -22,30 +22,15 @@
package org.jboss.security.authz.components.resource;
import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
import org.apache.log4j.Logger;
-import org.jboss.security.authz.model.PolicyMetaData;
-import org.jboss.security.authz.model.Target;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.model.AttributeExpression;
-import org.jboss.security.authz.model.Resource;
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.components.subject.Roles;
-import org.jboss.security.authz.components.action.Operation;
import org.jboss.security.authz.component.ComponentMarker;
import org.jboss.security.authz.component.Component;
import org.jboss.security.authz.component.ComponentType;
import org.jboss.security.authz.component.ComponentCategory;
import org.jboss.security.authz.component.TargetUri;
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
/**
* Represents any System Resource uniquely identified by a URI
*
@@ -66,22 +51,7 @@
@TargetUri
protected URI uri;
- /**
- * Roles that are allowed access to this resource
- */
- protected Roles allowed;
-
- /**
- * Roles that are denied access to this resource
- */
- protected Roles denied;
-
- /**
- * Operation allowed on this resource
- */
- protected Operation operation;
-
-
+
public URIResource()
{
@@ -95,224 +65,5 @@
public void setUri(URI uri)
{
this.uri = uri;
- }
-
- public Roles getAllowed()
- {
- if(this.allowed == null)
- {
- this.allowed = new Roles();
- }
- return allowed;
- }
-
- public void setAllowed(Roles allowed)
- {
- this.allowed = allowed;
- }
-
- public void addAllowed(String name)
- {
- this.getAllowed().addName(name);
- }
-
- public Roles getDenied()
- {
- if(this.denied == null)
- {
- this.denied = new Roles();
- }
- return denied;
- }
-
- public void setDenied(Roles denied)
- {
- this.denied = denied;
- }
-
- public void addDenied(String name)
- {
- this.getDenied().addName(name);
- }
-
- public Operation getOperation()
- {
- return operation;
- }
-
- public void setOperation(Operation operation)
- {
- this.operation = operation;
- }
- //-------Policy Services--------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a Policy Target suggesting that the Policy should apply to this HttpResource
- *
- * @param matchAllParameters 'true' = include matching of all the parameters, 'false' = only url matching, parameters are excluded
- */
- private Target getTarget()
- {
- if(this.uri == null)
- {
- throw new IllegalStateException("URI Cannot Be Empty");
- }
-
- Target target = new Target();
-
-
- AttributeExpression urlExpression = new AttributeExpression();
-
- String uriStr = this.uri.toString();
-
- if(uriStr.charAt(0) == '/' && uriStr.endsWith("/*"))
- {
- //If URL starts with '/' and ends with "/*", use a regular expression to match it (In consistency with the servlet spec)
- urlExpression.setFunctionId(XACMLConstants.FUNCTION_REGEXP_STRING_MATCH);
-
- String uriexp = uriStr.substring(1, uriStr.length()-2);
- StringBuilder buffer = new StringBuilder();
- buffer.append("^/"+uriexp+"$|");
- buffer.append("^"+uriexp+"$|");
- buffer.append("^/"+uriexp+"/.*|");
- buffer.append("^"+uriexp+"/.*");
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_RESOURCE_ID,
- XMLSchemaConstants.DATATYPE_STRING, buffer.toString());
- urlExpression.setAttribute(attribute);
- }
- else
- {
- //use an exact match
- urlExpression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
-
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_RESOURCE_ID,
- XMLSchemaConstants.DATATYPE_STRING, uriStr);
- urlExpression.setAttribute(attribute);
- }
-
- target.addResourceMatch(urlExpression);
-
- return target;
- }
-
- /**
- * Creates a Policy Rule suggesting the allowed roles are permitted access to the 'Resource' designated in the Policy
- *
- * @return the rule
- */
- private List<Rule> allowIfUserHasRole()
- {
- List<Rule> rules = new ArrayList<Rule>();
-
- if(this.operation != null)
- {
- List<Target> targets = this.operation.getTargets();
- if(targets != null)
- {
- for(Target target: targets)
- {
- Rule rule = this.getAllowed().allowIfUserHasRole();
- rule.setTarget(target);
- rules.add(rule);
- }
- }
- }
- else
- {
- rules.add(this.getAllowed().allowIfUserHasRole());
- }
-
- return rules;
- }
-
- /**
- * Creates a Policy Rule suggesting the denied roles are denied access to the 'Resource' designated in the Policy
- *
- * @return the role
- */
- private List<Rule> denyIfUserHasRole()
- {
- List<Rule> rules = new ArrayList<Rule>();
-
- if(this.operation != null)
- {
- List<Target> targets = this.operation.getTargets();
- if(targets != null)
- {
- for(Target target: targets)
- {
- Rule rule = this.getDenied().denyIfUserHasRole();
- rule.setTarget(target);
- rules.add(rule);
- }
- }
- }
- else
- {
- rules.add(this.getDenied().denyIfUserHasRole());
- }
-
- return rules;
- }
-
- /**
- * Produces PolicyMeta used to generate a Policy object to be registered with the Policy Server
- *
- * @return the policy meta data
- */
- public PolicyMetaData getPolicyMetaData()
- {
- PolicyMetaData metadata = new PolicyMetaData();
-
- Target target = this.getTarget();
-
- Set<Rule> rules = new HashSet<Rule>();
-
- //Permitted Roles
- if(this.allowed != null)
- {
- rules.addAll(this.allowIfUserHasRole());
- }
-
- //Denied Roles
- if(this.denied != null)
- {
- rules.addAll(this.denyIfUserHasRole());
- }
-
- metadata.setTarget(target);
- metadata.setRules(rules);
-
- return metadata;
- }
- //-------Request Context Services---------------------------------------------------------------------------------------------------------------------------
- /**
- * Represents the Resource that is currently being accessed
- *
- * @return the Resource
- */
- public Resource getResource()
- {
- Resource uriResource = new Resource();
-
- Attribute attribute = new Attribute();
- attribute.setUri(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
- attribute.setDatatType(XMLSchemaConstants.DATATYPE_STRING);
- attribute.setValue(this.uri.toString());
- uriResource.addAttribute(attribute);
-
- return uriResource;
- }
-
- public void start()
- {
- log.debug("-------------------------------------------------------");
- log.debug("URIResource component successfully started.............");
- log.debug("-------------------------------------------------------");
- }
-
- public void stop()
- {
-
- }
+ }
}
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Identity.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Identity.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Identity.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -22,14 +22,6 @@
******************************************************************************/
package org.jboss.security.authz.components.subject;
-import org.jboss.security.authz.model.AttributeExpression;
-import org.jboss.security.authz.model.Effect;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.model.Target;
-import org.jboss.security.authz.model.Subject;
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.tools.GeneralTool;
-
import org.jboss.security.authz.component.ComponentMarker;
import org.jboss.security.authz.component.Component;
import org.jboss.security.authz.component.ComponentType;
@@ -37,9 +29,6 @@
import org.jboss.security.authz.component.TargetUri;
import org.jboss.security.authz.component.LogicData;
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
/**
* The Identity Policy Component represents the "Identity/User" that is Authenticated by the System
*
@@ -77,85 +66,5 @@
public void setName(String name)
{
this.name = name;
- }
- //--------Services for Policy Generation----------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a Rule to Allow Access to this Identity
- *
- * @return rule that Allows Access to this Identity
- */
- public Rule allow()
- {
- if(this.name == null || this.name.trim().length() == 0)
- {
- throw new IllegalStateException("Identity Name Is Missing!!");
- }
-
- Rule rule = new Rule();
-
- rule.setRuleId(GeneralTool.generateUniqueId());
- rule.setEffect(Effect.PERMIT);
- rule.setTarget(this.getIdentityTarget());
-
- return rule;
- }
-
- /**
- * Creates a Rule to Deny Access to this Identity
- *
- * @return rule that Denies Access to this Identity
- */
- public Rule deny()
- {
- if(this.name == null || this.name.trim().length() == 0)
- {
- throw new IllegalStateException("Identity Name Is Missing!!");
- }
-
- Rule rule = new Rule();
-
- rule.setRuleId(GeneralTool.generateUniqueId());
- rule.setEffect(Effect.DENY);
- rule.setTarget(this.getIdentityTarget());
-
- return rule;
- }
-
- /**
- * Creates a Target that produces a Policy Match if the Input Subject has an Identity by the same 'Name' as this Identity
- *
- * @return target
- */
- private Target getIdentityTarget()
- {
- Target target = new Target();
-
- AttributeExpression expression = new AttributeExpression();
- expression.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_SUBJECT_ID,
- XMLSchemaConstants.DATATYPE_STRING, this.name);
- expression.setAttribute(attribute);
-
- target.addSubjectMatch(expression);
- return target;
- }
- //------------Services for RequestContext Generation--------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a Subject for the RequestContext with this Identity
- *
- * @return subject
- */
- public Subject getSubject()
- {
- Subject subject = new Subject();
-
- subject.setCategory(XACMLConstants.ATTRIBUTEID_ACCESS_SUBJECT);
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_SUBJECT_ID,
- XMLSchemaConstants.DATATYPE_STRING,
- this.name
- );
- subject.addAttribute(attribute);
-
- return subject;
- }
+ }
}
Modified: modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Roles.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Roles.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Roles.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -26,12 +26,7 @@
import java.util.Set;
import java.util.HashSet;
-import org.jboss.security.authz.model.Attribute;
-import org.jboss.security.authz.model.DroolsRuleExpression;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.model.Subject;
import org.jboss.security.authz.tools.GeneralTool;
-import org.jboss.security.authz.model.Effect;
import org.jboss.security.authz.component.ComponentMarker;
import org.jboss.security.authz.component.Component;
@@ -40,9 +35,6 @@
import org.jboss.security.authz.component.LogicData;
import org.jboss.security.authz.component.LogicExpression;
-import org.jboss.security.xacml.interfaces.XACMLConstants;
-import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
-
/**
* The Role Policy Component represents the "Roles" that are assigned to users of a System
*
@@ -122,104 +114,7 @@
throw new IllegalArgumentException("Role Name should not be empty!!");
}
this.getNames().add(name);
- }
- //-------Services for Policy Generation-----------------------------------------------------------------------------------------------------------------------------------------------------
- /**
- * Creates a Policy Rule suggesting the roles indicated by this object are permitted access to the 'Resource' designated in the Policy
- * The User must belong to atleast one of the specified roles to gain access
- *
- * @return the rule
- */
- public Rule allowIfUserHasRole()
- {
- if(this.getNames().isEmpty())
- {
- throw new IllegalStateException("The List of Allowed Roles must not be empty!!");
- }
-
- Rule rule = new Rule();
-
- String ruleReference = "roles://allowRule/"+GeneralTool.generateUniqueId();
- rule.setRuleId(ruleReference);
- rule.setEffect(Effect.PERMIT);
-
- //Generate a Drools Rule Expression
- StringBuffer buffer = new StringBuffer();
- for(String role: this.getNames())
- {
- buffer.append("$roles.contains(\""+role.toLowerCase()+"\") || ");
- }
- String condition = buffer.toString().trim();
- String ruleLogic = MessageFormat.format(Roles.allowRule,
- ruleReference, condition.substring(0, condition.length()-2).trim());
-
- DroolsRuleExpression expression = new DroolsRuleExpression();
- expression.setRuleReference(ruleReference);
- expression.setRule(ruleLogic);
- rule.setExpression(expression);
-
- return rule;
- }
-
- /**
- * Creates a Policy Rule suggesting the roles indicated by this object are denied access to the 'Resource' designated in the Policy
- * If the user belongs to atleast one of these roles, he will be denied access
- *
- * @return the rule
- */
- public Rule denyIfUserHasRole()
- {
- if(this.getNames().isEmpty())
- {
- throw new IllegalStateException("The List of Denied Roles must not be empty!!");
- }
-
- Rule rule = new Rule();
-
- String ruleReference = "roles://denyRule/"+GeneralTool.generateUniqueId();
- rule.setRuleId(ruleReference);
- rule.setEffect(Effect.DENY);
-
- //Generate a Drools Rule Expression
- StringBuffer buffer = new StringBuffer();
- for(String role: this.getNames())
- {
- buffer.append("$roles.contains(\""+role.toLowerCase()+"\") || ");
- }
- String condition = buffer.toString().trim();
- String ruleLogic = MessageFormat.format(Roles.denyRule,
- ruleReference, condition.substring(0, condition.length()-2).trim());
-
- DroolsRuleExpression expression = new DroolsRuleExpression();
- expression.setRuleReference(ruleReference);
- expression.setRule(ruleLogic);
- rule.setExpression(expression);
-
- return rule;
- }
- //--------Services for RequestContext Generation-----------------------------------------------------------------------------------------------------------
- /**
- * Creates a Subject for the RequestContext with these Roles
- *
- * @return subject
- */
- public Subject getSubject()
- {
- Subject subject = new Subject();
-
- subject.setCategory(XACMLConstants.ATTRIBUTEID_ACCESS_SUBJECT);
-
- for(String name: this.getNames())
- {
- Attribute attribute = new Attribute(XACMLConstants.ATTRIBUTEID_ROLE,
- XMLSchemaConstants.DATATYPE_STRING,
- name
- );
- subject.addAttribute(attribute);
- }
-
- return subject;
- }
+ }
//------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
* Creates a Policy Rule suggesting the roles indicated by this object are permitted access to the 'Resource' designated in the Policy
Deleted: modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,111 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.http;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.security.authz.components.resource.HttpResource;
-import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.test.MockPolicy;
-
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class TestHttpResource extends TestCase
-{
- private static Logger log = Logger.getLogger(TestHttpResource.class);
-
- public void testGetURLTargetNoParameters() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
-
- Policy policy = new MockPolicy("testGetURLTargetNoParameters", httpResource.getPolicyMetaData());
-
- log.info("------------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testGetURLTargetWithParameters() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- httpResource.addParameter("test1", "test1://value");
- httpResource.addParameter("test2", "test2://value");
-
-
- Policy policy = new MockPolicy("testGetURLTargetWithParameters", httpResource.getPolicyMetaData());
-
- log.info("------------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testRoleRules() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- httpResource.addParameter("test1", "test1://value");
- httpResource.addParameter("test2", "test2://value");
- httpResource.addAllowed("admin");
- httpResource.addDenied("anonymous");
-
- Policy policy = new MockPolicy("testRoleRules", httpResource.getPolicyMetaData());
-
- log.info("------------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testIPRules() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- httpResource.addParameter("test1", "test1://value");
- httpResource.addParameter("test2", "test2://value");
- httpResource.addAllowed("admin");
- httpResource.addDenied("anonymous");
-
- Policy policy = new MockPolicy("testIPRules", httpResource.getPolicyMetaData());
-
- log.info("------------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testURLPattern() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/portal/*"));
- httpResource.addParameter("test1", "test1://value");
- httpResource.addParameter("test2", "test2://value");
- httpResource.addAllowed("admin");
- httpResource.addDenied("anonymous");
-
- Policy policy = new MockPolicy("testURLPattern", httpResource.getPolicyMetaData());
-
- log.info("------------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-}
Deleted: modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/subject/TestIdentity.java
===================================================================
--- modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/subject/TestIdentity.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/subject/TestIdentity.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,92 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.components.subject;
-
-import java.util.Set;
-import java.util.HashSet;
-
-import junit.framework.TestCase;
-import org.apache.log4j.Logger;
-
-import org.jboss.security.authz.model.PolicyMetaData;
-import org.jboss.security.authz.model.Target;
-import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.model.Rule;
-import org.jboss.security.authz.test.MockPolicy;
-import org.jboss.security.authz.xacml.*;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class TestIdentity extends TestCase
-{
- private static Logger log = Logger.getLogger(TestIdentity.class);
-
- public void testAllow() throws Exception
- {
- Identity identity = new Identity();
- identity.setName("admin");
-
- Target target = new Target();
- target.addResourceMatch(ExpressionBuilder.getInstance().createResourceIdExpression("test://Resource"));
-
- Set<Rule> rules = new HashSet<Rule>();
- rules.add(identity.allow());
-
- PolicyMetaData metadata = new PolicyMetaData();
- metadata.setTarget(target);
- metadata.setRules(rules);
- Policy policy = new MockPolicy("testGetAllowIdentityRule", metadata);
-
- log.info("----------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testDeny() throws Exception
- {
- Identity identity = new Identity();
- identity.setName("admin");
-
- Target target = new Target();
- target.addResourceMatch(ExpressionBuilder.getInstance().createResourceIdExpression("test://Resource"));
-
- Set<Rule> rules = new HashSet<Rule>();
- rules.add(identity.deny());
-
- PolicyMetaData metadata = new PolicyMetaData();
- metadata.setTarget(target);
- metadata.setRules(rules);
- Policy policy = new MockPolicy("testGetDenyIdentityRule", metadata);
-
- log.info("----------------------------------------------------------------");
- log.info(policy.generateSystemPolicy());
- }
-
- public void testGetSubject() throws Exception
- {
- Identity identity = new Identity();
- identity.setName("admin");
-
- log.info("----------------------------------------------------------------");
- JAXBEncoder.marshall(System.out, identity.getSubject());
- }
-}
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Delete.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Delete.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Delete.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Delete.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-delete",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Delete extends Operation
+{
+ public Delete()
+ {
+ this.name = "delete";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Delete.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Get.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Get.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Get.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Get.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-get",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Get extends Operation
+{
+ public Get()
+ {
+ this.name = "get";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Get.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Head.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Head.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Head.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Head.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-head",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Head extends Operation
+{
+ public Head()
+ {
+ this.name = "head";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Head.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Options.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Options.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Options.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Options.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-options",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Options extends Operation
+{
+ public Options()
+ {
+ this.name = "options";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Options.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Post.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Post.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Post.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Post.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Post represents a "POST" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-post",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Post extends Operation
+{
+ public Post()
+ {
+ this.name = "post";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Post.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Put.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Put.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Put.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Put.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-put",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Put extends Operation
+{
+ public Put()
+ {
+ this.name = "put";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Put.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Trace.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/http/Trace.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Trace.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Trace.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.component.action;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.components.action.Operation;
+
+/**
+ * Get represents a "GET" action that can be performed on a Http Servlet
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+@Component(
+ name="http-trace",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.ACTION
+)
+public class Trace extends Operation
+{
+ public Trace()
+ {
+ this.name = "trace";
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/action/Trace.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/resource/HttpResource.java (from rev 13462, modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/HttpResource.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/resource/HttpResource.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/component/resource/HttpResource.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.security.authz.http.component.resource;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.security.authz.component.Component;
+import org.jboss.security.authz.component.ComponentCategory;
+import org.jboss.security.authz.component.ComponentType;
+import org.jboss.security.authz.component.TargetUri;
+import org.jboss.security.authz.components.resource.URIResource;
+
+/**
+ * The HttpResource Policy Component represents a System Resource available via the HTTP Protocol
+ *
+ * This Component provides an easy to use Developer API for generating commonly used Expressions/Logic related to Http information that must be
+ * represented within an Authorization Policy
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+@Component(
+ name="http-uri",
+ type=ComponentType.TARGET,
+ category=ComponentCategory.RESOURCE
+)
+public class HttpResource extends URIResource implements Cloneable
+{
+ /**
+ * The HTTP Parameters that are used to access this resource
+ */
+ @TargetUri
+ private Map<String, String> parameters;
+
+ /**
+ *
+ */
+ public HttpResource()
+ {
+ this.parameters = new HashMap<String, String>();
+ }
+
+ public Map<String, String> getParameters()
+ {
+ if(this.parameters == null)
+ {
+ this.parameters = new HashMap<String, String>();
+ }
+ return parameters;
+ }
+
+
+ public void setParameters(Map<String, String> parameters)
+ {
+ this.parameters = parameters;
+ }
+
+ public void addParameter(String name, String value)
+ {
+ this.getParameters().put(name, value);
+ }
+
+ /*public PolicyMetaData getPolicyMetaData()
+ {
+ PolicyMetaData metadata = super.getPolicyMetaData();
+
+ if(!this.getParameters().isEmpty())
+ {
+ Set<String> names = this.parameters.keySet();
+ for(String name: names)
+ {
+ String value = this.parameters.get(name);
+
+ AttributeExpression paramExpression = ExpressionBuilder.getInstance().createCustomResourceExpression(name, value);
+ paramExpression.setDesignatorMustBePresent(false);
+ metadata.getTarget().addResourceMatch(paramExpression);
+ }
+ }
+
+ return metadata;
+ }*/
+
+ /*public Resource getResource()
+ {
+ Resource urlResource = super.getResource();
+
+ if(!this.getParameters().isEmpty())
+ {
+ Set<String> names = this.parameters.keySet();
+ for(String name: names)
+ {
+ String value = this.parameters.get(name);
+
+ Attribute customAttribute = new Attribute();
+ customAttribute.setUri(name);
+ customAttribute.setDatatType(XMLSchemaConstants.DATATYPE_STRING);
+ customAttribute.setValue(value);
+ urlResource.addAttribute(customAttribute);
+ }
+ }
+
+ return urlResource;
+ }*/
+}
Modified: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/configuration/HttpPolicyConfig.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -38,19 +38,19 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.tools.GeneralTool;
import org.jboss.security.authz.policy.server.plugin.XACMLPolicy;
import org.jboss.security.authz.policy.server.spi.PolicyConfig;
-import org.jboss.security.authz.components.action.http.Get;
-import org.jboss.security.authz.components.action.http.Post;
-import org.jboss.security.authz.components.action.http.Delete;
-import org.jboss.security.authz.components.action.http.Head;
-import org.jboss.security.authz.components.action.http.Options;
-import org.jboss.security.authz.components.action.http.Put;
-import org.jboss.security.authz.components.action.http.Trace;
+import org.jboss.security.authz.http.component.action.Delete;
+import org.jboss.security.authz.http.component.action.Get;
+import org.jboss.security.authz.http.component.action.Head;
+import org.jboss.security.authz.http.component.action.Options;
+import org.jboss.security.authz.http.component.action.Post;
+import org.jboss.security.authz.http.component.action.Put;
+import org.jboss.security.authz.http.component.action.Trace;
+import org.jboss.security.authz.http.component.resource.HttpResource;
/**
Modified: modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/enforcement/SecurityFilter.java
===================================================================
--- modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/enforcement/SecurityFilter.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/main/java/org/jboss/security/authz/http/enforcement/SecurityFilter.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -44,6 +44,14 @@
import org.w3c.dom.Element;
import org.w3c.dom.Document;
+import org.jboss.security.authz.http.component.action.Delete;
+import org.jboss.security.authz.http.component.action.Get;
+import org.jboss.security.authz.http.component.action.Head;
+import org.jboss.security.authz.http.component.action.Options;
+import org.jboss.security.authz.http.component.action.Post;
+import org.jboss.security.authz.http.component.action.Put;
+import org.jboss.security.authz.http.component.action.Trace;
+import org.jboss.security.authz.http.component.resource.HttpResource;
import org.jboss.security.authz.http.configuration.HttpPolicyConfig;
import org.jboss.security.authz.tools.GeneralTool;
@@ -57,15 +65,7 @@
import org.jboss.security.authz.policy.client.enforcement.PolicyEnforcementPoint;
import org.jboss.security.authz.policy.client.provisioning.PolicyProvisioner;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.components.subject.Roles;
-import org.jboss.security.authz.components.action.http.Get;
-import org.jboss.security.authz.components.action.http.Post;
-import org.jboss.security.authz.components.action.http.Delete;
-import org.jboss.security.authz.components.action.http.Head;
-import org.jboss.security.authz.components.action.http.Options;
-import org.jboss.security.authz.components.action.http.Put;
-import org.jboss.security.authz.components.action.http.Trace;
/**
Copied: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestHttpResource.java (from rev 13462, modules/authorization/trunk/core-components-api/src/test/java/org/jboss/security/authz/components/http/TestHttpResource.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestHttpResource.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestHttpResource.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,111 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.components;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.http.component.resource.HttpResource;
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.test.MockPolicy;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestHttpResource extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestHttpResource.class);
+
+ public void testGetURLTargetNoParameters() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
+
+ Policy policy = new MockPolicy("testGetURLTargetNoParameters", httpResource.getPolicyMetaData());
+
+ log.info("------------------------------------------------------------------");
+ log.info(policy.generateSystemPolicy());
+ }
+
+ public void testGetURLTargetWithParameters() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
+ httpResource.addParameter("test1", "test1://value");
+ httpResource.addParameter("test2", "test2://value");
+
+
+ Policy policy = new MockPolicy("testGetURLTargetWithParameters", httpResource.getPolicyMetaData());
+
+ log.info("------------------------------------------------------------------");
+ log.info(policy.generateSystemPolicy());
+ }
+
+ public void testRoleRules() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
+ httpResource.addParameter("test1", "test1://value");
+ httpResource.addParameter("test2", "test2://value");
+ httpResource.addAllowed("admin");
+ httpResource.addDenied("anonymous");
+
+ Policy policy = new MockPolicy("testRoleRules", httpResource.getPolicyMetaData());
+
+ log.info("------------------------------------------------------------------");
+ log.info(policy.generateSystemPolicy());
+ }
+
+ public void testIPRules() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
+ httpResource.addParameter("test1", "test1://value");
+ httpResource.addParameter("test2", "test2://value");
+ httpResource.addAllowed("admin");
+ httpResource.addDenied("anonymous");
+
+ Policy policy = new MockPolicy("testIPRules", httpResource.getPolicyMetaData());
+
+ log.info("------------------------------------------------------------------");
+ log.info(policy.generateSystemPolicy());
+ }
+
+ public void testURLPattern() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/portal/*"));
+ httpResource.addParameter("test1", "test1://value");
+ httpResource.addParameter("test2", "test2://value");
+ httpResource.addAllowed("admin");
+ httpResource.addDenied("anonymous");
+
+ Policy policy = new MockPolicy("testURLPattern", httpResource.getPolicyMetaData());
+
+ log.info("------------------------------------------------------------------");
+ log.info(policy.generateSystemPolicy());
+ }
+}
Modified: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestParameterMatching.java
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestParameterMatching.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestParameterMatching.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -25,8 +25,8 @@
import org.apache.log4j.Logger;
import org.jboss.security.authz.components.action.Read;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.http.component.resource.HttpResource;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.policy.client.enforcement.Request;
Modified: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestRoles.java
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestRoles.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestRoles.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -25,8 +25,8 @@
import org.apache.log4j.Logger;
import org.jboss.security.authz.components.action.Read;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.http.component.resource.HttpResource;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.policy.client.enforcement.PolicyEnforcementPoint;
Modified: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestURLPattern.java
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestURLPattern.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/components/TestURLPattern.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -26,8 +26,8 @@
import org.apache.log4j.Logger;
import org.jboss.security.authz.components.action.Read;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.http.component.resource.HttpResource;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.model.PolicyMetaData;
Copied: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/TestEnterprisePolicyFinderModule.java (from rev 13462, modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java)
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/TestEnterprisePolicyFinderModule.java (rev 0)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/TestEnterprisePolicyFinderModule.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -0,0 +1,130 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.http.integration;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.http.component.resource.HttpResource;
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.model.Resource;
+
+import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.components.action.Read;
+
+import org.jboss.security.authz.policy.client.enforcement.PolicyEnforcementPoint;
+import org.jboss.security.authz.policy.client.enforcement.Request;
+import org.jboss.security.authz.policy.client.enforcement.Response;
+import org.jboss.security.authz.policy.client.provisioning.PolicyProvisioner;
+import org.jboss.security.authz.policy.server.Server;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestEnterprisePolicyFinderModule extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestEnterprisePolicyFinderModule.class);
+
+ private PolicyEnforcementPoint enforcer;
+ private PolicyProvisioner provisioner;
+
+ public void setUp() throws Exception
+ {
+ Server.bootstrap();
+ this.enforcer = (PolicyEnforcementPoint)Server.lookup("/enforcement/localEnforcementPoint");
+ this.provisioner = (PolicyProvisioner)Server.lookup("/provisioning/localProvisioner");
+ }
+
+ public void tearDown() throws Exception
+ {
+ }
+
+ public void testNewPolicyEnforcement() throws Exception
+ {
+ HttpResource httpResource = new HttpResource();
+ httpResource.setUri(new URI("/blah/index.html"));
+ httpResource.addParameter("param1", "param1Value");
+ httpResource.addParameter("param2", "param2Value");
+ httpResource.addAllowed("Admin");
+ httpResource.setOperation(new Read());
+
+ PolicyMetaData policyMetaData = httpResource.getPolicyMetaData();
+ this.provisioner.newPolicy(policyMetaData);
+
+
+ //Assert Policy State of the Server
+ Policy[] policies = this.provisioner.readAllPolicies();
+
+ assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
+ log.info("------------------------------------------------------------------------------");
+ log.info(policies[0].generateSystemPolicy());
+
+ //Send an Enforcement request that should be allowed
+ this.enforce(this.createRequest(httpResource, true), true);
+
+ //Send an Enforcement request that should be denied
+ this.enforce(this.createRequest(httpResource, false), false);
+ }
+ //----------------------------------------------------------------------------------------------------------------------------------------------------------
+ private void enforce(Request request, boolean mustBePermitted) throws Exception
+ {
+
+ Response response = this.enforcer.checkAccess(request);
+
+ assertNotNull(response);
+ if(mustBePermitted)
+ {
+ assertTrue("Access must be granted!!!", response.isAccessGranted());
+ }
+ else
+ {
+ assertFalse("Access must be denied!!!", response.isAccessGranted());
+ }
+
+ log.info("-----------------------------------");
+ log.info("Decision="+response.getMessage());
+ }
+
+ private Request createRequest(HttpResource httpResource, boolean mustBePermitted) throws Exception
+ {
+ //Create a RequestType
+ Request request = new Request();
+
+ //Create Subjects
+ Roles roles = new Roles();
+ roles.addName(mustBePermitted?"Admin":"Anonymous");
+ request.addSubject(roles.getSubject());
+
+ //Create Resource
+ Resource urlResource = httpResource.getResource();
+ request.addResource(urlResource);
+
+ //Create Action
+ request.setAction(new Read().getAction());
+
+ return request;
+ }
+}
Property changes on: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/integration/TestEnterprisePolicyFinderModule.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java
===================================================================
--- modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/http-profile/src/test/java/org/jboss/security/authz/http/provisioning/TestHttpPolicyConfig.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -29,10 +29,10 @@
import org.apache.log4j.Logger;
-import org.jboss.security.authz.components.action.http.Get;
-import org.jboss.security.authz.components.action.http.Post;
-import org.jboss.security.authz.components.resource.HttpResource;
import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.http.component.action.Get;
+import org.jboss.security.authz.http.component.action.Post;
+import org.jboss.security.authz.http.component.resource.HttpResource;
import org.jboss.security.authz.http.configuration.HttpPolicyConfig;
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.tools.GeneralTool;
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -60,7 +60,8 @@
{
}
- public void testExplicitPermit() throws Exception
+ //TODO: Rewrite these tests with the new Developer Framework
+ /*public void testExplicitPermit() throws Exception
{
//SetUp Resource
URIResource resource = new URIResource();
@@ -247,5 +248,5 @@
assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
log.info("------------------------------------------------------------------------------");
log.info(policies[0].generateSystemPolicy());
- }
+ }*/
}
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliedActions.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -63,7 +63,8 @@
{
}
- public void testReadImpliedWithWrite() throws Exception
+ //TODO: Rewrite these tests with the new Developer Framework
+ /*public void testReadImpliedWithWrite() throws Exception
{
//SetUp Resource
URIResource resource = new URIResource();
@@ -164,5 +165,5 @@
assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
log.info("------------------------------------------------------------------------------");
log.info(policies[0].generateSystemPolicy());
- }
+ }*/
}
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliesHierarchialPropagation.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliesHierarchialPropagation.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestImpliesHierarchialPropagation.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -62,7 +62,8 @@
{
}
- public void testExplicitPermitReadImpliedWithWrite() throws Exception
+ //TODO: Rewrite these tests with the new Developer Framework
+ /*public void testExplicitPermitReadImpliedWithWrite() throws Exception
{
//SetUp Resource
URIResource resource = new URIResource();
@@ -228,5 +229,5 @@
assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
log.info("------------------------------------------------------------------------------");
log.info(policies[0].generateSystemPolicy());
- }
+ }*/
}
Modified: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestPolicyServer.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -27,7 +27,6 @@
import org.jboss.security.authz.model.Policy;
import org.jboss.security.authz.policy.client.provisioning.PolicyProvisioner;
-import org.jboss.security.authz.components.resource.HttpResource;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -49,7 +48,8 @@
{
}
- public void testNewPolicy() throws Exception
+ //TODO: Rewrite these tests with the new Developer Framework
+ /*public void testNewPolicy() throws Exception
{
HttpResource httpResource = new HttpResource();
httpResource.setUri(new URI("/blah/index.html"));
@@ -63,5 +63,5 @@
assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
log.info("------------------------------------------------------------------------------");
log.info(policies[0].generateSystemPolicy());
- }
+ }*/
}
Deleted: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/plugin/TestEnterprisePolicyFinderModule.java 2009-06-23 02:03:19 UTC (rev 13480)
@@ -1,130 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.security.authz.policy.server.plugin;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-import org.apache.log4j.Logger;
-
-import org.jboss.security.authz.model.Policy;
-import org.jboss.security.authz.model.PolicyMetaData;
-import org.jboss.security.authz.model.Resource;
-
-import org.jboss.security.authz.components.resource.HttpResource;
-import org.jboss.security.authz.components.subject.Roles;
-import org.jboss.security.authz.components.action.Read;
-
-import org.jboss.security.authz.policy.client.enforcement.PolicyEnforcementPoint;
-import org.jboss.security.authz.policy.client.enforcement.Request;
-import org.jboss.security.authz.policy.client.enforcement.Response;
-import org.jboss.security.authz.policy.client.provisioning.PolicyProvisioner;
-import org.jboss.security.authz.policy.server.Server;
-
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class TestEnterprisePolicyFinderModule extends TestCase
-{
- private static Logger log = Logger.getLogger(TestEnterprisePolicyFinderModule.class);
-
- private PolicyEnforcementPoint enforcer;
- private PolicyProvisioner provisioner;
-
- public void setUp() throws Exception
- {
- Server.bootstrap();
- this.enforcer = (PolicyEnforcementPoint)Server.lookup("/enforcement/localEnforcementPoint");
- this.provisioner = (PolicyProvisioner)Server.lookup("/provisioning/localProvisioner");
- }
-
- public void tearDown() throws Exception
- {
- }
-
- public void testNewPolicyEnforcement() throws Exception
- {
- HttpResource httpResource = new HttpResource();
- httpResource.setUri(new URI("/blah/index.html"));
- httpResource.addParameter("param1", "param1Value");
- httpResource.addParameter("param2", "param2Value");
- httpResource.addAllowed("Admin");
- httpResource.setOperation(new Read());
-
- PolicyMetaData policyMetaData = httpResource.getPolicyMetaData();
- this.provisioner.newPolicy(policyMetaData);
-
-
- //Assert Policy State of the Server
- Policy[] policies = this.provisioner.readAllPolicies();
-
- assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
- log.info("------------------------------------------------------------------------------");
- log.info(policies[0].generateSystemPolicy());
-
- //Send an Enforcement request that should be allowed
- this.enforce(this.createRequest(httpResource, true), true);
-
- //Send an Enforcement request that should be denied
- this.enforce(this.createRequest(httpResource, false), false);
- }
- //----------------------------------------------------------------------------------------------------------------------------------------------------------
- private void enforce(Request request, boolean mustBePermitted) throws Exception
- {
-
- Response response = this.enforcer.checkAccess(request);
-
- assertNotNull(response);
- if(mustBePermitted)
- {
- assertTrue("Access must be granted!!!", response.isAccessGranted());
- }
- else
- {
- assertFalse("Access must be denied!!!", response.isAccessGranted());
- }
-
- log.info("-----------------------------------");
- log.info("Decision="+response.getMessage());
- }
-
- private Request createRequest(HttpResource httpResource, boolean mustBePermitted) throws Exception
- {
- //Create a RequestType
- Request request = new Request();
-
- //Create Subjects
- Roles roles = new Roles();
- roles.addName(mustBePermitted?"Admin":"Anonymous");
- request.addSubject(roles.getSubject());
-
- //Create Resource
- Resource urlResource = httpResource.getResource();
- request.addResource(urlResource);
-
- //Create Action
- request.setAction(new Read().getAction());
-
- return request;
- }
-}
Modified: modules/authorization/trunk/pom.xml
===================================================================
--- modules/authorization/trunk/pom.xml 2009-06-22 22:49:02 UTC (rev 13479)
+++ modules/authorization/trunk/pom.xml 2009-06-23 02:03:19 UTC (rev 13480)
@@ -14,8 +14,10 @@
<module>core-components-api</module>
<module>agent</module>
<module>policy-server</module>
+ <!--
<module>http-profile</module>
- <module>portal-profile</module>
+ <module>portal-profile</module>
+ -->
</modules>
<properties>
14 years, 11 months
JBoss Portal SVN: r13479 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests.
by portal-commits@lists.jboss.org
Author: mposolda(a)redhat.com
Date: 2009-06-22 18:49:02 -0400 (Mon, 22 Jun 2009)
New Revision: 13479
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
Log:
ui-tests - build.xml (refactoring)
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-22 19:38:34 UTC (rev 13478)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-22 22:49:02 UTC (rev 13479)
@@ -155,6 +155,8 @@
<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" />
+ <echo message="Copying portal-bookstore-samples into the ${portal.instance} server" />
+ <copy file="apps/portal-bookstore-samples.war" tofile="${jboss.home}/server/${portal.instance}/deploy/portal-bookstore-samples.war" />
</target>
<target name="clean">
14 years, 11 months
JBoss Portal SVN: r13478 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests: apps and 1 other directory.
by portal-commits@lists.jboss.org
Author: mposolda(a)redhat.com
Date: 2009-06-22 15:38:34 -0400 (Mon, 22 Jun 2009)
New Revision: 13478
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/portal-bookstore-samples.war
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
Log:
Adding portal-bookstore-samples test to the main selenium testsuite.
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/portal-bookstore-samples.war
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/portal-bookstore-samples.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-22 13:36:15 UTC (rev 13477)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-22 19:38:34 UTC (rev 13478)
@@ -37,6 +37,9 @@
<property name="test.cms.suite" value="testng-cms.xml" />
<property name="usecase.suite" value="end2end.xml" />
+ <!-- Default properties for single-test-without-dependencies -->
+ <property name="suite.test.name" value="Ant test" />
+
<path id="jboss.test.classpath">
<pathelement path="${jboss.test.jar}" />
</path>
@@ -125,6 +128,22 @@
</java>
<sleep seconds="20" />
</target>
+
+ <target name="run-src-with-ssl">
+ <echo message="Starting Selenium Remote Control with usage of HTTPS" />
+ <java jar="${selsrv.dir}/selenium-server.jar" fork="true" spawn="true">
+ <arg value="-trustAllSSLCertificates" />
+ <arg value="-multiWindow" />
+ <arg value="-port" />
+ <arg value="44444" />
+ <arg value="-log" />
+ <arg value="selenium.log" />
+ <arg value="-debug" />
+ <arg value="-userExtensions" />
+ <arg value="${selsrv.dir}/user-extensions.js" />
+ </java>
+ <sleep seconds="20" />
+ </target>
<target name="stop-src">
<get taskname="selenium-shutdown" src="http://localhost:44444/selenium-server/driver/?cmd=shutDown" dest="result.txt" ignoreerrors="true" />
@@ -245,10 +264,33 @@
<sysproperty key="output-dir" value="${testng.output.dir}" />
<jvmarg value="-ea" />
</testng>
+
<antcall target="cleanup" />
</target>
+ <target name="single-test-without-dependencies" depends="run-src">
+ <echo message="Runing TestNG" />
+
+ <!--<mkdir dir="test-output" />
+ <mkdir dir="debug" />-->
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}" outputdir="${testng.output.dir}" listeners="org.jboss.portal.test.selenium.JBossSeleniumTestListener" suitename="SeleniumSingleTest" testname="${suite.test.name}" verbose="2" >
+
+ <classfileset dir="${test.build.dir}" includes="${testname}" />
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="screenshot" value="${screenshot}" />
+ <sysproperty key="debug" value="${debug}" />
+ <sysproperty key="workspace" value="${workspace}" />
+ <sysproperty key="userCount" value="${userCount}" />
+ <sysproperty key="html-src" value="${html-src}" />
+ <sysproperty key="output-dir" value="${testng.output.dir}" />
+ <jvmarg value="-ea" />
+ </testng>
+
+ <antcall target="cleanup" />
+
+ </target>
+
<target name="selenium-test" depends="init, compile, run-src, copyApps, create-test-files">
<echo message="Runing TestNG" />
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml 2009-06-22 13:36:15 UTC (rev 13477)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml 2009-06-22 19:38:34 UTC (rev 13478)
@@ -105,6 +105,12 @@
<classes>
<class name="org.jboss.portal.test.selenium.PortalAjaxSamplesTestCase"></class></classes>
</test>
+
+ <test name="org.jboss.portal.test.selenium.PortalBookstoreSampleTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.PortalBookstoreSampleTestCase"></class></classes>
+ </test>
<test name="org.jboss.portal.test.selenium.EndToEndBeaPortlet"
verbose="2" annotations="JDK">
14 years, 11 months