Author: alex.guizar(a)jboss.com
Date: 2010-08-19 00:35:22 -0400 (Thu, 19 Aug 2010)
New Revision: 6611
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/AuthenticatedUserExprTest.java
Removed:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/authenticateduser/
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java
Log:
restore method PropertyImpl.propertyTableExists(), needed by org.jbpm.db.Upgrade in
jbpm-db module;
align AuthenticatedUserExprTest package with directory location to restore jboss and
tomcat hudson jobs
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2010-08-19
03:18:32 UTC (rev 6610)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2010-08-19
04:35:22 UTC (rev 6611)
@@ -21,31 +21,12 @@
*/
package org.jbpm.pvm.internal.id;
-import java.util.ArrayList;
-import java.util.List;
-
import org.hibernate.Session;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
-import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
-import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
-import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
-import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
-import org.jbpm.pvm.internal.identity.impl.GroupImpl;
-import org.jbpm.pvm.internal.identity.impl.MembershipImpl;
-import org.jbpm.pvm.internal.identity.impl.UserImpl;
-import org.jbpm.pvm.internal.job.JobImpl;
-import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.processengine.ProcessEngineImpl;
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
-import org.jbpm.pvm.internal.repository.DeploymentProperty;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.task.ParticipationImpl;
-import org.jbpm.pvm.internal.task.SwimlaneImpl;
-import org.jbpm.pvm.internal.task.TaskImpl;
-import org.jbpm.pvm.internal.type.Variable;
/** jbpm installation properties.
*
@@ -112,6 +93,17 @@
}
}
+ public static boolean propertiesTableExists(Session session) {
+ try {
+ session.createCriteria(PropertyImpl.class)
+ .setMaxResults(1)
+ .uniqueResult();
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
protected static String getPropertyValue(Session session, String propertyKey) {
PropertyImpl dbidProperty = getProperty(session, propertyKey);
if (dbidProperty == null) {
Copied:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/AuthenticatedUserExprTest.java
(from rev 6609,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/authenticateduser/AuthenticatedUserExprTest.java)
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/AuthenticatedUserExprTest.java
(rev 0)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/AuthenticatedUserExprTest.java 2010-08-19
04:35:22 UTC (rev 6611)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.jbpm.test.auth;
+
+import java.util.List;
+
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Huisheng Xu
+ */
+public class AuthenticatedUserExprTest extends JbpmTestCase {
+
+ public void testTaskAssignmentHandlerExpr() {
+ deployJpdlXmlString(
+ "<process name='AuthenticatedUser'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review'
assignee='#{environment.authenticatedUserId}'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+ processEngine.setAuthenticatedUserId("johndoe");
+ executionService.startProcessInstanceByKey("AuthenticatedUser");
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ assertEquals("Expected a single task being created", 1, taskList.size());
+ Task task = taskList.get(0);
+ assertEquals("review", task.getName());
+ }
+}
Modified:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java 2010-08-19
03:18:32 UTC (rev 6610)
+++
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/auth/UserProvidedAuthenticationTest.java 2010-08-19
04:35:22 UTC (rev 6611)
@@ -22,10 +22,10 @@
package org.jbpm.test.auth;
import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryComment;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Tom Baeyens
*/
@@ -51,8 +51,8 @@
.uniqueResult();
processEngine.setAuthenticatedUserId("jackblack");
- taskService.addTaskComment(task.getId(), "the lord of the ring");
+ HistoryComment comment = taskService.addTaskComment(task.getId(), "the lord of
the ring");
- task.getId();
+ assertEquals("jackblack", comment.getUserId());
}
}