Author: sohil.shah(a)jboss.com
Date: 2010-06-05 10:58:25 -0400 (Sat, 05 Jun 2010)
New Revision: 1119
Added:
authz/gatein/authz-plugin/trunk/service/
authz/gatein/authz-plugin/trunk/service/pom.xml
authz/gatein/authz-plugin/trunk/service/src/
authz/gatein/authz-plugin/trunk/service/src/main/
authz/gatein/authz-plugin/trunk/service/src/main/java/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/PolicyServerComponent.java
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/decision/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/decision/PolicyDecisionPointComponent.java
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/event/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/event/LocalEventBusComponent.java
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/plugin/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/plugin/DroolsRuleManagerComponent.java
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/provisioning/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/provisioning/RelationalDBPolicyStoreComponent.java
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/tools/
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/tools/HibernateServiceComponent.java
authz/gatein/authz-plugin/trunk/service/src/test/
authz/gatein/authz-plugin/trunk/service/src/test/java/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/ContainerBuilder.java
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/MyComponent.java
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/TestKernelStartup.java
authz/gatein/authz-plugin/trunk/service/src/test/resources/
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/gatein-authz-configuration.xml
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/portal/
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/portal/gatein-authz-configuration.xml
authz/gatein/authz-plugin/trunk/service/src/test/resources/hibernate.cfg.xml
authz/gatein/authz-plugin/trunk/service/src/test/resources/log4j.properties
Modified:
authz/gatein/authz-plugin/trunk/.classpath
authz/gatein/authz-plugin/trunk/pom.xml
Log:
refactoring
Modified: authz/gatein/authz-plugin/trunk/.classpath
===================================================================
--- authz/gatein/authz-plugin/trunk/.classpath 2010-06-05 14:39:38 UTC (rev 1118)
+++ authz/gatein/authz-plugin/trunk/.classpath 2010-06-05 14:58:25 UTC (rev 1119)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="core/src/main/java"/>
- <classpathentry kind="src" path="core/src/test/java"/>
+ <classpathentry kind="src" path="service/src/main/java"/>
+ <classpathentry kind="src" path="service/src/test/java"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con"
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
Modified: authz/gatein/authz-plugin/trunk/pom.xml
===================================================================
--- authz/gatein/authz-plugin/trunk/pom.xml 2010-06-05 14:39:38 UTC (rev 1118)
+++ authz/gatein/authz-plugin/trunk/pom.xml 2010-06-05 14:58:25 UTC (rev 1119)
@@ -9,7 +9,7 @@
<description>Authz Plugin for GateIn Portal</description>
<modules>
- <module>core</module>
+ <module>service</module>
</modules>
<properties>
Added: authz/gatein/authz-plugin/trunk/service/pom.xml
===================================================================
--- authz/gatein/authz-plugin/trunk/service/pom.xml (rev 0)
+++ authz/gatein/authz-plugin/trunk/service/pom.xml 2010-06-05 14:58:25 UTC (rev 1119)
@@ -0,0 +1,87 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.gatein.authz</groupId>
+ <artifactId>gatein-authz-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.jboss.gatein.authz.core</groupId>
+ <artifactId>service</artifactId>
+ <name>service</name>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.cache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.command</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>picocontainer</groupId>
+ <artifactId>picocontainer</artifactId>
+ </dependency>
+
+ <!-- authz -->
+ <dependency>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>policy-server</artifactId>
+ </dependency>
+
+ <!-- Hibernate Dependency -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+
+ <!-- Drools -->
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/PolicyServerComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/PolicyServerComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/PolicyServerComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.PolicyServer;
+
+import org.jboss.gatein.authz.core.server.decision.PolicyDecisionPointComponent;
+import org.jboss.gatein.authz.core.server.event.LocalEventBusComponent;
+import org.jboss.gatein.authz.core.server.plugin.DroolsRuleManagerComponent;
+import org.jboss.gatein.authz.core.server.provisioning.RelationalDBPolicyStoreComponent;
+import org.jboss.gatein.authz.core.server.tools.HibernateServiceComponent;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PolicyServerComponent implements Startable
+{
+ private final InitParams params;
+ private PolicyServer policyServer;
+
+ public PolicyServerComponent(InitParams params,PolicyDecisionPointComponent
pdpComponent,
+ LocalEventBusComponent eventBusComponent,
+ DroolsRuleManagerComponent ruleManagerComponent,
+ RelationalDBPolicyStoreComponent storageComponent,
+ HibernateServiceComponent hibernateServiceComponent)
+ {
+ this.params = params;
+
+ this.policyServer = new PolicyServer();
+
+ this.policyServer.setPolicyDecisionPoint(pdpComponent.getPDP());
+ this.policyServer.setEventBus(eventBusComponent.getEventBus());
+ this.policyServer.setRuleManager(ruleManagerComponent.getDroolsRuleManager());
+ this.policyServer.setPolicyStore(storageComponent.getRelationalDBPolicyStore());
+ this.policyServer.setHibernateService(hibernateServiceComponent.getHibernateService());
+ }
+
+ @Override
+ public void start()
+ {
+ this.policyServer.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.policyServer.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public PolicyServer getPolicyServer()
+ {
+ return this.policyServer;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/decision/PolicyDecisionPointComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/decision/PolicyDecisionPointComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/decision/PolicyDecisionPointComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server.decision;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.decision.PolicyDecisionPoint;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PolicyDecisionPointComponent implements Startable
+{
+ private final InitParams params;
+ private PolicyDecisionPoint pdp;
+
+ public PolicyDecisionPointComponent(InitParams params)
+ {
+ this.params = params;
+ this.pdp = new PolicyDecisionPoint();
+ this.pdp.setDebug(Boolean.parseBoolean(this.params.getValueParam("debug").getValue()));
+ }
+
+ @Override
+ public void start()
+ {
+ this.pdp.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.pdp.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public PolicyDecisionPoint getPDP()
+ {
+ return this.pdp;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/event/LocalEventBusComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/event/LocalEventBusComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/event/LocalEventBusComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server.event;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.event.LocalEventBus;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class LocalEventBusComponent implements Startable
+{
+ private final InitParams params;
+ private LocalEventBus eventBus;
+
+ public LocalEventBusComponent(InitParams params)
+ {
+ this.params = params;
+ this.eventBus = new LocalEventBus();
+ }
+
+ @Override
+ public void start()
+ {
+ this.eventBus.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.eventBus.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public LocalEventBus getEventBus()
+ {
+ return this.eventBus;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/plugin/DroolsRuleManagerComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/plugin/DroolsRuleManagerComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/plugin/DroolsRuleManagerComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server.plugin;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.plugin.DroolsRuleManager;
+import org.jboss.gatein.authz.core.server.tools.HibernateServiceComponent;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class DroolsRuleManagerComponent implements Startable
+{
+ private final InitParams params;
+ private DroolsRuleManager droolsRuleManager;
+
+ public DroolsRuleManagerComponent(InitParams params,HibernateServiceComponent
hibernateServiceComponent)
+ {
+ this.params = params;
+ this.droolsRuleManager = new DroolsRuleManager();
+ this.droolsRuleManager.setHibernateService(hibernateServiceComponent.getHibernateService());
+ }
+
+ @Override
+ public void start()
+ {
+ this.droolsRuleManager.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.droolsRuleManager.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public DroolsRuleManager getDroolsRuleManager()
+ {
+ return this.droolsRuleManager;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/provisioning/RelationalDBPolicyStoreComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/provisioning/RelationalDBPolicyStoreComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/provisioning/RelationalDBPolicyStoreComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server.provisioning;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.provisioning.RelationalDBPolicyStore;
+import org.jboss.gatein.authz.core.server.tools.HibernateServiceComponent;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class RelationalDBPolicyStoreComponent implements Startable
+{
+ private final InitParams params;
+ private RelationalDBPolicyStore relationDBPolicyStore;
+
+ public RelationalDBPolicyStoreComponent(InitParams params,HibernateServiceComponent
hibernateServiceComponent)
+ {
+ this.params = params;
+ this.relationDBPolicyStore = new RelationalDBPolicyStore();
+ this.relationDBPolicyStore.setHibernateService(hibernateServiceComponent.getHibernateService());
+ }
+
+ @Override
+ public void start()
+ {
+ this.relationDBPolicyStore.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.relationDBPolicyStore.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public RelationalDBPolicyStore getRelationalDBPolicyStore()
+ {
+ return this.relationDBPolicyStore;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/tools/HibernateServiceComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/tools/HibernateServiceComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/main/java/org/jboss/gatein/authz/core/server/tools/HibernateServiceComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core.server.tools;
+
+import org.exoplatform.container.xml.InitParams;
+import org.picocontainer.Startable;
+
+import org.jboss.security.authz.policy.server.tools.HibernateService;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class HibernateServiceComponent implements Startable
+{
+ private final InitParams params;
+ private HibernateService hibernateService;
+
+ public HibernateServiceComponent(InitParams params)
+ {
+ this.params = params;
+ this.hibernateService = new HibernateService();
+ }
+
+ @Override
+ public void start()
+ {
+ this.hibernateService.start();
+ }
+
+ @Override
+ public void stop()
+ {
+ this.hibernateService.stop();
+ }
+
+ public String getName()
+ {
+ return this.params.getValueParam("name").getValue();
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ public HibernateService getHibernateService()
+ {
+ return this.hibernateService;
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/ContainerBuilder.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/ContainerBuilder.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/ContainerBuilder.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.gatein.authz.core;
+
+import junit.framework.AssertionFailedError;
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Tools;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.RootContainer;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <p>An helper for building a root container and a portal container. I have done
several attempt to make easily
+ * and safe root/portal container boot for unit test. This one is my best attempt so
far.</p>
+ *
+ * <p>Note that the portal container are booted in the order they are declared
first.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class ContainerBuilder
+{
+
+ /** A hack used during the boot of a portal container. */
+ private final ThreadLocal<String> bootedPortalName = new
ThreadLocal<String>();
+
+ /** . */
+ private ClassLoader loader;
+
+ /** . */
+ private List<URL> configURLs;
+
+ /** . */
+ private LinkedHashMap<String, List<URL>> portalConfigURLs;
+
+ /** . */
+ private Set<String> profiles;
+
+ public ContainerBuilder()
+ {
+ this.loader = Thread.currentThread().getContextClassLoader();
+ this.configURLs = new ArrayList<URL>();
+ this.portalConfigURLs = new LinkedHashMap<String, List<URL>>();
+ }
+
+ public ContainerBuilder withRoot(String configPath)
+ {
+ configURLs.addAll(urls(configPath));
+ return this;
+ }
+
+ public ContainerBuilder withRoot(URL configURL)
+ {
+ configURLs.add(configURL);
+ return this;
+ }
+
+ public ContainerBuilder withPortal(String configPath)
+ {
+ return withPortal("portal", configPath);
+ }
+
+ public ContainerBuilder withPortal(String portalName, String configPath)
+ {
+ for (URL configURL : urls(configPath))
+ {
+ withPortal(portalName, configURL);
+ }
+ return this;
+ }
+
+ public ContainerBuilder withPortal(URL configURL)
+ {
+ return withPortal("portal", configURL);
+ }
+
+ public ContainerBuilder withPortal(String portalName, URL configURL)
+ {
+ List<URL> urls = portalConfigURLs.get(portalName);
+ if (urls == null)
+ {
+ urls = new ArrayList<URL>();
+ portalConfigURLs.put(portalName, urls);
+ }
+ urls.add(configURL);
+ return this;
+ }
+
+ public ContainerBuilder withLoader(ClassLoader loader)
+ {
+ this.loader = loader;
+ return this;
+ }
+
+
+ private List<URL> urls(String path)
+ {
+ try
+ {
+ return Collections.list(loader.getResources(path));
+ }
+ catch (IOException e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+ }
+
+ public RootContainer build()
+ {
+ try
+ {
+ return _build();
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+ }
+
+ private RootContainer _build() throws Exception
+ {
+ //
+ if (configURLs.size() == 0)
+ {
+ throw new IllegalStateException("Must provide at least one URL for building
the root container");
+ }
+
+ // Must clear the top container first otherwise it's not going to work well
+ // it's a big ugly but I don't want to change anything in the
ExoContainerContext class for now
+ // and this is for unit testing
+ Field topContainerField =
ExoContainerContext.class.getDeclaredField("topContainer");
+ topContainerField.setAccessible(true);
+ topContainerField.set(null, null);
+
+ // Same remark than above
+ Field singletonField =
RootContainer.class.getDeclaredField("singleton_");
+ singletonField.setAccessible(true);
+ singletonField.set(null, null);
+
+ // Setup profiles
+ if (profiles == null)
+ {
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "");
+ }
+ else
+ {
+ StringBuilder builder = new StringBuilder();
+ for (Iterator<String> i = profiles.iterator();i.hasNext();)
+ {
+ builder.append(i.next());
+ if (i.hasNext())
+ {
+ builder.append(',');
+ }
+ }
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES,
builder.toString());
+ }
+
+ //
+ ClassLoader rootCL = new ClassLoader(loader)
+ {
+ @Override
+ public Enumeration<URL> getResources(String name) throws IOException
+ {
+ if ("conf/configuration.xml".equals(name))
+ {
+ return Collections.enumeration(configURLs);
+ }
+ else if ("conf/portal/configuration.xml".equals(name))
+ {
+ String portalName = bootedPortalName.get();
+ return Collections.enumeration(portalConfigURLs.get(portalName));
+ }
+ else if ("conf/portal/test-configuration.xml".equals(name))
+ {
+ return Collections.enumeration(Collections.<URL>emptyList());
+ }
+ else
+ {
+ return super.getResources(name);
+ }
+ }
+ };
+
+ //
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+
+ // Boot root container
+ RootContainer root;
+ try
+ {
+ Thread.currentThread().setContextClassLoader(rootCL);
+
+ //
+ root = RootContainer.getInstance();
+
+ //
+ for (String portalName : portalConfigURLs.keySet())
+ {
+ try
+ {
+ bootedPortalName.set(portalName);
+ root.getPortalContainer(portalName);
+ }
+ finally
+ {
+ bootedPortalName.set(null);
+ }
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+
+ //
+ return root;
+ }
+
+ public static RootContainer bootstrap(URL configurationURL, String... profiles)
+ {
+ ContainerBuilder builder = new ContainerBuilder();
+ builder.withRoot(configurationURL);
+ return builder.build();
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/MyComponent.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/MyComponent.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/MyComponent.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core;
+
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MyComponent
+{
+ private final InitParams params;
+
+ public MyComponent(InitParams params)
+ {
+ this.params = params;
+ }
+
+ public String getValue(String name)
+ {
+ final ValueParam vp = params.getValueParam(name);
+ return vp == null ? null : vp.getValue();
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/TestKernelStartup.java
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/TestKernelStartup.java
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/java/org/jboss/gatein/authz/core/TestKernelStartup.java 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, 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.gatein.authz.core;
+
+import java.net.URL;
+
+import org.exoplatform.container.PortalContainer;
+import org.jboss.gatein.authz.core.server.event.LocalEventBusComponent;
+import org.jboss.security.authz.policy.server.event.LocalEventBus;
+import org.jboss.gatein.authz.core.server.tools.HibernateServiceComponent;
+import org.jboss.security.authz.policy.server.tools.HibernateService;
+import org.jboss.gatein.authz.core.server.provisioning.RelationalDBPolicyStoreComponent;
+import org.jboss.security.authz.policy.server.provisioning.RelationalDBPolicyStore;
+import org.jboss.gatein.authz.core.server.plugin.DroolsRuleManagerComponent;
+import org.jboss.security.authz.policy.server.plugin.DroolsRuleManager;
+import org.jboss.gatein.authz.core.server.decision.PolicyDecisionPointComponent;
+import org.jboss.security.authz.policy.server.decision.PolicyDecisionPoint;
+import org.jboss.gatein.authz.core.server.PolicyServerComponent;
+import org.jboss.security.authz.policy.server.PolicyServer;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestKernelStartup extends TestCase
+{
+ public void testStartup() throws Exception
+ {
+ URL rootURL =
getClass().getResource("/conf/gatein-authz-configuration.xml");
+ URL portalURL =
getClass().getResource("/conf/portal/gatein-authz-configuration.xml");
+ new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
+
+ PortalContainer portal = PortalContainer.getInstance();
+
+ //Integrating the EventBus service
+ LocalEventBusComponent eventBusComponent =
(LocalEventBusComponent)portal.getComponentInstanceOfType(LocalEventBusComponent.class);
+ assertNotNull(eventBusComponent);
+ LocalEventBus eventBus = eventBusComponent.getEventBus();
+ assertNotNull(eventBus);
+ assertEquals(eventBusComponent.getName(),"/policy-server/EventBus");
+
+ //Integrating the Hibernate Service
+ HibernateServiceComponent hibernateServiceComponent =
(HibernateServiceComponent)portal.getComponentInstanceOfType(
+ HibernateServiceComponent.class);
+ assertNotNull(hibernateServiceComponent);
+ HibernateService hibernateService = hibernateServiceComponent.getHibernateService();
+ assertNotNull(hibernateService);
+ assertEquals(hibernateServiceComponent.getName(),"/policy-server/HibernateService");
+
+ //Integrating the RelationalDBPolicy Store
+ RelationalDBPolicyStoreComponent dbComponent =
(RelationalDBPolicyStoreComponent)portal.getComponentInstanceOfType(
+ RelationalDBPolicyStoreComponent.class);
+ assertNotNull(dbComponent);
+ RelationalDBPolicyStore store = dbComponent.getRelationalDBPolicyStore();
+ assertNotNull(store);
+ assertEquals(dbComponent.getName(),"/policy-server/PolicyStore");
+
+ //Integrating DroolsRuleManager
+ DroolsRuleManagerComponent rmComponent =
(DroolsRuleManagerComponent)portal.getComponentInstanceOfType(
+ DroolsRuleManagerComponent.class);
+ assertNotNull(rmComponent);
+ DroolsRuleManager ruleManager = rmComponent.getDroolsRuleManager();
+ assertNotNull(ruleManager);
+ assertEquals(rmComponent.getName(),"/policy-server/DroolsRuleManager");
+
+ //Integrating Policy Decision Point
+ PolicyDecisionPointComponent pdpComponent =
(PolicyDecisionPointComponent)portal.getComponentInstanceOfType(PolicyDecisionPointComponent.class);
+ assertNotNull(pdpComponent);
+ PolicyDecisionPoint pdp = pdpComponent.getPDP();
+ assertNotNull(pdp);
+ assertEquals(pdpComponent.getName(),"/policy-server/PolicyDecisionPoint");
+ assertTrue(pdp.isDebug());
+
+ //Integrating the PolicyServer
+ PolicyServerComponent policyServerComponent =
(PolicyServerComponent)portal.getComponentInstanceOfType(PolicyServerComponent.class);
+ assertNotNull(policyServerComponent);
+ PolicyServer policyServer = policyServerComponent.getPolicyServer();
+ assertNotNull(policyServer);
+ assertEquals(policyServerComponent.getName(),"/policy-server/PolicyServer");
+ }
+}
Added:
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/gatein-authz-configuration.xml
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/gatein-authz-configuration.xml
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/gatein-authz-configuration.xml 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. 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.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+ <component>
+ <type>org.jboss.gatein.authz.core.server.event.LocalEventBusComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/EventBus</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.jboss.gatein.authz.core.server.tools.HibernateServiceComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/HibernateService</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.jboss.gatein.authz.core.server.provisioning.RelationalDBPolicyStoreComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/PolicyStore</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.jboss.gatein.authz.core.server.plugin.DroolsRuleManagerComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/DroolsRuleManager</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.jboss.gatein.authz.core.server.decision.PolicyDecisionPointComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/PolicyDecisionPoint</value>
+ </value-param>
+ <value-param>
+ <name>debug</name>
+ <value>true</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.jboss.gatein.authz.core.server.PolicyServerComponent</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>/policy-server/PolicyServer</value>
+ </value-param>
+ </init-params>
+ </component>
+</configuration>
\ No newline at end of file
Added:
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/portal/gatein-authz-configuration.xml
===================================================================
---
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/portal/gatein-authz-configuration.xml
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/resources/conf/portal/gatein-authz-configuration.xml 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+ <!--
+
+ Copyright (C) 2009 eXo Platform SAS. 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.
+ -->
+<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
+
+</configuration>
\ No newline at end of file
Added: authz/gatein/authz-plugin/trunk/service/src/test/resources/hibernate.cfg.xml
===================================================================
--- authz/gatein/authz-plugin/trunk/service/src/test/resources/hibernate.cfg.xml
(rev 0)
+++
authz/gatein/authz-plugin/trunk/service/src/test/resources/hibernate.cfg.xml 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- Database connection settings -->
+ <property
name="connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property
name="connection.url">jdbc:hsqldb:file:target/testdb</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"></property>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property
name="dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- Enable Hibernate's automatic session context management -->
+ <property
name="current_session_context_class">thread</property>
+
+ <!-- Disable the second-level cache -->
+ <property
name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">true</property>
+
+ <!--
+ Drop and re-create the database schema on startup
+ -->
+ <property name="hbm2ddl.auto">create</property>
+
+ <mapping resource="policy.hbm.xml"/>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Added: authz/gatein/authz-plugin/trunk/service/src/test/resources/log4j.properties
===================================================================
--- authz/gatein/authz-plugin/trunk/service/src/test/resources/log4j.properties
(rev 0)
+++ authz/gatein/authz-plugin/trunk/service/src/test/resources/log4j.properties 2010-06-05
14:58:25 UTC (rev 1119)
@@ -0,0 +1,8 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=INFO, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n