Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop maven #236

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions fixflow-test/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
<classpathentry combineaccessrules="false" kind="src" path="/fixflow-expand"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container/bpmcenter"/>
<classpathentry kind="var" path="M2_REPO/org/quartz-scheduler/quartz/2.1.7/quartz-2.1.7.jar" sourcepath="M2_REPO/org/quartz-scheduler/quartz/2.1.7/quartz-2.1.7-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:file:/G:/m2/org/quartz-scheduler/quartz/2.1.7/quartz-2.1.7-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/com/founder/fix/fixflow/com.founder.fix.fixflow.bpmn2.extensions/5.2.0/com.founder.fix.fixflow.bpmn2.extensions-5.2.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/oracle/jdbc/ojdbc5/11.2.0.1.0/ojdbc5-11.2.0.1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/p-unit/p-unit/0.15.319/p-unit-0.15.319.jar"/>
<classpathentry kind="var" path="M2_REPO/p-unit/p-unit-extension/0.15.319/p-unit-extension-0.15.319.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package com.founder.fix.fixflow.service;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
Expand All @@ -45,7 +44,6 @@
import com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst;
import com.founder.fix.fixflow.core.impl.bpmn.behavior.UserTaskBehavior;
import com.founder.fix.fixflow.core.impl.command.ExpandTaskCommand;
import com.founder.fix.fixflow.core.impl.identity.GroupDefinition;
import com.founder.fix.fixflow.core.impl.identity.GroupTo;
import com.founder.fix.fixflow.core.impl.identity.UserTo;
import com.founder.fix.fixflow.core.impl.task.QueryExpandTo;
Expand All @@ -54,7 +52,6 @@
import com.founder.fix.fixflow.core.runtime.ProcessInstance;
import com.founder.fix.fixflow.core.runtime.ProcessInstanceQuery;
import com.founder.fix.fixflow.core.runtime.ProcessInstanceType;
import com.founder.fix.fixflow.core.task.IdentityLink;
import com.founder.fix.fixflow.core.task.TaskInstance;
import com.founder.fix.fixflow.core.task.TaskQuery;
import com.founder.fix.fixflow.service.FlowCenterService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ public ObjectNode convertToJson(Definitions model) {
propertiesNode.put(PROPERTY_NAME, mainProcess.getName());
}

String dbid = StringUtil.getString(mainProcess.eGet(FixFlowPackage.Literals.DOCUMENT_ROOT__DBID));
if(dbid != null){
propertiesNode.put(PROPERTY_PROCESS_DBID, dbid);
}

