JBoss Portal SVN: r13497 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium: cms and 1 other directory.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-24 11:43:56 -0400 (Wed, 24 Jun 2009)
New Revision: 13497
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/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
Log:
[JBPORTAL-2407] - several new tests
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-24 11:20:46 UTC (rev 13496)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-06-24 15:43:56 UTC (rev 13497)
@@ -583,7 +583,9 @@
* 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.
+ * of window name input. Types XSS string into window name and without
+ * selecting any portlet it presses enter on the input. Final assert is made
+ * - XSS string should not be the value of window name input.
*
* @jira(JBPORTAL-2418)
*/
@@ -603,6 +605,22 @@
Assert.assertFalse(selenium.getValue(INP_WINDOW_NAME).equals(XSS_STR1),
"XSS string found on the page in window name input.");
Assert.assertTrue(selenium.isTextPresent(MSG_NO_PORTLET),"Message about no portlet selected missing or other then expected");
+
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LNK_CONFIGURE_DASHBOARD);
+ waitFor(AJAX_LOAD);
+
+ selectIfNotSelected(SEL_PAGE, "DashTestPage");
+ selenium.type(INP_WINDOW_NAME, XSS_STR1);
+ selenium.keyPress(INP_WINDOW_NAME, "\\13");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.getValue(INP_WINDOW_NAME).equals(XSS_STR1),
+ "XSS string found on the page in window name input after pressing enter on it.");
+ Assert.assertTrue(selenium.isTextPresent(MSG_NO_PORTLET),"Message about no portlet selected missing or other then expected");
}
// http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-24 11:20:46 UTC (rev 13496)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-24 15:43:56 UTC (rev 13497)
@@ -743,7 +743,9 @@
* users.. The test creates 95 users named man0us - man94us. Then it tests
* the paginator of the search functions. It sets count of results to 10,50
* and 100, traverse through paginator and check, whether the amount of
- * returned results is correct.
+ * returned results is correct. The last action is searching for non
+ * existing user. It is asserted that table with usernames is not present on
+ * the screen.
*/
@Test(enabled = true, description = "Altering the number of rows in user search")
public void testSearchUserCount() {
@@ -768,14 +770,12 @@
searchSimple("man", "100");
selenium.waitForPageToLoad(PAGE_LOAD);
- // selenium.setSpeed("60000");
Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 95, "Wrong number of row in user table #4.");
- // selenium.setSpeed("0");
- /*
- * for(int i=0; i< 95; i++){ deleteUser("man"+i+"us",
- * "man"+i+"us"+"@redhatqa.com"); }
- */
+ searchSimple("ubmbobungo", "10");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent(TBL_USERLIST),"Table with users found after searching for non-existing user.");
+
}
/**
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2009-06-24 11:20:46 UTC (rev 13496)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2009-06-24 15:43:56 UTC (rev 13497)
@@ -275,8 +275,8 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent(INP_DIR_NAME));
- Assert.assertTrue(selenium.isElementPresent(INP_DIR_DESC));
+ Assert.assertTrue(selenium.isElementPresent(INP_DIR_NAME),"Directory name is missing or other then expected.");
+ Assert.assertTrue(selenium.isElementPresent(INP_DIR_DESC),"Directory description is missing or other then expected");
Assert.assertEquals("Confirm Directory Creation", selenium.getText("//div[@id='center']/div/h3"));
selenium.type(INP_DIR_NAME, copyCancelDirName);
@@ -295,11 +295,11 @@
selenium.click(INP_DIR_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=" + copyCancelDirName));
+ Assert.assertTrue(selenium.isElementPresent("link=" + copyCancelDirName),"Cancel directory name is missing.");
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isElementPresent("link=" + copyCancelDirName));
+ Assert.assertFalse(selenium.isElementPresent("link=" + copyCancelDirName),"Cancel directory name is missing.");
}
14 years, 11 months
JBoss Portal SVN: r13496 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-24 07:20:46 -0400 (Wed, 24 Jun 2009)
New Revision: 13496
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
Log:
[selenium] - output on screen removed
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2009-06-24 10:54:07 UTC (rev 13495)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2009-06-24 11:20:46 UTC (rev 13496)
@@ -204,7 +204,7 @@
selenium.select(INP_FC_LANGUAGE, "label=Czech");
selenium.click(INP_FC_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
- System.out.println("!"+MSG_VAL_INVALID_FILENAME);
+
Assert.assertTrue(selenium.isTextPresent(MSG_VAL_INVALID_FILENAME), "Input validation for filename is missing.");
selenium.type(INP_FC_FILENAME, "newFile");
14 years, 11 months
JBoss Portal SVN: r13495 - 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-24 06:54:07 -0400 (Wed, 24 Jun 2009)
New Revision: 13495
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
Log:
[selenium] - property changes
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-23 22:41:14 UTC (rev 13494)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-24 10:54:07 UTC (rev 13495)
@@ -14,6 +14,11 @@
cms.file.msg.val.invalid.title=A value below was invalid
cms.file.msg.val.invalid.desc=A value below was invalid
+test.wsrp.msg.cons.add.valid=is not a valid URL
+
+portal.port.ins.msg.pi.prop.update.valid=is an invalid preference name
+portal.port.ins.msg.pi.prop.append.valid=is an invalid preference name
+
samples.ajax.p3.l3=$256.00
samples.ajax.p3.l2=SANTA CRUZ ALLSTAR
samples.ajax.p3.l1=Product ID: 3
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-23 22:41:14 UTC (rev 13494)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-24 10:54:07 UTC (rev 13495)
@@ -356,13 +356,13 @@
portal.port.ins.link.20.page=link=20
portal.port.ins.link.pref.welcomeport=//a[contains(@id,'security-JSPPortletInstance')]
portal.port.ins.table.pref.key=//form[contains(@id,'common-edit-pref-form')]/table
-portal.port.ins.submit.pref.delete=//input[contains(@id,'common-edit-exisiting-form:row_0')]
+portal.port.ins.submit.pref.delete=//input[contains(@id,'common-edit-existing-form:row_0')]
portal.port.ins.link.pref.guestnum=//a[contains(@id,'common-edit-pref-form:pref-link-0')]
portal.port.ins.input.pref.newval=//input[contains(@id,'common-append-form:new_value')]
portal.port.ins.submit.pref.update=//input[contains(@id,'common-append-form:append-button')]
portal.port.ins.submit.pref.save=//input[contains(@id,':save')]
-portal.port.ins.input.pref.update=//input[contains(@id,'common-edit-exisiting-form:update')]
-portal.port.ins.input.pref.append=//input[contains(@id,'common-edit-exisiting-form:pref-input-0')]
+portal.port.ins.input.pref.update=//input[contains(@id,'common-edit-existing-form:update')]
+portal.port.ins.input.pref.append=//input[contains(@id,'common-edit-existing-form:pref-input-0')]
portal.port.ins.submit.pref.cancel=//input[contains(@id,':cancel')]
portal.port.ins.link.curuser.preferences=//a[contains(@id,'instances-form:preference-CurrentUsersPortletInstance')]
portal.port.ins.link.del.exceptport=//a[contains(@id,'instances-form:delete-GoogleMapPortletInstance')]
14 years, 11 months
JBoss Portal SVN: r13494 - in branches/JBoss_Portal_Branch_2_7: faces/src/main/org/jboss/portal/faces/gui and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-23 18:41:14 -0400 (Tue, 23 Jun 2009)
New Revision: 13494
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
Log:
- JBPORTAL-2428: Now properly validates inputs (including WSDL URL that wasn't properly validated by URL constructor due to a Java bug).
- JSFBeanContext now provides renderResponseImmediately method to bypass further processing in case of an error.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-06-23 22:11:58 UTC (rev 13493)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-06-23 22:41:14 UTC (rev 13494)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.admin.ui;
+import org.jboss.portal.faces.gui.JSFBeanContext;
import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
@@ -32,10 +33,9 @@
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.consumer.RegistrationProperty;
-import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -139,6 +139,10 @@
// we're not using modifyIfNeeded here to avoid double equality check, so we need to set modified manually
modified = true;
}
+ else
+ {
+ JSFBeanContext.renderResponseImmediately();
+ }
}
}
else
@@ -527,6 +531,9 @@
private Object modifyIfNeeded(Object oldValue, Object newValue, String target, boolean checkURL)
{
+ // prepend form id to target
+ target = "edit-cons-form:" + target;
+
if (isOldAndNewDifferent(oldValue, newValue))
{
if (checkURL)
@@ -534,13 +541,22 @@
try
{
// check that the new value is a valid URL
- new URL(newValue.toString());
+ new URI(newValue.toString());
}
- catch (MalformedURLException e)
+ catch (URISyntaxException e)
{
beanContext.createTargetedErrorMessage(target, MALFORMED_URL, newValue, e.getLocalizedMessage());
+ JSFBeanContext.renderResponseImmediately();
}
}
+ else
+ {
+ String newStringValue = checkValidity(newValue.toString(), target);
+ if (newStringValue == null)
+ {
+ JSFBeanContext.renderResponseImmediately();
+ }
+ }
oldValue = newValue;
modified = true;
@@ -555,8 +571,7 @@
{
useWSDL = (Boolean)modifyIfNeeded(useWSDL, event.getNewValue(), "wsdl", false);
- // bypass the rest of the life cycle and re-display page
- FacesContext.getCurrentInstance().renderResponse();
+ JSFBeanContext.renderResponseImmediately();
}
// todo: valueChangeListener not needed anymore when events on RegistrationProperties work
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-06-23 22:11:58 UTC (rev 13493)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-06-23 22:41:14 UTC (rev 13494)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.admin.ui;
+import org.jboss.portal.faces.gui.JSFBeanContext;
import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.registration.RegistrationPolicy;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
@@ -31,7 +32,6 @@
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
-import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
@@ -281,8 +281,7 @@
{
setRegistrationRequired((Boolean)event.getNewValue());
- // bypass the rest of the life cycle and re-display page
- FacesContext.getCurrentInstance().renderResponse();
+ JSFBeanContext.renderResponseImmediately();
}
public void selectProperty(ActionEvent event)
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-06-23 22:11:58 UTC (rev 13493)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-06-23 22:41:14 UTC (rev 13494)
@@ -147,4 +147,10 @@
{
return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
}
+
+ /** Bypasses the rest of the life cycle and re-displays page immediately. Useful for error reporting. */
+ public static void renderResponseImmediately()
+ {
+ FacesContext.getCurrentInstance().renderResponse();
+ }
}
14 years, 11 months
JBoss Portal SVN: r13493 - 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 18:11:58 -0400 (Tue, 23 Jun 2009)
New Revision: 13493
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java
Log:
Refactor locator.properties / fix test failures in selenium sso tests.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-23 20:12:21 UTC (rev 13492)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-23 22:11:58 UTC (rev 13493)
@@ -758,7 +758,7 @@
sso.tomcatvalve.ex.login=//input[@value='Login']
sso.tomcatvalve.ex.logout=//input[@value='Logout']
sso.tomcatvalve.ex.logged.user.label=//tr[1]/td[2]/b
-sso.tomcatvalve.ex.logged.user.label=//tr[4]/td[2]/b
+sso.tomcatvalve.ex.logged.role.auth.label=//tr[4]/td[2]/b
sso.tomcatvalve.jmx.title.element=//h1
sso.tomcatvalve.jmx.image=//img[@alt='JBoss']
sso.tomcatvalve.lnk.login=link=Login
@@ -766,4 +766,4 @@
sso.tomcatvalve.lnk.default=link=default
sso.tomcatvalve.lnk.admin=link=Admin
sso.tomcatvalve.lnk.wsrp=link=WSRP
-sso.tomcatvalve.lnk.default=link=Dashboard
+sso.tomcatvalve.lnk.default.dashboard=link=Dashboard
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 20:12:21 UTC (rev 13492)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/TomcatSSOValveTestCase.java 2009-06-23 22:11:58 UTC (rev 13493)
@@ -24,7 +24,7 @@
protected final String EXAMPLE_LOGIN = getLoc(casePfx+"ex.login","//input[@value='Login']");
protected final String EXAMPLE_LOGOUT = getLoc(casePfx+"ex.logout","//input[@value='Logout']");
protected final String EXAMPLE_LOGGED_USER_OUTPUT = getLoc(casePfx+"ex.logged.user.label","//tr[1]/td[2]/b");
- protected final String EXAMPLE_AUTHORIZED_ROLE_OUTPUT = getLoc(casePfx+"ex.logged.user.label","//tr[4]/td[2]/b");
+ protected final String EXAMPLE_AUTHORIZED_ROLE_OUTPUT = getLoc(casePfx+"ex.logged.role.auth.label","//tr[4]/td[2]/b");
protected final String JMX_TITLE_ELEMENT = getLoc(casePfx+"jmx.title.element", "//h1");
protected final String JMX_IMAGE = getLoc(casePfx+"jmx.image", "//img[@alt='JBoss']");
@@ -33,7 +33,7 @@
protected final String LNK_DEFAULT = getLoc(casePfx+"lnk.default","link=default");
protected final String LNK_ADMIN = getLoc(casePfx+"lnk.admin","link=Admin");
protected final String LNK_WSRP = getLoc(casePfx+"lnk.wsrp","link=WSRP");
- protected final String LNK_DASHBOARD = getLoc(casePfx+"lnk.default","link=Dashboard");
+ protected final String LNK_DASHBOARD = getLoc(casePfx+"lnk.default.dashboard","link=Dashboard");
protected final String EXAMPLE_ADMIN_USERNAME = "admin";
protected final String EXAMPLE_ADMIN_PASSWORD = "password";
14 years, 11 months
JBoss Portal SVN: r13492 - in modules/authorization/trunk: agent/src/main/resources and 6 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-06-23 16:12:21 -0400 (Tue, 23 Jun 2009)
New Revision: 13492
Added:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/CompositionContext.java
Removed:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/ComponentRepository.java
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposer.java
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleDeclarationRepository.java
modules/authorization/trunk/agent/src/main/resources/authz-components.xml
modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestConfiguration.java
modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/component/ComponentMarker.java
Modified:
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/PolicyComposer.java
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposition.java
modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/TargetComposition.java
modules/authorization/trunk/agent/src/main/resources/META-INF/jboss-beans.xml
modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestPolicyComposition.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/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
Log:
first pass baseline stability of the developer framework
* need to test it with http-profile and portal-profile built on top of it....fingers crossed...
Deleted: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/ComponentRepository.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/ComponentRepository.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/ComponentRepository.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,64 +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.agent.services;
-
-import java.util.Map;
-
-import org.jboss.security.authz.component.Component;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class ComponentRepository
-{
- private Map<String, Component> registeredComponents;
-
- public ComponentRepository()
- {
-
- }
-
- public void start()
- {
-
- }
-
- public void stop()
- {
-
- }
- //-----------Repository Access related services----------------------------------------------------------------------------------------------------------------------------------------------------------
- public void register(String name, Component component)
- {
- this.registeredComponents.put(name, component);
- }
-
- public Component getComponent(String name)
- {
- return this.registeredComponents.get(name);
- }
-
- public void unregister(String name)
- {
- this.registeredComponents.remove(name);
- }
-}
Added: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/CompositionContext.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/CompositionContext.java (rev 0)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/CompositionContext.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -0,0 +1,92 @@
+/*
+* 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.agent.services;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.security.authz.model.Effect;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class CompositionContext implements Serializable
+{
+ private TargetComposition policyTarget;
+ private Set<RuleComposition> policyRules;
+
+ public CompositionContext()
+ {
+ this.policyRules = new HashSet<RuleComposition>();
+ }
+
+ //------Public API exposed to the developer--------------------------------------------------------------------------------------------------------------------------
+ public void setPolicyTarget(Object policyTarget)
+ {
+ this.policyTarget = new TargetComposition();
+ this.policyTarget.setTargetComponent(policyTarget);
+ }
+
+ public void addPolicyRule(Effect effect, Object target, Object logic)
+ {
+ RuleComposition ruleComposition = new RuleComposition();
+ ruleComposition.setEffect(effect);
+ ruleComposition.setTargetComponent(target);
+ ruleComposition.setLogicComponent(logic);
+
+ this.policyRules.add(ruleComposition);
+ }
+
+ public void addPolicyRule(Effect effect, Object target, Object logic, String condition_expression_type)
+ {
+ RuleComposition ruleComposition = new RuleComposition();
+ ruleComposition.setEffect(effect);
+ ruleComposition.setTargetComponent(target);
+ ruleComposition.setLogicComponent(logic);
+ ruleComposition.setExpressionName(condition_expression_type);
+
+ this.policyRules.add(ruleComposition);
+ }
+
+ public void clearPolicyRule(String ruleDefinition)
+ {
+ for(RuleComposition ruleComposition: this.policyRules)
+ {
+ if(ruleComposition.getType().equals(ruleDefinition))
+ {
+ this.policyRules.remove(ruleComposition);
+ break;
+ }
+ }
+ }
+ //------------internals-----------------------------------------------------------------------------------------------------------------------------------------------
+ TargetComposition getPolicyTarget()
+ {
+ return this.policyTarget;
+ }
+
+ Set<RuleComposition> getPolicyRules()
+ {
+ return this.policyRules;
+ }
+}
Modified: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/PolicyComposer.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/PolicyComposer.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/PolicyComposer.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -21,10 +21,51 @@
*/
package org.jboss.security.authz.agent.services;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.security.authz.model.Target;
+import org.jboss.security.authz.model.Rule;
+import org.jboss.security.authz.model.PolicyMetaData;
+
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
public class PolicyComposer
{
+ public PolicyComposer()
+ {
+
+ }
+ public PolicyMetaData compose(CompositionContext context)
+ {
+ PolicyMetaData policyMetaData = null;
+
+ TargetComposition policyTarget = context.getPolicyTarget();
+ Set<RuleComposition> policyRules = context.getPolicyRules();
+
+ if(policyTarget == null)
+ {
+ throw new IllegalStateException("Policy Target is missing!!");
+ }
+
+ if(policyRules == null || policyRules.isEmpty())
+ {
+ throw new IllegalStateException("Policy Rule(s) are missing!!");
+ }
+
+ Target target = policyTarget.compose();
+ Set<Rule> rules = new HashSet<Rule>();
+ for(RuleComposition composition: policyRules)
+ {
+ rules.addAll(composition.compose());
+ }
+
+ policyMetaData = new PolicyMetaData();
+ policyMetaData.setTarget(target);
+ policyMetaData.setRules(rules);
+
+ return policyMetaData;
+ }
}
Deleted: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposer.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposer.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposer.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,30 +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.agent.services;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class RuleComposer
-{
-
-}
Modified: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposition.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposition.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleComposition.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -39,61 +39,72 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class RuleComposition
+class RuleComposition
{
private static Logger log = Logger.getLogger(RuleComposition.class);
+ private String type;
private Object targetComponent;
private Object logicComponent;
private String expressionName;
private Effect effect;
- public RuleComposition()
+ RuleComposition()
{
}
- public Object getTargetComponent()
+ Object getTargetComponent()
{
return targetComponent;
}
- public void setTargetComponent(Object targetComponent)
+ void setTargetComponent(Object targetComponent)
{
this.targetComponent = targetComponent;
}
- public Object getLogicComponent()
+ Object getLogicComponent()
{
return logicComponent;
}
- public void setLogicComponent(Object logicComponent)
+ void setLogicComponent(Object logicComponent)
{
this.logicComponent = logicComponent;
}
- public Effect getEffect()
+ Effect getEffect()
{
return effect;
}
- public void setEffect(Effect effect)
+ void setEffect(Effect effect)
{
this.effect = effect;
}
- public String getExpressionName()
+ String getExpressionName()
{
return expressionName;
}
- public void setExpressionName(String expressionName)
+ void setExpressionName(String expressionName)
{
this.expressionName = expressionName;
}
+
+ String getType()
+ {
+ return type;
+ }
+
+ void setType(String type)
+ {
+ this.type = type;
+ }
//----------------------------------------------------------------------------------------------------------------------------------------------------------------
- public Set<Rule> compose()
+ Set<Rule> compose()
{
if(this.effect == null)
{
Deleted: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleDeclarationRepository.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleDeclarationRepository.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/RuleDeclarationRepository.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,65 +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.agent.services;
-
-import java.util.Set;
-import java.util.HashSet;
-
-import org.apache.log4j.Logger;
-import org.jboss.security.authz.component.ComponentMarker;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class RuleDeclarationRepository
-{
- private static Logger log = Logger.getLogger(RuleDeclarationRepository.class);
-
- private Set<ComponentMarker> components;
-
- public RuleDeclarationRepository()
- {
- }
-
- public void start()
- {
- this.components = new HashSet<ComponentMarker>();
- log.info("-------------------------------------------------------------------");
- log.info("RuleDeclarationRepository successfully started.....................");
- log.info("-------------------------------------------------------------------");
- }
-
- public void stop()
- {
-
- }
-
- public void register(ComponentMarker component)
- {
- this.components.add(component);
-
- log.debug("--------------------------------------------------------------");
- log.debug(component.getClass()+" was successfully registered.............");
- log.debug("--------------------------------------------------------------");
- }
- //---------------------------------------------------------------------------------------------------------------------------------------------------------------
-}
Modified: modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/TargetComposition.java
===================================================================
--- modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/TargetComposition.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/java/org/jboss/security/authz/agent/services/TargetComposition.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -41,28 +41,28 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public class TargetComposition
+class TargetComposition
{
private static Logger log = Logger.getLogger(TargetComposition.class);
private Object targetComponent;
- public TargetComposition()
+ TargetComposition()
{
}
- public Object getTargetComponent()
+ Object getTargetComponent()
{
return targetComponent;
}
- public void setTargetComponent(Object targetComponent)
+ void setTargetComponent(Object targetComponent)
{
this.targetComponent = targetComponent;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public Target compose()
+ Target compose()
{
if(this.targetComponent == null)
{
@@ -82,7 +82,7 @@
}
}
- public Set<Target> composeImpliedTargets()
+ Set<Target> composeImpliedTargets()
{
try
{
Modified: modules/authorization/trunk/agent/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- modules/authorization/trunk/agent/src/main/resources/META-INF/jboss-beans.xml 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/resources/META-INF/jboss-beans.xml 2009-06-23 20:12:21 UTC (rev 13492)
@@ -3,25 +3,6 @@
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="/agent/RuleDeclarationRepository" class="org.jboss.security.authz.component.RuleDeclarationRepository">
- <incallback method="register"/>
- </bean>
-
- <bean name="/component/URIResource" class="org.jboss.security.authz.components.resource.URIResource">
- </bean>
-
- <bean name="/component/Identity" class="org.jboss.security.authz.components.subject.Identity">
- </bean>
-
- <bean name="/component/Roles" class="org.jboss.security.authz.components.subject.Roles">
- </bean>
-
- <bean name="/component/Read" class="org.jboss.security.authz.components.action.Read">
- </bean>
-
- <bean name="/component/Write" class="org.jboss.security.authz.components.action.Write">
- </bean>
-
- <bean name="/component/Manage" class="org.jboss.security.authz.components.action.Manage">
- </bean>
+ <bean name="/agent/PolicyComposer" class="org.jboss.security.authz.agent.services.PolicyComposer">
+ </bean>
</deployment>
\ No newline at end of file
Deleted: modules/authorization/trunk/agent/src/main/resources/authz-components.xml
===================================================================
--- modules/authorization/trunk/agent/src/main/resources/authz-components.xml 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/main/resources/authz-components.xml 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<components>
- <!--
- TODO: Just for prototyping the Component Contract. Eventually the method of configuration will be POJO components with Annotations
- -->
- <target-component name="uri" category="resource" class="org.jboss.security.authz.components.resource.URIResource">
- <target-uri>uniqueUri</target-uri>
- </target-component>
-
- <target-component name="operation" category="action" class="org.jboss.security.authz.components.action.Operation">
- <target-uri>name</target-uri>
- </target-component>
-
- <target-component name="read" category="action" class="org.jboss.security.authz.components.action.Read">
- <target-uri>name</target-uri>
- </target-component>
-
- <target-component name="write" category="action" class="org.jboss.security.authz.components.action.Write">
- <target-uri>name</target-uri>
- </target-component>
-
- <target-component name="manage" category="action" class="org.jboss.security.authz.components.action.Manage">
- <target-uri>name</target-uri>
- </target-component>
-
- <logic-component name="identity" category="subject" class="org.jboss.security.authz.components.subject.Identity">
- <target-uri>uri</target-uri>
- <logic-data>
- <data>name</data>
- </logic-data>
- </logic-component>
-
- <logic-component name="roles" category="subject" class="org.jboss.security.authz.components.subject.Roles">
- <target-uri></target-uri>
- <logic-data>
- <data>names</data>
- </logic-data>
- <logic-expressions>
- <expression>allowExpression</expression>
- <expression>denyExpression</expression>
- </logic-expressions>
- </logic-component>
-
-
- <!--
- Core Rule Compositions shipped with the framework. These can be re-used and more compositions can be added
- depending upon Application/Profile Requirements
- -->
- <rule-composition name="permitIdentity" outcome="permit">
- <target-component>identity</target-component>
- </rule-composition>
-
- <rule-composition name="denyIdentity" outcome="deny">
- <target-component>identity</target-component>
- </rule-composition>
-
- <rule-composition name="permitRole" outcome="permit">
- <target-component>operation</target-component>
- <logic-component expression="allowExpression">roles</logic-component>
- </rule-composition>
-
- <rule-composition name="denyRole" outcome="deny">
- <target-component>operation</target-component>
- <logic-component expression="denyExpression">roles</logic-component>
- </rule-composition>
-</components>
\ No newline at end of file
Deleted: modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestConfiguration.java
===================================================================
--- modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestConfiguration.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestConfiguration.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,76 +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.agent.services;
-
-import java.io.InputStream;
-
-import junit.framework.TestCase;
-
-import org.apache.log4j.Logger;
-
-import org.jboss.security.authz.tools.GeneralTool;
-import org.jboss.security.authz.agent.Agent;
-import org.jboss.security.authz.agent.services.ComponentRepository;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public class TestConfiguration extends TestCase
-{
- private static Logger log = Logger.getLogger(TestConfiguration.class);
-
- protected void setUp() throws Exception
- {
- Agent.bootstrap();
- }
- //---------------------------------------------------------------------------------------------------------------------------------------------------------------
- public void test() throws Exception
- {
- InputStream is = null;
- try
- {
- is = Thread.currentThread().getContextClassLoader().getResourceAsStream("authz-components.xml");
- String xmlConfig = GeneralTool.readStream(is);
-
- ComponentRepository repository = new ComponentRepository();
- this.parse(xmlConfig);
-
- //Assert
- }
- finally
- {
- if(is != null)
- {
- is.close();
- }
- }
- }
- //------------Configuration related services---------------------------------------------------------------------------------------------------------------------------------------------------------
- private void parse(String xmlConfig)
- {
- log.info("------------------------------------------------------");
- log.info("Parsing-----------------------------------------------");
- log.info(xmlConfig);
- log.info("------------------------------------------------------");
- }
- //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-}
Modified: modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestPolicyComposition.java
===================================================================
--- modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestPolicyComposition.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/agent/src/test/java/org/jboss/security/authz/agent/services/TestPolicyComposition.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -32,17 +32,15 @@
import org.jboss.security.authz.model.Effect;
import org.jboss.security.authz.model.Policy;
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.agent.services.RuleComposition;
-import org.jboss.security.authz.agent.services.TargetComposition;
import org.jboss.security.authz.components.subject.Identity;
import org.jboss.security.authz.components.subject.Roles;
import org.jboss.security.authz.components.action.Read;
import org.jboss.security.authz.components.action.Manage;
import org.jboss.security.authz.components.resource.URIResource;
+import org.jboss.security.authz.agent.Agent;
+
import org.jboss.security.authz.agent.test.MockPolicy;
/**
@@ -52,36 +50,32 @@
{
private static Logger log = Logger.getLogger(TestPolicyComposition.class);
+ private PolicyComposer policyComposer;
+
protected void setUp() throws Exception
{
+ Agent.bootstrap();
+ this.policyComposer = (PolicyComposer)Agent.lookup("/agent/PolicyComposer");
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------
public void testComposePermitIdentity() throws Exception
- {
+ {
+ //Setup the state of Components to be used for Policy Composition
URIResource uriResource = new URIResource();
uriResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
Identity identity = new Identity();
identity.setName("blahUser");
+
+ //Setup the Context for the Composition with these components
+ CompositionContext context = new CompositionContext();
+ context.setPolicyTarget(uriResource);
+ context.addPolicyRule(Effect.PERMIT, identity, null);
- TargetComposition targetComposition = new TargetComposition();
- targetComposition.setTargetComponent(uriResource);
+ PolicyMetaData metadata = this.policyComposer.compose(context);
+ assertNotNull("Target must not be null!!", metadata.getTarget());
+ assertNotNull("Rule must not be null!!", metadata.getRules());
- RuleComposition ruleComposition = new RuleComposition();
- ruleComposition.setTargetComponent(identity);
- ruleComposition.setEffect(Effect.PERMIT);
-
-
- Target policyTarget = targetComposition.compose();
- Set<Rule> policyRule = ruleComposition.compose();
-
- //Assert the State
- assertNotNull("Target must not be null!!", policyTarget);
- assertNotNull("Rule must not be null!!", policyRule);
-
- PolicyMetaData metadata = new PolicyMetaData();
- metadata.setTarget(policyTarget);
- metadata.setRules(policyRule);
Policy policy = new MockPolicy("testComposePermitIdentity", metadata);
log.info("----------------------------------------------------------------");
@@ -89,7 +83,8 @@
}
public void testComposePermitRole() throws Exception
- {
+ {
+ //Setup the state of Components to be used for Policy Composition
Roles roles = new Roles();
Set<String> names = new HashSet<String>();
names.add("admin");
@@ -99,26 +94,15 @@
URIResource uriResource = new URIResource();
uriResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- TargetComposition targetComposition = new TargetComposition();
- targetComposition.setTargetComponent(uriResource);
-
- RuleComposition ruleComposition = new RuleComposition();
- ruleComposition.setEffect(Effect.PERMIT);
- ruleComposition.setLogicComponent(roles);
- ruleComposition.setExpressionName("allowExpression");
- ruleComposition.setTargetComponent(new Read());
-
-
- Target policyTarget = targetComposition.compose();
- Set<Rule> policyRule = ruleComposition.compose();
-
- //Assert the State
- assertNotNull("Target must not be null!!", policyTarget);
- assertNotNull("Rule must not be null!!", policyRule);
-
- PolicyMetaData metadata = new PolicyMetaData();
- metadata.setTarget(policyTarget);
- metadata.setRules(policyRule);
+
+ //Setup the Context for the Composition with these components
+ CompositionContext context = new CompositionContext();
+ context.setPolicyTarget(uriResource);
+ context.addPolicyRule(Effect.PERMIT, new Read(), roles, "allowExpression");
+
+ PolicyMetaData metadata = this.policyComposer.compose(context);
+ assertNotNull("Target must not be null!!", metadata.getTarget());
+ assertNotNull("Rule must not be null!!", metadata.getRules());
Policy policy = new MockPolicy("testComposePermitRole", metadata);
log.info("----------------------------------------------------------------");
@@ -126,7 +110,8 @@
}
public void testImpliedTarget() throws Exception
- {
+ {
+ //Setup the state of Components to be used for Policy Composition
Roles roles = new Roles();
Set<String> names = new HashSet<String>();
names.add("admin");
@@ -136,26 +121,16 @@
URIResource uriResource = new URIResource();
uriResource.setUri(new URI("/portal/admin-tool/modifyLayout"));
- TargetComposition targetComposition = new TargetComposition();
- targetComposition.setTargetComponent(uriResource);
+
+ //Setup the CompositionContext
+ CompositionContext context = new CompositionContext();
+ context.setPolicyTarget(uriResource);
+ context.addPolicyRule(Effect.PERMIT, new Manage(), roles, "allowExpression");
+
- RuleComposition ruleComposition = new RuleComposition();
- ruleComposition.setEffect(Effect.PERMIT);
- ruleComposition.setLogicComponent(roles);
- ruleComposition.setExpressionName("allowExpression");
- ruleComposition.setTargetComponent(new Manage());
-
-
- Target policyTarget = targetComposition.compose();
- Set<Rule> policyRule = ruleComposition.compose();
-
- //Assert the State
- assertNotNull("Target must not be null!!", policyTarget);
- assertNotNull("Rule must not be null!!", policyRule);
-
- PolicyMetaData metadata = new PolicyMetaData();
- metadata.setTarget(policyTarget);
- metadata.setRules(policyRule);
+ PolicyMetaData metadata = this.policyComposer.compose(context);
+ assertNotNull("Target must not be null!!", metadata.getTarget());
+ assertNotNull("Rule must not be null!!", metadata.getRules());
Policy policy = new MockPolicy("testComposePermitRole", metadata);
log.info("----------------------------------------------------------------");
Deleted: modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/component/ComponentMarker.java
===================================================================
--- modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/component/ComponentMarker.java 2009-06-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/common-api/src/main/java/org/jboss/security/authz/component/ComponentMarker.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -1,35 +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.component;
-
-/**
- * Just a marker interface used for Microcontainer callbacks for registration of security components with the Agent Component Repository
- *
- * TODO: need to check with Microcontainer team if callbacks can be received based on Type level Annotations. If so, this marker interface can be completely avoided and
- * kept more elegant. This is more of an elegance issue and not a performance or too much developer pain the ass issue.
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- */
-public interface ComponentMarker
-{
-
-}
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-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/action/Operation.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -21,7 +21,6 @@
*/
package org.jboss.security.authz.components.action;
-import org.jboss.security.authz.component.ComponentMarker;
import org.jboss.security.authz.component.TargetUri;
/**
@@ -29,7 +28,7 @@
*
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*/
-public abstract class Operation implements ComponentMarker
+public abstract class Operation
{
@TargetUri
protected String name;
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-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/resource/URIResource.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -25,7 +25,6 @@
import org.apache.log4j.Logger;
-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;
@@ -41,7 +40,7 @@
type=ComponentType.TARGET,
category=ComponentCategory.RESOURCE
)
-public class URIResource implements ComponentMarker
+public class URIResource
{
private static Logger log = Logger.getLogger(URIResource.class);
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-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Identity.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.security.authz.components.subject;
-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;
@@ -43,7 +42,7 @@
type=ComponentType.LOGIC,
category=ComponentCategory.SUBJECT
)
-public class Identity implements ComponentMarker
+public class Identity
{
/**
* Unique id/name of the Identity
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-23 16:01:40 UTC (rev 13491)
+++ modules/authorization/trunk/core-components-api/src/main/java/org/jboss/security/authz/components/subject/Roles.java 2009-06-23 20:12:21 UTC (rev 13492)
@@ -28,7 +28,6 @@
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;
import org.jboss.security.authz.component.ComponentCategory;
@@ -50,7 +49,7 @@
type=ComponentType.LOGIC,
category=ComponentCategory.SUBJECT
)
-public class Roles implements ComponentMarker
+public class Roles
{
//make it package-level access so that unit tests can test these rules
static final String allowRule =
14 years, 11 months
JBoss Portal SVN: r13491 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-23 12:01:40 -0400 (Tue, 23 Jun 2009)
New Revision: 13491
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
Log:
- Marked test case with the associated JIRA issue.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-06-23 15:59:30 UTC (rev 13490)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-06-23 16:01:40 UTC (rev 13491)
@@ -488,6 +488,7 @@
selenium.click(SUB_PROD_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
+ // @jira JBPORTAL-2414
Assert.assertTrue(selenium.isTextPresent(MSG_PROD_NAME_VALID),"validation error message missing or other than expected.");
selenium.type(INPUT_PROPNAME, "testProp");
14 years, 11 months
JBoss Portal SVN: r13490 - in branches/JBoss_Portal_Branch_2_7: core-admin/src/main/org/jboss/portal/core/admin/ui/actions and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-23 11:59:30 -0400 (Tue, 23 Jun 2009)
New Revision: 13490
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
Log:
- Renamed ManagedBean.checkNameValidity to checkValidity as it's more correct.
- JBPORTAL-2427:
+ PreferenceBean now validates value in setValue
+ inject beanContext in PortletManagerBean and InstanceManagerBean so that it can be made available to PreferenceBean via PreferencesBean
+ added error reporting in editPreferences.xhtml and fixed typo
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -86,7 +86,7 @@
public void setValue(Object value)
{
// it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
- String propertyValue = checkNameValidity(value.toString(), null);
+ String propertyValue = checkValidity(value.toString(), null);
if (propertyValue != null && !inherited)
{
this.value = value.toString();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.instance.InstanceDefinition;
import org.jboss.portal.core.model.instance.NoSuchInstanceException;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -108,6 +109,13 @@
/** . */
private AuthorizationBean auth = new InstanceAuthorizationBean();
+ private transient BeanContext beanContext;
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
// Services accessors
public RoleModule getRoleModule()
@@ -218,7 +226,7 @@
{
try
{
- selectedPrefs = new PreferencesBean(true);
+ selectedPrefs = new PreferencesBean(true, beanContext);
//
PreferencesInfo prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -20,12 +20,14 @@
* 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.portal.core.admin.ui;
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
@@ -124,6 +126,13 @@
/** . */
private transient FederatedPortletInvoker selectedPortletInvoker;
+ private transient BeanContext beanContext;
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
// Wired services
public InstanceContainer getInstanceContainer()
@@ -262,7 +271,7 @@
// If the portlet has preferences info then we display them
if (prefsInfo != null)
{
- selectedPreferences = new PreferencesBean(false);
+ selectedPreferences = new PreferencesBean(false, beanContext);
for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext();)
{
String key = (String)i.next();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -25,8 +25,11 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.gui.BeanContext;
+import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.portlet.info.PreferenceInfo;
+import javax.faces.el.EvaluationException;
import javax.faces.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +38,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PreferenceBean implements Comparable, DynamicBean
+public class PreferenceBean extends ManagedBean implements Comparable, DynamicBean
{
/** . */
@@ -62,13 +65,14 @@
/** . */
private boolean stale;
- public PreferenceBean(PreferenceInfo prefInfo, List<String> value)
+ public PreferenceBean(PreferenceInfo prefInfo, List<String> value, BeanContext beanContext)
{
this.name = prefInfo.getKey();
this.readOnly = Boolean.TRUE.equals(prefInfo.isReadOnly());
this.displayName = prefInfo.getDisplayName();
this.description = prefInfo.getDescription();
this.value = value;
+ setBeanContext(beanContext);
}
public String getName()
@@ -197,16 +201,36 @@
public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
{
+ // if the value is invalid, throw an EvaluationException to prevent upstream processing...
if (propertyName instanceof String)
{
+ String stringValue = (String)value;
String s = (String)propertyName;
+
if (s.startsWith("index_"))
{
int index = Integer.parseInt(s.substring(6));
- this.value.set(index, (String)value);
- stale = true;
- return true;
+ stringValue = checkValidity(stringValue, "common-edit-existing-form:pref-input-" + index);
+
+ if (stringValue != null)
+ {
+ this.value.set(index, stringValue);
+ stale = true;
+ return true;
+ }
+ else
+ {
+ throw new EvaluationException("Invalid preference value: " + value);
+ }
}
+ else
+ {
+ stringValue = checkValidity(stringValue, "common-append-form:new_value");
+ if (stringValue == null)
+ {
+ throw new EvaluationException("Invalid preference value: " + value);
+ }
+ }
}
return false;
}
@@ -216,4 +240,14 @@
PreferenceBean that = (PreferenceBean)o;
return name.compareTo(that.name);
}
+
+ protected String getObjectTypeName()
+ {
+ return "PREFERENCE_TYPE";
+ }
+
+ public boolean isAlreadyExisting(String objectName)
+ {
+ return false; // not used
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.portlet.info.PreferenceInfo;
import java.util.ArrayList;
@@ -43,12 +44,14 @@
/** . */
private boolean mutable;
+ private BeanContext beanContext;
- public PreferencesBean(boolean mutable)
+ public PreferencesBean(boolean mutable, BeanContext beanContext)
{
this.entries = new ArrayList();
this.selectedIndex = -1;
this.mutable = mutable;
+ this.beanContext = beanContext;
}
public boolean isMutable()
@@ -92,7 +95,7 @@
}
//
- addEntry(new PreferenceBean(prefInfo, null));
+ addEntry(new PreferenceBean(prefInfo, null, beanContext));
}
public void addEntry(PreferenceInfo prefInfo, List<String> value)
@@ -103,7 +106,7 @@
}
//
- addEntry(new PreferenceBean(prefInfo, value));
+ addEntry(new PreferenceBean(prefInfo, value, beanContext));
}
private void addEntry(PreferenceBean pref)
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -125,7 +125,7 @@
if (!ParameterValidation.isNullOrEmpty(propertyValue))
{
// it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
- propertyValue = checkNameValidity(propertyValue, null);
+ propertyValue = checkValidity(propertyValue, null);
}
if (propertyValue != null)
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -53,7 +53,7 @@
public void execute()
{
- pageName = checkNameValidity(pageName, messageTarget);
+ pageName = checkValidity(pageName, messageTarget);
if (pageName != null)
{
try
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -84,7 +84,7 @@
public String execute()
{
// Validate instance id
- instanceId = checkNameValidity(instanceId, MESSAGE_TARGET);
+ instanceId = checkValidity(instanceId, MESSAGE_TARGET);
if (instanceId == null)
{
return null;
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -28,8 +28,8 @@
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.core.admin.ui.DisplayNameBean;
import org.jboss.portal.core.model.HasDisplayName;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.faces.gui.ManagedBean;
-import org.jboss.portal.faces.gui.BeanContext;
import java.util.Collection;
import java.util.HashMap;
@@ -109,7 +109,7 @@
boolean directResolved = beanContext.isTargetResolved(DISPLAY_NAME_DIRECT);
boolean inViewResolved = beanContext.isTargetResolved(DISPLAY_NAME_IN_VIEW);
- if(directResolved)
+ if (directResolved)
{
errorMessageTarget = DISPLAY_NAME_DIRECT;
}
@@ -122,7 +122,7 @@
errorMessageTarget = BeanContext.STATUS;
}
- newText = checkNameValidity(newText, errorMessageTarget);
+ newText = checkValidity(newText, errorMessageTarget);
if (newText != null)
{
HasDisplayName hasDisplayName = getTarget();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -104,7 +104,7 @@
{
PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
- portalName = checkNameValidity(portalName, MESSAGE_TARGET);
+ portalName = checkValidity(portalName, MESSAGE_TARGET);
if (portalName != null)
{
Portal portal = portalContainer.createPortal(portalName);
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -97,7 +97,7 @@
String propertyName = null;
if (!ParameterValidation.isNullOrEmpty(otherPropertyName))
{
- propertyName = checkNameValidity(otherPropertyName, "common-edit-prop-form:property");
+ propertyName = checkValidity(otherPropertyName, "common-edit-prop-form:property");
}
else
{
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -93,7 +93,7 @@
return null;
}
- newName = checkNameValidity(newName, MESSAGE_TARGET);
+ newName = checkValidity(newName, MESSAGE_TARGET);
if (newName != null)
{
PortalObject parent = renamedObject.getParent();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -20,6 +20,7 @@
* 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.portal.core.admin.ui.common;
import org.jboss.portal.Mode;
@@ -294,7 +295,7 @@
}
else
{
- windowName = checkNameValidity(windowName, "windowForm:windowName");
+ windowName = checkValidity(windowName, "windowForm:windowName");
if (windowName == null)
{
throw new AbortProcessingException("Duplicate window name!");
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -141,7 +141,7 @@
{
if (isOldAndNewDifferent(oldName, newName))
{
- if (checkNameValidity(newName, "renameForm:newName") != null)
+ if (checkValidity(newName, "renameForm:newName") != null)
{
try
{
@@ -170,7 +170,7 @@
{
String nameForMessages = getObjectNameForMessages();
String target = "create-" + nameForMessages + "-form:" + getAdditionalFormId() + nameForMessages + "Name";
- if (checkNameValidity(getBeanName(), target) != null)
+ if (checkValidity(getBeanName(), target) != null)
{
try
{
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-06-23 15:59:30 UTC (rev 13490)
@@ -340,6 +340,7 @@
PROPERTY_TYPE=property
PORTAL_OBJECT_TYPE=portal object
WINDOW_TYPE=window
+PREFERENCE_TYPE=preference
MAKE_DEFAULT_SUCCESS= ''{0}'' {1} was successfully set as default {1}
DESTROY_SUCCESS=''{0}'' has successfully been destroyed
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-06-23 15:59:30 UTC (rev 13490)
@@ -215,6 +215,11 @@
<property-name>paginationSize</property-name>
<value>20</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<!-- The portlet manager managed bean -->
@@ -246,6 +251,11 @@
<property-name>paginationSize</property-name>
<value>20</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml 2009-06-23 15:59:30 UTC (rev 13490)
@@ -1,3 +1,26 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
<div
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
@@ -5,11 +28,11 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
-<c:choose>
- <c:when test="#{not empty prefs.entries}">
- <h:form id="common-edit-pref-form">
- <table class="full-width datatable">
- <thead class="portlet-section-header" style="text-align:left;">
+ <c:choose>
+ <c:when test="#{not empty prefs.entries}">
+ <h:form id="common-edit-pref-form">
+ <table class="full-width datatable">
+ <thead class="portlet-section-header" style="text-align:left;">
<tr>
<th>#{bundle.COMMON_KEY}</th>
<th>#{bundle.COMMON_NAME}</th>
@@ -18,16 +41,16 @@
<th>#{bundle.COMMON_VALUE}</th>
</c:if>
</tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
<c:forEach items="#{prefs.entries}" var="pref" varStatus="status">
<tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
<td>
<c:choose>
<c:when test="#{prefs.mutable and pref.readOnly == false}">
<h:commandLink id="pref-link-#{status.index}"
- rendered="#{pref.readOnly == false}"
- action="#{pref.select}">#{pref.name}</h:commandLink>
+ rendered="#{pref.readOnly == false}"
+ action="#{pref.select}">#{pref.name}</h:commandLink>
</c:when>
<c:otherwise>#{pref.name}</c:otherwise>
</c:choose>
@@ -36,7 +59,8 @@
<h:outputText value="#{pref.displayName.value}"/>
</td>
<td>
- <h:selectBooleanCheckbox id="pref-check-#{status.index}" disabled="true" value="#{pref.readOnly}"/>
+ <h:selectBooleanCheckbox id="pref-check-#{status.index}" disabled="true"
+ value="#{pref.readOnly}"/>
</td>
<c:if test="#{prefs.mutable}">
<td>
@@ -45,30 +69,32 @@
</c:if>
</tr>
</c:forEach>
- </tbody>
- </table>
- </h:form>
- </c:when>
- <c:otherwise>
- <p>#{bundle.COMMON_NO_DEFINED_PREFERENCES}.</p>
- </c:otherwise>
-</c:choose>
+ </tbody>
+ </table>
+ </h:form>
+ </c:when>
+ <c:otherwise>
+ <p>#{bundle.COMMON_NO_DEFINED_PREFERENCES}.</p>
+ </c:otherwise>
+ </c:choose>
-<c:if test="#{prefs.selectedEntry != null}">
- <h:form id="common-edit-exisiting-form" style="padding: 1em 0 1em 0">
- <fieldset style="border: 1px solid;">
- <legend>#{bundle.COMMON_EDIT_EXISTING_VALUES}</legend>
- <table>
- <tbody>
+ <c:if test="#{prefs.selectedEntry != null}">
+ <h:form id="common-edit-existing-form" style="padding: 1em 0 1em 0">
+ <fieldset style="border: 1px solid;">
+ <legend>#{bundle.COMMON_EDIT_EXISTING_VALUES}</legend>
+ <table>
+ <tbody>
<c:forEach items="#{prefs.selectedEntry.indices}" var="index" varStatus="status">
<tr>
<td>
<h:outputLabel for="row_#{status.index}">
- <h:outputText value="#{bundle.COMMON_VALUE} #{status.index}: " styleClass="portlet-form-field-label"/>
+ <h:outputText value="#{bundle.COMMON_VALUE} #{status.index}: "
+ styleClass="portlet-form-field-label"/>
</h:outputLabel>
</td>
<td>
- <h:inputText id="pref-input-#{status.index}" value="#{prefs.selectedEntry[index]}" styleClass="portlet-form-input-field"/>
+ <h:inputText id="pref-input-#{status.index}" value="#{prefs.selectedEntry[index]}"
+ styleClass="portlet-form-input-field"/>
</td>
<td>
<h:commandButton
@@ -76,6 +102,7 @@
actionListener="#{prefs.selectedEntry.deleteLine}"
value="#{bundle.COMMON_DELETE}"
styleClass="portlet-form-button"/>
+ <h:message for="pref-input-#{status.index}" errorClass="portlet-msg-error"/>
</td>
</tr>
</c:forEach>
@@ -84,23 +111,25 @@
<h:commandButton id="update" value="#{bundle.COMMON_UPDATE}" styleClass="portlet-form-button"/>
</td>
</tr>
- </tbody>
- </table>
- </fieldset>
- </h:form>
+ </tbody>
+ </table>
+ </fieldset>
+ </h:form>
- <h:form id="common-append-form">
- <fieldset style="border: 1px solid;">
- <legend>#{bundle.COMMON_APPEND_VALUE}</legend>
- <h:outputLabel for="new_value">
- <h:outputText value="#{bundle.COMMON_NEW_VALUE}: " styleClass="portlet-form-field-label"/>
- </h:outputLabel>
- <h:inputText id="new_value" value="#{prefs.selectedEntry.line}" styleClass="portlet-form-input-field"/>
- <h:commandButton id="append-button" action="#{prefs.selectedEntry.appendLine}" value="#{bundle.COMMON_APPEND}"
- styleClass="portlet-form-button"/>
- </fieldset>
- </h:form>
+ <h:form id="common-append-form">
+ <fieldset style="border: 1px solid;">
+ <legend>#{bundle.COMMON_APPEND_VALUE}</legend>
+ <h:outputLabel for="new_value">
+ <h:outputText value="#{bundle.COMMON_NEW_VALUE}: " styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
+ <h:inputText id="new_value" value="#{prefs.selectedEntry.line}" styleClass="portlet-form-input-field"/>
+ <h:commandButton id="append-button" action="#{prefs.selectedEntry.appendLine}"
+ value="#{bundle.COMMON_APPEND}"
+ styleClass="portlet-form-button"/>
+ <h:message for="new_value" errorClass="portlet-msg-error"/>
+ </fieldset>
+ </h:form>
-</c:if>
+ </c:if>
</div>
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -20,6 +20,7 @@
* 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.portal.core.identity.ui.actions;
import org.jboss.portal.core.identity.ui.UIRole;
@@ -39,10 +40,10 @@
{
String name = this.uiRole.getName();
String displayName = this.uiRole.getDisplayName();
- name = checkNameValidity(name, "create-role-form:rolename");
+ name = checkValidity(name, "create-role-form:rolename");
// check display name validity for XSS injection but check duplicate separately due to limitation to how ManagedBean works
- displayName = checkNameValidity(displayName, "create-role-form:roledisplayname", displayNameValidator);
+ displayName = checkValidity(displayName, "create-role-form:roledisplayname", displayNameValidator);
if (name != null && displayName != null)
{
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -20,6 +20,7 @@
* 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.portal.core.identity.ui.actions;
import org.jboss.portal.common.text.FastURLDecoder;
@@ -73,7 +74,7 @@
log.error("Couldn't get current role " + roleDisplayName);
}
- roleDisplayName = checkNameValidity(roleDisplayName, "edit-role-link:display-name", displayNameValidator); // display names are unique as well
+ roleDisplayName = checkValidity(roleDisplayName, "edit-role-link:display-name", displayNameValidator); // display names are unique as well
if (roleDisplayName != null)
{
try
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -128,7 +128,7 @@
// need to check that the new id is valid
if (isOldAndNewDifferent(oldId, id))
{
- id = checkNameValidity(id, "edit-cons-form:id");
+ id = checkValidity(id, "edit-cons-form:id");
if (id != null)
{
info.setId(id);
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -173,7 +173,7 @@
public String createConsumer()
{
- selectedId = checkNameValidity(selectedId, MESSAGE_TARGET);
+ selectedId = checkValidity(selectedId, MESSAGE_TARGET);
if (selectedId != null)
{
try
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -148,7 +148,7 @@
public void setRegistrationPolicyClassName(String className)
{
- className = checkNameValidity(className, "producer-form:registrationPolicy");
+ className = checkValidity(className, "producer-form:registrationPolicy");
if (className != null)
{
policyClassName = className;
@@ -176,7 +176,7 @@
public void setValidatorClassName(String className)
{
- className = checkNameValidity(className, "producer-form:validator");
+ className = checkValidity(className, "producer-form:validator");
if (className != null)
{
validatorClassName = className;
Modified: branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-06-23 14:48:15 UTC (rev 13489)
+++ branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-06-23 15:59:30 UTC (rev 13490)
@@ -73,31 +73,31 @@
this.beanContext = beanContext;
}
- public String checkNameValidity(String name, String targetForErrorMessage)
+ public String checkValidity(String value, String targetForErrorMessage)
{
- return checkNameValidity(name, targetForErrorMessage, validator);
+ return checkValidity(value, targetForErrorMessage, validator);
}
- public String checkNameValidity(String name, String targetForErrorMessage, PropertyValidator validator)
+ public String checkValidity(String value, String targetForErrorMessage, PropertyValidator validator)
{
ParameterValidation.throwIllegalArgExceptionIfNull(validator, "PropertyValidator");
String objectTypeName = validator.getObjectTypeName();
- if (ParameterValidation.isNullOrEmpty(name))
+ if (ParameterValidation.isNullOrEmpty(value))
{
- beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), name, getLocalizedType(objectTypeName));
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), value, getLocalizedType(objectTypeName));
return null;
}
else
{
- String original = name;
+ String original = value;
// Trim name
- name = name.trim();
+ value = value.trim();
// we got an invalid name after simple checks, fail!
- name = validator.doSimpleChecks(name);
- if (name == null)
+ value = validator.doSimpleChecks(value);
+ if (value == null)
{
beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), original, getLocalizedType(objectTypeName));
return null;
@@ -105,23 +105,23 @@
// "sanitize" name: if it's invalid, return null and output message
- name = ParameterValidation.sanitizeFromPatternWithHandler(name, validator.getValidationPattern(),
- validator.getValidationErrorHandler(name, targetForErrorMessage));
+ value = ParameterValidation.sanitizeFromPatternWithHandler(value, validator.getValidationPattern(),
+ validator.getValidationErrorHandler(value, targetForErrorMessage));
// we got an invalid name, fail!
- if (name == null)
+ if (value == null)
{
return null;
}
// Check for duplicate
- if (validator.checkForDuplicates() && validator.isAlreadyExisting(name))
+ if (validator.checkForDuplicates() && validator.isAlreadyExisting(value))
{
- getDuplicateErrorMessage(name, targetForErrorMessage, objectTypeName);
+ getDuplicateErrorMessage(value, targetForErrorMessage, objectTypeName);
return null;
}
- return name;
+ return value;
}
}
14 years, 11 months
JBoss Portal SVN: r13489 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests: tools and 1 other directory.
by portal-commits@lists.jboss.org
Author: mposolda(a)redhat.com
Date: 2009-06-23 10:48:15 -0400 (Tue, 23 Jun 2009)
New Revision: 13489
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl
Log:
Refactor extract.pl and adding help. Added properties from PortalBookstoreSampleTestCase and SSO test cases to properties files.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-23 14:48:03 UTC (rev 13488)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-23 14:48:15 UTC (rev 13489)
@@ -36,4 +36,51 @@
ajax.p1.l3=Sale Price: $314.96
ajax.p1.l2=B BY BURTON ALPHA
-ajax.p1.l1=Product ID: 1
\ No newline at end of file
+ajax.p1.l1=Product ID: 1
+
+samples.bookstore.pmode.normal=portlet-mode-normal
+samples.bookstore.pmode.minimized=portlet-mode-minimized
+samples.bookstore.book.1000.title=Foundation Flash Cartoon Animation
+samples.bookstore.book.1000.author=Tim Jones
+samples.bookstore.book.1000.img=animation.jpg
+samples.bookstore.book.1001.title=Head First Design Patterns
+samples.bookstore.book.1001.author=Elisabeth Freeman
+samples.bookstore.book.1001.img=patterns.jpg
+samples.bookstore.book.1004.title=Java Servlet and JSP Cookbook
+samples.bookstore.book.1004.author=Bruce Perry
+samples.bookstore.book.1004.img=servlets.jpg
+samples.bookstore.book.1005.title=Mommywood
+samples.bookstore.book.1005.author=Tori Spelling
+samples.bookstore.book.1005.img=mommywood.jpg
+samples.bookstore.book.1007.title=The Picture of Dorian Gray
+samples.bookstore.book.1007.author=Oscar Wilde
+samples.bookstore.book.1007.img=dorian.jpg
+samples.bookstore.catalog.title=Book Catalog Portlet
+samples.bookstore.catalog.choose=Please choose from our selections:
+samples.bookstore.showcart.header.card.empty=Your cart is empty.
+samples.bookstore.showcart.header.card.pref=Your shopping cart contains
+samples.bookstore.showcart.header.card.suf=\ items.
+samples.bookstore.receipt.success=Thank you for purchasing your books from us
+samples.bookstore.receipt.failure=Your order could not be completed due to insufficient inventory.
+samples.bookstore.receipt.failure.mess=Not enough books with title: Foundation Flash Cartoon Animation in inventory.
+
+sso.cas.cas.invalid.auth=The credentials you provided cannot be determined to be authentic.
+sso.cas.cas.login.mess=Enter your JA-SIG NetID and Password.
+sso.cas.cas.logout.succ=Logout successful
+sso.cas.logged.in.mess=Logged in as:
+sso.cas.forbidden.mess=HTTP Status 403 -
+
+sso.josso.josso.invalid.auth=Invalid Authentication Information
+sso.josso.logged.in.mess=Logged in as:
+sso.josso.forbidden.mess=HTTP Status 403 -
+sso.josso.samples.ses.no=No session
+sso.josso.samples.ses.id=Session id
+
+sso.tomcatvalve.example.login.form=Login form
+sso.tomcatvalve.example.title.output=Tomcat SSO valve example servlet
+sso.tomcatvalve.logged.in.mess=Logged in as:
+sso.tomcatvalve.jmx.agnview=JMX Agent View
+sso.tomcatvalve.forbidden.mess=HTTP Status 403 -
+
+
+
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-23 14:48:03 UTC (rev 13488)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-23 14:48:15 UTC (rev 13489)
@@ -684,4 +684,86 @@
samples.ajax.url.div2=//html/body/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/table/tbody/tr[2]/td[2]/div/div/table
samples.ajax.url.lnk2.blue=
samples.ajax.url.lnk2.red=//div[contains(@id,'expander')]/div[2]/div[2]/div/div[2]/div/div/table/tbody/tr[2]/td[2]/div/div/a[2]
-samples.ajax.url.lnk2.white=
\ No newline at end of file
+samples.ajax.url.lnk2.white=
+
+samples.bookstore.adr=/portal/portal/default/Bookstore+sample
+samples.bookstore.bookstore.lnk.start=link=Start Shopping
+samples.bookstore.bookstore.lnk.detail=link=Java Servlet and JSP Cookbook
+samples.bookstore.catalog.icon=//div[@id='regionA']/div[2]/table/tbody/tr[1]/td[2]/div[2]/span[1]/a@class
+samples.bookstore.catalog.tr.pref=//tr[@id='BookCatalogPortlet_
+samples.bookstore.catalog.tr.suf.detail=']/td[1]/a/strong
+samples.bookstore.catalog.tr.suf.add=']/td[4]/p/strong/a
+samples.bookstore.catalog.tr.suf.count=']/td[3]
+samples.bookstore.detail.image.pref=//img[@alt='
+samples.bookstore.detail.image.suf=']
+samples.bookstore.detail.bktitle=bookDetailPortlet_title
+samples.bookstore.detail.bkauthor=bookDetailPortlet_author
+samples.bookstore.detail.lnk.add=BookDetailPortlet_AddBookLink
+samples.bookstore.showcart.lnk.clear=link=Clear Cart
+samples.bookstore.showcart.header=BookShowCartPortlet_header
+samples.bookstore.showcart.table=BookShowCartPortlet_cardTable
+samples.bookstore.showcart.table.tr.pref=//tr[@id='BookShowCartPortlet_cardTable_
+samples.bookstore.showcart.table.tr.count.suf=']/td[1]
+samples.bookstore.showcart.table.tr.title.suf=']/td[2]/strong/a
+samples.bookstore.showcart.table.tr.remove.suf=']/td[4]/strong/a
+samples.bookstore.cashier.amount=BookCashierPortlet_amount
+samples.bookstore.cashier.inp.name=cardname
+samples.bookstore.cashier.inp.num=cardnum
+samples.bookstore.cashier.submit=cashierSubmit
+samples.bookstore.receipt.header=BookReceiptPortlet_header
+
+sso.cas.adr.portal=/portal
+sso.cas.adr.portal.admin=/portal/auth/portal/admin
+sso.cas.adr.portal.default=/portal/auth/portal/default
+sso.cas.lnk.login=link=Login
+sso.cas.lnk.admin=link=Admin
+sso.cas.lnk.weather=link=Weather
+sso.cas.lnk.cp.dashboard=link=Copy to my dashboard
+sso.cas.lnk.conf.dashboard=link=Configure dashboard
+sso.cas.lnk.dashboard=link=Dashboard
+sso.cas.lnk.logout=link=Logout
+sso.cas.forbidden.element=//h1
+sso.cas.cas.input.username=username
+sso.cas.cas.input.password=password
+sso.cas.cas.submit.login=//input[@value='LOGIN']
+sso.cas.cas.image=//img[@alt='Central Authentication Service']
+
+sso.josso.adr.portal=/portal
+sso.josso.adr.portal.admin=/portal/auth/portal/admin
+sso.josso.adr.portal.default=/portal/auth/portal/default
+sso.josso.adr.portal.test.session=/portal/auth/portal/default/Test/Session+test
+sso.josso.lnk.login=link=Login
+sso.josso.lnk.admin=link=Admin
+sso.josso.lnk.weather=link=Weather
+sso.josso.lnk.cp.dashboard=link=Copy to my dashboard
+sso.josso.lnk.conf.dashboard=link=Configure dashboard
+sso.josso.lnk.dashboard=link=Dashboard
+sso.josso.lnk.logout=link=Logout
+sso.josso.forbidden.element=//h1
+sso.josso.josso.input.username=josso_username
+sso.josso.josso.input.password=josso_password
+sso.josso.josso.submit.login=//input[@value='Login']
+sso.josso.josso.image=//img[@alt='Java Open Single SignOn']
+sso.josso.cms.file.tbl.cms.file=//div[@id='center']/div/div/div[3]/table
+sso.josso.samples.ses.sub.pscope=portlet
+sso.josso.samples.ses.inp.val=value
+sso.josso.samples.ses.inp.nam=name
+
+sso.tomcatvalve.adr.portal=/portal
+sso.tomcatvalve.adr.example=/TomcatSSOValveExampleApp
+sso.tomcatvalve.adr.jmx=/jmx-console/
+sso.tomcatvalve.ex.title=//h1
+sso.tomcatvalve.ex.inp.username=j_username
+sso.tomcatvalve.ex.inp.password=j_password
+sso.tomcatvalve.ex.login=//input[@value='Login']
+sso.tomcatvalve.ex.logout=//input[@value='Logout']
+sso.tomcatvalve.ex.logged.user.label=//tr[1]/td[2]/b
+sso.tomcatvalve.ex.logged.user.label=//tr[4]/td[2]/b
+sso.tomcatvalve.jmx.title.element=//h1
+sso.tomcatvalve.jmx.image=//img[@alt='JBoss']
+sso.tomcatvalve.lnk.login=link=Login
+sso.tomcatvalve.lnk.logout=link=Logout
+sso.tomcatvalve.lnk.default=link=default
+sso.tomcatvalve.lnk.admin=link=Admin
+sso.tomcatvalve.lnk.wsrp=link=WSRP
+sso.tomcatvalve.lnk.default=link=Dashboard
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 14:48:03 UTC (rev 13488)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/tools/extract.pl 2009-06-23 14:48:15 UTC (rev 13489)
@@ -1,5 +1,21 @@
#!/usr/bin/perl -w
+if ($#ARGV != 1 ) {
+ print "\n\nUsage: extract.pl OPTION FILE.\n\nScript is used to extract properties from Java source files. Example of one input and output line: \n";
+ print "INPUT: private final String SHOWCART_PORTLET_TABLE_TR_PREFIX = getLoc(casePfx+\"showcart.table.tr.pref\", \"//tr[\@id='BookShowCartPortlet_cardTable_\");\n";
+ print "OUTPUT: samples.bookstore.showcart.table.tr.pref=//tr[\@id='BookShowCartPortlet_cardTable_\n";
+ print "\n\n";
+ print "OPTION - one of these:\n";
+ print " l - Extract properties from calling of method getLoc\n";
+ print " m - Extract properties from calling of method getMess\n";
+ print "\n";
+ print "FILE - path to file. Something like: ../src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java\n\n";
+ print "EXAMPLE OF USAGE (from directory ui-tests): \n";
+ print "tools/extract.pl l src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java\n";
+ print "tools/extract.pl m src/org/jboss/portal/test/selenium/PortalBookstoreSampleTestCase.java\n\n";
+ exit;
+}
+
$mode = shift;
$file = shift;
@@ -23,9 +39,9 @@
$pfx = $1;
}
- if ( $_ =~ /^.*String\W*(\w+)\W=\W$fun*.*\"(.*)\"\W*\)\W*;\W*$/ ) {
- $value= $2;
- $name =lc($1);
+ if ( $_ =~ /^.*String\W*(.*)\W=\W$fun*.*\"(.*)\".*\"(.*)\"\W*\)\W*;\W*$/ ) {
+ $value= $3;
+ $name =lc($2);
$name =~ s/_/./g;
print $pfx.$name."=".$value."\n";
14 years, 11 months
JBoss Portal SVN: r13488 - 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:48:03 -0400 (Tue, 23 Jun 2009)
New Revision: 13488
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
[JBPORTAL-2418] - selenium; one more assert
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 14:45:50 UTC (rev 13487)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-06-23 14:48:03 UTC (rev 13488)
@@ -13,9 +13,12 @@
@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_NO_PORTLET = getMess(casePfx
+ + "msg.no.portlet", "You must select a content type!");
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
@@ -599,6 +602,7 @@
Assert.assertFalse(selenium.getValue(INP_WINDOW_NAME).equals(XSS_STR1),
"XSS string found on the page in window name input.");
+ Assert.assertTrue(selenium.isTextPresent(MSG_NO_PORTLET),"Message about no portlet selected missing or other then expected");
}
// http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
14 years, 11 months