JBoss JBPM SVN: r3085 - projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-25 12:10:47 -0500 (Tue, 25 Nov 2008)
New Revision: 3085
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3CommandDelegate.java
Log:
Fix JBPM-1826: InstanceList doesnt respect process version
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3CommandDelegate.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3CommandDelegate.java 2008-11-25 16:45:39 UTC (rev 3084)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3CommandDelegate.java 2008-11-25 17:10:47 UTC (rev 3085)
@@ -150,11 +150,10 @@
}
public ProcessInstance startNewInstance(long processId)
- {
- ProcessDefinition p0 = getActualDefinition(processId);
- ProcessInstance instance = (ProcessInstance)
- facade.execute(new NewProcessInstanceCommand(p0.getName()));
-
+ {
+ NewProcessInstanceCommand command = new NewProcessInstanceCommand();
+ command.setProcessId(processId);
+ ProcessInstance instance = (ProcessInstance)facade.execute(command);
return instance;
}
17 years, 5 months
JBoss JBPM SVN: r3084 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server: integration/spec and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-25 11:45:39 -0500 (Tue, 25 Nov 2008)
New Revision: 3084
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
Log:
Rollback to -r3080
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 16:11:56 UTC (rev 3083)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 16:45:39 UTC (rev 3084)
@@ -21,24 +21,20 @@
*/
package org.jboss.bpm.console.server;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
+import com.google.gson.Gson;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
-import com.google.gson.Gson;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
/**
* REST server module for accessing process related data.
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-25 16:11:56 UTC (rev 3083)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-25 16:45:39 UTC (rev 3084)
@@ -21,23 +21,11 @@
*/
package org.jboss.bpm.console.server.integration.spec;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import javax.management.ObjectName;
-
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
-import org.jbpm.api.NotImplementedException;
-import org.jbpm.api.client.Configuration;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.ProcessDefinition;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.service.ProcessDefinitionService;
-import org.jbpm.api.service.ProcessService;
/**
* An implementation that delegates to the jBPM API
@@ -49,147 +37,36 @@
{
public List<ProcessDefinitionRef> getAllDefinitions()
{
- List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
-
- ProcessDefinitionService pdService = getProcessDefinitionService();
- Iterator<ObjectName> itKey = pdService.getProcessDefinitions().iterator();
- while(itKey.hasNext())
- {
- ObjectName procDefKey = itKey.next();
- ProcessDefinition procDef = pdService.getProcessDefinition(procDefKey);
- ProcessDefinitionRef pdRef = adaptProcessDefinition(procDef);
- results.add(pdRef);
- }
-
- return results;
+ throw new RuntimeException("Not implemented");
}
- public ProcessDefinitionRef getDefinitionById(long procDefId)
+ public ProcessDefinitionRef getDefinitionById(long processId)
{
- ProcessDefinitionRef results = null;
-
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
- if (procDef != null)
- {
- results = new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion());
- }
-
- return results;
+ throw new RuntimeException("Not implemented");
}
- public List<ProcessDefinitionRef> removeDefinition(long procDefId)
+ public List<ProcessDefinitionRef> removeDefinition(long processId)
{
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
- if (procDef != null)
- {
- ProcessDefinitionService pdService = getProcessDefinitionService();
- pdService.unregisterProcessDefinition(procDef.getKey());
- }
- return getAllDefinitions();
+ throw new RuntimeException("Not implemented");
}
- public ProcessInstanceRef newInstance(long procDefId)
+ public ProcessInstanceRef newInstance(long processId)
{
- ProcessDefinition procDef = getProcessDefinitionById(procDefId);
- if (procDef == null)
- throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
-
- Process proc = procDef.newInstance();
- ProcessInstanceRef procRef = adaptProcess(proc);
- return procRef;
+ throw new RuntimeException("Not implemented");
}
- public List<ProcessInstanceRef> getInstancesByDefinitionId(long procDefId)
+ public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
{
- throw new NotImplementedException();
+ throw new RuntimeException("Not implemented");
}
- public ProcessInstanceRef getInstanceById(long procID)
+ public ProcessInstanceRef getInstanceById(long instanceId)
{
- Process proc = getProcessById(procID);
- ProcessInstanceRef procRef = adaptProcess(proc);
- return procRef;
+ throw new RuntimeException("Not implemented");
}
public void signalToken(long tokenId, String signal)
{
- throw new NotImplementedException();
+ throw new RuntimeException("Not implemented");
}
-
- private ProcessDefinitionService getProcessDefinitionService()
- {
- ProcessEngine engine = Configuration.getProcessEngine();
- ProcessDefinitionService pdService = engine.getService(ProcessDefinitionService.class);
- return pdService;
- }
-
- private ProcessDefinition getProcessDefinitionById(long procDefID)
- {
- ProcessDefinition procDef = null;
- ProcessDefinitionService pdService = getProcessDefinitionService();
- Iterator<ObjectName> it = pdService.getProcessDefinitions().iterator();
- while(it.hasNext())
- {
- ObjectName auxKey = it.next();
- if (procDefID == apaptKey(auxKey))
- {
- procDef = pdService.getProcessDefinition(auxKey);
- break;
- }
- }
- return procDef;
- }
-
- private ProcessDefinitionRef adaptProcessDefinition(ProcessDefinition procDef)
- {
- ObjectName procDefKey = procDef.getKey();
- Long procDefID = apaptKey(procDefKey);
- return new ProcessDefinitionRef(procDefID, procDef.getName(), procDef.getVersion());
- }
-
- private ProcessService getProcessService()
- {
- ProcessEngine engine = Configuration.getProcessEngine();
- ProcessService pService = engine.getService(ProcessService.class);
- return pService;
- }
-
- private Process getProcessById(long procID)
- {
- Process proc = null;
- ProcessService pdService = getProcessService();
- Iterator<ObjectName> it = pdService.getProcesses().iterator();
- while(it.hasNext())
- {
- ObjectName auxKey = it.next();
- if (procID == apaptKey(auxKey))
- {
- proc = pdService.getProcess(auxKey);
- break;
- }
- }
- return proc;
- }
-
- private ProcessInstanceRef adaptProcess(Process proc)
- {
- Long procDefID = apaptKey(proc.getProcessDefinition().getKey());
- Long procID = apaptKey(proc.getKey());
-
- // [TODO] clarify process status
- ProcessStatus status = proc.getProcessStatus();
- boolean suspended = ProcessStatus.Active != status;
-
- ProcessInstanceRef procRef = new ProcessInstanceRef(procID, procDefID, proc.getStartDate(), proc.getEndDate(), suspended);
- return procRef;
- }
-
- private Long apaptKey(ObjectName procDefKey)
- {
- String procDefID = procDefKey.getKeyProperty("id");
- if (procDefID == null)
- throw new IllegalStateException("Cannot obtain id property from: " + procDefKey);
-
- return new Long(procDefID);
- }
}
17 years, 5 months
JBoss JBPM SVN: r3083 - in projects/gwt-console/trunk: server/src/main/resources and 4 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-25 11:11:56 -0500 (Tue, 25 Nov 2008)
New Revision: 3083
Added:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java
projects/gwt-console/trunk/server/src/main/resources/SampleProcess.par
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/test/java/PreparationTest.java
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
Log:
More work on test coverage: Added /test resources to console server to simplify GWT tests
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -40,6 +40,7 @@
singletons.add(new TaskMgmtFacade());
singletons.add(new UserMgmtFacade());
singletons.add(new JBPM3MgmtFacade());
+ singletons.add(new TestFacade());
}
@Override
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -52,7 +52,7 @@
private ProcessManagement processManagement;
private JBPM3Extension managementExtension;
- private ProcessManagement getProcessDAO()
+ private ProcessManagement getProcessManagement()
{
if(null==this.processManagement)
{
@@ -83,7 +83,7 @@
public Response getDefinitionsJSON()
{
ProcessDefinitionRefWrapper wrapper =
- new ProcessDefinitionRefWrapper(getProcessDAO().getAllDefinitions());
+ new ProcessDefinitionRefWrapper(getProcessManagement().getAllDefinitions());
return createJsonResponse(wrapper);
}
@@ -96,7 +96,7 @@
)
{
ProcessDefinitionRefWrapper wrapper =
- new ProcessDefinitionRefWrapper( getProcessDAO().removeDefinition(processId));
+ new ProcessDefinitionRefWrapper( getProcessManagement().removeDefinition(processId));
return createJsonResponse(wrapper);
}
@@ -110,7 +110,7 @@
{
ProcessInstanceRefWrapper wrapper =
- new ProcessInstanceRefWrapper(getProcessDAO().getInstancesByDefinitionId(processId));
+ new ProcessInstanceRefWrapper(getProcessManagement().getInstancesByDefinitionId(processId));
return createJsonResponse(wrapper);
}
@@ -122,7 +122,7 @@
long processId)
{
- ProcessInstanceRef instance = getProcessDAO().newInstance(processId);
+ ProcessInstanceRef instance = getProcessManagement().newInstance(processId);
return createJsonResponse(instance);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TaskMgmtFacade.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -69,7 +69,7 @@
return this.taskManagement;
}
- private JBPM3Extension getExtensionDAO()
+ private JBPM3Extension getManagementExtension()
{
if(null==this.JBPM3Extension)
{
@@ -103,7 +103,7 @@
)
{
Map<String,String> formMapping =
- getExtensionDAO().getAvailableTaskForms(processId);
+ getManagementExtension().getAvailableTaskForms(processId);
List<MapEntry> entries = new ArrayList<MapEntry>();
for(String s : formMapping.keySet())
@@ -180,7 +180,7 @@
)
{
- byte[] form = getExtensionDAO().getTaskFormByTaskName(processId, taskId);
+ byte[] form = getManagementExtension().getTaskFormByTaskName(processId, taskId);
JBPM3FormParser parser = new JBPM3FormParser();
final FormDef formDef = new FormDef("taskform-"+taskId);
try
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/TestFacade.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.server;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.server.integration.JBPM3Extension;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.server.integration.ProcessManagement;
+
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+/**
+ * Test utility to simplify GWT tests.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("test")
+public class TestFacade
+{
+ private static final Log log = LogFactory.getLog(TaskMgmtFacade.class);
+
+ private JBPM3Extension JBPM3Extension;
+ private ProcessManagement processManagement;
+
+ private JBPM3Extension getManagementExtension()
+ {
+ if(null==this.JBPM3Extension)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.JBPM3Extension = factory.createExtensionManagement();
+ }
+
+ return this.JBPM3Extension;
+
+ }
+
+ private ProcessManagement getProcessManagement()
+ {
+ if(null==this.processManagement)
+ {
+ ManagementFactory factory = ManagementFactory.newInstance();
+ this.processManagement = factory.createProcessManagement();
+ log.debug("Using ManagementFactory impl:" + factory.getClass().getName());
+ }
+
+ return this.processManagement;
+ }
+
+ @POST
+ @Path("deploy/harness")
+ public Response deployTestHarness()
+ {
+ try
+ {
+ InputStream in = getClass().getResourceAsStream("/WEB-INF/classes/SampleProcess.par");
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ final int BUF_SIZE = 1 << 8;
+ byte[] buffer = new byte[BUF_SIZE];
+ int bytesRead = -1;
+ while((bytesRead = in.read(buffer)) > -1) {
+ out.write(buffer, 0, bytesRead);
+ }
+ in.close();
+ byte[] data = out.toByteArray();
+
+ ProcessDefinitionRef def = getManagementExtension().deployNewDefinition(data);
+ log.info("Deployed test process definition " + def);
+
+ return Response.ok().build();
+ }
+ catch (IOException e)
+ {
+ throw new WebApplicationException(e, 500);
+ }
+
+ }
+
+ @POST
+ @Path("undeploy/harness")
+ public Response undeployTestHarness()
+ {
+ List<ProcessDefinitionRef> defs = getProcessManagement().getAllDefinitions();
+
+ for(ProcessDefinitionRef pd : defs)
+ {
+ if(pd.getName().equals("GWT_Test_Harness"))
+ {
+ log.info("Remove test harness " +pd);
+ getProcessManagement().removeDefinition(pd.getProcessId());
+ }
+ }
+ return Response.ok().build();
+ }
+}
Added: projects/gwt-console/trunk/server/src/main/resources/SampleProcess.par
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/trunk/server/src/main/resources/SampleProcess.par
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -470,6 +470,11 @@
public Logger getLogger() {
if (logger == null) {
logger = Logger.getLogger("jmaki.services.xhp.Log");
+
+ // TODO: the logger breaks the GWT tests, because it writes to stderr
+ // we'll turn it off for now.
+ System.out.println("WARN: XHP proxy logging is turned off");
+ logger.setLevel(Level.OFF);
}
return logger;
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -161,4 +161,14 @@
{
return getBaseUrl() + "/rs/process/definitions/"+name;
}
+
+ public String getDeployTestHarnessUrl()
+ {
+ return getBaseUrl()+ "/rs/test/deploy/harness";
+ }
+
+ public String getUndeployTestHarnessUrl()
+ {
+ return getBaseUrl()+ "/rs/test/undeploy/harness";
+ }
}
Modified: projects/gwt-console/trunk/war/src/test/java/PreparationTest.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/PreparationTest.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/war/src/test/java/PreparationTest.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -22,41 +22,16 @@
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.jboss.bpm.console.client.URLBuilder;
-import java.io.File;
-import java.io.FileInputStream;
-
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class PreparationTest extends TestCase
{
- private static String JSON = null;
-
protected void setUp() throws Exception
{
- File workDir = new File(".");
- System.out.println("===================" );
- System.out.println("Test execution in " + workDir.getAbsolutePath() );
- System.out.println("===================" );
-
- // deploy a sample process
- String pathname = workDir.getAbsolutePath() + "/src/test/resources/SampleProcess.par";
- File samplePar = new File(pathname);
- if(!samplePar.exists())
- throw new RuntimeException("Failed to load sample process: " +pathname);
-
- URLBuilder urlBuilder = new URLBuilder("http://localhost:8080", "gwt-console-server");
- String response = HTTP.post(
- urlBuilder.getUploadDefinitionURL(),
- new FileInputStream(samplePar)
- );
-
- System.out.println("HTTP response: " + response);
-
}
public void testSuccess()
@@ -64,8 +39,4 @@
Assert.assertTrue(true);
}
- public static String getJSON()
- {
- return JSON;
- }
}
Modified: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-11-25 15:41:56 UTC (rev 3082)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-11-25 16:11:56 UTC (rev 3083)
@@ -25,7 +25,6 @@
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
-import com.google.gwt.user.client.Timer;
import com.gwtext.client.widgets.ComponentMgr;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.process.ProcessDefinitionList;
@@ -41,105 +40,77 @@
*/
public class GwtTestProcessManagement extends AbstractConsoleTC
{
- public void testAuthentication()
+ public void testProcessManagement()
{
- System.out.println("=== testAuthentication ===");
+ System.out.println("=== testProcessInstanceEditor ===");
- final MainView view = application.getConsoleView();
- assertNotNull("View not initialized", view);
+ final ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)
+ ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
+
+ Map<String, Object> context = new HashMap<String, Object>();
+ context.put("editor", editor);
- HashMap<String, Object> context = new HashMap<String, Object>();
+ DeployTestHarnessTimer deployTimer = new DeployTestHarnessTimer(context);
+ AuthenticationTimer authTimer = new AuthenticationTimer(context,"admin", "admin");
+ LoadTestHarnessTimer loadingTimer = new LoadTestHarnessTimer(context);
+ InstanceEditorTimer instanceTimer = new InstanceEditorTimer(context);
+ UndeployTimer undeployTimer = new UndeployTimer(context);
- Timer authTimer = new AuthenticationTimer(context,"admin", "admin");
-
- // launch first timer
- authTimer.schedule(500);
+ context.put("deployFollow", authTimer);
+ context.put("authFollow", loadingTimer);
+ context.put("loadFollow", instanceTimer);
+ context.put("instanceFollow", undeployTimer);
+
+ // trigger first timer
+ deployTimer.schedule(500);
delayTestFinish(1000);
+
}
- public void testProcessDefEditor()
+ class DeployTestHarnessTimer extends ChainedTimer
{
- System.out.println("=== testProcessDefEditor ===");
- final MainView view = application.getConsoleView();
- assertNotNull("View not initialized", view);
+ protected DeployTestHarnessTimer(Map<String, Object> context)
+ {
+ super(context);
+ }
- Timer verification = new Timer(){
-
- public void run()
+ public void run()
+ {
+ String url = urlBuilder.getDeployTestHarnessUrl();
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
+ try
{
- System.out.println("Verify process definition list");
- ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)
- ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
+ rb.sendRequest("",
+ new RequestCallback()
+ {
- ProcessDefinitionList list = editor.getProcessDefinitionList();
- assertTrue("No process definitions loaded",
- list.getAvailableProcessDefinitions().size() != 0
- );
+ public void onResponseReceived(Request request, Response response)
+ {
+ if(response.getStatusCode()!=200)
+ throw new RuntimeException("HTTP status " + response.getStatusCode());
- ProcessDefinitionRef testPd =
- getTestProcessDefinition(list.getAvailableProcessDefinitions());
- assertNotNull("Unable to find test process definition", testPd);
+ proceedOrFinish();
+ }
- finishTest();
+ public void onError(Request request, Throwable t)
+ {
+ throw new RuntimeException("Connection problem", t);
+ }
+ }
+ );
}
- };
-
- Timer loading = new Timer(){
-
- public void run()
+ catch (Throwable e)
{
- System.out.println("Fetch process definitions");
- ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)
- ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
-
- ProcessDefinitionList list = editor.getProcessDefinitionList();
- list.reloadStore();
+ throw new RuntimeException("Failed to remove process definition", e);
}
- };
+ }
- Timer authentication = new Timer()
+ public ChainedTimer getNext()
{
- public void run()
- {
- System.out.println("Do authentication");
- String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainView.KNOWN_ROLES);
- final Authentication auth = new Authentication(inRoleURL);
- auth.doLogin();
-
- }
- };
-
- authentication.schedule(500);
- loading.schedule(1000);
- verification.schedule(1500);
-
- delayTestFinish(2000);
+ return (ChainedTimer)context.get("deployFollow");
+ }
}
-
- public void testProcessInstanceEditor()
- {
- System.out.println("=== testProcessInstanceEditor ===");
-
- final ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)
- ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
-
- Map<String, Object> context = new HashMap<String, Object>();
- context.put("editor", editor);
-
- AuthenticationTimer authTimer = new AuthenticationTimer(context,"admin", "admin");
- LoadTestHarnessTimer loadingTimer = new LoadTestHarnessTimer(context);
- InstanceEditorTimer instanceTimer = new InstanceEditorTimer(context);
-
- context.put("authFollow", loadingTimer);
- context.put("loadFollow", instanceTimer);
-
- // trigger first timer
- authTimer.schedule(500);
- delayTestFinish(1000);
-
- }
-
class LoadTestHarnessTimer extends ChainedTimer
{
@@ -157,15 +128,7 @@
{
ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor) context.get("editor");
ProcessDefinitionList list = editor.getProcessDefinitionList();
- list.reloadStore();
-
- List<ProcessDefinitionRef> defs = list.getAvailableProcessDefinitions();
- assertFalse(defs.isEmpty());
-
- ProcessDefinitionRef testPd = getTestProcessDefinition(defs);
- assertNotNull("No test PD found", testPd);
- context.put("def", testPd);
-
+ list.reloadStore(); // trigger async load operation
proceedOrFinish();
}
}
@@ -186,14 +149,16 @@
public void run()
{
ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)context.get("editor");
- ProcessDefinitionRef def = (ProcessDefinitionRef)context.get("def");
- assertNotNull("No test definition given: " +context, def);
-
ProcessDefinitionList list = editor.getProcessDefinitionList();
- list.launchEditor(def); // will create an instance editor
+ List<ProcessDefinitionRef> processDefinitions = list.getAvailableProcessDefinitions();
+ ProcessDefinitionRef testPd = getTestProcessDefinition(processDefinitions);
+ assertNotNull("No test definition given: " +processDefinitions, testPd);
+
+ list.launchEditor(testPd); // will create an instance editor
+
// lookup instance editor
- String editorId = ProcessInstanceListEditor.createWidgetID(def);
+ String editorId = ProcessInstanceListEditor.createWidgetID(testPd);
ProcessInstanceListEditor instanceEditor = (ProcessInstanceListEditor)
ComponentMgr.getComponent(editorId);
assertNotNull("Failed to create instance editor for process", instanceEditor);
@@ -203,11 +168,8 @@
List<ProcessDefinitionRef> defs = list.getAvailableProcessDefinitions();
assertFalse(defs.isEmpty());
-
- ProcessDefinitionRef testPd = getTestProcessDefinition(list.getAvailableProcessDefinitions());
- CleanupTimer cleanup = new CleanupTimer(context, testPd);
- cleanup.schedule(500);
- delayTestFinish(1000);
+
+ proceedOrFinish();
}
}
@@ -225,31 +187,26 @@
return def;
}
- class CleanupTimer extends ChainedTimer
+ class UndeployTimer extends ChainedTimer
{
- ProcessDefinitionRef pd;
-
- public CleanupTimer(Map<String, Object> context, ProcessDefinitionRef pd)
+ public UndeployTimer(Map<String, Object> context)
{
- super(context);
- this.pd = pd;
+ super(context);
}
-
public ChainedTimer getNext()
{
- return null;
+ return (ChainedTimer)context.get("undeployFollow");
}
public void run()
{
- String deleteUrl = urlBuilder.getRemoveDefinitionURL(pd.getProcessId());
+ String deleteUrl = urlBuilder.getUndeployTestHarnessUrl();
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, deleteUrl);
try
{
- System.out.println("FIXME: Schedule " + pd + " for removal");
-
- /*rb.sendRequest("",
+
+ rb.sendRequest("",
new RequestCallback()
{
@@ -264,7 +221,7 @@
throw new RuntimeException("Connection problem", t);
}
}
- );*/
+ );
}
catch (Throwable e)
{
17 years, 5 months
JBoss JBPM SVN: r3082 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server: integration and 2 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-25 10:41:56 -0500 (Tue, 25 Nov 2008)
New Revision: 3082
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
Log:
API integration first cut
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 14:37:10 UTC (rev 3081)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2008-11-25 15:41:56 UTC (rev 3082)
@@ -21,20 +21,24 @@
*/
package org.jboss.bpm.console.server;
-import com.google.gson.Gson;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.server.integration.JBPM3Extension;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Response;
+import com.google.gson.Gson;
/**
* REST server module for accessing process related data.
@@ -83,18 +87,6 @@
return createJsonResponse(wrapper);
}
- @GET
- @Path("definitions/{name}")
- @Produces("application/json")
- public Response getDefinitionByName(
- @PathParam("name")
- String name
- )
- {
- ProcessDefinitionRef def = getProcessDAO().getDefinition(name);
- return createJsonResponse(def);
- }
-
@POST
@Path("definitions/{id}/remove")
@Produces("application/json")
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-25 14:37:10 UTC (rev 3081)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ProcessManagement.java 2008-11-25 15:41:56 UTC (rev 3082)
@@ -44,6 +44,4 @@
ProcessInstanceRef newInstance(long processId);
void signalToken(long tokenId, String signal);
-
- ProcessDefinitionRef getDefinition(String name);
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java 2008-11-25 14:37:10 UTC (rev 3081)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ProcessManagement.java 2008-11-25 15:41:56 UTC (rev 3082)
@@ -60,13 +60,6 @@
return Transform.processDefinition(p0);
}
-
- public ProcessDefinitionRef getDefinition(String name)
- {
- ProcessDefinition p0 = delegate.getActualDefinition(name);
- return Transform.processDefinition(p0);
- }
-
public List<ProcessDefinitionRef> removeDefinition(long processId)
{
delegate.removeActualDefinition(processId);
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-25 14:37:10 UTC (rev 3081)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-25 15:41:56 UTC (rev 3082)
@@ -21,12 +21,23 @@
*/
package org.jboss.bpm.console.server.integration.spec;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import javax.management.ObjectName;
+
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
import org.jbpm.api.NotImplementedException;
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.service.ProcessDefinitionService;
+import org.jbpm.api.service.ProcessService;
/**
* An implementation that delegates to the jBPM API
@@ -38,41 +49,147 @@
{
public List<ProcessDefinitionRef> getAllDefinitions()
{
- throw new NotImplementedException();
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ Iterator<ObjectName> itKey = pdService.getProcessDefinitions().iterator();
+ while(itKey.hasNext())
+ {
+ ObjectName procDefKey = itKey.next();
+ ProcessDefinition procDef = pdService.getProcessDefinition(procDefKey);
+ ProcessDefinitionRef pdRef = adaptProcessDefinition(procDef);
+ results.add(pdRef);
+ }
+
+ return results;
}
- public ProcessDefinitionRef getDefinitionById(long processId)
+ public ProcessDefinitionRef getDefinitionById(long procDefId)
{
- throw new NotImplementedException();
+ ProcessDefinitionRef results = null;
+
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef != null)
+ {
+ results = new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion());
+ }
+
+ return results;
}
- public ProcessDefinitionRef getDefinition(String name)
+ public List<ProcessDefinitionRef> removeDefinition(long procDefId)
{
- throw new NotImplementedException();
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef != null)
+ {
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ pdService.unregisterProcessDefinition(procDef.getKey());
+ }
+ return getAllDefinitions();
}
- public List<ProcessDefinitionRef> removeDefinition(long processId)
+ public ProcessInstanceRef newInstance(long procDefId)
{
- throw new NotImplementedException();
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef == null)
+ throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
+
+ Process proc = procDef.newInstance();
+ ProcessInstanceRef procRef = adaptProcess(proc);
+ return procRef;
}
- public ProcessInstanceRef newInstance(long processId)
+ public List<ProcessInstanceRef> getInstancesByDefinitionId(long procDefId)
{
throw new NotImplementedException();
}
- public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
+ public ProcessInstanceRef getInstanceById(long procID)
{
- throw new NotImplementedException();
+ Process proc = getProcessById(procID);
+ ProcessInstanceRef procRef = adaptProcess(proc);
+ return procRef;
}
- public ProcessInstanceRef getInstanceById(long instanceId)
+ public void signalToken(long tokenId, String signal)
{
throw new NotImplementedException();
}
- public void signalToken(long tokenId, String signal)
+ private ProcessDefinitionService getProcessDefinitionService()
{
- throw new NotImplementedException();
+ ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessDefinitionService pdService = engine.getService(ProcessDefinitionService.class);
+ return pdService;
}
+
+ private ProcessDefinition getProcessDefinitionById(long procDefID)
+ {
+ ProcessDefinition procDef = null;
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ Iterator<ObjectName> it = pdService.getProcessDefinitions().iterator();
+ while(it.hasNext())
+ {
+ ObjectName auxKey = it.next();
+ if (procDefID == apaptKey(auxKey))
+ {
+ procDef = pdService.getProcessDefinition(auxKey);
+ break;
+ }
+ }
+ return procDef;
+ }
+
+ private ProcessDefinitionRef adaptProcessDefinition(ProcessDefinition procDef)
+ {
+ ObjectName procDefKey = procDef.getKey();
+ Long procDefID = apaptKey(procDefKey);
+ return new ProcessDefinitionRef(procDefID, procDef.getName(), procDef.getVersion());
+ }
+
+ private ProcessService getProcessService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessService pService = engine.getService(ProcessService.class);
+ return pService;
+ }
+
+ private Process getProcessById(long procID)
+ {
+ Process proc = null;
+ ProcessService pdService = getProcessService();
+ Iterator<ObjectName> it = pdService.getProcesses().iterator();
+ while(it.hasNext())
+ {
+ ObjectName auxKey = it.next();
+ if (procID == apaptKey(auxKey))
+ {
+ proc = pdService.getProcess(auxKey);
+ break;
+ }
+ }
+ return proc;
+ }
+
+ private ProcessInstanceRef adaptProcess(Process proc)
+ {
+ Long procDefID = apaptKey(proc.getProcessDefinition().getKey());
+ Long procID = apaptKey(proc.getKey());
+
+ // [TODO] clarify process status
+ ProcessStatus status = proc.getProcessStatus();
+ boolean suspended = ProcessStatus.Active != status;
+
+ ProcessInstanceRef procRef = new ProcessInstanceRef(procID, procDefID, proc.getStartDate(), proc.getEndDate(), suspended);
+ return procRef;
+ }
+
+ private Long apaptKey(ObjectName procDefKey)
+ {
+ String procDefID = procDefKey.getKeyProperty("id");
+ if (procDefID == null)
+ throw new IllegalStateException("Cannot obtain id property from: " + procDefKey);
+
+ return new Long(procDefID);
+ }
}
17 years, 5 months
JBoss JBPM SVN: r3081 - jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-25 09:37:10 -0500 (Tue, 25 Nov 2008)
New Revision: 3081
Modified:
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
Log:
Follow API update
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-25 14:35:27 UTC (rev 3080)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessDefinitionImpl.java 2008-11-25 14:37:10 UTC (rev 3081)
@@ -89,7 +89,13 @@
public ObjectName getKey()
{
long id = oldProcDef.getId();
- return ObjectNameFactory.create(Constants.ID_DOMAIN + ":procdef=" + getName() + ",id=" + id);
+ String version = getVersion();
+
+ String keyStr = Constants.ID_DOMAIN + ":procdef=" + getName() + ",id=" + id;
+ if (version != null)
+ keyStr += ",version=" + version;
+
+ return ObjectNameFactory.create(keyStr);
}
public String getName()
@@ -97,6 +103,12 @@
return oldProcDef.getName();
}
+ public String getVersion()
+ {
+ int version = oldProcDef.getVersion();
+ return version > 0 ? String.valueOf(version) : null;
+ }
+
public Process newInstance()
{
ProcessImpl procImpl = new ProcessImpl(this);
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-25 14:35:27 UTC (rev 3080)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-25 14:37:10 UTC (rev 3081)
@@ -21,6 +21,7 @@
*/
package org.jbpm.integration.model;
+import java.util.Date;
import java.util.List;
import javax.management.ObjectName;
@@ -98,6 +99,16 @@
return procDef.getName();
}
+ public Date getEndDate()
+ {
+ return oldProc.getEnd();
+ }
+
+ public Date getStartDate()
+ {
+ return oldProc.getStart();
+ }
+
//@Override
public <T extends Node> T getNode(Class<T> clazz, String name)
{
17 years, 5 months
JBoss JBPM SVN: r3080 - in projects/gwt-console/trunk/war/src: test/java and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-25 09:35:27 -0500 (Tue, 25 Nov 2008)
New Revision: 3080
Added:
projects/gwt-console/trunk/war/src/test/java/HTTP.java
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java
Removed:
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/ChainedTimer.java
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
projects/gwt-console/trunk/war/src/test/java/PreparationTest.java
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
Log:
Further enhancement to the GWT test coverage. Added a bunch of FIXME's
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-25 11:54:02 UTC (rev 3079)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -85,10 +85,10 @@
public void onExamine(int row)
{
ProcessDefinitionRef proc = row2ProcessMap.get(row);
- lauchEditor(proc);
+ launchEditor(proc);
}
- public void lauchEditor(ProcessDefinitionRef proc)
+ public void launchEditor(ProcessDefinitionRef proc)
{
String editorId = ProcessInstanceListEditor.createWidgetID(proc);
Added: projects/gwt-console/trunk/war/src/test/java/HTTP.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/HTTP.java (rev 0)
+++ projects/gwt-console/trunk/war/src/test/java/HTTP.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.
+ */
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class HTTP
+{
+ public static String post(String urlString, InputStream inputStream)
+ throws Exception
+ {
+
+ String userPassword = "admin:admin";
+ String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
+
+ HttpURLConnection conn = null;
+ BufferedReader br = null;
+ DataOutputStream dos = null;
+ DataInputStream inStream = null;
+
+ InputStream is = null;
+ OutputStream os = null;
+ boolean ret = false;
+ String StrMessage = "";
+
+
+ String lineEnd = "\r\n";
+ String twoHyphens = "--";
+ String boundary = "*****";
+
+
+ int bytesRead, bytesAvailable, bufferSize;
+
+ byte[] buffer;
+
+ int maxBufferSize = 1*1024*1024;
+
+ String responseFromServer = "";
+
+ try
+ {
+ //------------------ CLIENT REQUEST
+
+ // open a URL connection to the Servlet
+
+ URL url = new URL(urlString);
+
+
+ // Open a HTTP connection to the URL
+
+ conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestProperty ("Authorization", "Basic " + encoding);
+
+ // Allow Inputs
+ conn.setDoInput(true);
+
+ // Allow Outputs
+ conn.setDoOutput(true);
+
+ // Don't use a cached copy.
+ conn.setUseCaches(false);
+
+ // Use a post method.
+ conn.setRequestMethod("POST");
+
+ conn.setRequestProperty("Connection", "Keep-Alive");
+
+ conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
+
+ dos = new DataOutputStream( conn.getOutputStream() );
+
+ dos.writeBytes(twoHyphens + boundary + lineEnd);
+ dos.writeBytes("Content-Disposition: form-data; name=\"upload\";"
+ + " filename=\"" + UUID.randomUUID().toString() +"\"" + lineEnd);
+ dos.writeBytes(lineEnd);
+
+ // create a buffer of maximum size
+ bytesAvailable = inputStream.available();
+ bufferSize = Math.min(bytesAvailable, maxBufferSize);
+ buffer = new byte[bufferSize];
+
+ // read file and write it into form...
+ bytesRead = inputStream.read(buffer, 0, bufferSize);
+
+ while (bytesRead > 0)
+ {
+ dos.write(buffer, 0, bufferSize);
+ bytesAvailable = inputStream.available();
+ bufferSize = Math.min(bytesAvailable, maxBufferSize);
+ bytesRead = inputStream.read(buffer, 0, bufferSize);
+ }
+
+ // send multipart form data necesssary after file data...
+
+ dos.writeBytes(lineEnd);
+ dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
+
+ // close streams
+
+ inputStream.close();
+ dos.flush();
+ dos.close();
+
+ }
+ catch (MalformedURLException ex)
+ {
+ throw ex;
+ }
+
+ catch (IOException ioe)
+ {
+ throw ioe;
+ }
+
+
+ //------------------ read the SERVER RESPONSE
+
+ StringBuffer sb = new StringBuffer();
+
+ try
+ {
+ inStream = new DataInputStream ( conn.getInputStream() );
+ String str;
+ while (( str = inStream.readLine()) != null)
+ {
+ sb.append(str).append("");
+ }
+ inStream.close();
+
+ }
+ catch (IOException ioex)
+ {
+ System.out.println("From (ServerResponse): "+ioex);
+
+ }
+
+
+ return sb.toString();
+
+ }
+}
Modified: projects/gwt-console/trunk/war/src/test/java/PreparationTest.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/PreparationTest.java 2008-11-25 11:54:02 UTC (rev 3079)
+++ projects/gwt-console/trunk/war/src/test/java/PreparationTest.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -24,10 +24,8 @@
import junit.framework.TestCase;
import org.jboss.bpm.console.client.URLBuilder;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.io.File;
+import java.io.FileInputStream;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -52,9 +50,9 @@
throw new RuntimeException("Failed to load sample process: " +pathname);
URLBuilder urlBuilder = new URLBuilder("http://localhost:8080", "gwt-console-server");
- String response = doHttpPost(
+ String response = HTTP.post(
urlBuilder.getUploadDefinitionURL(),
- samplePar
+ new FileInputStream(samplePar)
);
System.out.println("HTTP response: " + response);
@@ -66,141 +64,6 @@
Assert.assertTrue(true);
}
- private String doHttpPost(String urlString, File data)
- throws Exception
- {
-
- String userPassword = "admin:admin";
- String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
-
- HttpURLConnection conn = null;
- BufferedReader br = null;
- DataOutputStream dos = null;
- DataInputStream inStream = null;
-
- InputStream is = null;
- OutputStream os = null;
- boolean ret = false;
- String StrMessage = "";
-
-
- String lineEnd = "\r\n";
- String twoHyphens = "--";
- String boundary = "*****";
-
-
- int bytesRead, bytesAvailable, bufferSize;
-
- byte[] buffer;
-
- int maxBufferSize = 1*1024*1024;
-
- String responseFromServer = "";
-
- try
- {
- //------------------ CLIENT REQUEST
-
- FileInputStream fileInputStream = new FileInputStream( data );
-
- // open a URL connection to the Servlet
-
- URL url = new URL(urlString);
-
-
- // Open a HTTP connection to the URL
-
- conn = (HttpURLConnection) url.openConnection();
- conn.setRequestProperty ("Authorization", "Basic " + encoding);
-
- // Allow Inputs
- conn.setDoInput(true);
-
- // Allow Outputs
- conn.setDoOutput(true);
-
- // Don't use a cached copy.
- conn.setUseCaches(false);
-
- // Use a post method.
- conn.setRequestMethod("POST");
-
- conn.setRequestProperty("Connection", "Keep-Alive");
-
- conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
-
- dos = new DataOutputStream( conn.getOutputStream() );
-
- dos.writeBytes(twoHyphens + boundary + lineEnd);
- dos.writeBytes("Content-Disposition: form-data; name=\"upload\";"
- + " filename=\"" + data.getName() +"\"" + lineEnd);
- dos.writeBytes(lineEnd);
-
- // create a buffer of maximum size
- bytesAvailable = fileInputStream.available();
- bufferSize = Math.min(bytesAvailable, maxBufferSize);
- buffer = new byte[bufferSize];
-
- // read file and write it into form...
- bytesRead = fileInputStream.read(buffer, 0, bufferSize);
-
- while (bytesRead > 0)
- {
- dos.write(buffer, 0, bufferSize);
- bytesAvailable = fileInputStream.available();
- bufferSize = Math.min(bytesAvailable, maxBufferSize);
- bytesRead = fileInputStream.read(buffer, 0, bufferSize);
- }
-
- // send multipart form data necesssary after file data...
-
- dos.writeBytes(lineEnd);
- dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
-
- // close streams
-
- fileInputStream.close();
- dos.flush();
- dos.close();
-
- }
- catch (MalformedURLException ex)
- {
- throw ex;
- }
-
- catch (IOException ioe)
- {
- throw ioe;
- }
-
-
- //------------------ read the SERVER RESPONSE
-
- StringBuffer sb = new StringBuffer();
-
- try
- {
- inStream = new DataInputStream ( conn.getInputStream() );
- String str;
- while (( str = inStream.readLine()) != null)
- {
- sb.append(str).append("");
- }
- inStream.close();
-
- }
- catch (IOException ioex)
- {
- System.out.println("From (ServerResponse): "+ioex);
-
- }
-
-
- return sb.toString();
-
- }
-
public static String getJSON()
{
return JSON;
Added: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java (rev 0)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.core.client.GWT;
+
+import java.util.Map;
+
+/**
+ * Base class for console tests
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class AbstractConsoleTC extends GWTTestCase
+{
+
+ protected static Application application = null;
+ protected static final String GWT_TEST_HARNESS = "GWT_Test_Harness";
+ protected URLBuilder urlBuilder;
+
+ public String getModuleName()
+ {
+ return "org.jboss.bpm.console.Application";
+ }
+
+ protected void gwtSetUp() throws Exception
+ {
+ super.gwtSetUp();
+
+ if(null==application)
+ {
+ application = new Application();
+ application.onModuleLoad2();
+ }
+
+ urlBuilder = new URLBuilder(GWT.getModuleBaseURL(), "xhp");
+ }
+
+ protected abstract class ChainedTimer extends Timer
+ {
+ protected Map<String,Object> context;
+
+ protected ChainedTimer(Map<String, Object> context)
+ {
+ this.context = context;
+ }
+
+ protected void proceedOrFinish()
+ {
+
+ ChainedTimer next = getNext();
+ if(next !=null)
+ {
+ next.schedule(500);
+ delayTestFinish(1000);
+ }
+ else
+ {
+ finishTest();
+ }
+ }
+
+ public abstract ChainedTimer getNext();
+
+ }
+}
Deleted: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/ChainedTimer.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/ChainedTimer.java 2008-11-25 11:54:02 UTC (rev 3079)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/ChainedTimer.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.bpm.console.client;
-
-import com.google.gwt.user.client.Timer;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-abstract class ChainedTimer extends Timer
-{
-
- private Timer next;
-
-
- protected ChainedTimer(Timer next)
- {
- this.next = next;
- }
-
- public abstract void run();
-
- protected void scheduleNext(int after)
- {
- if(null==next)
- throw new IllegalArgumentException("No next timer given");
- next.schedule(after);
- }
-}
Modified: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-11-25 11:54:02 UTC (rev 3079)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestProcessManagement.java 2008-11-25 14:35:27 UTC (rev 3080)
@@ -22,15 +22,15 @@
package org.jboss.bpm.console.client;
import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.Timer;
import com.gwtext.client.widgets.ComponentMgr;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.process.ProcessDefinitionList;
import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
import org.jboss.bpm.console.client.process.ProcessInstanceListEditor;
-import org.jboss.bpm.console.client.util.ConsoleLog;
import java.util.HashMap;
import java.util.List;
@@ -39,70 +39,28 @@
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class GwtTestProcessManagement extends GWTTestCase
+public class GwtTestProcessManagement extends AbstractConsoleTC
{
- private static Application application = null;
-
- public String getModuleName()
+ public void testAuthentication()
{
- return "org.jboss.bpm.console.Application";
- }
+ System.out.println("=== testAuthentication ===");
- protected void gwtSetUp() throws Exception
- {
- super.gwtSetUp();
-
- if(null==application)
- {
- System.out.println("=========");
- System.out.println("Setup console application");
- System.out.println("=========");
-
- application = new Application();
- application.onModuleLoad2();
-
- }
-
- }
-
- public void testAuthentication()
- {
final MainView view = application.getConsoleView();
assertNotNull("View not initialized", view);
- Timer timer = new Timer()
- {
- public void run()
- {
+ HashMap<String, Object> context = new HashMap<String, Object>();
- String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainView.KNOWN_ROLES);
- final Authentication auth = new Authentication(inRoleURL);
- auth.setCallback(
- new Authentication.AuthCallback() {
-
- public void onLoginSuccess(Request request, Response response) {
- System.out.println("Assigned roles: " + auth.getRolesAssigned() );
- }
-
- public void onLoginFailed(Request request, Throwable t) {
-
- throw new RuntimeException("Login failed", t);
- }
- }
- );
- auth.doLogin();
- finishTest();
- }
-
-
- };
-
- timer.schedule(300);
- delayTestFinish(500);
+ Timer authTimer = new AuthenticationTimer(context,"admin", "admin");
+
+ // launch first timer
+ authTimer.schedule(500);
+ delayTestFinish(1000);
}
public void testProcessDefEditor()
{
+ System.out.println("=== testProcessDefEditor ===");
+
final MainView view = application.getConsoleView();
assertNotNull("View not initialized", view);
@@ -119,6 +77,10 @@
list.getAvailableProcessDefinitions().size() != 0
);
+ ProcessDefinitionRef testPd =
+ getTestProcessDefinition(list.getAvailableProcessDefinitions());
+ assertNotNull("Unable to find test process definition", testPd);
+
finishTest();
}
};
@@ -157,32 +119,40 @@
public void testProcessInstanceEditor()
{
+ System.out.println("=== testProcessInstanceEditor ===");
+
final ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)
ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
Map<String, Object> context = new HashMap<String, Object>();
context.put("editor", editor);
-
- LoadTestHarnessTimer loading = new LoadTestHarnessTimer(context);
- InstanceEditorTimer instances = new InstanceEditorTimer(context);
- context.put("secondTimer", instances);
-
- loading.schedule(500);
+
+ AuthenticationTimer authTimer = new AuthenticationTimer(context,"admin", "admin");
+ LoadTestHarnessTimer loadingTimer = new LoadTestHarnessTimer(context);
+ InstanceEditorTimer instanceTimer = new InstanceEditorTimer(context);
+
+ context.put("authFollow", loadingTimer);
+ context.put("loadFollow", instanceTimer);
+
+ // trigger first timer
+ authTimer.schedule(500);
delayTestFinish(1000);
}
- class LoadTestHarnessTimer extends Timer
+ class LoadTestHarnessTimer extends ChainedTimer
{
- Map<String, Object> context;
-
public LoadTestHarnessTimer(Map<String, Object> context)
{
- super();
- this.context = context;
+ super(context);
}
+ public ChainedTimer getNext()
+ {
+ return (ChainedTimer)context.get("loadFollow");
+ }
+
public void run()
{
ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor) context.get("editor");
@@ -192,37 +162,35 @@
List<ProcessDefinitionRef> defs = list.getAvailableProcessDefinitions();
assertFalse(defs.isEmpty());
- for(ProcessDefinitionRef pd : defs)
- {
- if(pd.getName().equals("GWT_Test_Harness"))
- {
- context.put("def", pd);
- break;
- }
- }
+ ProcessDefinitionRef testPd = getTestProcessDefinition(defs);
+ assertNotNull("No test PD found", testPd);
+ context.put("def", testPd);
- Timer next = (Timer)context.get("secondTimer");
- next.schedule(500);
- delayTestFinish(1000);
+ proceedOrFinish();
}
}
- class InstanceEditorTimer extends Timer
+ class InstanceEditorTimer extends ChainedTimer
{
- Map<String, Object> context;
-
public InstanceEditorTimer(Map<String, Object> context)
{
- super();
- this.context = context;
+ super(context);
}
+
+ public ChainedTimer getNext()
+ {
+ return (ChainedTimer)context.get("instanceFollow");
+ }
+
public void run()
- {
+ {
ProcessDefinitionListEditor editor = (ProcessDefinitionListEditor)context.get("editor");
- ProcessDefinitionRef def = (ProcessDefinitionRef)context.get("def");
+ ProcessDefinitionRef def = (ProcessDefinitionRef)context.get("def");
+ assertNotNull("No test definition given: " +context, def);
+
ProcessDefinitionList list = editor.getProcessDefinitionList();
- list.lauchEditor(def); // will create an instance editor
+ list.launchEditor(def); // will create an instance editor
// lookup instance editor
String editorId = ProcessInstanceListEditor.createWidgetID(def);
@@ -230,11 +198,124 @@
ComponentMgr.getComponent(editorId);
assertNotNull("Failed to create instance editor for process", instanceEditor);
- // todo: start new instance
+ // todo: start new instance
+ System.out.println("FIXME: Implement instance creation test");
- // finish
- finishTest();
+ List<ProcessDefinitionRef> defs = list.getAvailableProcessDefinitions();
+ assertFalse(defs.isEmpty());
+
+ ProcessDefinitionRef testPd = getTestProcessDefinition(list.getAvailableProcessDefinitions());
+ CleanupTimer cleanup = new CleanupTimer(context, testPd);
+ cleanup.schedule(500);
+ delayTestFinish(1000);
+ }
+ }
+ private ProcessDefinitionRef getTestProcessDefinition(List<ProcessDefinitionRef> list)
+ {
+ ProcessDefinitionRef def =null;
+ for(ProcessDefinitionRef pd : list)
+ {
+ if(pd.getName().equals(GWT_TEST_HARNESS))
+ {
+ def=pd;
+ break;
+ }
}
+ return def;
}
+
+ class CleanupTimer extends ChainedTimer
+ {
+ ProcessDefinitionRef pd;
+
+ public CleanupTimer(Map<String, Object> context, ProcessDefinitionRef pd)
+ {
+ super(context);
+ this.pd = pd;
+ }
+
+
+ public ChainedTimer getNext()
+ {
+ return null;
+ }
+
+ public void run()
+ {
+ String deleteUrl = urlBuilder.getRemoveDefinitionURL(pd.getProcessId());
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, deleteUrl);
+ try
+ {
+ System.out.println("FIXME: Schedule " + pd + " for removal");
+
+ /*rb.sendRequest("",
+ new RequestCallback()
+ {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ if(response.getStatusCode()!=200)
+ throw new RuntimeException("HTTP status " + response.getStatusCode());
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ throw new RuntimeException("Connection problem", t);
+ }
+ }
+ );*/
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException("Failed to remove process definition", e);
+ }
+
+ proceedOrFinish();
+ }
+ }
+
+ class AuthenticationTimer extends ChainedTimer
+ {
+ String user;
+ String pass;
+
+ public AuthenticationTimer(Map<String,Object> context, String user, String pass)
+ {
+ super(context);
+
+ this.user = user;
+ this.pass = pass;
+ }
+
+
+ public ChainedTimer getNext()
+ {
+ return (ChainedTimer)context.get("authFollow");
+ }
+
+ public void run()
+ {
+
+ String inRoleURL = urlBuilder.getUserInRoleURL(MainView.KNOWN_ROLES);
+ final Authentication auth = new Authentication(inRoleURL);
+ auth.setCallback(
+ new Authentication.AuthCallback() {
+
+ public void onLoginSuccess(Request request, Response response) {
+ System.out.println("Assigned roles: " + auth.getRolesAssigned() );
+
+ // only proceed when authentication was successfull
+ proceedOrFinish();
+ }
+
+ public void onLoginFailed(Request request, Throwable t) {
+
+ throw new RuntimeException("Login failed", t);
+ }
+ }
+ );
+ auth.doLogin(user,pass);
+ }
+ }
}
17 years, 5 months
JBoss JBPM SVN: r3079 - in projects/spec/trunk/modules: ri/src/main/java/org/jbpm/ri/model and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-25 06:54:02 -0500 (Tue, 25 Nov 2008)
New Revision: 3079
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/ProcessDefinition.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessDefinitionImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
Log:
Add procDef version, and start/end date
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java 2008-11-25 11:23:45 UTC (rev 3078)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java 2008-11-25 11:54:02 UTC (rev 3079)
@@ -23,6 +23,8 @@
//$Id$
+import java.util.Date;
+
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
import org.jbpm.api.runtime.Attachments;
@@ -67,4 +69,15 @@
* Start the process, with a given context data
*/
Token startProcess(Attachments att);
+
+ /**
+ * Get the start date of this process
+ */
+ Date getStartDate();
+
+ /**
+ * Get the end date of this process
+ * @return null if not ended
+ */
+ Date getEndDate();
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/ProcessDefinition.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/ProcessDefinition.java 2008-11-25 11:23:45 UTC (rev 3078)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/ProcessDefinition.java 2008-11-25 11:54:02 UTC (rev 3079)
@@ -42,4 +42,10 @@
* Get the associated ProcessEngine
*/
ProcessEngine getProcessEngine();
+
+ /**
+ * Get the process definition version
+ * @return null if not versioned
+ */
+ String getVersion();
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessDefinitionImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessDefinitionImpl.java 2008-11-25 11:23:45 UTC (rev 3078)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessDefinitionImpl.java 2008-11-25 11:54:02 UTC (rev 3079)
@@ -32,6 +32,7 @@
import java.util.Set;
import javax.management.ObjectName;
+import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Lob;
@@ -72,6 +73,9 @@
@OneToOne(cascade = { CascadeType.ALL }, targetEntity = ProcessStructureImpl.class)
private ProcessStructureExt procStruct;
+ @Basic
+ private String version;
+
@Lob
private byte[] rawProcStruct;
@@ -101,6 +105,16 @@
this.engine = engine;
}
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
@Override
public Process newInstance()
{
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-25 11:23:45 UTC (rev 3078)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-25 11:54:02 UTC (rev 3079)
@@ -23,10 +23,12 @@
//$Id$
+import java.util.Date;
import java.util.List;
import java.util.Set;
import javax.management.ObjectName;
+import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
@@ -85,6 +87,12 @@
@OneToOne(cascade = { CascadeType.ALL }, targetEntity = ProcessStructureImpl.class)
private ProcessStructureImpl procStruct;
+ @Basic
+ private Date startDate;
+
+ @Basic
+ private Date endDate;
+
@Transient
private transient RuntimeException runtimeException;
@@ -133,6 +141,26 @@
this.status = status;
}
+ public Date getStartDate()
+ {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate)
+ {
+ this.startDate = startDate;
+ }
+
+ public Date getEndDate()
+ {
+ return endDate;
+ }
+
+ public void setEndDate(Date endDate)
+ {
+ this.endDate = endDate;
+ }
+
@Override
public List<Assignment> getAssignments()
{
@@ -381,6 +409,7 @@
{
super.create(proc);
procStruct.create(proc);
+ startDate = new Date();
}
@Override
17 years, 5 months
JBoss JBPM SVN: r3078 - jbpm4/trunk/hudson/hudson-home.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-25 06:23:45 -0500 (Tue, 25 Nov 2008)
New Revision: 3078
Modified:
jbpm4/trunk/hudson/hudson-home/command.sh
Log:
removing schema docs generation
Modified: jbpm4/trunk/hudson/hudson-home/command.sh
===================================================================
--- jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:19:19 UTC (rev 3077)
+++ jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:23:45 UTC (rev 3078)
@@ -35,13 +35,3 @@
MVN_CMD="mvn -o $ENVIRONMENT -DtestFailureIgnore=true test"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/tests.log
cat $WORKSPACE/tests.log | egrep FIXME\|FAILED | sort -u | tee $WORKSPACE/fixme.txt
-
-#
-# generate schema docs
-# ( for some reason or another xsddoc has to be called from
-# the modules/api dir and can't be called from the parent
-# project directory )
-#
-cd $JBPMDIR/modules/api
-MVN_CMD="mvn $ENVIRONMENT -Pschemadocs package"
-echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/schemadocs.log
17 years, 5 months
JBoss JBPM SVN: r3077 - jbpm4/trunk/hudson/hudson-home.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-25 06:19:19 -0500 (Tue, 25 Nov 2008)
New Revision: 3077
Modified:
jbpm4/trunk/hudson/hudson-home/command.sh
Log:
extracted change dir command
Modified: jbpm4/trunk/hudson/hudson-home/command.sh
===================================================================
--- jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:14:55 UTC (rev 3076)
+++ jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:19:19 UTC (rev 3077)
@@ -42,5 +42,6 @@
# the modules/api dir and can't be called from the parent
# project directory )
#
-MVN_CMD="cd $JBPMDIR/modules/api; mvn $ENVIRONMENT -Pschemadocs package"
+cd $JBPMDIR/modules/api
+MVN_CMD="mvn $ENVIRONMENT -Pschemadocs package"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/schemadocs.log
17 years, 5 months
JBoss JBPM SVN: r3076 - jbpm4/trunk/hudson/hudson-home.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2008-11-25 06:14:55 -0500 (Tue, 25 Nov 2008)
New Revision: 3076
Modified:
jbpm4/trunk/hudson/hudson-home/command.sh
Log:
added $JBPMDIR to schemadocs profile invocation
Modified: jbpm4/trunk/hudson/hudson-home/command.sh
===================================================================
--- jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:05:56 UTC (rev 3075)
+++ jbpm4/trunk/hudson/hudson-home/command.sh 2008-11-25 11:14:55 UTC (rev 3076)
@@ -42,5 +42,5 @@
# the modules/api dir and can't be called from the parent
# project directory )
#
-MVN_CMD="cd modules/api; mvn $ENVIRONMENT -Pschemadocs package"
+MVN_CMD="cd $JBPMDIR/modules/api; mvn $ENVIRONMENT -Pschemadocs package"
echo $MVN_CMD; $MVN_CMD 2>&1 | tee $WORKSPACE/schemadocs.log
17 years, 5 months