//fixflow扩展流程属性
String category = mainProcess.getCategory();
if(category != null){
Expand Down Expand Up @@ -439,6 +444,12 @@ public Definitions convertToBpmnModel(JsonNode modelNode) {
BpmnModelUtil.addExtensionElement(process, FixFlowPackage.Literals.DOCUMENT_ROOT__TASK_SUBJECT, taskSubject);
}

//流程分类
JsonNode process_dbid = JsonConverterUtil.getProperty(PROPERTY_PROCESS_DBID, modelNode);
if(process_dbid != null &&!"null".equals(process_dbid.asText()) && StringUtil.isNotEmpty(process_dbid.asText())){
BpmnModelUtil.addExtensionAttribute(process, FixFlowPackage.Literals.DOCUMENT_ROOT__DBID, process_dbid.asText());
}

//流程分类
JsonNode processCategory = JsonConverterUtil.getProperty(PROPERTY_PROCESS_CATEGORY, modelNode);
if(processCategory != null &&!"null".equals(processCategory.asText()) && StringUtil.isNotEmpty(processCategory.asText())){
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/**
* Copyright 1996-2013 Founder International Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author kenshin
*/
package com.founder.fix.fixflow.test;

import java.lang.reflect.Method;


import com.founder.fix.fixflow.core.FormService;
import com.founder.fix.fixflow.core.HistoryService;
import com.founder.fix.fixflow.core.IdentityService;
import com.founder.fix.fixflow.core.ModelService;
import com.founder.fix.fixflow.core.ProcessEngine;
import com.founder.fix.fixflow.core.ProcessEngineManagement;
import com.founder.fix.fixflow.core.RuntimeService;
import com.founder.fix.fixflow.core.ScheduleService;
import com.founder.fix.fixflow.core.TaskService;
import com.founder.fix.fixflow.core.exception.FixFlowException;
import com.founder.fix.fixflow.core.impl.ExternalContent;
import com.founder.fix.fixflow.core.impl.ProcessEngineConfigurationImpl;
import com.founder.fix.fixflow.core.impl.ProcessEngineImpl;
import com.founder.fix.fixflow.core.impl.identity.Authentication;
import com.founder.fix.fixflow.core.model.DeploymentBuilder;

import junit.framework.TestCase;

public abstract class AbstractFixFlowTestCase extends TestCase {

public static ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
protected String deploymentId;

protected ProcessEngineConfigurationImpl processEngineConfiguration;
protected ModelService modelService;
protected RuntimeService runtimeService;
protected TaskService taskService;
protected FormService formService;
protected HistoryService historyService;
protected IdentityService identityService;
protected ScheduleService scheduleService;





protected void initializeServices() {
processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();


modelService = processEngine.getModelService();
runtimeService = processEngine.getRuntimeService();
taskService = processEngine.getTaskService();
formService = processEngine.getFormService();
historyService = processEngine.getHistoryService();
identityService = processEngine.getIdentityService();
scheduleService = processEngine.getScheduleService();
}



protected void initializeProcessEngine() {


ExternalContent externalContent=new ExternalContent();
externalContent.setAuthenticatedUserId(Authentication.getSystemId());
externalContent.setConnectionManagement("General");
processEngine.setExternalContent(externalContent);
//processEngine.getProcessEngineConfiguration().setConnectionManagement("General");
}

public void runBare() throws Throwable {

if (modelService == null) {
initializeProcessEngine();
initializeServices();
}

try {
deploymentId = annotationDeploymentSetUp(processEngine, getClass(), getName());
super.runBare();
} finally {
cleanDb();
}

}

protected void cleanDb() {

processEngine.rollBackConnection();

processEngine.contextClose(true, true);

}


public String annotationDeploymentSetUp(ProcessEngine processEngine, Class<?> testClass, String methodName) throws Exception {
String deploymentId = null;
Method method = null;
try {
method = testClass.getDeclaredMethod(methodName, (Class<?>[]) null);
} catch (Exception e) {
throw new FixFlowException("获取方法失败!", e);
}
Deployment deploymentAnnotation = method.getAnnotation(Deployment.class);
if (deploymentAnnotation != null) {
String[] resources = deploymentAnnotation.resources();
if (resources.length == 0) {
return null;
}


DeploymentBuilder deploymentBuilder = processEngine.getModelService().createDeployment().name("测试名称");

for (String resource : resources) {
deploymentBuilder.addClasspathResource(resource);
}

deploymentId = deploymentBuilder.deploy().getId();

// connection.close();
// processEngine.contextClose();
}
return deploymentId;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 1996-2013 Founder International Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author kenshin
*/
package com.founder.fix.fixflow.test;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;


@Retention(RetentionPolicy.RUNTIME)
public @interface Deployment {

public String[] resources() default {};

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.founder.fix.fixflow.test.bpmn.bpmndiagram;

import java.util.List;

import org.eclipse.bpmn2.di.BPMNDiagram;


import com.founder.fix.fixflow.core.impl.bpmn.behavior.ProcessDefinitionBehavior;
import com.founder.fix.fixflow.test.AbstractFixFlowTestCase;
import com.founder.fix.fixflow.test.Deployment;


public class BPMNDiagramQueryTest extends AbstractFixFlowTestCase {
@Override
protected void setUp() throws Exception {
// 初始化测试方法
super.setUp();
}

@Override
protected void tearDown() throws Exception {
// 测试完毕清理方法
super.tearDown();
}

@Deployment(resources = { "com/founder/fix/fixflow/test/bpmn/bpmndiagram/bpmndiagram.bpmn" })
@SuppressWarnings("unused")
public void testProcessDefinitionQuery() {

ProcessDefinitionBehavior processDefinition = modelService.createProcessDefinitionQuery().processDefinitionKey("bpmndiagramTest")
.singleResult();

List<BPMNDiagram> BPMNDiagramList=processDefinition.getDefinitions().getDiagrams();
assertNotNull(processDefinition);
}

}
Loading